Fossil

Changes On Branch jimTcl74
Login

Changes On Branch jimTcl74

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

Changes In Branch jimTcl74 Excluding Merge-Ins

This is equivalent to a diff from f7c022c1 to 023e6812

2013-10-02
03:26
Upgrade the included Jim Tcl to 0.74. ... (check-in: 753f4d9a user: mistachkin tags: trunk)
2013-10-01
23:01
Merge updates from trunk. ... (check-in: 8d2f9ab1 user: mistachkin tags: cleanX)
09:58
Upgrade the included Jim Tcl to 0.74. ... (Closed-Leaf check-in: 023e6812 user: mistachkin tags: jimTcl74)
09:35
Make sure the --emptydirs option is processed even when it is already implied to prevent it from being considered as an 'unrecognized option'. ... (check-in: f7c022c1 user: mistachkin tags: trunk)
2013-09-30
14:45
Merge the new --dirsonly and --emptydirs and --allckouts options for the "fossil clean" command onto trunk. ... (check-in: 238c8daf user: drh tags: trunk)

Changes to autosetup/jimsh0.c.

183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#    define strtoull strtoul
#  endif
#endif

#define UCHAR(c) ((unsigned char)(c))


#define JIM_VERSION 73

#define JIM_OK 0
#define JIM_ERR 1
#define JIM_RETURN 2
#define JIM_BREAK 3
#define JIM_CONTINUE 4
#define JIM_SIGNAL 5







|







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#    define strtoull strtoul
#  endif
#endif

#define UCHAR(c) ((unsigned char)(c))


#define JIM_VERSION 74

#define JIM_OK 0
#define JIM_ERR 1
#define JIM_RETURN 2
#define JIM_BREAK 3
#define JIM_CONTINUE 4
#define JIM_SIGNAL 5
319
320
321
322
323
324
325
326
327
328
329


330
331
332
333
334
335
336
#define Jim_GetHashEntryVal(he) ((he)->val)
#define Jim_GetHashTableCollisions(ht) ((ht)->collisions)
#define Jim_GetHashTableSize(ht) ((ht)->size)
#define Jim_GetHashTableUsed(ht) ((ht)->used)


typedef struct Jim_Obj {
    int refCount; 
    char *bytes; 
    int length; 
    const struct Jim_ObjType *typePtr; 


    
    union {
        
        jim_wide wideValue;
        
        int intValue;
        







<

<

>
>







319
320
321
322
323
324
325

326

327
328
329
330
331
332
333
334
335
336
#define Jim_GetHashEntryVal(he) ((he)->val)
#define Jim_GetHashTableCollisions(ht) ((ht)->collisions)
#define Jim_GetHashTableSize(ht) ((ht)->size)
#define Jim_GetHashTableUsed(ht) ((ht)->used)


typedef struct Jim_Obj {

    char *bytes; 

    const struct Jim_ObjType *typePtr; 
    int refCount; 
    int length; 
    
    union {
        
        jim_wide wideValue;
        
        int intValue;
        
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
JIM_EXPORT Jim_HashEntry * Jim_NextHashEntry
        (Jim_HashTableIterator *iter);


JIM_EXPORT Jim_Obj * Jim_NewObj (Jim_Interp *interp);
JIM_EXPORT void Jim_FreeObj (Jim_Interp *interp, Jim_Obj *objPtr);
JIM_EXPORT void Jim_InvalidateStringRep (Jim_Obj *objPtr);
JIM_EXPORT void Jim_InitStringRep (Jim_Obj *objPtr, const char *bytes,
        int length);
JIM_EXPORT Jim_Obj * Jim_DuplicateObj (Jim_Interp *interp,
        Jim_Obj *objPtr);
JIM_EXPORT const char * Jim_GetString(Jim_Obj *objPtr,
        int *lenPtr);
JIM_EXPORT const char *Jim_String(Jim_Obj *objPtr);
JIM_EXPORT int Jim_Length(Jim_Obj *objPtr);








<
<







663
664
665
666
667
668
669


670
671
672
673
674
675
676
JIM_EXPORT Jim_HashEntry * Jim_NextHashEntry
        (Jim_HashTableIterator *iter);


JIM_EXPORT Jim_Obj * Jim_NewObj (Jim_Interp *interp);
JIM_EXPORT void Jim_FreeObj (Jim_Interp *interp, Jim_Obj *objPtr);
JIM_EXPORT void Jim_InvalidateStringRep (Jim_Obj *objPtr);


JIM_EXPORT Jim_Obj * Jim_DuplicateObj (Jim_Interp *interp,
        Jim_Obj *objPtr);
JIM_EXPORT const char * Jim_GetString(Jim_Obj *objPtr,
        int *lenPtr);
JIM_EXPORT const char *Jim_String(Jim_Obj *objPtr);
JIM_EXPORT int Jim_Length(Jim_Obj *objPtr);

875
876
877
878
879
880
881


882
883
884
885
886
887
888
JIM_EXPORT char *Jim_HistoryGetline(const char *prompt);
JIM_EXPORT void Jim_HistoryAdd(const char *line);
JIM_EXPORT void Jim_HistoryShow(void);


JIM_EXPORT int Jim_InitStaticExtensions(Jim_Interp *interp);
JIM_EXPORT int Jim_StringToWide(const char *str, jim_wide *widePtr, int base);




JIM_EXPORT int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName);
JIM_EXPORT void Jim_FreeLoadHandles(Jim_Interp *interp);


JIM_EXPORT FILE *Jim_AioFilehandle(Jim_Interp *interp, Jim_Obj *command);







>
>







873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
JIM_EXPORT char *Jim_HistoryGetline(const char *prompt);
JIM_EXPORT void Jim_HistoryAdd(const char *line);
JIM_EXPORT void Jim_HistoryShow(void);


JIM_EXPORT int Jim_InitStaticExtensions(Jim_Interp *interp);
JIM_EXPORT int Jim_StringToWide(const char *str, jim_wide *widePtr, int base);
JIM_EXPORT int Jim_CheckSignal(Jim_Interp *interp);
#define Jim_CheckSignal(i) ((i)->signal_level && (i)->sigmask)


JIM_EXPORT int Jim_LoadLibrary(Jim_Interp *interp, const char *pathName);
JIM_EXPORT void Jim_FreeLoadHandles(Jim_Interp *interp);


JIM_EXPORT FILE *Jim_AioFilehandle(Jim_Interp *interp, Jim_Obj *command);
5669
5670
5671
5672
5673
5674
5675



5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694

5695
5696
5697
5698
5699
5700
5701


#ifdef JIM_MAINTAINER
#define JIM_DEBUG_COMMAND
#define JIM_DEBUG_PANIC
#endif




const char *jim_tt_name(int type);

#ifdef JIM_DEBUG_PANIC
static void JimPanicDump(int panic_condition, const char *fmt, ...);
#define JimPanic(X) JimPanicDump X
#else
#define JimPanic(X)
#endif


static char JimEmptyStringRep[] = "";

static void JimChangeCallFrameId(Jim_Interp *interp, Jim_CallFrame *cf);
static void JimFreeCallFrame(Jim_Interp *interp, Jim_CallFrame *cf, int flags);
static int ListSetIndex(Jim_Interp *interp, Jim_Obj *listPtr, int listindex, Jim_Obj *newObjPtr,
    int flags);
static int JimDeleteLocalProcs(Jim_Interp *interp, Jim_Stack *localCommands);
static Jim_Obj *JimExpandDictSugar(Jim_Interp *interp, Jim_Obj *objPtr);
static void SetDictSubstFromAny(Jim_Interp *interp, Jim_Obj *objPtr);

static void JimSetFailedEnumResult(Jim_Interp *interp, const char *arg, const char *badtype,
    const char *prefix, const char *const *tablePtr, const char *name);
static int JimCallProcedure(Jim_Interp *interp, Jim_Cmd *cmd, int argc, Jim_Obj *const *argv);
static int JimGetWideNoErr(Jim_Interp *interp, Jim_Obj *objPtr, jim_wide * widePtr);
static int JimSign(jim_wide w);
static int JimValidName(Jim_Interp *interp, const char *type, Jim_Obj *nameObjPtr);
static void JimPrngSeed(Jim_Interp *interp, unsigned char *seed, int seedLen);







>
>
>



















>







5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705


#ifdef JIM_MAINTAINER
#define JIM_DEBUG_COMMAND
#define JIM_DEBUG_PANIC
#endif


#define JIM_INTEGER_SPACE 24

const char *jim_tt_name(int type);

#ifdef JIM_DEBUG_PANIC
static void JimPanicDump(int panic_condition, const char *fmt, ...);
#define JimPanic(X) JimPanicDump X
#else
#define JimPanic(X)
#endif


static char JimEmptyStringRep[] = "";

static void JimChangeCallFrameId(Jim_Interp *interp, Jim_CallFrame *cf);
static void JimFreeCallFrame(Jim_Interp *interp, Jim_CallFrame *cf, int flags);
static int ListSetIndex(Jim_Interp *interp, Jim_Obj *listPtr, int listindex, Jim_Obj *newObjPtr,
    int flags);
static int JimDeleteLocalProcs(Jim_Interp *interp, Jim_Stack *localCommands);
static Jim_Obj *JimExpandDictSugar(Jim_Interp *interp, Jim_Obj *objPtr);
static void SetDictSubstFromAny(Jim_Interp *interp, Jim_Obj *objPtr);
static Jim_Obj **JimDictPairs(Jim_Obj *dictPtr, int *len);
static void JimSetFailedEnumResult(Jim_Interp *interp, const char *arg, const char *badtype,
    const char *prefix, const char *const *tablePtr, const char *name);
static int JimCallProcedure(Jim_Interp *interp, Jim_Cmd *cmd, int argc, Jim_Obj *const *argv);
static int JimGetWideNoErr(Jim_Interp *interp, Jim_Obj *objPtr, jim_wide * widePtr);
static int JimSign(jim_wide w);
static int JimValidName(Jim_Interp *interp, const char *type, Jim_Obj *nameObjPtr);
static void JimPrngSeed(Jim_Interp *interp, unsigned char *seed, int seedLen);
5932
5933
5934
5935
5936
5937
5938
5939
5940

5941


5942
























5943
5944
5945
5946
5947
5948
5949
5950
    if (n > 0) {
        n = utf8_strlen(s2, n);
    }
    return n;
}
#endif

int Jim_WideToString(char *buf, jim_wide wideValue)
{

    const char *fmt = "%" JIM_WIDE_MODIFIER;



























    return sprintf(buf, fmt, wideValue);
}

static int JimCheckConversion(const char *str, const char *endptr)
{
    if (str[0] == '\0' || str == endptr) {
        return JIM_ERR;
    }







|

>
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
    if (n > 0) {
        n = utf8_strlen(s2, n);
    }
    return n;
}
#endif

static int JimWideToString(char *buf, jim_wide wideValue)
{
    int pos = 0;

    if (wideValue == 0) {
        buf[pos++] = '0';
    }
    else {
        char tmp[JIM_INTEGER_SPACE];
        int num = 0;
        int i;

        if (wideValue < 0) {
            buf[pos++] = '-';
            
            i = wideValue % 10;
            tmp[num++] = (i > 0) ? (10 - i) : -i;
            wideValue /= -10;
        }

        while (wideValue) {
            tmp[num++] = wideValue % 10;
            wideValue /= 10;
        }

        for (i = 0; i < num; i++) {
            buf[pos++] = '0' + tmp[num - i - 1];
        }
    }
    buf[pos] = 0;

    return pos;
}

static int JimCheckConversion(const char *str, const char *endptr)
{
    if (str[0] == '\0' || str == endptr) {
        return JIM_ERR;
    }
6227
6228
6229
6230
6231
6232
6233








6234
6235
6236
6237
6238
6239
6240
    ht->table = NULL;
    ht->size = 0;
    ht->sizemask = 0;
    ht->used = 0;
    ht->collisions = 0;
}










int Jim_InitHashTable(Jim_HashTable *ht, const Jim_HashTableType *type, void *privDataPtr)
{
    JimResetHashTable(ht);
    ht->type = type;
    ht->privdata = privDataPtr;
    return JIM_OK;







>
>
>
>
>
>
>
>







6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
    ht->table = NULL;
    ht->size = 0;
    ht->sizemask = 0;
    ht->used = 0;
    ht->collisions = 0;
}

static void JimInitHashTableIterator(Jim_HashTable *ht, Jim_HashTableIterator *iter)
{
    iter->ht = ht;
    iter->index = -1;
    iter->entry = NULL;
    iter->nextEntry = NULL;
}


int Jim_InitHashTable(Jim_HashTable *ht, const Jim_HashTableType *type, void *privDataPtr)
{
    JimResetHashTable(ht);
    ht->type = type;
    ht->privdata = privDataPtr;
    return JIM_OK;
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
    }
    return NULL;
}

Jim_HashTableIterator *Jim_GetHashTableIterator(Jim_HashTable *ht)
{
    Jim_HashTableIterator *iter = Jim_Alloc(sizeof(*iter));

    iter->ht = ht;
    iter->index = -1;
    iter->entry = NULL;
    iter->nextEntry = NULL;
    return iter;
}

Jim_HashEntry *Jim_NextHashEntry(Jim_HashTableIterator *iter)
{
    while (1) {
        if (iter->entry == NULL) {







|
<
<
<
<







6445
6446
6447
6448
6449
6450
6451
6452




6453
6454
6455
6456
6457
6458
6459
    }
    return NULL;
}

Jim_HashTableIterator *Jim_GetHashTableIterator(Jim_HashTable *ht)
{
    Jim_HashTableIterator *iter = Jim_Alloc(sizeof(*iter));
    JimInitHashTableIterator(ht, iter);




    return iter;
}

Jim_HashEntry *Jim_NextHashEntry(Jim_HashTableIterator *iter)
{
    while (1) {
        if (iter->entry == NULL) {
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
}

int Jim_GetExitCode(Jim_Interp *interp)
{
    return interp->exitCode;
}

#define JIM_INTEGER_SPACE 24

static void UpdateStringOfInt(struct Jim_Obj *objPtr);
static int SetIntFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags);

static const Jim_ObjType intObjType = {
    "int",
    NULL,
    NULL,
    UpdateStringOfInt,
    JIM_TYPE_NONE,
};

static const Jim_ObjType coercedDoubleObjType = {
    "coerced-double",
    NULL,
    NULL,
    UpdateStringOfInt,
    JIM_TYPE_NONE,
};


void UpdateStringOfInt(struct Jim_Obj *objPtr)
{
    int len;
    char buf[JIM_INTEGER_SPACE + 1];

    len = Jim_WideToString(buf, JimWideValue(objPtr));
    objPtr->bytes = Jim_Alloc(len + 1);
    memcpy(objPtr->bytes, buf, len + 1);
    objPtr->length = len;
}

int SetIntFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags)
{







<
<




















|




|







10533
10534
10535
10536
10537
10538
10539


10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
}

int Jim_GetExitCode(Jim_Interp *interp)
{
    return interp->exitCode;
}



static void UpdateStringOfInt(struct Jim_Obj *objPtr);
static int SetIntFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags);

static const Jim_ObjType intObjType = {
    "int",
    NULL,
    NULL,
    UpdateStringOfInt,
    JIM_TYPE_NONE,
};

static const Jim_ObjType coercedDoubleObjType = {
    "coerced-double",
    NULL,
    NULL,
    UpdateStringOfInt,
    JIM_TYPE_NONE,
};


static void UpdateStringOfInt(struct Jim_Obj *objPtr)
{
    int len;
    char buf[JIM_INTEGER_SPACE + 1];

    len = JimWideToString(buf, JimWideValue(objPtr));
    objPtr->bytes = Jim_Alloc(len + 1);
    memcpy(objPtr->bytes, buf, len + 1);
    objPtr->length = len;
}

int SetIntFromAny(Jim_Interp *interp, Jim_Obj *objPtr, int flags)
{
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
    }
    dupPtr->typePtr = &listObjType;
}

#define JIM_ELESTR_SIMPLE 0
#define JIM_ELESTR_BRACE 1
#define JIM_ELESTR_QUOTE 2
static int ListElementQuotingType(const char *s, int len)
{
    int i, level, blevel, trySimple = 1;

    
    if (len == 0)
        return JIM_ELESTR_BRACE;
    if (s[0] == '"' || s[0] == '{') {







|







10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
    }
    dupPtr->typePtr = &listObjType;
}

#define JIM_ELESTR_SIMPLE 0
#define JIM_ELESTR_BRACE 1
#define JIM_ELESTR_QUOTE 2
static unsigned char ListElementQuotingType(const char *s, int len)
{
    int i, level, blevel, trySimple = 1;

    
    if (len == 0)
        return JIM_ELESTR_BRACE;
    if (s[0] == '"' || s[0] == '{') {
10901
10902
10903
10904
10905
10906
10907

10908
10909
10910
10911
10912
10913

10914




10915
10916
10917
10918
10919
10920
10921
    *p = '\0';

    return p - q;
}

static void JimMakeListStringRep(Jim_Obj *objPtr, Jim_Obj **objv, int objc)
{

    int i, bufLen, realLength;
    const char *strRep;
    char *p;
    int *quotingType;

    

    quotingType = Jim_Alloc(sizeof(int) * objc + 1);




    bufLen = 0;
    for (i = 0; i < objc; i++) {
        int len;

        strRep = Jim_GetString(objv[i], &len);
        quotingType[i] = ListElementQuotingType(strRep, len);
        switch (quotingType[i]) {







>



|


>
|
>
>
>
>







10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
    *p = '\0';

    return p - q;
}

static void JimMakeListStringRep(Jim_Obj *objPtr, Jim_Obj **objv, int objc)
{
    #define STATIC_QUOTING_LEN 32
    int i, bufLen, realLength;
    const char *strRep;
    char *p;
    unsigned char *quotingType, staticQuoting[STATIC_QUOTING_LEN];

    
    if (objc > STATIC_QUOTING_LEN) {
        quotingType = Jim_Alloc(objc);
    }
    else {
        quotingType = staticQuoting;
    }
    bufLen = 0;
    for (i = 0; i < objc; i++) {
        int len;

        strRep = Jim_GetString(objv[i], &len);
        quotingType[i] = ListElementQuotingType(strRep, len);
        switch (quotingType[i]) {
10973
10974
10975
10976
10977
10978
10979


10980

10981
10982
10983
10984
10985
10986
10987
        if (i + 1 != objc) {
            *p++ = ' ';
            realLength++;
        }
    }
    *p = '\0';                  
    objPtr->length = realLength;


    Jim_Free(quotingType);

}

static void UpdateStringOfList(struct Jim_Obj *objPtr)
{
    JimMakeListStringRep(objPtr, objPtr->internalRep.listValue.ele, objPtr->internalRep.listValue.len);
}








>
>
|
>







11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
        if (i + 1 != objc) {
            *p++ = ' ';
            realLength++;
        }
    }
    *p = '\0';                  
    objPtr->length = realLength;

    if (quotingType != staticQuoting) {
        Jim_Free(quotingType);
    }
}

static void UpdateStringOfList(struct Jim_Obj *objPtr)
{
    JimMakeListStringRep(objPtr, objPtr->internalRep.listValue.ele, objPtr->internalRep.listValue.len);
}

10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
    }

    if (Jim_IsDict(objPtr) && !Jim_IsShared(objPtr)) {
        Jim_Obj **listObjPtrPtr;
        int len;
        int i;

        Jim_DictPairs(interp, objPtr, &listObjPtrPtr, &len);
        for (i = 0; i < len; i++) {
            Jim_IncrRefCount(listObjPtrPtr[i]);
        }

        
        Jim_FreeIntRep(interp, objPtr);
        objPtr->typePtr = &listObjType;







|







11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
    }

    if (Jim_IsDict(objPtr) && !Jim_IsShared(objPtr)) {
        Jim_Obj **listObjPtrPtr;
        int len;
        int i;

        listObjPtrPtr = JimDictPairs(objPtr, &len);
        for (i = 0; i < len; i++) {
            Jim_IncrRefCount(listObjPtrPtr[i]);
        }

        
        Jim_FreeIntRep(interp, objPtr);
        objPtr->typePtr = &listObjType;
11223
11224
11225
11226
11227
11228
11229





11230
11231

11232


11233
11234
11235
11236
11237
11238
11239
11240
{
    int currentLen = listPtr->internalRep.listValue.len;
    int requiredLen = currentLen + elemc;
    int i;
    Jim_Obj **point;

    if (requiredLen > listPtr->internalRep.listValue.maxLen) {





        listPtr->internalRep.listValue.maxLen = requiredLen * 2;


        listPtr->internalRep.listValue.ele = Jim_Realloc(listPtr->internalRep.listValue.ele,


            sizeof(Jim_Obj *) * listPtr->internalRep.listValue.maxLen);
    }
    if (idx < 0) {
        idx = currentLen;
    }
    point = listPtr->internalRep.listValue.ele + idx;
    memmove(point + elemc, point, (currentLen - idx) * sizeof(Jim_Obj *));
    for (i = 0; i < elemc; ++i) {







>
>
>
>
>
|
|
>

>
>
|







11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
{
    int currentLen = listPtr->internalRep.listValue.len;
    int requiredLen = currentLen + elemc;
    int i;
    Jim_Obj **point;

    if (requiredLen > listPtr->internalRep.listValue.maxLen) {
        if (requiredLen < 2) {
            
            requiredLen = 4;
        }
        else {
            requiredLen *= 2;
        }

        listPtr->internalRep.listValue.ele = Jim_Realloc(listPtr->internalRep.listValue.ele,
            sizeof(Jim_Obj *) * requiredLen);

        listPtr->internalRep.listValue.maxLen = requiredLen;
    }
    if (idx < 0) {
        idx = currentLen;
    }
    point = listPtr->internalRep.listValue.ele + idx;
    memmove(point + elemc, point, (currentLen - idx) * sizeof(Jim_Obj *));
    for (i = 0; i < elemc; ++i) {
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
    Jim_FreeHashTable(objPtr->internalRep.ptr);
    Jim_Free(objPtr->internalRep.ptr);
}

void DupDictInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr)
{
    Jim_HashTable *ht, *dupHt;
    Jim_HashTableIterator *htiter;
    Jim_HashEntry *he;

    
    ht = srcPtr->internalRep.ptr;
    dupHt = Jim_Alloc(sizeof(*dupHt));
    Jim_InitHashTable(dupHt, &JimDictHashTableType, interp);
    if (ht->size != 0)
        Jim_ExpandHashTable(dupHt, ht->size);
    
    htiter = Jim_GetHashTableIterator(ht);
    while ((he = Jim_NextHashEntry(htiter)) != NULL) {
        const Jim_Obj *keyObjPtr = he->key;
        Jim_Obj *valObjPtr = he->u.val;

        Jim_IncrRefCount((Jim_Obj *)keyObjPtr); 
        Jim_IncrRefCount(valObjPtr);
        Jim_AddHashEntry(dupHt, keyObjPtr, valObjPtr);
    }
    Jim_FreeHashTableIterator(htiter);

    dupPtr->internalRep.ptr = dupHt;
    dupPtr->typePtr = &dictObjType;
}

static Jim_Obj **JimDictPairs(Jim_Obj *dictPtr, int *len)
{
    Jim_HashTable *ht;
    Jim_HashTableIterator *htiter;
    Jim_HashEntry *he;
    Jim_Obj **objv;
    int i;

    ht = dictPtr->internalRep.ptr;

    
    objv = Jim_Alloc((ht->used * 2) * sizeof(Jim_Obj *));
    htiter = Jim_GetHashTableIterator(ht);
    i = 0;
    while ((he = Jim_NextHashEntry(htiter)) != NULL) {
        objv[i++] = (Jim_Obj *)he->key;
        objv[i++] = he->u.val;
    }
    *len = i;
    Jim_FreeHashTableIterator(htiter);
    return objv;
}

static void UpdateStringOfDict(struct Jim_Obj *objPtr)
{
    
    int len;







|









|
|







<








|








|

|




<







11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596

11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620

11621
11622
11623
11624
11625
11626
11627
    Jim_FreeHashTable(objPtr->internalRep.ptr);
    Jim_Free(objPtr->internalRep.ptr);
}

void DupDictInternalRep(Jim_Interp *interp, Jim_Obj *srcPtr, Jim_Obj *dupPtr)
{
    Jim_HashTable *ht, *dupHt;
    Jim_HashTableIterator htiter;
    Jim_HashEntry *he;

    
    ht = srcPtr->internalRep.ptr;
    dupHt = Jim_Alloc(sizeof(*dupHt));
    Jim_InitHashTable(dupHt, &JimDictHashTableType, interp);
    if (ht->size != 0)
        Jim_ExpandHashTable(dupHt, ht->size);
    
    JimInitHashTableIterator(ht, &htiter);
    while ((he = Jim_NextHashEntry(&htiter)) != NULL) {
        const Jim_Obj *keyObjPtr = he->key;
        Jim_Obj *valObjPtr = he->u.val;

        Jim_IncrRefCount((Jim_Obj *)keyObjPtr); 
        Jim_IncrRefCount(valObjPtr);
        Jim_AddHashEntry(dupHt, keyObjPtr, valObjPtr);
    }


    dupPtr->internalRep.ptr = dupHt;
    dupPtr->typePtr = &dictObjType;
}

static Jim_Obj **JimDictPairs(Jim_Obj *dictPtr, int *len)
{
    Jim_HashTable *ht;
    Jim_HashTableIterator htiter;
    Jim_HashEntry *he;
    Jim_Obj **objv;
    int i;

    ht = dictPtr->internalRep.ptr;

    
    objv = Jim_Alloc((ht->used * 2) * sizeof(Jim_Obj *));
    JimInitHashTableIterator(ht, &htiter);
    i = 0;
    while ((he = Jim_NextHashEntry(&htiter)) != NULL) {
        objv[i++] = (Jim_Obj *)he->key;
        objv[i++] = he->u.val;
    }
    *len = i;

    return objv;
}

static void UpdateStringOfDict(struct Jim_Obj *objPtr)
{
    
    int len;
12087
12088
12089
12090
12091
12092
12093

12094
12095
12096
12097

12098
12099
12100
12101
12102
12103
12104
    int skip;
};


typedef struct Jim_ExprOperator
{
    const char *name;

    int precedence;
    int arity;
    int (*funcop) (Jim_Interp *interp, struct JimExprState * e);
    int lazy;

} Jim_ExprOperator;

static void ExprPush(struct JimExprState *e, Jim_Obj *obj)
{
    Jim_IncrRefCount(obj);
    e->stack[e->stacklen++] = obj;
}







>
|
|
<
|
>







12135
12136
12137
12138
12139
12140
12141
12142
12143
12144

12145
12146
12147
12148
12149
12150
12151
12152
12153
    int skip;
};


typedef struct Jim_ExprOperator
{
    const char *name;
    int (*funcop) (Jim_Interp *interp, struct JimExprState * e);
    unsigned char precedence;
    unsigned char arity;

    unsigned char lazy;
    unsigned char namelen;
} Jim_ExprOperator;

static void ExprPush(struct JimExprState *e, Jim_Obj *obj)
{
    Jim_IncrRefCount(obj);
    e->stack[e->stacklen++] = obj;
}
12772
12773
12774
12775
12776
12777
12778


12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861

12862
12863
12864
12865
12866
12867
12868
{
    LAZY_NONE,
    LAZY_OP,
    LAZY_LEFT,
    LAZY_RIGHT
};



static const struct Jim_ExprOperator Jim_ExprOperators[] = {
    {"*", 200, 2, JimExprOpBin, LAZY_NONE},
    {"/", 200, 2, JimExprOpBin, LAZY_NONE},
    {"%", 200, 2, JimExprOpIntBin, LAZY_NONE},

    {"-", 100, 2, JimExprOpBin, LAZY_NONE},
    {"+", 100, 2, JimExprOpBin, LAZY_NONE},

    {"<<", 90, 2, JimExprOpIntBin, LAZY_NONE},
    {">>", 90, 2, JimExprOpIntBin, LAZY_NONE},

    {"<<<", 90, 2, JimExprOpIntBin, LAZY_NONE},
    {">>>", 90, 2, JimExprOpIntBin, LAZY_NONE},

    {"<", 80, 2, JimExprOpBin, LAZY_NONE},
    {">", 80, 2, JimExprOpBin, LAZY_NONE},
    {"<=", 80, 2, JimExprOpBin, LAZY_NONE},
    {">=", 80, 2, JimExprOpBin, LAZY_NONE},

    {"==", 70, 2, JimExprOpBin, LAZY_NONE},
    {"!=", 70, 2, JimExprOpBin, LAZY_NONE},

    {"&", 50, 2, JimExprOpIntBin, LAZY_NONE},
    {"^", 49, 2, JimExprOpIntBin, LAZY_NONE},
    {"|", 48, 2, JimExprOpIntBin, LAZY_NONE},

    {"&&", 10, 2, NULL, LAZY_OP},
    {NULL, 10, 2, JimExprOpAndLeft, LAZY_LEFT},
    {NULL, 10, 2, JimExprOpAndOrRight, LAZY_RIGHT},

    {"||", 9, 2, NULL, LAZY_OP},
    {NULL, 9, 2, JimExprOpOrLeft, LAZY_LEFT},
    {NULL, 9, 2, JimExprOpAndOrRight, LAZY_RIGHT},

    {"?", 5, 2, JimExprOpNull, LAZY_OP},
    {NULL, 5, 2, JimExprOpTernaryLeft, LAZY_LEFT},
    {NULL, 5, 2, JimExprOpNull, LAZY_RIGHT},

    {":", 5, 2, JimExprOpNull, LAZY_OP},
    {NULL, 5, 2, JimExprOpColonLeft, LAZY_LEFT},
    {NULL, 5, 2, JimExprOpNull, LAZY_RIGHT},

    {"**", 250, 2, JimExprOpBin, LAZY_NONE},

    {"eq", 60, 2, JimExprOpStrBin, LAZY_NONE},
    {"ne", 60, 2, JimExprOpStrBin, LAZY_NONE},

    {"in", 55, 2, JimExprOpStrBin, LAZY_NONE},
    {"ni", 55, 2, JimExprOpStrBin, LAZY_NONE},

    {"!", 300, 1, JimExprOpNumUnary, LAZY_NONE},
    {"~", 300, 1, JimExprOpIntUnary, LAZY_NONE},
    {NULL, 300, 1, JimExprOpNumUnary, LAZY_NONE},
    {NULL, 300, 1, JimExprOpNumUnary, LAZY_NONE},



    {"int", 400, 1, JimExprOpNumUnary, LAZY_NONE},
    {"abs", 400, 1, JimExprOpNumUnary, LAZY_NONE},
    {"double", 400, 1, JimExprOpNumUnary, LAZY_NONE},
    {"round", 400, 1, JimExprOpNumUnary, LAZY_NONE},
    {"rand", 400, 0, JimExprOpNone, LAZY_NONE},
    {"srand", 400, 1, JimExprOpIntUnary, LAZY_NONE},

#ifdef JIM_MATH_FUNCTIONS
    {"sin", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"cos", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"tan", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"asin", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"acos", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"atan", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"sinh", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"cosh", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"tanh", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"ceil", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"floor", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"exp", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"log", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"log10", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"sqrt", 400, 1, JimExprOpDoubleUnary, LAZY_NONE},
    {"pow", 400, 2, JimExprOpBin, LAZY_NONE},
#endif
};


#define JIM_EXPR_OPERATORS_NUM \
    (sizeof(Jim_ExprOperators)/sizeof(struct Jim_ExprOperator))

static int JimParseExpression(struct JimParserCtx *pc)
{
    







>
>

|
|
|

|
|

|
|

|
|

|
|
|
|

|
|

|
|
|

|
|
|

|
|
|

|
|
|

|
|
|

|

|
|

|
|

|
|
|
|



|
|
|
|
|
|


|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|


>







12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
{
    LAZY_NONE,
    LAZY_OP,
    LAZY_LEFT,
    LAZY_RIGHT
};

#define OPRINIT(N, P, A, F, L) {N, F, P, A, L, sizeof(N) - 1}

static const struct Jim_ExprOperator Jim_ExprOperators[] = {
    OPRINIT("*", 110, 2, JimExprOpBin, LAZY_NONE),
    OPRINIT("/", 110, 2, JimExprOpBin, LAZY_NONE),
    OPRINIT("%", 110, 2, JimExprOpIntBin, LAZY_NONE),

    OPRINIT("-", 100, 2, JimExprOpBin, LAZY_NONE),
    OPRINIT("+", 100, 2, JimExprOpBin, LAZY_NONE),

    OPRINIT("<<", 90, 2, JimExprOpIntBin, LAZY_NONE),
    OPRINIT(">>", 90, 2, JimExprOpIntBin, LAZY_NONE),

    OPRINIT("<<<", 90, 2, JimExprOpIntBin, LAZY_NONE),
    OPRINIT(">>>", 90, 2, JimExprOpIntBin, LAZY_NONE),

    OPRINIT("<", 80, 2, JimExprOpBin, LAZY_NONE),
    OPRINIT(">", 80, 2, JimExprOpBin, LAZY_NONE),
    OPRINIT("<=", 80, 2, JimExprOpBin, LAZY_NONE),
    OPRINIT(">=", 80, 2, JimExprOpBin, LAZY_NONE),

    OPRINIT("==", 70, 2, JimExprOpBin, LAZY_NONE),
    OPRINIT("!=", 70, 2, JimExprOpBin, LAZY_NONE),

    OPRINIT("&", 50, 2, JimExprOpIntBin, LAZY_NONE),
    OPRINIT("^", 49, 2, JimExprOpIntBin, LAZY_NONE),
    OPRINIT("|", 48, 2, JimExprOpIntBin, LAZY_NONE),

    OPRINIT("&&", 10, 2, NULL, LAZY_OP),
    OPRINIT(NULL, 10, 2, JimExprOpAndLeft, LAZY_LEFT),
    OPRINIT(NULL, 10, 2, JimExprOpAndOrRight, LAZY_RIGHT),

    OPRINIT("||", 9, 2, NULL, LAZY_OP),
    OPRINIT(NULL, 9, 2, JimExprOpOrLeft, LAZY_LEFT),
    OPRINIT(NULL, 9, 2, JimExprOpAndOrRight, LAZY_RIGHT),

    OPRINIT("?", 5, 2, JimExprOpNull, LAZY_OP),
    OPRINIT(NULL, 5, 2, JimExprOpTernaryLeft, LAZY_LEFT),
    OPRINIT(NULL, 5, 2, JimExprOpNull, LAZY_RIGHT),

    OPRINIT(":", 5, 2, JimExprOpNull, LAZY_OP),
    OPRINIT(NULL, 5, 2, JimExprOpColonLeft, LAZY_LEFT),
    OPRINIT(NULL, 5, 2, JimExprOpNull, LAZY_RIGHT),

    OPRINIT("**", 250, 2, JimExprOpBin, LAZY_NONE),

    OPRINIT("eq", 60, 2, JimExprOpStrBin, LAZY_NONE),
    OPRINIT("ne", 60, 2, JimExprOpStrBin, LAZY_NONE),

    OPRINIT("in", 55, 2, JimExprOpStrBin, LAZY_NONE),
    OPRINIT("ni", 55, 2, JimExprOpStrBin, LAZY_NONE),

    OPRINIT("!", 150, 1, JimExprOpNumUnary, LAZY_NONE),
    OPRINIT("~", 150, 1, JimExprOpIntUnary, LAZY_NONE),
    OPRINIT(NULL, 150, 1, JimExprOpNumUnary, LAZY_NONE),
    OPRINIT(NULL, 150, 1, JimExprOpNumUnary, LAZY_NONE),



    OPRINIT("int", 200, 1, JimExprOpNumUnary, LAZY_NONE),
    OPRINIT("abs", 200, 1, JimExprOpNumUnary, LAZY_NONE),
    OPRINIT("double", 200, 1, JimExprOpNumUnary, LAZY_NONE),
    OPRINIT("round", 200, 1, JimExprOpNumUnary, LAZY_NONE),
    OPRINIT("rand", 200, 0, JimExprOpNone, LAZY_NONE),
    OPRINIT("srand", 200, 1, JimExprOpIntUnary, LAZY_NONE),

#ifdef JIM_MATH_FUNCTIONS
    OPRINIT("sin", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("cos", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("tan", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("asin", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("acos", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("atan", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("sinh", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("cosh", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("tanh", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("ceil", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("floor", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("exp", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("log", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("log10", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("sqrt", 200, 1, JimExprOpDoubleUnary, LAZY_NONE),
    OPRINIT("pow", 200, 2, JimExprOpBin, LAZY_NONE),
#endif
};
#undef OPRINIT

#define JIM_EXPR_OPERATORS_NUM \
    (sizeof(Jim_ExprOperators)/sizeof(struct Jim_ExprOperator))

static int JimParseExpression(struct JimParserCtx *pc)
{
    
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
static int JimParseExprOperator(struct JimParserCtx *pc)
{
    int i;
    int bestIdx = -1, bestLen = 0;

    
    for (i = 0; i < (signed)JIM_EXPR_OPERATORS_NUM; i++) {
        const char *opname;
        int oplen;

        opname = Jim_ExprOperators[i].name;
        if (opname == NULL) {
            continue;
        }
        oplen = strlen(opname);

        if (strncmp(opname, pc->p, oplen) == 0 && oplen > bestLen) {
            bestIdx = i + JIM_TT_EXPR_OP;
            bestLen = oplen;
        }
    }
    if (bestIdx == -1) {
        return JIM_ERR;
    }







|
|

<
|


<

|







13076
13077
13078
13079
13080
13081
13082
13083
13084
13085

13086
13087
13088

13089
13090
13091
13092
13093
13094
13095
13096
13097
static int JimParseExprOperator(struct JimParserCtx *pc)
{
    int i;
    int bestIdx = -1, bestLen = 0;

    
    for (i = 0; i < (signed)JIM_EXPR_OPERATORS_NUM; i++) {
        const char * const opname = Jim_ExprOperators[i].name;
        const int oplen = Jim_ExprOperators[i].namelen;


        if (opname == NULL || opname[0] != pc->p[0]) {
            continue;
        }


        if (oplen > bestLen && strncmp(opname, pc->p, oplen) == 0) {
            bestIdx = i + JIM_TT_EXPR_OP;
            bestLen = oplen;
        }
    }
    if (bestIdx == -1) {
        return JIM_ERR;
    }
13109
13110
13111
13112
13113
13114
13115
13116
13117

13118
13119
13120
13121
13122
13123
13124
    NULL,
    JIM_TYPE_REFERENCES,
};


typedef struct ExprByteCode
{
    int len;                    
    ScriptToken *token;         

    int inUse;                  
} ExprByteCode;

static void ExprFreeByteCode(Jim_Interp *interp, ExprByteCode * expr)
{
    int i;








<

>







13159
13160
13161
13162
13163
13164
13165

13166
13167
13168
13169
13170
13171
13172
13173
13174
    NULL,
    JIM_TYPE_REFERENCES,
};


typedef struct ExprByteCode
{

    ScriptToken *token;         
    int len;                    
    int inUse;                  
} ExprByteCode;

static void ExprFreeByteCode(Jim_Interp *interp, ExprByteCode * expr)
{
    int i;

13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
}




typedef struct ScanFmtPartDescr
{
    char type;                  
    char modifier;              
    size_t width;               
    int pos;                    
    char *arg;                  
    char *prefix;               
} ScanFmtPartDescr;


typedef struct ScanFmtStringObj
{
    jim_wide size;              
    char *stringRep;            







|
|


|
|







13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
}




typedef struct ScanFmtPartDescr
{
    char *arg;                  
    char *prefix;               
    size_t width;               
    int pos;                    
    char type;                  
    char modifier;              
} ScanFmtPartDescr;


typedef struct ScanFmtStringObj
{
    jim_wide size;              
    char *stringRep;            
14869
14870
14871
14872
14873
14874
14875
14876
14877

14878
14879
14880
14881
14882
14883
14884
                argc += len - 1;
            }
        }

        if (retcode == JIM_OK && argc) {
            
            retcode = JimInvokeCommand(interp, argc, argv);
            if (interp->signal_level && interp->sigmask) {
                

                retcode = JIM_SIGNAL;
            }
        }

        
        while (j-- > 0) {
            Jim_DecrRefCount(interp, argv[j]);







<
|
>







14919
14920
14921
14922
14923
14924
14925

14926
14927
14928
14929
14930
14931
14932
14933
14934
                argc += len - 1;
            }
        }

        if (retcode == JIM_OK && argc) {
            
            retcode = JimInvokeCommand(interp, argc, argv);

            
            if (Jim_CheckSignal(interp)) {
                retcode = JIM_SIGNAL;
            }
        }

        
        while (j-- > 0) {
            Jim_DecrRefCount(interp, argv[j]);
15444
15445
15446
15447
15448
15449
15450
15451

15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
    if (patternObjPtr && JimTrivialMatch(Jim_String(patternObjPtr))) {
        he = Jim_FindHashEntry(ht, Jim_String(patternObjPtr));
        if (he) {
            callback(interp, listObjPtr, he, type);
        }
    }
    else {
        Jim_HashTableIterator *htiter = Jim_GetHashTableIterator(ht);

        while ((he = Jim_NextHashEntry(htiter)) != NULL) {
            if (patternObjPtr == NULL || JimGlobMatch(Jim_String(patternObjPtr), he->key, 0)) {
                callback(interp, listObjPtr, he, type);
            }
        }
        Jim_FreeHashTableIterator(htiter);
    }
    return listObjPtr;
}


#define JIM_CMDLIST_COMMANDS 0
#define JIM_CMDLIST_PROCS 1







|
>
|




<







15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507

15508
15509
15510
15511
15512
15513
15514
    if (patternObjPtr && JimTrivialMatch(Jim_String(patternObjPtr))) {
        he = Jim_FindHashEntry(ht, Jim_String(patternObjPtr));
        if (he) {
            callback(interp, listObjPtr, he, type);
        }
    }
    else {
        Jim_HashTableIterator htiter;
        JimInitHashTableIterator(ht, &htiter);
        while ((he = Jim_NextHashEntry(&htiter)) != NULL) {
            if (patternObjPtr == NULL || JimGlobMatch(Jim_String(patternObjPtr), he->key, 0)) {
                callback(interp, listObjPtr, he, type);
            }
        }

    }
    return listObjPtr;
}


#define JIM_CMDLIST_COMMANDS 0
#define JIM_CMDLIST_PROCS 1
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
    argv += i;

    if ((ignore_mask & (1 << JIM_SIGNAL)) == 0) {
        sig++;
    }

    interp->signal_level += sig;
    if (interp->signal_level && interp->sigmask) {
        
        exitCode = JIM_SIGNAL;
    }
    else {
        exitCode = Jim_EvalObj(interp, argv[0]);
    }
    interp->signal_level -= sig;







|







17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
    argv += i;

    if ((ignore_mask & (1 << JIM_SIGNAL)) == 0) {
        sig++;
    }

    interp->signal_level += sig;
    if (Jim_CheckSignal(interp)) {
        
        exitCode = JIM_SIGNAL;
    }
    else {
        exitCode = Jim_EvalObj(interp, argv[0]);
    }
    interp->signal_level -= sig;
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
    return JIM_OK;
}


static int JimInfoReferences(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    Jim_Obj *listObjPtr;
    Jim_HashTableIterator *htiter;
    Jim_HashEntry *he;

    listObjPtr = Jim_NewListObj(interp, NULL, 0);

    htiter = Jim_GetHashTableIterator(&interp->references);
    while ((he = Jim_NextHashEntry(htiter)) != NULL) {
        char buf[JIM_REFERENCE_SPACE + 1];
        Jim_Reference *refPtr = he->u.val;
        const unsigned long *refId = he->key;

        JimFormatReference(buf, refPtr, *refId);
        Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, buf, -1));
    }
    Jim_FreeHashTableIterator(htiter);
    Jim_SetResult(interp, listObjPtr);
    return JIM_OK;
}
#endif


static int Jim_RenameCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)







|




|
|







<







17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019

18020
18021
18022
18023
18024
18025
18026
    return JIM_OK;
}


static int JimInfoReferences(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
    Jim_Obj *listObjPtr;
    Jim_HashTableIterator htiter;
    Jim_HashEntry *he;

    listObjPtr = Jim_NewListObj(interp, NULL, 0);

    JimInitHashTableIterator(&interp->references, &htiter);
    while ((he = Jim_NextHashEntry(&htiter)) != NULL) {
        char buf[JIM_REFERENCE_SPACE + 1];
        Jim_Reference *refPtr = he->u.val;
        const unsigned long *refId = he->key;

        JimFormatReference(buf, refPtr, *refId);
        Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, buf, -1));
    }

    Jim_SetResult(interp, listObjPtr);
    return JIM_OK;
}
#endif


static int Jim_RenameCoreCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
18003
18004
18005
18006
18007
18008
18009
18010

18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
static Jim_Obj *JimDictPatternMatch(Jim_Interp *interp, Jim_HashTable *ht, Jim_Obj *patternObjPtr,
    JimDictMatchCallbackType *callback, int type)
{
    Jim_HashEntry *he;
    Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0);

    
    Jim_HashTableIterator *htiter = Jim_GetHashTableIterator(ht);

    while ((he = Jim_NextHashEntry(htiter)) != NULL) {
        if (patternObjPtr == NULL || JimGlobMatch(Jim_String(patternObjPtr), Jim_String((Jim_Obj *)he->key), 0)) {
            callback(interp, listObjPtr, he, type);
        }
    }
    Jim_FreeHashTableIterator(htiter);

    return listObjPtr;
}


int Jim_DictKeys(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *patternObjPtr)
{







|
>
|




<







18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065

18066
18067
18068
18069
18070
18071
18072
static Jim_Obj *JimDictPatternMatch(Jim_Interp *interp, Jim_HashTable *ht, Jim_Obj *patternObjPtr,
    JimDictMatchCallbackType *callback, int type)
{
    Jim_HashEntry *he;
    Jim_Obj *listObjPtr = Jim_NewListObj(interp, NULL, 0);

    
    Jim_HashTableIterator htiter;
    JimInitHashTableIterator(ht, &htiter);
    while ((he = Jim_NextHashEntry(&htiter)) != NULL) {
        if (patternObjPtr == NULL || JimGlobMatch(Jim_String(patternObjPtr), Jim_String((Jim_Obj *)he->key), 0)) {
            callback(interp, listObjPtr, he, type);
        }
    }


    return listObjPtr;
}


int Jim_DictKeys(Jim_Interp *interp, Jim_Obj *objPtr, Jim_Obj *patternObjPtr)
{