/ Check-in [4cdaa72811]
DEMO | DOWNLOAD | DEPLOY | SEARCH
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:CData: generalize idconf to any XXconf with struct CMD_XX
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:4cdaa72811c56acf4805481fbfd65674ef627423
User & Date: pmacdona 2019-04-12 13:23:38
Context
2019-04-12
13:23
CData: generalize idconf to any XXconf with struct CMD_XX Leaf check-in: 4cdaa72811 user: pmacdona tags: trunk
03:39
Release "2.8.19". Finish sample CData example DBI. check-in: bd26a2d361 user: pmacdona tags: trunk
Changes

Changes to lib/Jsi_CData.jsi.

774
775
776
777
778
779
780

781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
...
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
                if (vget !== '')
                    ifpre += ind + vget;

                //var voao = afnam+'_value';
                //ifpre += ind+'Jsi_Value *'+voao+' = Jsi_ValueArrayIndex(interp, args, '+i+');\n';
                    
                if (!isObjNew && i === last && afnam === 'options' && tvlst.indexOf('object')>=0) {

                    var iopnam = name;
                    if (fname === 'idconf' && !fconstr)
                        iopnam += '_id';
                    else if (fname !== 'conf' && !fconstr)
                        iopnam += '_'+fname;
                    iopnam +=  self.confSuffix;
                    if (!self.structmap[iopnam])
                        throw('Can not find struct "'+iopnam+'" for cmd '+fname);
                    var iopnamS = iopnam+'_Specs';
                    var iodnam, iott = self.structmap[iopnam];
                    LogDebug('NAM:', iopnamS);
                    if (fname === 'conf') {
                        if (isObj || intData)
                            iodnam = 'cmdPtr';
                        else
                            iodnam = '&'+name+self.varSuffix;
                    } else if (fname === 'idconf') {
                        // Cmd-local options.
                        iodnam = 'options';
                        ifpre += '  '+iopnam + ' *options = '+name+'_IdGet(cmdPtr, id, 0);\n';
                    } else {
                        // Cmd-local options.
                        iodnam = 'options';
                        ifpostarg += '  '+iopnam + ' data = {}; vr.data = (void*)&data;\n';
................................................................................
                        ifpre += '  '+iopnam + ' *options = ('+iopnam+'*)vrPtr->data;\n';
                        //if (self.structfieldmap[name+'.'+iopnam])
                        //   ifpre += '  *options = cmdPtr->'+self.structfieldmap[name+'.'+iopnam]+';\n';
                    }
                    if (fname === 'conf') {
                        if (i>0) throw("Conf command takes only a single argument");
                        ifpre += '  return Jsi_OptionsConf(interp, (Jsi_OptionSpec*)'+iopnamS+', '+iodnam+', '+voao+', ret, 0);\n';
                    } else if (fname === 'idconf') {
                        ifpre += '  if (!options || Jsi_OptionsConf(interp, (Jsi_OptionSpec*)'+iopnamS+', '+iodnam+', '+voao+', ret, 0) < 0) return JSI_ERROR;\n';
                    } else {
                        if (!fconstr)
                            ifpre += '  if ('+voao+') { vrPtr->spec = (Jsi_OptionSpec*)'+iopnamS+'; }\n';
                        ifpre += '  if ('+voao+' && Jsi_OptionsProcess(interp, (Jsi_OptionSpec*)'+iopnamS+', '+iodnam+', '+voao+', 0) < 0) return JSI_ERROR;\n';
                    }
                }







>

|
|













|







 







|







774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
...
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
                if (vget !== '')
                    ifpre += ind + vget;

                //var voao = afnam+'_value';
                //ifpre += ind+'Jsi_Value *'+voao+' = Jsi_ValueArrayIndex(interp, args, '+i+');\n';
                    
                if (!isObjNew && i === last && afnam === 'options' && tvlst.indexOf('object')>=0) {
                    var idre, isconfcmd = ((idre=fname.match(/^([a-zA-Z]+)conf$/)) && self.structmap[name+'_'+idre[1]]);
                    var iopnam = name;
                    if (isconfcmd && !fconstr)
                        iopnam += '_'+idre[1];
                    else if (fname !== 'conf' && !fconstr)
                        iopnam += '_'+fname;
                    iopnam +=  self.confSuffix;
                    if (!self.structmap[iopnam])
                        throw('Can not find struct "'+iopnam+'" for cmd '+fname);
                    var iopnamS = iopnam+'_Specs';
                    var iodnam, iott = self.structmap[iopnam];
                    LogDebug('NAM:', iopnamS);
                    if (fname === 'conf') {
                        if (isObj || intData)
                            iodnam = 'cmdPtr';
                        else
                            iodnam = '&'+name+self.varSuffix;
                    } else if (isconfcmd) {
                        // Cmd-local options.
                        iodnam = 'options';
                        ifpre += '  '+iopnam + ' *options = '+name+'_IdGet(cmdPtr, id, 0);\n';
                    } else {
                        // Cmd-local options.
                        iodnam = 'options';
                        ifpostarg += '  '+iopnam + ' data = {}; vr.data = (void*)&data;\n';
................................................................................
                        ifpre += '  '+iopnam + ' *options = ('+iopnam+'*)vrPtr->data;\n';
                        //if (self.structfieldmap[name+'.'+iopnam])
                        //   ifpre += '  *options = cmdPtr->'+self.structfieldmap[name+'.'+iopnam]+';\n';
                    }
                    if (fname === 'conf') {
                        if (i>0) throw("Conf command takes only a single argument");
                        ifpre += '  return Jsi_OptionsConf(interp, (Jsi_OptionSpec*)'+iopnamS+', '+iodnam+', '+voao+', ret, 0);\n';
                    } else if (isconfcmd) {
                        ifpre += '  if (!options || Jsi_OptionsConf(interp, (Jsi_OptionSpec*)'+iopnamS+', '+iodnam+', '+voao+', ret, 0) < 0) return JSI_ERROR;\n';
                    } else {
                        if (!fconstr)
                            ifpre += '  if ('+voao+') { vrPtr->spec = (Jsi_OptionSpec*)'+iopnamS+'; }\n';
                        ifpre += '  if ('+voao+' && Jsi_OptionsProcess(interp, (Jsi_OptionSpec*)'+iopnamS+', '+iodnam+', '+voao+', 0) < 0) return JSI_ERROR;\n';
                    }
                }