Annotation of sbbs/src/sbbs3/js_xtrn_area.c, revision 1.1.1.1

1.1       root        1: /* js_xtrn_area.c */
                      2: 
                      3: /* Synchronet JavaScript "External Program Area" Object */
                      4: 
                      5: /* $Id: js_xtrn_area.c,v 1.21 2006/12/28 02:44:24 rswindell Exp $ */
                      6: 
                      7: /****************************************************************************
                      8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                     10:  *                                                                                                                                                     *
                     11:  * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html         *
                     12:  *                                                                                                                                                     *
                     13:  * This program is free software; you can redistribute it and/or                       *
                     14:  * modify it under the terms of the GNU General Public License                         *
                     15:  * as published by the Free Software Foundation; either version 2                      *
                     16:  * of the License, or (at your option) any later version.                                      *
                     17:  * See the GNU General Public License for more details: gpl.txt or                     *
                     18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
                     19:  *                                                                                                                                                     *
                     20:  * Anonymous FTP access to the most recent released source is available at     *
                     21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     22:  *                                                                                                                                                     *
                     23:  * Anonymous CVS access to the development source and modification history     *
                     24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     26:  *     (just hit return, no password is necessary)                                                     *
                     27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     28:  *                                                                                                                                                     *
                     29:  * For Synchronet coding style and modification guidelines, see                                *
                     30:  * http://www.synchro.net/source.html                                                                          *
                     31:  *                                                                                                                                                     *
                     32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     33:  * format) via e-mail to [email protected]                                                                      *
                     34:  *                                                                                                                                                     *
                     35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     36:  ****************************************************************************/
                     37: 
                     38: #include "sbbs.h"
                     39: 
                     40: #ifdef JAVASCRIPT
                     41: 
                     42: #ifdef BUILD_JSDOCS
                     43: 
                     44: static char* xtrn_sec_prop_desc[] = {
                     45: 
                     46:         "index into sec_list array (or -1 if not in index) <i>(introduced in v3.12)</i>"
                     47:        ,"unique number for this external program section"
                     48:        ,"external program section internal code"
                     49:        ,"external program section name"
                     50:        ,"external program section access requirements"
                     51:        ,NULL
                     52: };
                     53: 
                     54: static char* xtrn_prog_prop_desc[] = {
                     55: 
                     56:         "index into prog_list array (or -1 if not in index) <i>(introduced in v3.12)</i>"
                     57:        ,"program number"
                     58:        ,"program section index <i>(introduced in v3.12)</i>"
                     59:        ,"program section number"
                     60:        ,"program section internal code <i>(introduced in v3.12)</i>"
                     61:        ,"internal code"
                     62:        ,"name"
                     63:        ,"command-line"
                     64:        ,"clean-up command-line"
                     65:        ,"startup directory"
                     66:        ,"access requirements"
                     67:        ,"execution requirements"
                     68:        ,"toggle options (bitfield)"
                     69:        ,"drop file type"
                     70:        ,"event type (0=none)"
                     71:        ,"extra time given to users running this program"
                     72:        ,"maximum time allowed in program"
                     73:        ,"execution cost (credits to run this program)"
                     74:        /* Insert here */
                     75:        ,"user has sufficient access to run this program"
                     76:        ,NULL
                     77: };
                     78: 
                     79: static char* event_prop_desc[] = {
                     80: 
                     81:         "command-line"
                     82:        ,"startup directory"
                     83:        ,"node number"
                     84:        ,"time to execute"
                     85:        ,"frequency to execute"
                     86:        ,"days of week to execute (bitfield)"
                     87:        ,"days of month to execute (bitfield)"
                     88:        ,"date/time last run (in time_t format)"
                     89:        ,"toggle options (bitfield)"
                     90:        ,NULL
                     91: };
                     92: 
                     93: static char* xedit_prop_desc[] = {
                     94: 
                     95:         "name"
                     96:        ,"command-line"
                     97:        ,"access requirements"
                     98:        ,"toggle options (bitfield)"
                     99:        ,"drop file type"
                    100:        ,NULL
                    101: };
                    102: 
                    103: #endif
                    104: 
                    105: BOOL DLLCALL js_CreateXtrnProgProperties(JSContext* cx, JSObject* obj, xtrn_t* xtrn)
                    106: {
                    107:        JSString* js_str;
                    108: 
                    109:        if((js_str=JS_NewStringCopyZ(cx, xtrn->code))==NULL)
                    110:                return(FALSE);
                    111:        if(!JS_DefineProperty(cx, obj, "code", STRING_TO_JSVAL(js_str)
                    112:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    113:                return(FALSE);
                    114: 
                    115:        if((js_str=JS_NewStringCopyZ(cx, xtrn->name))==NULL)
                    116:                return(FALSE);
                    117:        if(!JS_DefineProperty(cx, obj, "name", STRING_TO_JSVAL(js_str)
                    118:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    119:                return(FALSE);
                    120: 
                    121:        if((js_str=JS_NewStringCopyZ(cx, xtrn->cmd))==NULL)
                    122:                return(FALSE);
                    123:        if(!JS_DefineProperty(cx, obj, "cmd", STRING_TO_JSVAL(js_str)
                    124:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    125:                return(FALSE);
                    126: 
                    127:        if((js_str=JS_NewStringCopyZ(cx, xtrn->clean))==NULL)
                    128:                return(FALSE);
                    129:        if(!JS_DefineProperty(cx, obj, "clean_cmd", STRING_TO_JSVAL(js_str)
                    130:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    131:                return(FALSE);
                    132: 
                    133:        if((js_str=JS_NewStringCopyZ(cx, xtrn->path))==NULL)
                    134:                return(FALSE);
                    135:        if(!JS_DefineProperty(cx, obj, "startup_dir", STRING_TO_JSVAL(js_str)
                    136:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    137:                return(FALSE);
                    138: 
                    139:        if((js_str=JS_NewStringCopyZ(cx, xtrn->arstr))==NULL)
                    140:                return(FALSE);
                    141:        if(!JS_DefineProperty(cx, obj, "ars", STRING_TO_JSVAL(js_str)
                    142:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    143:                return(FALSE);
                    144: 
                    145:        if((js_str=JS_NewStringCopyZ(cx, xtrn->run_arstr))==NULL)
                    146:                return(FALSE);
                    147:        if(!JS_DefineProperty(cx, obj, "execution_ars", STRING_TO_JSVAL(js_str)
                    148:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    149:                return(FALSE);
                    150: 
                    151:        if(!JS_DefineProperty(cx, obj, "settings", INT_TO_JSVAL(xtrn->misc)
                    152:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    153:                return(FALSE);
                    154: 
                    155:        if(!JS_DefineProperty(cx, obj, "type", INT_TO_JSVAL(xtrn->type)
                    156:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    157:                return(FALSE);
                    158: 
                    159:        if(!JS_DefineProperty(cx, obj, "event", INT_TO_JSVAL(xtrn->event)
                    160:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    161:                return(FALSE);
                    162: 
                    163:        if(!JS_DefineProperty(cx, obj, "textra", INT_TO_JSVAL(xtrn->textra)
                    164:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    165:                return(FALSE);
                    166: 
                    167:        if(!JS_DefineProperty(cx, obj, "max_time", INT_TO_JSVAL(xtrn->maxtime)
                    168:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    169:                return(FALSE);
                    170: 
                    171:        if(!JS_DefineProperty(cx, obj, "cost", INT_TO_JSVAL(xtrn->cost)
                    172:                ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    173:                return(FALSE);
                    174: 
                    175: #ifdef BUILD_JSDOCS
                    176:        js_CreateArrayOfStrings(cx, obj, "_property_desc_list", xtrn_prog_prop_desc, JSPROP_READONLY);
                    177: #endif
                    178: 
                    179:        return(TRUE);
                    180: }
                    181: 
                    182: 
                    183: JSObject* DLLCALL js_CreateXtrnAreaObject(JSContext* cx, JSObject* parent, scfg_t* cfg
                    184:                                                                                  ,user_t* user)
                    185: {
                    186:        JSObject*       areaobj;
                    187:        JSObject*       allsec;
                    188:        JSObject*       allprog;
                    189:        JSObject*       secobj;
                    190:        JSObject*       progobj;
                    191:        JSObject*       eventobj;
                    192:        JSObject*       event_array;
                    193:        JSObject*       xeditobj;
                    194:        JSObject*       xedit_array;
                    195:        JSObject*       sec_list;
                    196:        JSObject*       prog_list;
                    197:        JSString*       js_str;
                    198:        jsval           val;
                    199:        jsuint          sec_index;
                    200:        jsuint          prog_index;
                    201:        uint            l,d;
                    202: 
                    203:        /* Return existing object if it's already been created */
                    204:        if(JS_GetProperty(cx,parent,"xtrn_area",&val) && val!=JSVAL_VOID)
                    205:                areaobj = JSVAL_TO_OBJECT(val);
                    206:        else
                    207:                areaobj = JS_DefineObject(cx, parent, "xtrn_area", NULL
                    208:                                                                        , NULL, JSPROP_ENUMERATE|JSPROP_READONLY);
                    209: 
                    210:        if(areaobj==NULL)
                    211:                return(NULL);
                    212: 
                    213: #ifdef BUILD_JSDOCS
                    214:        js_DescribeSyncObject(cx,areaobj,"External Program Areas",310);
                    215: #endif
                    216: 
                    217:        /* xtrn_area.sec[] */
                    218:        if((allsec=JS_NewObject(cx,NULL,NULL,areaobj))==NULL)
                    219:                return(NULL);
                    220: 
                    221:        val=OBJECT_TO_JSVAL(allsec);
                    222:        if(!JS_SetProperty(cx, areaobj, "sec", &val))
                    223:                return(NULL);
                    224: 
                    225:        /* xtrn_area.prog[] */
                    226:        if((allprog=JS_NewObject(cx,NULL,NULL,areaobj))==NULL)
                    227:                return(NULL);
                    228: 
                    229:        val=OBJECT_TO_JSVAL(allprog);
                    230:        if(!JS_SetProperty(cx, areaobj, "prog", &val))
                    231:                return(NULL);
                    232: 
                    233:        /* xtrn_area.sec_list[] */
                    234:        if((sec_list=JS_NewArrayObject(cx, 0, NULL))==NULL) 
                    235:                return(NULL);
                    236: 
                    237:        val=OBJECT_TO_JSVAL(sec_list);
                    238:        if(!JS_SetProperty(cx, areaobj, "sec_list", &val)) 
                    239:                return(NULL);
                    240: 
                    241:        for(l=0;l<cfg->total_xtrnsecs;l++) {
                    242: 
                    243:                if((secobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL)
                    244:                        return(NULL);
                    245: 
                    246:                sec_index=-1;
                    247:                if(user==NULL || chk_ar(cfg,cfg->xtrnsec[l]->ar,user)) {
                    248: 
                    249:                        if(!JS_GetArrayLength(cx, sec_list, &sec_index))
                    250:                                return(NULL);
                    251: 
                    252:                        val=OBJECT_TO_JSVAL(secobj);
                    253:                        if(!JS_SetElement(cx, sec_list, sec_index, &val))
                    254:                                return(NULL);
                    255:                }
                    256: 
                    257:                /* Add as property (associative array element) */
                    258:                if(!JS_DefineProperty(cx, allsec, cfg->xtrnsec[l]->code, val
                    259:                        ,NULL,NULL,JSPROP_READONLY|JSPROP_ENUMERATE))
                    260:                        return(NULL);
                    261: 
                    262:                val=INT_TO_JSVAL(sec_index);
                    263:                if(!JS_SetProperty(cx, secobj, "index", &val))
                    264:                        return(NULL);
                    265: 
                    266:                val=INT_TO_JSVAL(l);
                    267:                if(!JS_SetProperty(cx, secobj, "number", &val))
                    268:                        return(NULL);
                    269: 
                    270:                if((js_str=JS_NewStringCopyZ(cx, cfg->xtrnsec[l]->code))==NULL)
                    271:                        return(NULL);
                    272:                val=STRING_TO_JSVAL(js_str);
                    273:                if(!JS_SetProperty(cx, secobj, "code", &val))
                    274:                        return(NULL);
                    275: 
                    276:                if((js_str=JS_NewStringCopyZ(cx, cfg->xtrnsec[l]->name))==NULL)
                    277:                        return(NULL);
                    278:                val=STRING_TO_JSVAL(js_str);
                    279:                if(!JS_SetProperty(cx, secobj, "name", &val))
                    280:                        return(NULL);
                    281: 
                    282:                if((js_str=JS_NewStringCopyZ(cx, cfg->xtrnsec[l]->arstr))==NULL)
                    283:                        return(NULL);
                    284:                val=STRING_TO_JSVAL(js_str);
                    285:                if(!JS_SetProperty(cx, secobj, "ars", &val))
                    286:                        return(NULL);
                    287: 
                    288:                /* prog_list[] */
                    289:                if((prog_list=JS_NewArrayObject(cx, 0, NULL))==NULL) 
                    290:                        return(NULL);
                    291: 
                    292:                val=OBJECT_TO_JSVAL(prog_list);
                    293:                if(!JS_SetProperty(cx, secobj, "prog_list", &val)) 
                    294:                        return(NULL);
                    295: 
                    296: #ifdef BUILD_JSDOCS
                    297:                js_DescribeSyncObject(cx,secobj,"Online Program (door) Sections (current user has access to)",310);
                    298: #endif
                    299: 
                    300:                for(d=0;d<cfg->total_xtrns;d++) {
                    301:                        if(cfg->xtrn[d]->sec!=l)
                    302:                                continue;
                    303: 
                    304:                        if((progobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL)
                    305:                                return(NULL);
                    306: 
                    307:                        prog_index=-1;
                    308:                        if((user==NULL || chk_ar(cfg,cfg->xtrn[d]->ar,user))
                    309:                                && !(cfg->xtrn[d]->event && cfg->xtrn[d]->misc&EVENTONLY)) {
                    310: 
                    311:                                if(!JS_GetArrayLength(cx, prog_list, &prog_index))
                    312:                                        return(NULL);                                                   
                    313: 
                    314:                                val=OBJECT_TO_JSVAL(progobj);
                    315:                                if(!JS_SetElement(cx, prog_list, prog_index, &val))
                    316:                                        return(NULL);
                    317:                        }
                    318: 
                    319:                        /* Add as property (associative array element) */
                    320:                        if(!JS_DefineProperty(cx, allprog, cfg->xtrn[d]->code, val
                    321:                                ,NULL,NULL,JSPROP_READONLY|JSPROP_ENUMERATE))
                    322:                                return(NULL);
                    323: 
                    324:                        val=INT_TO_JSVAL(prog_index);
                    325:                        if(!JS_SetProperty(cx, progobj, "index", &val))
                    326:                                return(NULL);
                    327: 
                    328:                        val=INT_TO_JSVAL(d);
                    329:                        if(!JS_SetProperty(cx, progobj, "number", &val))
                    330:                                return(NULL);
                    331: 
                    332:                        val=INT_TO_JSVAL(sec_index);
                    333:                        if(!JS_SetProperty(cx, progobj, "sec_index", &val))
                    334:                                return(NULL);
                    335: 
                    336:                        val=INT_TO_JSVAL(l);
                    337:                        if(!JS_SetProperty(cx, progobj, "sec_number", &val))
                    338:                                return(NULL);
                    339: 
                    340:                        val=STRING_TO_JSVAL(JS_NewStringCopyZ(cx,cfg->xtrnsec[l]->code));
                    341:                        if(!JS_SetProperty(cx, progobj, "sec_code", &val))
                    342:                                return(NULL);
                    343: 
                    344:                        if(!js_CreateXtrnProgProperties(cx, progobj, cfg->xtrn[d]))
                    345:                                return(NULL);
                    346: 
                    347:                        if(user==NULL || chk_ar(cfg,cfg->xtrn[d]->run_ar,user))
                    348:                                val=JSVAL_TRUE;
                    349:                        else
                    350:                                val=JSVAL_FALSE;
                    351:                        if(!JS_SetProperty(cx, progobj, "can_run", &val))
                    352:                                return(NULL);
                    353: 
                    354: #ifdef BUILD_JSDOCS
                    355:                        js_DescribeSyncObject(cx,progobj,"Online External Programs (doors) (current user has access to)",310);
                    356: #endif
                    357:                }
                    358: 
                    359: #ifdef BUILD_JSDOCS
                    360:                js_CreateArrayOfStrings(cx, secobj, "_property_desc_list", xtrn_sec_prop_desc, JSPROP_READONLY);
                    361: #endif
                    362: 
                    363:        }
                    364: 
                    365: #ifdef BUILD_JSDOCS
                    366: 
                    367:        js_DescribeSyncObject(cx,allsec,"Associative array of all external program sections (use internal code as index)",312);
                    368:        JS_DefineProperty(cx,allsec,"_dont_document",JSVAL_TRUE,NULL,NULL,JSPROP_READONLY);
                    369: 
                    370:        js_DescribeSyncObject(cx,allprog,"Associative array of all external programs (use internal code as index)",311);
                    371:        JS_DefineProperty(cx,allprog,"_dont_document",JSVAL_TRUE,NULL,NULL,JSPROP_READONLY);
                    372: #endif
                    373: 
                    374:        /* Create event property */
                    375:        if((event_array=JS_NewObject(cx,NULL,NULL,areaobj))==NULL)
                    376:                return(NULL);
                    377: 
                    378:        val=OBJECT_TO_JSVAL(event_array);
                    379:        if(!JS_SetProperty(cx, areaobj, "event", &val))
                    380:                return(NULL);
                    381: 
                    382:        for(l=0;l<cfg->total_events;l++) {
                    383: 
                    384:                if((eventobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL)
                    385:                        return(NULL);
                    386: 
                    387:                if(!JS_DefineProperty(cx, event_array, cfg->event[l]->code, OBJECT_TO_JSVAL(eventobj)
                    388:                        ,NULL,NULL,JSPROP_READONLY|JSPROP_ENUMERATE))
                    389:                        return(NULL);
                    390: 
                    391:                if((js_str=JS_NewStringCopyZ(cx, cfg->event[l]->cmd))==NULL)
                    392:                        return(NULL);
                    393:                if(!JS_DefineProperty(cx, eventobj, "cmd", STRING_TO_JSVAL(js_str)
                    394:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    395:                        return(NULL);
                    396: 
                    397:                if((js_str=JS_NewStringCopyZ(cx, cfg->event[l]->dir))==NULL)
                    398:                        return(NULL);
                    399:                if(!JS_DefineProperty(cx, eventobj, "startup_dir", STRING_TO_JSVAL(js_str)
                    400:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    401:                        return(NULL);
                    402: 
                    403:                if(!JS_DefineProperty(cx, eventobj, "node_num", INT_TO_JSVAL(cfg->event[l]->node)
                    404:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    405:                        return(NULL);
                    406: 
                    407:                if(!JS_DefineProperty(cx, eventobj, "time", INT_TO_JSVAL(cfg->event[l]->time)
                    408:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    409:                        return(NULL);
                    410: 
                    411:                if(!JS_DefineProperty(cx, eventobj, "freq", INT_TO_JSVAL(cfg->event[l]->freq)
                    412:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    413:                        return(NULL);
                    414: 
                    415:                if(!JS_DefineProperty(cx, eventobj, "days", INT_TO_JSVAL(cfg->event[l]->days)
                    416:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    417:                        return(NULL);
                    418: 
                    419:                if(!JS_DefineProperty(cx, eventobj, "mdays", INT_TO_JSVAL(cfg->event[l]->mdays)
                    420:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    421:                        return(NULL);
                    422: 
                    423:                if(!JS_DefineProperty(cx, eventobj, "last_run", INT_TO_JSVAL(cfg->event[l]->last)
                    424:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    425:                        return(NULL);
                    426: 
                    427:                if(!JS_DefineProperty(cx, eventobj, "settings", INT_TO_JSVAL(cfg->event[l]->misc)
                    428:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    429:                        return(NULL);
                    430: 
                    431: #ifdef BUILD_JSDOCS
                    432:                js_CreateArrayOfStrings(cx, eventobj, "_property_desc_list", event_prop_desc, JSPROP_READONLY);
                    433: #endif
                    434:        }
                    435: 
                    436: #ifdef BUILD_JSDOCS
                    437:        js_DescribeSyncObject(cx,event_array,"Associative array of all timed events (use internal code as index)",311);
                    438:        JS_DefineProperty(cx,event_array,"_assoc_array",JSVAL_TRUE,NULL,NULL,JSPROP_READONLY);
                    439: #endif
                    440: 
                    441:        /* Create editor property */
                    442:        if((xedit_array=JS_NewObject(cx,NULL,NULL,areaobj))==NULL)
                    443:                return(NULL);
                    444: 
                    445:        val=OBJECT_TO_JSVAL(xedit_array);
                    446:        if(!JS_SetProperty(cx, areaobj, "editor", &val))
                    447:                return(NULL);
                    448: 
                    449:        for(l=0;l<cfg->total_xedits;l++) {
                    450: 
                    451:                if(user!=NULL && !chk_ar(cfg,cfg->xedit[l]->ar,user))
                    452:                        continue;
                    453: 
                    454:                if((xeditobj=JS_NewObject(cx, NULL, NULL, NULL))==NULL)
                    455:                        return(NULL);
                    456: 
                    457:                if(!JS_DefineProperty(cx, xedit_array, cfg->xedit[l]->code, OBJECT_TO_JSVAL(xeditobj)
                    458:                        ,NULL,NULL,JSPROP_READONLY|JSPROP_ENUMERATE))
                    459:                        return(NULL);
                    460: 
                    461:                if((js_str=JS_NewStringCopyZ(cx, cfg->xedit[l]->name))==NULL)
                    462:                        return(NULL);
                    463:                if(!JS_DefineProperty(cx, xeditobj, "name", STRING_TO_JSVAL(js_str)
                    464:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    465:                        return(NULL);
                    466: 
                    467:                if((js_str=JS_NewStringCopyZ(cx, cfg->xedit[l]->rcmd))==NULL)
                    468:                        return(NULL);
                    469:                if(!JS_DefineProperty(cx, xeditobj, "cmd", STRING_TO_JSVAL(js_str)
                    470:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    471:                        return(NULL);
                    472: 
                    473:                if((js_str=JS_NewStringCopyZ(cx, cfg->xedit[l]->arstr))==NULL)
                    474:                        return(NULL);
                    475:                if(!JS_DefineProperty(cx, xeditobj, "ars", STRING_TO_JSVAL(js_str)
                    476:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    477:                        return(NULL);
                    478: 
                    479:                if(!JS_DefineProperty(cx, xeditobj, "settings", INT_TO_JSVAL(cfg->xedit[l]->misc)
                    480:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    481:                        return(NULL);
                    482: 
                    483:                if(!JS_DefineProperty(cx, xeditobj, "type", INT_TO_JSVAL(cfg->xedit[l]->type)
                    484:                        ,NULL,NULL,JSPROP_ENUMERATE|JSPROP_READONLY))
                    485:                        return(NULL);
                    486: 
                    487: #ifdef BUILD_JSDOCS
                    488:                js_CreateArrayOfStrings(cx, xeditobj, "_property_desc_list", xedit_prop_desc, JSPROP_READONLY);
                    489: #endif
                    490:        }
                    491: 
                    492: #ifdef BUILD_JSDOCS
                    493:        js_DescribeSyncObject(cx,xedit_array,"Associative array of all external editors (use internal code as index)",311);
                    494:        JS_DefineProperty(cx,xedit_array,"_assoc_array",JSVAL_TRUE,NULL,NULL,JSPROP_READONLY);
                    495: #endif
                    496: 
                    497:        return(areaobj);
                    498: }
                    499: 
                    500: #endif /* JAVSCRIPT */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.