Jim Tcl
Check-in [1063870bf4]
Not logged in

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

Overview
Comment:bump version to 0.79

Update documentation to indicate v0.79 and update Tcl_shipped.html

Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | trunk |
Files: files | file ages | folders
SHA1: 1063870bf400ebe1046b026de12e84f8ab4418b2
User & Date: steveb@workware.net.au 2019-11-20 01:32:12
Context
2019-11-20
01:32
bump version to 0.79

Update documentation to indicate v0.79 and update Tcl_shipped.html

Signed-off-by: Steve Bennett <steveb@workware.net.au> Leaf check-in: 1063870bf4 user: steveb@workware.net.au tags: trunk,

2019-11-14
23:04
build: Check for inline support

To ensure that linenoise.c can build, even for strict c89 Add cc-check-inline in autosetup/jim-misc.auto

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 2c1dd443ce user: steveb@workware.net.au tags: trunk,

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tcl_shipped.html.


1
2
3
4
5
6
7
8
9
10
11
12
13
...
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
...
874
875
876
877
878
879
880








































881
882
883
884
885
886
887
....
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
....
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
....
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
....
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
....
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
....
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
....
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
....
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
....
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
....
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
....
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
....
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
....
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
....
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
....
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
....
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905

2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
....
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
....
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
....
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
....
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
....
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
....
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
....
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283


3284
3285
3286
3287
3288
3289
3290
3291
3292
3293


3294
3295
3296
3297
3298
3299
3300
3301
3302
3303


3304
3305
3306
3307
3308
3309
3310
3311
3312
3313


3314
3315
3316
3317
3318
3319
3320
3321
3322
3323


3324
3325
3326
3327
3328
3329
3330
3331
3332
3333


3334
3335
3336
3337
3338
3339
3340
3341
3342
3343


3344
3345
3346
3347
3348
3349
3350
3351
3352
3353


3354
3355
3356
3357
3358
3359
3360
3361
3362
3363


3364
3365
3366
3367
3368
3369
3370
3371
3372
3373


3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
....
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
....
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
....
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
....
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
....
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690









3691
3692
3693
3694
3695
3696

3697
3698
3699
3700
3701
3702
3703
....
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
....
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
....
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
....
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
....
4349
4350
4351
4352
4353
4354
4355











4356
4357
4358
4359
4360
4361
4362
....
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422

4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
....
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
....
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
....
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
....
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042


5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059

5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
....
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
....
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
....
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
....
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
....
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
....
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
....
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
....
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
....
5543
5544
5545
5546
5547
5548
5549










5550
5551
5552
5553
5554
5555
5556
....
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
....
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
....
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
....
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
....
5950
5951
5952
5953
5954
5955
5956













5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
....
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
....
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
....
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
....
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
....
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
....
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
....
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
....
6379
6380
6381
6382
6383
6384
6385


6386
6387
6388
6389
6390

6391
6392
6393
6394
6395
6396
6397
....
6400
6401
6402
6403
6404
6405
6406


6407
6408
6409
6410
6411

6412
6413
6414
6415
6416
6417
6418
....
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
....
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
....
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
....
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
....
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
....
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
....
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
....
7022
7023
7024
7025
7026
7027
7028


7029
7030
7031
7032
7033
7034

7035
7036
7037
7038
7039
7040
7041
....
7055
7056
7057
7058
7059
7060
7061

7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079


7080
7081
7082
7083
7084
7085
7086
....
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139

7140
7141
7142
7143
7144
7145
7146
....
7148
7149
7150
7151
7152
7153
7154








7155
7156
7157
7158
7159
7160
7161
....
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200








7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
....
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
....
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297









7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
....
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
















7531
7532
7533
7534
7535
7536
7537
....
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
....
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
....
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
....
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
....
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
....
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
....
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
....
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238















































































































































8239
8240
8241
8242
8243
8244
8245
....
8316
8317
8318
8319
8320
8321
8322


8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334

8335
8336
8337
8338
8339
8340
8341
....
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398




























































































































































































































8399
8400
8401
8402
8403
8404
8405

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.9" />
<title>Jim Tcl(n)</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */

/* Default font. */
body {
  font-family: Georgia,serif;
................................................................................
<body class="manpage">
<div id="header">
<h1>
Jim Tcl(n) Manual Page
</h1>
<h2>NAME</h2>
<div class="sectionbody">
<p>Jim Tcl v0.78 -
   reference manual for the Jim Tcl scripting language
</p>
</div>
</div>
<div id="content">
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
................................................................................
</li>
</ol></div>
</div>
</div>
<div class="sect1">
<h2 id="_recent_changes">RECENT CHANGES</h2>
<div class="sectionbody">








































<div class="sect2">
<h3 id="_changes_between_0_77_and_0_78">Changes between 0.77 and 0.78</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Add serial/tty support with <a href="#_aio"><strong><code>aio</code></strong></a> <code>tty</code>
</p>
................................................................................
<a href="#_file"><strong><code>file</code></strong></a> <code>stat</code> no longer requires the variable name
</p>
</li>
<li>
<p>
Add support for <a href="#_file"><strong><code>file</code></strong></a> <code>link</code>
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_changes_between_0_73_and_0_74">Changes between 0.73 and 0.74</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Numbers with leading zeros are treated as decimal, not octal
</p>
</li>
<li>
<p>
Add <a href="#_aio"><strong><code>aio</code></strong></a> <code>isatty</code>
</p>
</li>
<li>
<p>
Add LFS (64 bit) support for <a href="#_aio"><strong><code>aio</code></strong></a> <code>seek</code>, <a href="#_aio"><strong><code>aio</code></strong></a> <code>tell</code>, <a href="#_aio"><strong><code>aio</code></strong></a> <code>copyto</code>, <a href="#_file"><strong><code>file</code></strong></a> <code>copy</code>
</p>
</li>
<li>
<p>
<a href="#_string"><strong><code>string</code></strong></a> <code>compare</code> and <a href="#_string"><strong><code>string</code></strong></a> <code>equal</code> now support <em>-length</em>
</p>
</li>
<li>
<p>
<a href="#_glob"><strong><code>glob</code></strong></a> now supports <em>-directory</em>
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_changes_between_0_72_and_0_73">Changes between 0.72 and 0.73</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Built-in regexp now support non-capturing parentheses: (?:&#8230;)
</p>
</li>
<li>
<p>
Add <a href="#_string"><strong><code>string</code></strong></a> <code>replace</code>
</p>
</li>
<li>
<p>
Add <a href="#_string"><strong><code>string</code></strong></a> <code>totitle</code>
</p>
</li>
<li>
<p>
Add <a href="#_info"><strong><code>info</code></strong></a> <code>statics</code>
</p>
</li>
<li>
<p>
Add <code>build-jim-ext</code> for easy separate building of loadable modules (extensions)
</p>
</li>
<li>
<p>
<a href="#_local"><strong><code>local</code></strong></a> now works with any command, not just procs
</p>
</li>
<li>
<p>
Add <a href="#_info"><strong><code>info</code></strong></a> <code>alias</code> to access the target of an alias
</p>
</li>
<li>
<p>
UTF-8 encoding past the basic multilingual plane (BMP) is supported
</p>
</li>
<li>
<p>
Add <a href="#_tcl_prefix"><strong><code>tcl::prefix</code></strong></a>
</p>
</li>
<li>
<p>
Add <a href="#_history"><strong><code>history</code></strong></a>
</p>
</li>
<li>
<p>
Most extensions are now enabled by default
</p>
</li>
<li>
<p>
Add support for namespaces and the <a href="#_namespace"><strong><code>namespace</code></strong></a> command
</p>
</li>
<li>
<p>
Add <a href="#_apply"><strong><code>apply</code></strong></a>
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_changes_between_0_71_and_0_72">Changes between 0.71 and 0.72</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
procs now allow <em>args</em> and optional parameters in any position
</p>
</li>
<li>
<p>
Add Tcl-compatible expr functions, <code>rand()</code>, <code>srand()</code> and <code>pow()</code>
</p>
</li>
<li>
<p>
Add support for the <em>-force</em> option to <a href="#_file"><strong><code>file</code></strong></a> <code>delete</code>
</p>
</li>
<li>
<p>
Better diagnostics when <a href="#_source"><strong><code>source</code></strong></a> fails to load a script with a missing quote or bracket
</p>
</li>
<li>
<p>
New <code>tcl_platform(pathSeparator)</code>
</p>
</li>
<li>
<p>
Add support settings the modification time with <a href="#_file"><strong><code>file</code></strong></a> <code>mtime</code>
</p>
</li>
<li>
<p>
<a href="#_exec"><strong><code>exec</code></strong></a> is now fully supported on win32 (mingw32)
</p>
</li>
<li>
<p>
<a href="#_file"><strong><code>file</code></strong></a> <code>join</code>, <a href="#_pwd"><strong><code>pwd</code></strong></a>, <a href="#_glob"><strong><code>glob</code></strong></a> etc. now work for mingw32
</p>
</li>
<li>
<p>
Line editing is now supported for the win32 console (mingw32)
</p>
</li>
<li>
<p>
Add <a href="#_aio"><strong><code>aio</code></strong></a> <code>listen</code> command
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_changes_between_0_70_and_0_71">Changes between 0.70 and 0.71</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Allow <em>args</em> to be renamed in procs
</p>
</li>
<li>
<p>
Add <code>$(&#8230;)</code> shorthand syntax for expressions
</p>
</li>
<li>
<p>
Add automatic reference variables in procs with <code>&amp;var</code> syntax
</p>
</li>
<li>
<p>
Support <code>jimsh --version</code>
</p>
</li>
<li>
<p>
Additional variables in <code>tcl_platform()</code>
</p>
</li>
<li>
<p>
<a href="#_local"><strong><code>local</code></strong></a> procs now push existing commands and <a href="#_upcall"><strong><code>upcall</code></strong></a> can call them
</p>
</li>
<li>
<p>
Add <a href="#_loop"><strong><code>loop</code></strong></a> command (TclX compatible)
</p>
</li>
<li>
<p>
Add <a href="#_aio"><strong><code>aio</code></strong></a> <code>buffering</code> command
</p>
</li>
<li>
<p>
<a href="#_info"><strong><code>info</code></strong></a> <code>complete</code> can now return the missing character
</p>
</li>
<li>
<p>
<a href="#_binary"><strong><code>binary</code></strong></a> <code>format</code> and <a href="#_binary"><strong><code>binary</code></strong></a> <code>scan</code> are now (optionally) supported
</p>
</li>
<li>
<p>
Add <a href="#_string"><strong><code>string</code></strong></a> <code>byterange</code>
</p>
</li>
<li>
<p>
Built-in regexp now support non-greedy repetition (*?, +?, ??)
</p>
</li>
</ol></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_tcl_introduction">TCL INTRODUCTION</h2>
................................................................................
A Tcl command string consists of one or more commands separated
by newline characters or semi-colons.
Each command consists of a collection of fields separated by
white space (spaces or tabs).
The first field must be the name of a command, and the
additional fields, if any, are arguments that will be passed to
that command.  For example, the command:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a 22</code></pre>
</div></div>
<div class="paragraph"><p>has three fields:  the first, <a href="#_set"><strong><code>set</code></strong></a>, is the name of a Tcl command, and
the last two, <em>a</em> and <em>22</em>, will be passed as arguments to
the <a href="#_set"><strong><code>set</code></strong></a> command.  The command name may refer either to a built-in
Tcl command, an application-specific command bound in with the library
procedure <em>Jim_CreateCommand</em>, or a command procedure defined with the
<a href="#_proc"><strong><code>proc</code></strong></a> built-in command.</p></div>
................................................................................
<div class="paragraph"><p>Normally each argument field ends at the next white space, but
double-quotes may be used to create arguments with embedded space.</p></div>
<div class="paragraph"><p>If an argument field begins with a double-quote, then the argument isn&#8217;t
terminated by white space (including newlines) or a semi-colon (see below
for information on semi-colons); instead it ends at the next double-quote
character.  The double-quotes are not included in the resulting argument.
For example, the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a "This is a single argument"</code></pre>
</div></div>
<div class="paragraph"><p>will pass two arguments to <a href="#_set"><strong><code>set</code></strong></a>:  <em>a</em> and <em>This is a single argument</em>.</p></div>
<div class="paragraph"><p>Within double-quotes, command substitutions, variable substitutions,
and backslash substitutions still occur, as described below.  If the
first character of a command field is not a quote, then quotes receive
no special interpretation in the parsing of that field.</p></div>
</div>
................................................................................
Second, the substitutions described below for commands, variables, and
backslashes do <strong>not</strong> occur in arguments enclosed in braces, so braces
can be used to prevent substitutions where they are undesirable.</p></div>
<div class="paragraph"><p>If an argument field begins with a left brace, then the argument ends
at the matching right brace.  Tcl will strip off the outermost layer
of braces and pass the information between the braces to the command
without any further modification.  For example, in the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a {xyz a {b c d}}</code></pre>
</div></div>
<div class="paragraph"><p>the <a href="#_set"><strong><code>set</code></strong></a> command will receive two arguments: <em>a</em>
and <em>xyz a {b c d}</em>.</p></div>
<div class="paragraph"><p>When braces or quotes are in effect, the matching brace or quote need
not be on the same line as the starting quote or brace; in this case
the newline will be included in the argument field along with any other
characters up to the matching brace or quote.  For example, the <a href="#_eval"><strong><code>eval</code></strong></a>
command takes one argument, which is a command string; <a href="#_eval"><strong><code>eval</code></strong></a> invokes
the Tcl interpreter to execute the command string.  The command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>eval {
  set a 22
  set b 33
}</code></pre>
</div></div>
<div class="paragraph"><p>will assign the value <em>22</em> to <em>a</em> and <em>33</em> to <em>b</em>.</p></div>
<div class="paragraph"><p>If the first character of a command field is not a left
brace, then neither left nor right
braces in the field will be treated specially (except as part of
variable substitution; see below).</p></div>
</div>
................................................................................
<h2 id="_command_substitution_with_brackets">COMMAND SUBSTITUTION WITH BRACKETS</h2>
<div class="sectionbody">
<div class="paragraph"><p>If an open bracket occurs in a field of a command, then command
substitution occurs (except for fields enclosed in braces).  All of the
text up to the matching close bracket is treated as a Tcl command and
executed immediately.  Then the result of that command is substituted
for the bracketed text.  For example, consider the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a [set b]</code></pre>
</div></div>
<div class="paragraph"><p>When the <a href="#_set"><strong><code>set</code></strong></a> command has only a single argument, it is the name of a
variable and <a href="#_set"><strong><code>set</code></strong></a> returns the contents of that variable.  In this case,
if variable <em>b</em> has the value <em>foo</em>, then the command above is equivalent
to the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a foo</code></pre>
</div></div>
<div class="paragraph"><p>Brackets can be used in more complex ways.  For example, if the variable
<em>b</em> has the value <em>foo</em> and the variable <em>c</em> has the value <em>gorp</em>,
then the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a xyz[set b].[set c]</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a xyzfoo.gorp</code></pre>
</div></div>
<div class="paragraph"><p>A bracketed command may contain multiple commands separated by newlines
or semi-colons in the usual fashion.  In this case the value of the last
command is used for substitution.  For example, the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a x[set b 22
expr $b+2]x</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a x24x</code></pre>
</div></div>
<div class="paragraph"><p>If a field is enclosed in braces then the brackets and the characters
between them are not interpreted specially; they are passed through to
the argument verbatim.</p></div>
</div>
</div>
<div class="sect1">
................................................................................
<div class="paragraph"><p>The dollar sign (<code>$</code>) may be used as a special shorthand form for
substituting variable values.  If <code>$</code> appears in an argument that isn&#8217;t
enclosed in braces then variable substitution will occur.  The characters
after the <code>$</code>, up to the first character that isn&#8217;t a number, letter,
or underscore, are taken as a variable name and the string value of that
variable is substituted for the name.</p></div>
<div class="paragraph"><p>For example, if variable <em>foo</em> has the value <em>test</em>, then the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a $foo.c</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a test.c</code></pre>
</div></div>
<div class="paragraph"><p>There are two special forms for variable substitution.  If the next
character after the name of the variable is an open parenthesis, then
the variable is assumed to be an array name, and all of the characters
between the open parenthesis and the next close parenthesis are taken as
an index into the array.  Command substitutions and variable substitutions
are performed on the information between the parentheses before it is
used as an index.</p></div>
<div class="paragraph"><p>For example, if the variable <em>x</em> is an array with one element named
<em>first</em> and value <em>87</em> and another element named <em>14</em> and value <em>more</em>,
then the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a xyz$x(first)zyx</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a xyz87zyx</code></pre>
</div></div>
<div class="paragraph"><p>If the variable <em>index</em> has the value <em>14</em>, then the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a xyz$x($index)zyx</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a xyzmorezyx</code></pre>
</div></div>
<div class="paragraph"><p>For more information on arrays, see VARIABLES AND ARRAYS below.</p></div>
<div class="paragraph"><p>The second special form for variables occurs when the dollar sign is
followed by an open curly brace.  In this case the variable name consists
of all the characters up to the next curly brace.</p></div>
<div class="paragraph"><p>Array references are not possible in this form:  the name between braces
is assumed to refer to a scalar variable.  For example, if variable
<em>foo</em> has the value <em>test</em>, then the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a abc${foo}bar</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a abctestbar</code></pre>
</div></div>
<div class="paragraph"><p>Variable substitution does not occur in arguments that are enclosed in
braces:  the dollar sign and variable name are passed through to the
argument verbatim.</p></div>
<div class="paragraph"><p>The dollar sign abbreviation is simply a shorthand form.  <code>$a</code> is
completely equivalent to <code>[set a]</code>; it is provided as a convenience
to reduce typing.</p></div>
................................................................................
    The <em>U</em> form allows for one to eight hex digits.
    The <em>u{nnn}</em> form allows for one to eight hex digits, but makes it easier to insert
    characters UTF-8 characters which are followed by a hex digit.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>For example, in the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a \{x\[\ yz\141</code></pre>
</div></div>
<div class="paragraph"><p>the second argument to <a href="#_set"><strong><code>set</code></strong></a> will be <code>{x[ yza</code>.</p></div>
<div class="paragraph"><p>If a backslash is followed by something other than one of the options
described above, then the backslash is transmitted to the argument
field without any special processing, and the Tcl scanner continues
normal processing with the next character.  For example, in the
command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set \*a \\\{foo</code></pre>
</div></div>
<div class="paragraph"><p>The first argument to <a href="#_set"><strong><code>set</code></strong></a> will be <code>\*a</code> and the second
argument will be <code>\{foo</code>.</p></div>
<div class="paragraph"><p>If an argument is enclosed in braces, then backslash sequences inside
the argument are parsed but no substitution occurs (except for
backslash-newline):  the backslash
sequence is passed through to the argument as is, without making
any special interpretation of the characters in the backslash sequence.
In particular, backslashed braces are not counted in locating the
matching right brace that terminates the argument.
For example, in the
command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a {\{abc}</code></pre>
</div></div>
<div class="paragraph"><p>the second argument to <a href="#_set"><strong><code>set</code></strong></a> will be <code>\{abc</code>.</p></div>
<div class="paragraph"><p>This backslash mechanism is not sufficient to generate absolutely
any argument structure; it only covers the
most common cases.  To produce particularly complicated arguments
it is probably easiest to use the <a href="#_format"><strong><code>format</code></strong></a> command along with
command substitution.</p></div>
................................................................................
<em>Jim_ExprBoolean</em>, etc.) to evaluate them.</p></div>
<div class="paragraph"><p>The operators permitted in Tcl expressions are a subset of
the operators permitted in C expressions, and they have the
same meaning and precedence as the corresponding C operators.
Expressions almost always yield numeric results
(integer or floating-point values).
For example, the expression</p></div>
<div class="literalblock">
<div class="content">
<pre><code>8.2 + 6</code></pre>
</div></div>
<div class="paragraph"><p>evaluates to 14.2.</p></div>
<div class="paragraph"><p>Tcl expressions differ from C expressions in the way that
operands are specified, and in that Tcl expressions support
non-numeric operands and string comparisons.</p></div>
<div class="paragraph"><p>A Tcl expression consists of a combination of operands, operators,
and parentheses.</p></div>
................................................................................
<div class="paragraph"><p>As discussed below, it is usually best to enclose expressions
in braces to prevent the command parser from performing substitutions
on the contents.</p></div>
<div class="paragraph"><p>For some examples of simple expressions, suppose the variable <em>a</em> has
the value 3 and the variable <em>b</em> has the value 6.  Then the expression
on the left side of each of the lines below will evaluate to the value
on the right side of the line:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>$a + 3.1                6.1
2 + "$a.$b"             5.6
4*[llength "6 2"]       8
{word one} &lt; "word $a"  0</code></pre>
</div></div>
<div class="paragraph"><p>The valid operators are listed below, grouped in decreasing order
of precedence:</p></div>
<div class="dlist" id="OperatorPrecedence"><dl>
<dt class="hdlist1">
<code>int() double() round() abs(), rand(), srand()</code>
</dt>
................................................................................
</p>
</dd>
</dl></div>
<div class="paragraph"><p>See the C manual for more details on the results
produced by each operator.
All of the binary operators group left-to-right within the same
precedence level.  For example, the expression</p></div>
<div class="literalblock">
<div class="content">
<pre><code>4*2 &lt; 7</code></pre>
</div></div>
<div class="paragraph"><p>evaluates to 0.</p></div>
<div class="paragraph"><p>The <code>&amp;&amp;</code>, <code>||</code>, and <code>?:</code> operators have <em>lazy evaluation</em>, just as
in C, which means that operands are not evaluated if they are not
needed to determine the outcome.  For example, in</p></div>
<div class="literalblock">
<div class="content">
<pre><code>$v ? [a] : [b]</code></pre>
</div></div>
<div class="paragraph"><p>only one of <code>[a]</code> or <code>[b]</code> will actually be evaluated,
depending on the value of <code>$v</code>.</p></div>
<div class="paragraph"><p>All internal computations involving integers are done with the C
type <em>long long</em> if available, or <em>long</em> otherwise, and all internal
computations involving floating-point are done with the C type
<em>double</em>.</p></div>
................................................................................
In any case, overflow and underflow are generally not detected
reliably for intermediate results.</p></div>
<div class="paragraph"><p>Conversion among internal representations for integer, floating-point,
string operands is done automatically as needed.
For arithmetic computations, integers are used until some
floating-point number is introduced, after which floating-point is used.
For example,</p></div>
<div class="literalblock">
<div class="content">
<pre><code>5 / 4</code></pre>
</div></div>
<div class="paragraph"><p>yields the result 1, while</p></div>
<div class="literalblock">
<div class="content">
<pre><code>5 / 4.0
5 / ( [string length "abcd"] + 0.0 )</code></pre>
</div></div>
<div class="paragraph"><p>both yield the result 1.25.</p></div>
<div class="paragraph"><p>String values may be used as operands of the comparison operators,
although the expression evaluator tries to do comparisons as integer
or floating-point when it can.
If one of the operands of a comparison is a string and the other
has a numeric value, the numeric operand is converted back to
a string using the C <em>sprintf</em> format specifier
<em>%d</em> for integers and <em>%g</em> for floating-point values.
For example, the expressions</p></div>
<div class="literalblock">
<div class="content">
<pre><code>"0x03" &gt; "2"
"0y" &lt; "0x12"</code></pre>
</div></div>
<div class="paragraph"><p>both evaluate to 1.  The first comparison is done using integer
comparison, and the second is done using string comparison after
the second operand is converted to the string <em>18</em>.</p></div>
<div class="paragraph"><p>In general it is safest to enclose an expression in braces when
entering it in a command:  otherwise, if the expression contains
any white space then the Tcl interpreter will split it
among several arguments.  For example, the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>expr $a + $b</code></pre>
</div></div>
<div class="paragraph"><p>results in three arguments being passed to <a href="#_expr"><strong><code>expr</code></strong></a>:  <code>$a</code>,
+, and <code>$b</code>.  In addition, if the expression isn&#8217;t in braces
then the Tcl interpreter will perform variable and command substitution
immediately (it will happen in the command parser rather than in
the expression parser).  In many cases the expression is being
passed to a command that will evaluate the expression later (or
even many times if, for example, the expression is to be used to
decide when to exit a loop).  Usually the desired goal is to re-do
the variable or command substitutions each time the expression is
evaluated, rather than once and for all at the beginning.  For example,
the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>for {set i 1} $i&lt;=10 {incr i} {...}        ** WRONG **</code></pre>
</div></div>
<div class="paragraph"><p>is probably intended to iterate over all values of <code>i</code> from 1 to 10.
After each iteration of the body of the loop, <a href="#_for"><strong><code>for</code></strong></a> will pass
its second argument to the expression evaluator to see whether or not
to continue processing.  Unfortunately, in this case the value of <code>i</code>
in the second argument will be substituted once and for all when the
<a href="#_for"><strong><code>for</code></strong></a> command is parsed.  If <code>i</code> was 0 before the <a href="#_for"><strong><code>for</code></strong></a>
command was invoked then the second argument of <a href="#_for"><strong><code>for</code></strong></a> will be <code>0&lt;=10</code>
which will always evaluate to 1, even though <code>i</code> eventually
becomes greater than 10.  In the above case the loop will never
terminate.  Instead, the expression should be placed in braces:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>for {set i 1} {$i&lt;=10} {incr i} {...}      ** RIGHT **</code></pre>
</div></div>
<div class="paragraph"><p>This causes the substitution of <em>i</em>
to be delayed; it will be re-done each time the expression is
evaluated, which is the desired result.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_lists">LISTS</h2>
<div class="sectionbody">
<div class="paragraph"><p>The third major way that strings are interpreted in Tcl is as lists.
A list is just a string with a list-like structure
consisting of fields separated by white space.  For example, the
string</p></div>
<div class="literalblock">
<div class="content">
<pre><code>Al Sue Anne John</code></pre>
</div></div>
<div class="paragraph"><p>is a list with four elements or fields.
Lists have the same basic structure as command strings, except
that a newline character in a list is treated as a field separator
just like space or tab.  Conventions for braces and quotes
and backslashes are the same for lists as for commands.  For example,
the string</p></div>
<div class="literalblock">
<div class="content">
<pre><code>a b\ c {d e {f g h}}</code></pre>
</div></div>
<div class="paragraph"><p>is a list with three elements:  <code>a</code>, <code>b c</code>, and <code>d e {f g h}</code>.</p></div>
<div class="paragraph"><p>Whenever an element is extracted from a list, the same rules about
braces and quotes and backslashes are applied as for commands.  Thus in
the example above when the third element is extracted from the list,
the result is</p></div>
<div class="literalblock">
<div class="content">
<pre><code>d e {f g h}</code></pre>
</div></div>
<div class="paragraph"><p>(when the field was extracted, all that happened was to strip off
the outermost layer of braces).  Command substitution and
variable substitution are never
made on a list (at least, not by the list-processing commands; the
list can always be passed to the Tcl interpreter for evaluation).</p></div>
<div class="paragraph"><p>The Tcl commands <a href="#_concat"><strong><code>concat</code></strong></a>, <a href="#_foreach"><strong><code>foreach</code></strong></a>, <a href="#_lappend"><strong><code>lappend</code></strong></a>, <a href="#_lindex"><strong><code>lindex</code></strong></a>, <a href="#_linsert"><strong><code>linsert</code></strong></a>,
................................................................................
</div>
<div class="sect1">
<h2 id="_list_expansion">LIST EXPANSION</h2>
<div class="sectionbody">
<div class="paragraph"><p>A new addition to Tcl 8.5 is the ability to expand a list into separate
arguments. Support for this feature is also available in Jim.</p></div>
<div class="paragraph"><p>Consider the following attempt to exec a list:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set cmd {ls -l}
exec $cmd</code></pre>
</div></div>
<div class="paragraph"><p>This will attempt to exec a command named "ls -l", which will clearly not
work. Typically eval and concat are required to solve this problem, however
it can be solved much more easily with <code>{*}</code>.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>exec {*}$cmd</code></pre>
</div></div>
<div class="paragraph"><p>This will expand the following argument into individual elements and then evaluate
the resulting command.</p></div>
<div class="paragraph"><p>Note that the official Tcl syntax is <code>{*}</code>, however <code>{expand}</code> is retained
for backward compatibility with experimental versions of this feature.</p></div>
</div>
</div>
................................................................................
<li>
<p>
Variable Argument
</p>
</li>
</ol></div>
<div class="paragraph"><p>The following example illustrates precedence. Assume a procedure declaration:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>proc p {{a A} args b {c C} d} {...}</code></pre>
</div></div>
<div class="paragraph"><p>This procedure requires at least two arguments, but can accept an unlimited number.
The following table shows how various numbers of arguments are assigned.
Values marked as <code>-</code> are assigned the default value.</p></div>
<div class="tableblock">
<table rules="all"
width="40%"
................................................................................
accessed by invoking the <a href="#_global"><strong><code>global</code></strong></a> command or via the <code>::</code> prefix.</p></div>
<div class="sect2">
<h3 id="_new_in_jim">New in Jim</h3>
<div class="paragraph"><p>In addition to procedure arguments, Jim procedures may declare static variables.
These variables scoped to the procedure and initialised at procedure definition.
Either from the static variable definition, or from the enclosing scope.</p></div>
<div class="paragraph"><p>Consider the following example:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; set a 1
jim&gt; proc a {} {a {b 2}} {
    set c 1
    puts "$a $b $c"
    incr a
    incr b
    incr c
}
jim&gt; a
1 2 1
jim&gt; a
2 3 1</code></pre>
</div></div>
<div class="paragraph"><p>The static variable <code><em>a</em></code> has no initialiser, so it is initialised from
the enclosing scope with the value 1. (Note that it is an error if there
is no variable with the same name in the enclosing scope). However <code><em>b</em></code>
has an initialiser, so it is initialised to 2.</p></div>
<div class="paragraph"><p>Unlike a local variable, the value of a static variable is retained across
invocations of the procedure.</p></div>
<div class="paragraph"><p>See the <a href="#_proc"><strong><code>proc</code></strong></a> command for information on how to define procedures
and what happens when they are invoked. See also NAMESPACES.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_variables_scalars_and_arrays">VARIABLES - SCALARS AND ARRAYS</h2>
<div class="sectionbody">
<div class="paragraph"><p>Tcl allows the definition of variables and the use of their values
................................................................................
<div class="paragraph"><p>Tcl supports two types of variables:  scalars and arrays.
A scalar variable has a single value, whereas an array variable
can have any number of elements, each with a name (called
its <em>index</em>) and a value.</p></div>
<div class="paragraph"><p>Array indexes may be arbitrary strings; they need not be numeric.
Parentheses are used refer to array elements in Tcl commands.
For example, the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set x(first) 44</code></pre>
</div></div>
<div class="paragraph"><p>will modify the element of <em>x</em> whose index is <em>first</em>
so that its new value is <em>44</em>.</p></div>
<div class="paragraph"><p>Two-dimensional arrays can be simulated in Tcl by using indexes
that contain multiple concatenated values.
For example, the commands</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a(2,3) 1
set a(3,6) 2</code></pre>
</div></div>
<div class="paragraph"><p>set the elements of <em>a</em> whose indexes are <em>2,3</em> and <em>3,6</em>.</p></div>
<div class="paragraph"><p>In general, array elements may be used anywhere in Tcl that scalar
variables may be used.</p></div>
<div class="paragraph"><p>If an array is defined with a particular name, then there may
not be a scalar variable with the same name.</p></div>
<div class="paragraph"><p>Similarly, if there is a scalar variable with a particular
................................................................................
automatically refers to a global variable.  Variable names used
within a procedure normally refer to local variables associated with that
invocation of the procedure.  Local variables are deleted whenever
a procedure exits.  Either <a href="#_global"><strong><code>global</code></strong></a> command may be used to request
that a name refer to a global variable for the duration of the current
procedure (this is somewhat analogous to <em>extern</em> in C), or the variable
may be explicitly scoped with the <code>::</code> prefix. For example</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a 1
set b 2
proc p {} {
    set c 3
    global a</code></pre>
</div></div>
<div class="literalblock">
<div class="content">

<pre><code>    puts "$a $::b $c"
}
p</code></pre>
</div></div>
<div class="paragraph"><p>will output:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>1 2 3</code></pre>
</div></div>
</div>
................................................................................
<div class="sect1">
<h2 id="_arrays_as_lists_in_jim">ARRAYS AS LISTS IN JIM</h2>
<div class="sectionbody">
<div class="paragraph"><p>Unlike Tcl, Jim can automatically convert between a list (with an even
number of elements) and an array value. This is similar to the way Tcl
can convert between a string and a list.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a {1 one 2 two}
puts $a(2)</code></pre>
</div></div>
<div class="paragraph"><p>will output:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>two</code></pre>
</div></div>
<div class="paragraph"><p>Thus <a href="#_array"><strong><code>array</code></strong></a> <code>set</code> is equivalent to <a href="#_set"><strong><code>set</code></strong></a> when the variable does not
exist or is empty.</p></div>
<div class="paragraph"><p>The reverse is also true where an array will be converted into
a list.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a(1) one; set a(2) two
puts $a</code></pre>
</div></div>
<div class="paragraph"><p>will output:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>1 one 2 two</code></pre>
</div></div>
</div>
</div>
<div class="sect1">
<h2 id="_dictionary_values">DICTIONARY VALUES</h2>
<div class="sectionbody">
<div class="paragraph"><p>Tcl 8.5 introduced the dict command, and Jim Tcl has added a version
................................................................................
keys, only the last value for a particular key is used; the others
are ignored, meaning that, "apple banana" and "apple carrot apple
banana" are equivalent dictionaries (with different string
representations).</p></div>
<div class="paragraph"><p>Note that in Jim, arrays are implemented as dictionaries.
Thus automatic conversion between lists and dictionaries applies
as it does for arrays.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; dict set a 1 one
1 one
jim&gt; dict set a 2 two
1 one 2 two
jim&gt; puts $a
1 one 2 two
jim&gt; puts $a(2)
two
jim&gt; dict set a 3 T three
1 one 2 two 3 {T three}</code></pre>
</div></div>
<div class="paragraph"><p>See the <a href="#_dict"><strong><code>dict</code></strong></a> command for more details.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_namespaces">NAMESPACES</h2>
<div class="sectionbody">
................................................................................
These are described briefly below.</p></div>
<div class="paragraph"><p>More information may be found at <a href="http://wiki.tcl.tk/13847">http://wiki.tcl.tk/13847</a></p></div>
<div class="sect2">
<h3 id="_references">References</h3>
<div class="paragraph"><p>A reference can be thought of as holding a value with one level of indirection,
where the value may be garbage collected when unreferenced.
Consider the following example:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; set r [ref "One String" test]
&lt;reference.&lt;test___&gt;.00000000000000000000&gt;
jim&gt; getref $r
One String</code></pre>
</div></div>
<div class="paragraph"><p>The operation <a href="#_ref"><strong><code>ref</code></strong></a> creates a references to the value specified by the
first argument. (The second argument is a "type" used for documentation purposes).</p></div>
<div class="paragraph"><p>The operation <a href="#_getref"><strong><code>getref</code></strong></a> is the dereferencing operation which retrieves the value
stored in the reference.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; setref $r "New String"
New String
jim&gt; getref $r
New String</code></pre>
</div></div>
<div class="paragraph"><p>The operation <a href="#_setref"><strong><code>setref</code></strong></a> replaces the value stored by the reference. If the old value
is no longer accessible by any reference, it will eventually be automatically be garbage
collected.</p></div>
</div>
<div class="sect2">
<h3 id="_garbage_collection">Garbage Collection</h3>
................................................................................
<div class="paragraph"><p>Normally, all values in Tcl are passed by value. As such values are copied and released
automatically as necessary.</p></div>
<div class="paragraph"><p>With the introduction of references, it is possible to create values whose lifetime
transcend their scope. To support this, case, the Jim system will periodically identify
and discard objects which are no longer accessible by any reference.</p></div>
<div class="paragraph"><p>The <a href="#_collect"><strong><code>collect</code></strong></a> command may be used to force garbage collection.  Consider a reference created
with a finalizer:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; proc f {ref value} { puts "Finaliser called for $ref,$value" }
jim&gt; set r [ref "One String" test f]
&lt;reference.&lt;test___&gt;.00000000000
jim&gt; collect
0
jim&gt; set r ""
jim&gt; collect
Finaliser called for &lt;reference.&lt;test___&gt;.00000000000,One String
1</code></pre>
</div></div>
<div class="paragraph"><p>Note that once the reference, <em>r</em>, was modified so that it no longer
contained a reference to the value, the garbage collector discarded
the value (after calling the finalizer).</p></div>
<div class="paragraph"><p>The finalizer for a reference may be examined or changed with the <a href="#_finalize"><strong><code>finalize</code></strong></a> command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; finalize $r
f
jim&gt; finalize $r newf
newf</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_lambda_function">Lambda Function</h3>
<div class="paragraph"><p>Jim provides a garbage collected <a href="#_lambda"><strong><code>lambda</code></strong></a> function. This is a procedure
which is able to create an anonymous procedure.  Consider:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; set f [lambda {a} {{x 0}} { incr x $a }]
jim&gt; $f 1
1
jim&gt; $f 2
3
jim&gt; set f ""</code></pre>
</div></div>
<div class="paragraph"><p>This create an anonymous procedure (with the name stored in <em>f</em>), with a static variable
which is incremented by the supplied value and the result returned.</p></div>
<div class="paragraph"><p>Once the procedure name is no longer accessible, it will automatically be deleted
when the garbage collector runs.</p></div>
<div class="paragraph"><p>The procedure may also be delete immediately by renaming it "". e.g.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; rename $f ""</code></pre>
</div></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_utf_8_and_unicode">UTF-8 AND UNICODE</h2>
<div class="sectionbody">
................................................................................
<div class="paragraph"><p>Note that even if UTF-8 support is not enabled, the <code>\uNNNN</code> and related syntax
is still available to embed UTF-8 sequences.</p></div>
<div class="paragraph"><p>Jim Tcl supports all currently defined unicode codepoints. That is 21 bits, up to +<em>U+1FFFFF</em>.</p></div>
<div class="sect2">
<h3 id="_string_matching">String Matching</h3>
<div class="paragraph"><p>Commands such as <a href="#_string"><strong><code>string</code></strong></a> <code>match</code>, <a href="#_lsearch"><strong><code>lsearch</code></strong></a> <code>-glob</code>, <a href="#_array"><strong><code>array</code></strong></a> <code>names</code> and others use string
pattern matching rules. These commands support UTF-8. For example:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>string match a\[\ua0-\ubf\]b "a\u00a3b"</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_format_and_scan">format and scan</h3>
<div class="paragraph"><p><code>format %c</code> allows a unicode codepoint to be be encoded. For example, the following will return
a string with two bytes and one character. The same as <code>\ub5</code></p></div>
<div class="literalblock">
<div class="content">
<pre><code>format %c 0xb5</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_format"><strong><code>format</code></strong></a> respects widths as character widths, not byte widths. For example, the following will
return a string with three characters, not three bytes.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>format %.3s \ub5\ub6\ub7\ub8</code></pre>
</div></div>
<div class="paragraph"><p>Similarly, <code>scan &#8230; %c</code> allows a UTF-8 to be decoded to a unicode codepoint. The following will set
<code><em>a</em></code> to 181 (0xb5) and <code><em>b</em></code> to 65 (0x41).</p></div>
<div class="literalblock">
<div class="content">
<pre><code>scan \u00b5A %c%c a b</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_scan"><strong><code>scan</code></strong></a> <code>%s</code> will also accept a character class, including unicode ranges.</p></div>
</div>
<div class="sect2">
<h3 id="_string_classes">String Classes</h3>
<div class="paragraph"><p><a href="#_string"><strong><code>string</code></strong></a> <code>is</code> has <strong>not</strong> been extended to classify UTF-8 characters. Therefore, the following
will return 0, even though the string may be considered to be alphabetic.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>string is alpha \ub5Test</code></pre>
</div></div>
<div class="paragraph"><p>This does not affect the string classes <em>ascii</em>, <em>control</em>, <em>digit</em>, <em>double</em>, <em>integer</em> or <em>xdigit</em>.</p></div>
</div>
<div class="sect2">
<h3 id="_case_mapping_and_conversion">Case Mapping and Conversion</h3>
<div class="paragraph"><p>Jim provides a simplified unicode case mapping. This means that case conversion
and comparison will not increase or decrease the number of characters in a string.
................................................................................
<div class="sect2">
<h3 id="_invalid_utf_8_sequences">Invalid UTF-8 Sequences</h3>
<div class="paragraph"><p>Some UTF-8 character sequences are invalid, such as those beginning with <em>0xff</em>,
those which represent character sequences longer than 3 bytes (greater than U+FFFF),
and those which end prematurely, such as a lone <em>0xc2</em>.</p></div>
<div class="paragraph"><p>In these situations, the offending bytes are treated as single characters. For example,
the following returns 2.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>string bytelength \xff\xff</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_regular_expressions_2">Regular Expressions</h3>
<div class="paragraph"><p>If UTF-8 support is enabled, the built-in regular expression engine will be
selected which supports UTF-8 strings and patterns.</p></div>
<div class="paragraph"><p>See REGULAR EXPRESSIONS</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_built_in_commands">BUILT-IN COMMANDS</h2>
<div class="sectionbody">
<div class="paragraph"><p>The Tcl library provides the following built-in commands, which will
................................................................................
<td align="left" valign="top"><p class="table"><a href="#_global"><strong><code>global</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_history"><strong><code>history</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_if"><strong><code>if</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_incr"><strong><code>incr</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_info"><strong><code>info</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_interp"><strong><code>interp</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_join"><strong><code>join</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_kill"><strong><code>kill</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_lambda"><strong><code>lambda</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lappend"><strong><code>lappend</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lassign"><strong><code>lassign</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lindex"><strong><code>lindex</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_linsert"><strong><code>linsert</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_list"><strong><code>list</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_llength"><strong><code>llength</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lmap"><strong><code>lmap</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_load"><strong><code>load</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_local"><strong><code>local</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_loop"><strong><code>loop</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lrange"><strong><code>lrange</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lrepeat"><strong><code>lrepeat</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lreplace"><strong><code>lreplace</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lreverse"><strong><code>lreverse</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lsearch"><strong><code>lsearch</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_lset"><strong><code>lset</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lsort"><strong><code>lsort</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_namespace"><strong><code>namespace</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_4"><strong><code>oo</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_open"><strong><code>open</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>os.fork</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>os.gethostname</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>os.getids</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>os.uptime</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_3"><strong><code>pack</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_3"><strong><code>pack</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_package"><strong><code>package</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_pid"><strong><code>pid</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_pipe"><strong><code>pipe</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>posix</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_proc"><strong><code>proc</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_puts"><strong><code>puts</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_pwd"><strong><code>pwd</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_rand"><strong><code>rand</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_range"><strong><code>range</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_read"><strong><code>read</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_ref"><strong><code>ref</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_regexp"><strong><code>regexp</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_regsub"><strong><code>regsub</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_rename"><strong><code>rename</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_return"><strong><code>return</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_scan"><strong><code>scan</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_seek"><strong><code>seek</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_set"><strong><code>set</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_setref"><strong><code>setref</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_signal"><strong><code>signal</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_sleep"><strong><code>sleep</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_socket"><strong><code>socket</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_source"><strong><code>source</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_split"><strong><code>split</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_stackdump"><strong><code>stackdump</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_stacktrace"><strong><code>stacktrace</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_string"><strong><code>string</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_subst"><strong><code>subst</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_4"><strong><code>super</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_switch"><strong><code>switch</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_syslog"><strong><code>syslog</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tailcall"><strong><code>tailcall</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tcl_autocomplete"><strong><code>tcl::autocomplete</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tcl_prefix"><strong><code>tcl::prefix</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tell"><strong><code>tell</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_throw"><strong><code>throw</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_time"><strong><code>time</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_tree"><strong><code>tree</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_try"><strong><code>try</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_unknown"><strong><code>unknown</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_3"><strong><code>unpack</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_unset"><strong><code>unset</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_upcall"><strong><code>upcall</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_2"><strong><code>update</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_uplevel"><strong><code>uplevel</code></strong></a></p></td>
</tr>
<tr>


<td align="left" valign="top"><p class="table"><a href="#_upvar"><strong><code>upvar</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_2"><strong><code>vwait</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_wait"><strong><code>wait</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_while"><strong><code>while</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_zlib"><strong><code>zlib</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"></p></td>
<td align="left" valign="top"><p class="table"></p></td>
<td align="left" valign="top"><p class="table"></p></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="sect2">
................................................................................
(see <a href="#_signal"><strong><code>signal</code></strong></a>), the process will exit on this signal.</p></div>
</div>
<div class="sect2">
<h3 id="_alias">alias</h3>
<div class="paragraph"><p><code><strong>alias</strong> <em>name args...</em></code></p></div>
<div class="paragraph"><p>Creates a single word alias (command) for one or more words. For example,
the following creates an alias for the command <a href="#_info"><strong><code>info</code></strong></a> <code>exists</code>.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>alias e info exists
if {[e var]} {
  ...
}</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_alias"><strong><code>alias</code></strong></a> returns <code><em>name</em></code>, allowing it to be used with <a href="#_local"><strong><code>local</code></strong></a>.</p></div>
<div class="paragraph"><p>See also <a href="#_proc"><strong><code>proc</code></strong></a>, <a href="#_curry"><strong><code>curry</code></strong></a>, <a href="#_lambda"><strong><code>lambda</code></strong></a>, <a href="#_local"><strong><code>local</code></strong></a>, <a href="#_info"><strong><code>info</code></strong></a> <code>alias</code>, <a href="#_exists"><strong><code>exists</code></strong></a> <code>-alias</code></p></div>
</div>
<div class="sect2">
<h3 id="_append">append</h3>
<div class="paragraph"><p><code><strong>append</strong> <em>varName value ?value value &#8230;?</em></code></p></div>
................................................................................
<div class="paragraph"><p><code><strong>break</strong></code></p></div>
<div class="paragraph"><p>This command may be invoked only inside the body of a loop command
such as <a href="#_for"><strong><code>for</code></strong></a> or <a href="#_foreach"><strong><code>foreach</code></strong></a> or <a href="#_while"><strong><code>while</code></strong></a>.  It returns a <code>JIM_BREAK</code> code
to signal the innermost containing loop command to return immediately.</p></div>
</div>
<div class="sect2">
<h3 id="_case">case</h3>
<div class="paragraph"><p><code><strong>case</strong> <em>string</em> ?in? <em>patList body ?patList body &#8230;?</em></code></p></div>
<div class="paragraph"><p><code><strong>case</strong> <em>string</em> ?in? {<em>patList body ?patList body &#8230;?</em>}</code></p></div>
<div class="paragraph"><p><strong>Note</strong> that the <a href="#_switch"><strong><code>switch</code></strong></a> command should generally be preferred unless compatibility
with Tcl 6.x is desired.</p></div>
<div class="paragraph"><p>Match <code><em>string</em></code> against each of the <code><em>patList</em></code> arguments
in order.  If one matches, then evaluate the following <code><em>body</em></code> argument
by passing it recursively to the Tcl interpreter, and return the result
of that evaluation.  Each <code><em>patList</em></code> argument consists of a single
pattern or list of patterns.  Each pattern may contain any of the wild-cards
described under <a href="#_string"><strong><code>string</code></strong></a> <code>match</code>.</p></div>
<div class="paragraph"><p>If a <code><em>patList</em></code> argument is <code>default</code>, the corresponding body will be
evaluated if no <code><em>patList</em></code> matches <code><em>string</em></code>.  If no <code><em>patList</em></code> argument
matches <code><em>string</em></code> and no default is given, then the <a href="#_case"><strong><code>case</code></strong></a> command returns
an empty string.</p></div>
<div class="paragraph"><p>Two syntaxes are provided.</p></div>
<div class="paragraph"><p>The first uses a separate argument for each of the patterns and commands;
this form is convenient if substitutions are desired on some of the
patterns or commands.</p></div>
<div class="paragraph"><p>The second form places all of the patterns and commands together into
a single argument; the argument must have proper list structure, with
the elements of the list being the patterns and commands.</p></div>
<div class="paragraph"><p>The second form makes it easy to construct multi-line case commands,
since the braces around the whole list make it unnecessary to include a
backslash at the end of each line.</p></div>
<div class="paragraph"><p>Since the <code><em>patList</em></code> arguments are in braces in the second form,
no command or variable substitutions are performed on them;  this makes
the behaviour of the second form different than the first form in some
cases.</p></div>
<div class="paragraph"><p>Below are some examples of <a href="#_case"><strong><code>case</code></strong></a> commands:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>case abc in {a b} {format 1} default {format 2} a* {format 3}</code></pre>
</div></div>
<div class="paragraph"><p>will return <em>3</em>,</p></div>
<div class="literalblock">
<div class="content">
<pre><code>case a in {
    {a b} {format 1}
    default {format 2}
    a* {format 3}
}</code></pre>
</div></div>
<div class="paragraph"><p>will return <em>1</em>, and</p></div>
<div class="literalblock">
<div class="content">
<pre><code>case xyz {
    {a b}
        {format 1}
    default
        {format 2}
    a*
        {format 3}
}</code></pre>
</div></div>
<div class="paragraph"><p>will return <em>2</em>.</p></div>
</div>
<div class="sect2">
<h3 id="_catch">catch</h3>
<div class="paragraph"><p><code><strong>catch</strong> ?-?no?<em>code ...</em>? ?--? <em>command ?resultVarName? ?optionsVarName?</em></code></p></div>
<div class="paragraph"><p>The <a href="#_catch"><strong><code>catch</code></strong></a> command may be used to prevent errors from aborting
command interpretation.  <a href="#_catch"><strong><code>catch</code></strong></a> evaluates <code><em>command</em></code>, and returns a
<code>JIM_OK</code> code, regardless of any errors that might occur while
................................................................................
it will be set to the code given in <a href="#_return"><strong><code>return</code></strong></a> <code>-code</code>. Additionally,
for the return code <code>JIM_ERR</code>, the value of the key <code>-errorinfo</code>
will contain the current stack trace (the same result as <a href="#_info"><strong><code>info</code></strong></a> <code>stacktrace</code>),
the value of the key <code>-errorcode</code> will contain the
same value as the global variable $::errorCode, and the value of
the key <code>-level</code> will be the current return level (see <a href="#_return"><strong><code>return</code></strong></a> <code>-level</code>).
This can be useful to rethrow an error:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>if {[catch {...} msg opts]} {
    ...maybe do something with the error...
    incr opts(-level)
    return {*}$opts $msg
}</code></pre>
</div></div>
<div class="paragraph"><p>Normally <a href="#_catch"><strong><code>catch</code></strong></a> will <code><em>not</em></code> catch any of the codes <code>JIM_EXIT</code>, <code>JIM_EVAL</code> or <code>JIM_SIGNAL</code>.
The set of codes which will be caught may be modified by specifying the one more codes before
<code><em>command</em></code>.</p></div>
<div class="paragraph"><p>e.g. To catch <code>JIM_EXIT</code> but not <code>JIM_BREAK</code> or <code>JIM_CONTINUE</code></p></div>
<div class="literalblock">
<div class="content">
<pre><code>catch -exit -nobreak -nocontinue -- { ... }</code></pre>
</div></div>
<div class="paragraph"><p>The use of <code>--</code> is optional. It signifies that no more return code options follow.</p></div>
<div class="paragraph"><p>Note that if a signal marked as <a href="#_signal"><strong><code>signal</code></strong></a> <code>handle</code> is caught with <a href="#_catch"><strong><code>catch</code></strong></a> <code>-signal</code>, the return value
(stored in <code><em>resultVarName</em></code>) is name of the signal caught.</p></div>
</div>
<div class="sect2">
<h3 id="_cd">cd</h3>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code><strong>clock clicks</strong></code>
</dt>
<dd>
<p>
    Returns the current time in &#8216;clicks&#8217;.
</p>
</dd>
<dt class="hdlist1">
<code><strong>clock microseconds</strong></code>
</dt>
<dd>
<p>
................................................................................
</dt>
<dd>
<p>
    Returns the current time in milliseconds.
</p>
</dd>
<dt class="hdlist1">
<code><strong>clock format</strong> <em>seconds</em> ?<strong>-format</strong> <em>format?</em></code>
</dt>
<dd>
<p>
    Format the given time (seconds since the epoch) according to the given
    format. See strftime(3) for supported formats.
    If no format is supplied, "%c" is used.
</p>
</dd>
<dt class="hdlist1">









<code><strong>clock scan</strong> <em>str</em> <strong>-format</strong> <em>format</em></code>
</dt>
<dd>
<p>
    Scan the given time string using the given format string.
    See strptime(3) for supported formats.

</p>
</dd>
</dl></div>
</div>
<div class="sect2">
<h3 id="_close">close</h3>
<div class="paragraph"><p><code><strong>close</strong> <em>fileId</em></code></p></div>
................................................................................
used anymore.</p></div>
</div>
<div class="sect2">
<h3 id="_collect">collect</h3>
<div class="paragraph"><p><code><strong>collect</strong></code></p></div>
<div class="paragraph"><p>Normally reference garbage collection is automatically performed periodically.
However it may be run immediately with the <a href="#_collect"><strong><code>collect</code></strong></a> command.</p></div>
<div class="paragraph"><p>See GARBAGE COLLECTION, REFERENCES, LAMBDA FUNCTION for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_concat">concat</h3>
<div class="paragraph"><p><code><strong>concat</strong> <em>arg ?arg ...?</em></code></p></div>
<div class="paragraph"><p>This command treats each argument as a list and concatenates them
into a single list.  It permits any number of arguments.  For example,
the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>concat a b {c d e} {f {g h}}</code></pre>
</div></div>
<div class="paragraph"><p>will return</p></div>
<div class="literalblock">
<div class="content">
<pre><code>a b c d e f {g h}</code></pre>
</div></div>
<div class="paragraph"><p>as its result.</p></div>
</div>
<div class="sect2">
<h3 id="_continue">continue</h3>
<div class="paragraph"><p><code><strong>continue</strong></code></p></div>
<div class="paragraph"><p>This command may be invoked only inside the body of a loop command such
................................................................................
</div>
<div class="sect2">
<h3 id="_curry">curry</h3>
<div class="paragraph"><p><code><strong>alias</strong> <em>args...</em></code></p></div>
<div class="paragraph"><p>Similar to <a href="#_alias"><strong><code>alias</code></strong></a> except it creates an anonymous procedure (lambda) instead of
a named procedure.</p></div>
<div class="paragraph"><p>the following creates a local, unnamed alias for the command <a href="#_info"><strong><code>info</code></strong></a> <code>exists</code>.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set e [local curry info exists]
if {[$e var]} {
  ...
}</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_curry"><strong><code>curry</code></strong></a> returns the name of the procedure.</p></div>
<div class="paragraph"><p>See also <a href="#_proc"><strong><code>proc</code></strong></a>, <a href="#_alias"><strong><code>alias</code></strong></a>, <a href="#_lambda"><strong><code>lambda</code></strong></a>, <a href="#_local"><strong><code>local</code></strong></a>.</p></div>
</div>
<div class="sect2">
<h3 id="_dict">dict</h3>
<div class="paragraph"><p><code><strong>dict</strong> <em>option ?arg...?</em></code></p></div>
................................................................................
to indicate what went wrong.</p></div>
<div class="paragraph"><p>If the <code><em>stacktrace</em></code> argument is provided and is non-empty,
it is used to initialize the stacktrace.</p></div>
<div class="paragraph"><p>This feature is most useful in conjunction with the <a href="#_catch"><strong><code>catch</code></strong></a> command:
if a caught error cannot be handled successfully, <code><em>stacktrace</em></code> can be used
to return a stack trace reflecting the original point of occurrence
of the error:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>catch {...} errMsg
...
error $errMsg [info stacktrace]</code></pre>
</div></div>
<div class="paragraph"><p>See also <code>errorInfo</code>, <a href="#_info"><strong><code>info</code></strong></a> <code>stacktrace</code>, <a href="#_catch"><strong><code>catch</code></strong></a> and <a href="#_return"><strong><code>return</code></strong></a></p></div>
</div>
<div class="sect2">
<h3 id="_errorinfo">errorInfo</h3>
<div class="paragraph"><p><code><strong>errorInfo</strong> <em>error ?stacktrace?</em></code></p></div>
<div class="paragraph"><p>Returns a human-readable representation of the given error message and stack trace.
Typical usage is:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>if {[catch {...} error]} {
    puts stderr [errorInfo $error [info stacktrace]]
    exit 1
}</code></pre>
</div></div>
<div class="paragraph"><p>See also <a href="#_error"><strong><code>error</code></strong></a>.</p></div>
</div>
<div class="sect2">
<h3 id="_eval">eval</h3>
<div class="paragraph"><p><code><strong>eval</strong> <em>arg ?arg...?</em></code></p></div>
<div class="paragraph"><p><a href="#_eval"><strong><code>eval</code></strong></a> takes one or more arguments, which together comprise a Tcl
................................................................................
to 0.</p></div>
<div class="paragraph"><p>Note that exit can be caught with <a href="#_catch"><strong><code>catch</code></strong></a>.</p></div>
</div>
<div class="sect2">
<h3 id="_expr">expr</h3>
<div class="paragraph"><p><code><strong>expr</strong> <em>arg</em></code></p></div>
<div class="paragraph"><p>Calls the expression processor to evaluate <code><em>arg</em></code>, and returns
the result as a string.  See the section EXPRESSIONS above.</p></div>
<div class="paragraph"><p>Note that Jim supports a shorthand syntax for <a href="#_expr"><strong><code>expr</code></strong></a> as <code>$(...)</code>
The following two are identical.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set x [expr {3 * 2 + 1}]
set x $(3 * 2 + 1)</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_file">file</h3>
<div class="paragraph"><p><code><strong>file</strong> <em>option name ?arg...?</em></code></p></div>
<div class="paragraph"><p>Operate on a file or a file name.  <code><em>name</em></code> is the name of a file.</p></div>
<div class="paragraph"><p><code><em>option</em></code> indicates what to do with the file name.  Any unique
................................................................................
    Return a decimal string giving the time at which file <code><em>name</em></code>
    was last modified.  The time is measured in the standard UNIX
    fashion as seconds from a fixed starting time (often January 1, 1970).
    If the file doesn&#8217;t exist or its modified time cannot be queried then an
    error is generated. If <code><em>time</em></code> is given, sets the modification time
    of the file to the given value.
</p>











</dd>
<dt class="hdlist1">
<code><strong>file normalize</strong> <em>name</em></code>
</dt>
<dd>
<p>
    Return the normalized path of <code><em>name</em></code>. See <em>realpath(3)</em>.
................................................................................
<p>
    Return all of the characters in <code><em>name</em></code> up to but not including
    the last <em>.</em> character in the name.  If <code><em>name</em></code> doesn&#8217;t contain
    a dot, then return <code><em>name</em></code>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>file size</strong> <em>name</em></code>
</dt>
<dd>
<p>
    Return a decimal string giving the size of file <code><em>name</em></code> in bytes.
    If the file doesn&#8217;t exist or its size cannot be queried then an
    error is generated.

</p>
</dd>
<dt class="hdlist1">
<code><strong>file stat</strong> <em>name ?varName?</em></code>
</dt>
<dd>
<p>
    Invoke the <em>stat</em> kernel call on <code><em>name</em></code>, and return the result
    as a dictionary with the following keys: <em>atime</em>,
    <em>ctime</em>, <em>dev</em>, <em>gid</em>, <em>ino</em>, <em>mode</em>, <em>mtime</em>,
    <em>nlink</em>, <em>size</em>, <em>type</em>, <em>uid</em>.
    Each element except <em>type</em> is a decimal string with the value of
    the corresponding field from the <em>stat</em> return structure; see the
    manual entry for <em>stat</em> for details on the meanings of the values.
    The <em>type</em> element gives the type of the file in the same form
    returned by the command <a href="#_file"><strong><code>file</code></strong></a> <code>type</code>.
    If <code><em>varName</em></code> is specified, it is taken to be the name of an array
    variable and the values are also stored into the array.
................................................................................
    Return <em>1</em> if file <code><em>name</em></code> is writable by
    the current user, <em>0</em> otherwise.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <a href="#_file"><strong><code>file</code></strong></a> commands that return 0/1 results are often used in
conditional or looping commands, for example:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>if {![file exists foo]} {
    error {bad file name}
} else {
    ...
}</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_finalize">finalize</h3>
<div class="paragraph"><p><code><strong>finalize</strong> <em>reference ?command?</em></code></p></div>
<div class="paragraph"><p>If <code><em>command</em></code> is omitted, returns the finalizer command for the given reference.</p></div>
<div class="paragraph"><p>Otherwise, sets a new finalizer command for the given reference. <code><em>command</em></code> may be
the empty string to remove the current finalizer.</p></div>
<div class="paragraph"><p>The reference must be a valid reference create with the <a href="#_ref"><strong><code>ref</code></strong></a>
command.</p></div>
<div class="paragraph"><p>See GARBAGE COLLECTION, REFERENCES, LAMBDA FUNCTION for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_flush">flush</h3>
<div class="paragraph"><p><code><strong>flush</strong> <em>fileId</em></code></p></div>
<div class="paragraph"><p><code><em>fileId</em> <strong>flush</strong></code></p></div>
<div class="paragraph"><p>Flushes any output that has been buffered for <code><em>fileId</em></code>.  <code><em>fileId</em></code> must
have been the return value from a previous call to <a href="#_open"><strong><code>open</code></strong></a>, or it may be
................................................................................
<div class="paragraph"><p>The return value from <a href="#_format"><strong><code>format</code></strong></a> is the formatted string.</p></div>
</div>
<div class="sect2">
<h3 id="_getref">getref</h3>
<div class="paragraph"><p><code><strong>getref</strong> <em>reference</em></code></p></div>
<div class="paragraph"><p>Returns the string associated with <code><em>reference</em></code>. The reference must
be a valid reference create with the <a href="#_ref"><strong><code>ref</code></strong></a> command.</p></div>
<div class="paragraph"><p>See GARBAGE COLLECTION, REFERENCES, LAMBDA FUNCTION for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_gets">gets</h3>
<div class="paragraph"><p><code><strong>gets</strong> <em>fileId ?varName?</em></code></p></div>
<div class="paragraph"><p><code><em>fileId</em> <strong>gets</strong> <em>?varName?</em></code></p></div>
<div class="paragraph"><p>Reads the next line from the file given by <code><em>fileId</em></code> and discards
the terminating newline character.</p></div>
................................................................................
</div>
<div class="sect2">
<h3 id="_lambda">lambda</h3>
<div class="paragraph"><p><code><strong>lambda</strong> <em>args ?statics? body</em></code></p></div>
<div class="paragraph"><p>The <a href="#_lambda"><strong><code>lambda</code></strong></a> command is identical to <a href="#_proc"><strong><code>proc</code></strong></a>, except rather than
creating a named procedure, it creates an anonymous procedure and returns
the name of the procedure.</p></div>
<div class="paragraph"><p>See <a href="#_proc"><strong><code>proc</code></strong></a> and GARBAGE COLLECTION, REFERENCES, LAMBDA FUNCTION for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_lappend">lappend</h3>
<div class="paragraph"><p><code><strong>lappend</strong> <em>varName value ?value value ...?</em></code></p></div>
<div class="paragraph"><p>Treat the variable given by <code><em>varName</em></code> as a list and append each of
the <code><em>value</em></code> arguments to that list as a separate element, with spaces
between elements.</p></div>
<div class="paragraph"><p>If <code><em>varName</em></code> doesn&#8217;t exist, it is created as a list with elements given
by the <code><em>value</em></code> arguments. <a href="#_lappend"><strong><code>lappend</code></strong></a> is similar to <a href="#_append"><strong><code>append</code></strong></a> except that
each <code><em>value</em></code> is appended as a list element rather than raw text.</p></div>
<div class="paragraph"><p>This command provides a relatively efficient way to build up large lists.
For example,</p></div>
<div class="literalblock">
<div class="content">
<pre><code>lappend a $b</code></pre>
</div></div>
<div class="paragraph"><p>is much more efficient than</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a [concat $a [list $b]]</code></pre>
</div></div>
<div class="paragraph"><p>when <code>$a</code> is long.</p></div>
</div>
<div class="sect2">
<h3 id="_lassign">lassign</h3>
<div class="paragraph"><p><code><strong>lassign</strong> <em>list varName ?varName ...?</em></code></p></div>
<div class="paragraph"><p>This command treats the value <code><em>list</em></code> as a list and assigns successive elements from that list to
the variables given by the <code><em>varName</em></code> arguments in order. If there are more variable names than
list elements, the remaining variables are set to the empty string. If there are more list elements
than variables, a list of unassigned elements is returned.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; lassign {1 2 3} a b; puts a=$a,b=$b
3
a=1,b=2</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_local">local</h3>
<div class="paragraph"><p><code><strong>local</strong> <em>cmd ?arg...?</em></code></p></div>
<div class="paragraph"><p>First, <a href="#_local"><strong><code>local</code></strong></a> evaluates <code><em>cmd</em></code> with the given arguments. The return value must
be the name of an existing command, which is marked as having local scope.
................................................................................
to automatically close a filehandle.</p></div>
<div class="paragraph"><p>In addition, if a command already exists with the same name,
the existing command will be kept rather than deleted, and may be called
via <a href="#_upcall"><strong><code>upcall</code></strong></a>. The previous command will be restored when the current
procedure exits. See <a href="#_upcall"><strong><code>upcall</code></strong></a> for more details.</p></div>
<div class="paragraph"><p>In this example, a local procedure is created. Note that the procedure
continues to have global scope while it is active.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>proc outer {} {
  # proc ... returns "inner" which is marked local
  local proc inner {} {
    # will be deleted when 'outer' exits
  }</code></pre>
</div></div>
<div class="literalblock">
<div class="content">


<pre><code>  inner
  ...
}</code></pre>
</div></div>
<div class="paragraph"><p>In this example, the lambda is deleted at the end of the procedure rather
than waiting until garbage collection.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>proc outer {} {
  set x [lambda inner {args} {
    # will be deleted when 'outer' exits
  }]
  # Use 'function' here which simply returns $x
  local function $x</code></pre>
</div></div>
<div class="literalblock">
<div class="content">

<pre><code>  $x ...
  ...
}</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_loop">loop</h3>
<div class="paragraph"><p><code><strong>loop</strong> <em>var first limit ?incr? body</em></code></p></div>
<div class="paragraph"><p>Similar to <a href="#_for"><strong><code>for</code></strong></a> except simpler and possibly more efficient.
With a positive increment, equivalent to:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>for {set var $first} {$var &lt; $limit} {incr var $incr} $body</code></pre>
</div></div>
<div class="paragraph"><p>If <code><em>incr</em></code> is not specified, 1 is used.
Note that setting the loop variable inside the loop does not
affect the loop count.</p></div>
</div>
<div class="sect2">
<h3 id="_lindex">lindex</h3>
<div class="paragraph"><p><code><strong>lindex</strong> <em>list ?index &#8230;?</em></code></p></div>
<div class="paragraph"><p>Treats <code><em>list</em></code> as a Tcl list and returns element <code><em>index</em></code> from it
(0 refers to the first element of the list).
See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>index</em></code>.</p></div>
<div class="paragraph"><p>In extracting the element, <code><em>lindex</em></code> observes the same rules concerning
braces and quotes and backslashes as the Tcl command interpreter; however,
variable substitution and command substitution do not occur.</p></div>
<div class="paragraph"><p>If no index values are given, simply returns <code><em>list</em></code></p></div>
<div class="paragraph"><p>If <code><em>index</em></code> is negative or greater than or equal to the number of elements
in <code><em>list</em></code>, then an empty string is returned.</p></div>
<div class="paragraph"><p>If additional index arguments are supplied, then each argument is
................................................................................
of the <code><em>element</em></code> arguments just before the element <code><em>index</em></code>
of <code><em>list</em></code>. Each <code><em>element</em></code> argument will become
a separate element of the new list. If <code><em>index</em></code> is less than
or equal to zero, then the new elements are inserted at the
beginning of the list. If <code><em>index</em></code> is greater than or equal
to the number of elements in the list, then the new elements are
appended to the list.</p></div>
<div class="paragraph"><p>See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>index</em></code>.</p></div>
</div>
<div class="sect2">
<h3 id="_list">list</h3>
<div class="paragraph"><p><code><strong>list</strong> <em>arg ?arg ...?</em></code></p></div>
<div class="paragraph"><p>This command returns a list comprised of all the arguments, <code><em>arg</em></code>. Braces
and backslashes get added as necessary, so that the <a href="#_lindex"><strong><code>lindex</code></strong></a> command
may be used on the result to re-extract the original arguments, and also
so that <a href="#_eval"><strong><code>eval</code></strong></a> may be used to execute the resulting list, with
<code><em>arg1</em></code> comprising the command&#8217;s name and the other args comprising
its arguments. <a href="#_list"><strong><code>list</code></strong></a> produces slightly different results than
<a href="#_concat"><strong><code>concat</code></strong></a>:  <a href="#_concat"><strong><code>concat</code></strong></a> removes one level of grouping before forming
the list, while <a href="#_list"><strong><code>list</code></strong></a> works directly from the original arguments.
For example, the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>list a b {c d e} {f {g h}}</code></pre>
</div></div>
<div class="paragraph"><p>will return</p></div>
<div class="literalblock">
<div class="content">
<pre><code>a b {c d e} {f {g h}}</code></pre>
</div></div>
<div class="paragraph"><p>while <a href="#_concat"><strong><code>concat</code></strong></a> with the same arguments will return</p></div>
<div class="literalblock">
<div class="content">
<pre><code>a b c d e f {g h}</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_llength">llength</h3>
<div class="paragraph"><p><code><strong>llength</strong> <em>list</em></code></p></div>
<div class="paragraph"><p>Treats <code><em>list</em></code> as a list and returns a decimal string giving
the number of elements in it.</p></div>
................................................................................
<div class="paragraph"><p><code><strong>lset</strong> <em>varName ?index ..? newValue</em></code></p></div>
<div class="paragraph"><p>Sets an element in a list.</p></div>
<div class="paragraph"><p>The <a href="#_lset"><strong><code>lset</code></strong></a> command accepts a parameter, <code><em>varName</em></code>, which it interprets
as the name of a variable containing a Tcl list. It also accepts
zero or more indices into the list. Finally, it accepts a new value
for an element of varName. If no indices are presented, the command
takes the form:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>lset varName newValue</code></pre>
</div></div>
<div class="paragraph"><p>In this case, newValue replaces the old value of the variable
varName.</p></div>
<div class="paragraph"><p>When presented with a single index, the <a href="#_lset"><strong><code>lset</code></strong></a> command
treats the content of the varName variable as a Tcl list. It addresses
the index&#8217;th element in it (0 refers to the first element of the
list). When interpreting the list, <a href="#_lset"><strong><code>lset</code></strong></a> observes the same rules
................................................................................
interpreter; however, variable substitution and command substitution
do not occur. The command constructs a new list in which the
designated element is replaced with newValue. This new list is
stored in the variable varName, and is also the return value from
the <a href="#_lset"><strong><code>lset</code></strong></a> command.</p></div>
<div class="paragraph"><p>If index is negative or greater than or equal to the number of
elements in $varName, then an error occurs.</p></div>
<div class="paragraph"><p>See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>index</em></code>.</p></div>
<div class="paragraph"><p>If additional index arguments are supplied, then each argument is
used in turn to address an element within a sublist designated by
the previous indexing operation, allowing the script to alter
elements in sublists. The command,</p></div>
<div class="literalblock">
<div class="content">
<pre><code>lset a 1 2 newValue</code></pre>
</div></div>
<div class="paragraph"><p>replaces element 2 of sublist 1 with <code><em>newValue</em></code>.</p></div>
<div class="paragraph"><p>The integer appearing in each index argument must be greater than
or equal to zero. The integer appearing in each index argument must
be strictly less than the length of the corresponding list. In other
words, the <a href="#_lset"><strong><code>lset</code></strong></a> command cannot change the size of a list. If an
index is outside the permitted range, an error is reported.</p></div>
................................................................................
</div>
<div class="sect2">
<h3 id="_lmap">lmap</h3>
<div class="paragraph"><p><code><strong>lmap</strong> <em>varName list body</em></code></p></div>
<div class="paragraph"><p><code><strong>lmap</strong> <em>varList list ?varList2 list2 ...? body</em></code></p></div>
<div class="paragraph"><p><a href="#_lmap"><strong><code>lmap</code></strong></a> is a "collecting" <a href="#_foreach"><strong><code>foreach</code></strong></a> which returns a list of its results.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; lmap i {1 2 3 4 5} {expr $i*$i}
1 4 9 16 25
jim&gt; lmap a {1 2 3} b {A B C} {list $a $b}
{1 A} {2 B} {3 C}</code></pre>
</div></div>
<div class="paragraph"><p>If the body invokes <a href="#_continue"><strong><code>continue</code></strong></a>, no value is added for this iteration.
If the body invokes <a href="#_break"><strong><code>break</code></strong></a>, the loop ends and no more values are added.</p></div>
</div>
<div class="sect2">
<h3 id="_load">load</h3>
<div class="paragraph"><p><code><strong>load</strong> <em>filename</em></code></p></div>
................................................................................
should not be used directly. Instead it is invoked automatically by <a href="#_package"><strong><code>package</code></strong></a> <code>require</code>.</p></div>
</div>
<div class="sect2">
<h3 id="_lrange">lrange</h3>
<div class="paragraph"><p><code><strong>lrange</strong> <em>list first last</em></code></p></div>
<div class="paragraph"><p><code><em>list</em></code> must be a valid Tcl list. This command will return a new
list consisting of elements <code><em>first</em></code> through <code><em>last</em></code>, inclusive.</p></div>
<div class="paragraph"><p>See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>first</em></code> and <code><em>last</em></code>.</p></div>
<div class="paragraph"><p>If <code><em>last</em></code> is greater than or equal to the number of elements
in the list, then it is treated as if it were <code>end</code>.</p></div>
<div class="paragraph"><p>If <code><em>first</em></code> is greater than <code><em>last</em></code> then an empty string
is returned.</p></div>
<div class="paragraph"><p>Note: <code>"<a href="#_lrange"><strong><code>lrange</code></strong></a> <em>list first first</em>"</code> does not always produce the
same result as <code>"<a href="#_lindex"><strong><code>lindex</code></strong></a> <em>list first</em>"</code> (although it often does
for simple fields that aren&#8217;t enclosed in braces); it does, however,
................................................................................
<div class="paragraph"><p><code><em>first</em></code> gives the index in <code><em>list</em></code> of the first element
to be replaced.</p></div>
<div class="paragraph"><p>If <code><em>first</em></code> is less than zero then it refers to the first
element of <code><em>list</em></code>;  the element indicated by <code><em>first</em></code>
must exist in the list.</p></div>
<div class="paragraph"><p><code><em>last</em></code> gives the index in <code><em>list</em></code> of the last element
to be replaced;  it must be greater than or equal to <code><em>first</em></code>.</p></div>
<div class="paragraph"><p>See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>first</em></code> and <code><em>last</em></code>.</p></div>
<div class="paragraph"><p>The <code><em>element</em></code> arguments specify zero or more new arguments to
be added to the list in place of those that were deleted.</p></div>
<div class="paragraph"><p>Each <code><em>element</em></code> argument will become a separate element of
the list.</p></div>
<div class="paragraph"><p>If no <code><em>element</em></code> arguments are specified, then the elements
between <code><em>first</em></code> and <code><em>last</em></code> are simply deleted.</p></div>
</div>
<div class="sect2">
<h3 id="_lrepeat">lrepeat</h3>
<div class="paragraph"><p><code><strong>lrepeat</strong> <em>number element1 ?element2 ...?</em></code></p></div>
<div class="paragraph"><p>Build a list by repeating elements <code><em>number</em></code> times (which must be
a positive integer).</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; lrepeat 3 a b
a b a b a b</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_lreverse">lreverse</h3>
<div class="paragraph"><p><code><strong>lreverse</strong> <em>list</em></code></p></div>
<div class="paragraph"><p>Returns the list in reverse order.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; lreverse {1 2 3}
3 2 1</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_lsearch">lsearch</h3>
<div class="paragraph"><p><code><strong>lsearch</strong> <em>?options? list pattern</em></code></p></div>
<div class="paragraph"><p>This command searches the elements <code><em>list</em></code> to see if one of them matches <code><em>pattern</em></code>. If so, the
command returns the index of the first matching element (unless the options <code>-all</code>, <code>-inline</code> or <code>-bool</code> are
................................................................................
be any valid list index, such as <code>1</code>, <code>end</code> or <code>end-2</code>.</p></div>
</div>
<div class="sect2">
<h3 id="_defer">defer</h3>
<div class="paragraph"><p><code><strong>defer</strong> <em>script</em></code></p></div>
<div class="paragraph"><p>This command is a simple helper command to add a script to the <em><code>$jim::defer</code></em> variable
that will run when the current proc or interpreter exits. For example:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; proc a {} { defer {puts "Leaving a"}; puts "Exit" }
jim&gt; a
Exit
Leaving a</code></pre>
</div></div>
<div class="paragraph"><p>If the <em><code>$jim::defer</code></em> variable exists, it is treated as a list of scripts to run
when the proc or interpreter exits.</p></div>
</div>
<div class="sect2">
<h3 id="_open">open</h3>
<div class="paragraph"><p><code><strong>open</strong> <em>fileName ?access?</em></code></p></div>
................................................................................
<h3 id="_proc">proc</h3>
<div class="paragraph"><p><code><strong>proc</strong> <em>name args ?statics? body</em></code></p></div>
<div class="paragraph"><p>The <a href="#_proc"><strong><code>proc</code></strong></a> command creates a new Tcl command procedure, <code><em>name</em></code>.
When the new command is invoked, the contents of <code><em>body</em></code> will be executed.
Tcl interpreter. <code><em>args</em></code> specifies the formal arguments to the procedure.
If specified, <code><em>statics</em></code>, declares static variables which are bound to the
procedure.</p></div>
<div class="paragraph"><p>See PROCEDURES for detailed information about Tcl procedures.</p></div>
<div class="paragraph"><p>The <a href="#_proc"><strong><code>proc</code></strong></a> command returns <code><em>name</em></code> (which is useful with <a href="#_local"><strong><code>local</code></strong></a>).</p></div>
<div class="paragraph"><p>When a procedure is invoked, the procedure&#8217;s return value is the
value specified in a <a href="#_return"><strong><code>return</code></strong></a> command.  If the procedure doesn&#8217;t
execute an explicit <a href="#_return"><strong><code>return</code></strong></a>, then its return value is the value
of the last command executed in the procedure&#8217;s body.</p></div>
<div class="paragraph"><p>If an error occurs while executing the procedure body, then the
procedure-as-a-whole will return that same error.</p></div>
................................................................................
switch.</p></div>
<div class="paragraph"><p>Output to files is buffered internally by Tcl; the <a href="#_flush"><strong><code>flush</code></strong></a>
command may be used to force buffered characters to be output.</p></div>
</div>
<div class="sect2">
<h3 id="_pipe">pipe</h3>
<div class="paragraph"><p>Creates a pair of <a href="#_aio"><strong><code>aio</code></strong></a> channels and returns the handles as a list: <code>{read write}</code></p></div>










</div>
<div class="sect2">
<h3 id="_pwd">pwd</h3>
<div class="paragraph"><p><code><strong>pwd</strong></code></p></div>
<div class="paragraph"><p>Returns the path name of the current working directory.</p></div>
</div>
<div class="sect2">
................................................................................
<div class="paragraph"><p>If only one argument is given, it is interpreted as <code><em>max</em></code>.</p></div>
</div>
<div class="sect2">
<h3 id="_range">range</h3>
<div class="paragraph"><p><code><strong>range</strong> <em>?start? end ?step?</em></code></p></div>
<div class="paragraph"><p>Returns a list of integers starting at <code><em>start</em></code> (defaults to 0)
and ranging up to but not including <code><em>end</em></code> in steps of <code><em>step</em></code> defaults to 1).</p></div>
<div class="literalblock">
<div class="content">
<pre><code>jim&gt; range 5
0 1 2 3 4
jim&gt; range 2 5
2 3 4
jim&gt; range 2 10 4
2 6
jim&gt; range 7 4 -2
7 5</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_read">read</h3>
<div class="paragraph"><p><code><strong>read</strong> ?<strong>-nonewline</strong>? <em>fileId</em></code></p></div>
<div class="paragraph"><p><code><em>fileId</em> <strong>read</strong> ?<strong>-nonewline</strong>?</code></p></div>
<div class="paragraph"><p><code><strong>read</strong> <em>fileId numBytes</em></code></p></div>
................................................................................
to <a href="#_open"><strong><code>open</code></strong></a>; it must refer to a file that was opened for reading.</p></div>
</div>
<div class="sect2">
<h3 id="_regexp">regexp</h3>
<div class="paragraph"><p><code><strong>regexp ?-nocase? ?-line? ?-indices? ?-start</strong> <em>offset</em>? <strong>?-all? ?-inline? ?--?</strong> <em>exp string ?matchVar? ?subMatchVar subMatchVar ...?</em></code></p></div>
<div class="paragraph"><p>Determines whether the regular expression <code><em>exp</em></code> matches part or
all of <code><em>string</em></code> and returns 1 if it does, 0 if it doesn&#8217;t.</p></div>
<div class="paragraph"><p>See REGULAR EXPRESSIONS above for complete information on the
syntax of <code><em>exp</em></code> and how it is matched against <code><em>string</em></code>.</p></div>
<div class="paragraph"><p>If additional arguments are specified after <code><em>string</em></code> then they
are treated as the names of variables to use to return
information about which part(s) of <code><em>string</em></code> matched <code><em>exp</em></code>.
<code><em>matchVar</em></code> will be set to the range of <code><em>string</em></code> that
matched all of <code><em>exp</em></code>. The first <code><em>subMatchVar</em></code> will contain
the characters in <code><em>string</em></code> that matched the leftmost parenthesized
................................................................................
<h3 id="_ref">ref</h3>
<div class="paragraph"><p><code><strong>ref</strong> <em>string tag ?finalizer?</em></code></p></div>
<div class="paragraph"><p>Create a new reference containing <code><em>string</em></code> of type <code><em>tag</em></code>.
If <code><em>finalizer</em></code> is specified, it is a command which will be invoked
when the a garbage collection cycle runs and this reference is
no longer accessible.</p></div>
<div class="paragraph"><p>The finalizer is invoked as:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>finalizer reference string</code></pre>
</div></div>
<div class="paragraph"><p>See GARBAGE COLLECTION, REFERENCES, LAMBDA FUNCTION for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_rename">rename</h3>
<div class="paragraph"><p><code><strong>rename</strong> <em>oldName newName</em></code></p></div>
<div class="paragraph"><p>Rename the command that used to be called <code><em>oldName</em></code> so that it
is now called <code><em>newName</em></code>.  If <code><em>newName</em></code> is an empty string
(e.g. {}) then <code><em>oldName</em></code> is deleted.  The <a href="#_rename"><strong><code>rename</code></strong></a> command
................................................................................
</div>
<div class="sect2">
<h3 id="_setref">setref</h3>
<div class="paragraph"><p><code><strong>setref</strong> <em>reference string</em></code></p></div>
<div class="paragraph"><p>Store a new string in <code><em>reference</em></code>, replacing the existing string.
The reference must be a valid reference create with the <a href="#_ref"><strong><code>ref</code></strong></a>
command.</p></div>
<div class="paragraph"><p>See GARBAGE COLLECTION, REFERENCES, LAMBDA FUNCTION for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_signal">signal</h3>
<div class="paragraph"><p>Command for signal handling.</p></div>
<div class="paragraph"><p>See <a href="#_kill"><strong><code>kill</code></strong></a> for the different forms which may be used to specify signals.</p></div>
<div class="paragraph"><p>Commands which return a list of signal names do so using the canonical form:
"<code>SIGINT SIGTERM</code>".</p></div>
................................................................................
    being ignored.
    If signals are specified, these are added to the list of signals
    currently being ignored. These signals are still delivered, but
    are not considered by <a href="#_catch"><strong><code>catch</code></strong></a> <code>-signal</code> or <a href="#_try"><strong><code>try</code></strong></a> <code>-signal</code>. Use
    <a href="#_signal"><strong><code>signal</code></strong></a> <code>check</code> to determine which signals have occurred but
    been ignored.
</p>













</dd>
<dt class="hdlist1">
<code><strong>signal default</strong> ?<em>signals ...</em>?</code>
</dt>
<dd>
<p>
    If no signals are given, returns a lists all signals which are currently have
    the default behaviour.
    If signals are specified, these are added to the list of signals which have
    the default behaviour.
</p>
</dd>
<dt class="hdlist1">
<code><strong>signal check ?-clear?</strong> ?<em>signals ...</em>?</code>
................................................................................
<code><strong>signal throw</strong> ?<em>signal</em>?</code>
</dt>
<dd>
<p>
    Raises the given signal, which defaults to <code>SIGINT</code> if not specified.
    The behaviour is identical to:
</p>
<div class="literalblock">
<div class="content">
<pre><code>kill signal [pid]</code></pre>
</div></div>
</dd>
</dl></div>
<div class="paragraph"><p>Note that <a href="#_signal"><strong><code>signal</code></strong></a> <code>handle</code> and <a href="#_signal"><strong><code>signal</code></strong></a> <code>ignore</code> represent two forms of signal
handling. <a href="#_signal"><strong><code>signal</code></strong></a> <code>handle</code> is used in conjunction with <a href="#_catch"><strong><code>catch</code></strong></a> <code>-signal</code> or <a href="#_try"><strong><code>try</code></strong></a> <code>-signal</code>
to immediately abort execution when the signal is delivered. Alternatively, <a href="#_signal"><strong><code>signal</code></strong></a> <code>ignore</code>
is used in conjunction with <a href="#_signal"><strong><code>signal</code></strong></a> <code>check</code> to handle signal synchronously. Consider the
two examples below.</p></div>
<div class="paragraph"><p>Prevent a processing from taking too long</p></div>
<div class="literalblock">
<div class="content">
<pre><code>signal handle SIGALRM
alarm 20
try -signal {
    .. possibly long running process ..
    alarm 0
} on signal {sig} {
    puts stderr "Process took too long"
}</code></pre>
</div></div>
<div class="paragraph"><p>Handle SIGHUP to reconfigure:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>signal ignore SIGHUP
while {1} {
    ... handle configuration/reconfiguration ...
    while {[signal check -clear SIGHUP] eq ""} {
        ... do processing ..
    }
    # Received SIGHUP, so reconfigure
}</code></pre>
</div></div>
<div class="paragraph"><p>Note: signal handling is currently not supported in child interpreters.
In these interpreters, the signal command does not exist.</p></div>
</div>
<div class="sect2">
<h3 id="_sleep">sleep</h3>
<div class="paragraph"><p><code><strong>sleep</strong> <em>seconds</em></code></p></div>
................................................................................
<div class="paragraph"><p>Empty list elements will be generated if <code><em>string</em></code> contains
adjacent characters in <code><em>splitChars</em></code>, or if the first or last
character of <code><em>string</em></code> is in <code><em>splitChars</em></code>.</p></div>
<div class="paragraph"><p>If <code><em>splitChars</em></code> is an empty string then each character of
<code><em>string</em></code> becomes a separate element of the result list.</p></div>
<div class="paragraph"><p><code><em>splitChars</em></code> defaults to the standard white-space characters.
For example,</p></div>
<div class="literalblock">
<div class="content">
<pre><code>split "comp.unix.misc" .</code></pre>
</div></div>
<div class="paragraph"><p>returns <code><em>"comp unix misc"</em></code> and</p></div>
<div class="literalblock">
<div class="content">
<pre><code>split "Hello world" {}</code></pre>
</div></div>
<div class="paragraph"><p>returns <code><em>"H e l l o { } w o r l d"</em></code>.</p></div>
</div>
<div class="sect2">
<h3 id="_stackdump">stackdump</h3>
<div class="paragraph"><p><code><strong>stackdump</strong> <em>stacktrace</em></code></p></div>
<div class="paragraph"><p>Creates a human readable representation of a stack trace.</p></div>
................................................................................
<code><strong>string bytelength</strong> <em>string</em></code>
</dt>
<dd>
<p>
    Returns the length of the string in bytes. This will return
    the same value as <a href="#_string"><strong><code>string</code></strong></a> <code>length</code> if UTF-8 support is not enabled,
    or if the string is composed entirely of ASCII characters.
    See UTF-8 AND UNICODE.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string byterange</strong> <em>string first last</em></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>firstIndex</em></code>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string index</strong> <em>string charIndex</em></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>charIndex</em></code>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string is</strong> <em>class</em> ?<strong>-strict</strong>? <em>string</em></code>
</dt>
<dd>
<p>
................................................................................
</dl></div>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    Note that string classification does <code><em>not</em></code> respect UTF-8. See UTF-8 AND UNICODE
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>lastIndex</em></code>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string length</strong> <em>string</em></code>
</dt>
<dd>
<p>
    Returns a decimal string giving the number of characters in <code><em>string</em></code>.
    If UTF-8 support is enabled, this may be different than the number of bytes.
    See UTF-8 AND UNICODE
</p>
</dd>
<dt class="hdlist1">
<code><strong>string map ?-nocase?</strong> <em>mapping string</em></code>
</dt>
<dd>
<p>
................................................................................
    replaced with its corresponding value.  If <code>-nocase</code> is specified, then
    matching is done without regard to case differences. Both key and value may
    be multiple characters.  Replacement is done in an ordered manner, so the
    key appearing first in the list will be checked first, and so on. <code><em>string</em></code> is
    only iterated over once, so earlier key replacements will have no affect for
    later key matches. For example,
</p>


<div class="literalblock">
<div class="content">
<pre><code>string map {abc 1 ab 2 a 3 1 0} 1abcaababcabababc</code></pre>
</div></div>
</dd>

<dt class="hdlist1">
 
</dt>
<dd>
<p>
    will return the string <code>01321221</code>.
</p>
................................................................................
 
</dt>
<dd>
<p>
    Note that if an earlier key is a prefix of a later one, it will completely mask the later
    one.  So if the previous example is reordered like this,
</p>


<div class="literalblock">
<div class="content">
<pre><code>string map {1 0 ab 2 a 3 abc 1} 1abcaababcabababc</code></pre>
</div></div>
</dd>

<dt class="hdlist1">
 
</dt>
<dd>
<p>
    it will return the string <code>02c322c222c</code>.
</p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    See STRING AND LIST INDEX SPECIFICATIONS for all allowed forms for <code><em>first</em></code> and <code><em>last</em></code>.
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
................................................................................
specified, then the corresponding substitutions are not performed.
For example, if <code>-nocommands</code> is specified, no command substitution
is performed: open and close brackets are treated as ordinary
characters with no special interpretation.</p></div>
<div class="paragraph"><p><strong>Note</strong>: when it performs its substitutions, subst does not give any
special treatment to double quotes or curly braces. For example,
the following script returns <code>xyz {44}</code>, not <code>xyz {$a}</code>.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set a 44
subst {xyz {$a}}</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_switch">switch</h3>
<div class="paragraph"><p><code><strong>switch</strong> <em>?options? string pattern body ?pattern body ...?</em></code></p></div>
<div class="paragraph"><p><code><strong>switch</strong> <em>?options? string {pattern body ?pattern body ...?}</em></code></p></div>
<div class="paragraph"><p>The <a href="#_switch"><strong><code>switch</code></strong></a> command matches its string argument against each of
................................................................................
some cases.</p></div>
<div class="paragraph"><p>If a body is specified as <code>-</code> it means that the body for the next
pattern should also be used as the body for this pattern (if the
next pattern also has a body of <code>-</code> then the body after that is
used, and so on). This feature makes it possible to share a single
body among several patterns.</p></div>
<div class="paragraph"><p>Below are some examples of <a href="#_switch"><strong><code>switch</code></strong></a> commands:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>switch abc a - b {format 1} abc {format 2} default {format 3}</code></pre>
</div></div>
<div class="paragraph"><p>will return 2,</p></div>
<div class="literalblock">
<div class="content">
<pre><code>switch -regexp aaab {
       ^a.*b$ -
       b {format 1}
       a* {format 2}
       default {format 3}
}</code></pre>
</div></div>
<div class="paragraph"><p>will return 1, and</p></div>
<div class="literalblock">
<div class="content">
<pre><code>switch xyz {
       a -
       b {format 1}
       a* {format 2}
       default {format 3}
}</code></pre>
</div></div>
<div class="paragraph"><p>will return 3.</p></div>
</div>
<div class="sect2">
<h3 id="_tailcall">tailcall</h3>
<div class="paragraph"><p><code><strong>tailcall</strong> <em>cmd ?arg...?</em></code></p></div>
<div class="paragraph"><p>The <a href="#_tailcall"><strong><code>tailcall</code></strong></a> command provides an optimised way of invoking a command whilst replacing
the current call frame. This is similar to <em>exec</em> in Bourne Shell.</p></div>
<div class="paragraph"><p>The following are identical except the first immediately replaces the current call frame.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>tailcall a b c</code></pre>
</div></div>
<div class="literalblock">
<div class="content">
<pre><code>return [uplevel 1 [list a b c]]</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_tailcall"><strong><code>tailcall</code></strong></a> is useful as a dispatch mechanism:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>proc a {cmd args} {
  tailcall sub_$cmd {*}$args
}
proc sub_cmd1 ...
proc sub_cmd2 ...</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_tell">tell</h3>
<div class="paragraph"><p><code><strong>tell</strong> <em>fileId</em></code></p></div>
<div class="paragraph"><p><code><em>fileId</em> <strong>tell</strong></code></p></div>
<div class="paragraph"><p>Returns a decimal string giving the current access position in
................................................................................
</div>
<div class="sect2">
<h3 id="_time">time</h3>
<div class="paragraph"><p><code><strong>time</strong> <em>command ?count?</em></code></p></div>
<div class="paragraph"><p>This command will call the Tcl interpreter <code><em>count</em></code>
times to execute <code><em>command</em></code> (or once if <code><em>count</em></code> isn&#8217;t
specified).  It will then return a string of the form</p></div>
<div class="literalblock">
<div class="content">
<pre><code>503 microseconds per iteration</code></pre>
</div></div>
<div class="paragraph"><p>which indicates the average amount of time required per iteration,
in microseconds.</p></div>
<div class="paragraph"><p>Time is measured in elapsed time, not CPU time.</p></div>
</div>
<div class="sect2">
<h3 id="_try">try</h3>
................................................................................
case where an exception occurs in a matching <em>on</em> handler script or the <em>finally</em> script,
in which case the result is this new exception.</p></div>
<div class="paragraph"><p>The specified <code><em>returncodes</em></code> is a list of return codes either as names (<em>ok</em>, <em>error</em>, <em>break</em>, etc.)
or as integers.</p></div>
<div class="paragraph"><p>If <code><em>resultvar</em></code> and <code><em>optsvar</em></code> are specified, they are set as for <a href="#_catch"><strong><code>catch</code></strong></a> before evaluating
the matching handler.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set f [open input]
try -signal {
    process $f
} on {continue break} {} {
    error "Unexpected break/continue"
} on error {msg opts} {
    puts "Dealing with error"
    return {*}$opts $msg
} on signal sig {
    puts "Got signal: $sig"
} finally {
    $f close
}</code></pre>
</div></div>
<div class="paragraph"><p>If break, continue or error are raised, they are dealt with by the matching
handler.</p></div>
<div class="paragraph"><p>In any case, the file will be closed via the <em>finally</em> clause.</p></div>
<div class="paragraph"><p>See also <a href="#_throw"><strong><code>throw</code></strong></a>, <a href="#_catch"><strong><code>catch</code></strong></a>, <a href="#_return"><strong><code>return</code></strong></a>, <a href="#_error"><strong><code>error</code></strong></a>.</p></div>
</div>
<div class="sect2">
................................................................................
in the variable context of <em>b</em>.  If <code><em>level</em></code> is <code>2</code> or <code>#1</code>
then the command will be executed in the variable context of <em>a</em>.</p></div>
<div class="paragraph"><p>If <code><em>level</em></code> is <em>3</em> or <code>#0</code> then the command will be executed
at top-level (only global variables will be visible).
The <a href="#_uplevel"><strong><code>uplevel</code></strong></a> command causes the invoking procedure to disappear
from the procedure calling stack while the command is being executed.
In the above example, suppose <em>c</em> invokes the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>uplevel 1 {set x 43; d}</code></pre>
</div></div>
<div class="paragraph"><p>where <em>d</em> is another Tcl procedure.  The <a href="#_set"><strong><code>set</code></strong></a> command will
modify the variable <em>x</em> in <em>b&#8217;s context, and 'd</em> will execute
at level 3, as if called from <em>b</em>.  If it in turn executes
the command</p></div>
<div class="literalblock">
<div class="content">
<pre><code>uplevel {set x 42}</code></pre>
</div></div>
<div class="paragraph"><p>then the <a href="#_set"><strong><code>set</code></strong></a> command will modify the same variable <em>x</em> in <em>b&#8217;s
context:  the procedure 'c</em> does not appear to be on the call stack
when <em>d</em> is executing.  The command <a href="#_info"><strong><code>info</code></strong></a> <code>level</code> may
be used to obtain the level of the current procedure.</p></div>
<div class="paragraph"><p><a href="#_uplevel"><strong><code>uplevel</code></strong></a> makes it possible to implement new control
constructs as Tcl procedures (for example, <a href="#_uplevel"><strong><code>uplevel</code></strong></a> could
................................................................................
an ordinary variable.</p></div>
<div class="paragraph"><p><a href="#_upvar"><strong><code>upvar</code></strong></a> may only be invoked from within procedures.</p></div>
<div class="paragraph"><p><a href="#_upvar"><strong><code>upvar</code></strong></a> returns an empty string.</p></div>
<div class="paragraph"><p>The <a href="#_upvar"><strong><code>upvar</code></strong></a> command simplifies the implementation of call-by-name
procedure calling and also makes it easier to build new control constructs
as Tcl procedures.
For example, consider the following procedure:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>proc add2 name {
    upvar $name x
    set x [expr $x+2]
}</code></pre>
</div></div>
<div class="paragraph"><p><em>add2</em> is invoked with an argument giving the name of a variable,
and it adds two to the value of that variable.
Although <em>add2</em> could have been implemented using <a href="#_uplevel"><strong><code>uplevel</code></strong></a>
instead of <a href="#_upvar"><strong><code>upvar</code></strong></a>, <a href="#_upvar"><strong><code>upvar</code></strong></a> makes it simpler for <em>add2</em>
to access the variable in the caller&#8217;s procedure frame.</p></div>
</div>
................................................................................
<dt class="hdlist1">
<code><strong>os.getids</strong></code>
</dt>
<dd>
<p>
    Returns the various user/group ids for the current process.
</p>


<div class="literalblock">
<div class="content">
<pre><code>jim&gt; os.getids
uid 1000 euid 1000 gid 100 egid 100</code></pre>
</div></div>
</dd>

<dt class="hdlist1">
<code><strong>os.uptime</strong></code>
</dt>
<dd>
<p>
    Returns the number of seconds since system boot. See description of <em>uptime</em> in <em>sysinfo(2)</em>.
</p>
................................................................................
<dt class="hdlist1">
<code>$handle <strong>accept</strong> ?addrvar?</code>
</dt>
<dd>
<p>
    Server socket only: Accept a connection and return stream.
    If <code><em>addrvar</em></code> is specified, the address of the connected client is stored

    in the named variable in the form <em>addr:port</em>. See <a href="#_socket"><strong><code>socket</code></strong></a> for details.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>buffering none|line|full</strong></code>
</dt>
<dd>
<p>
    Sets the buffering mode of the stream.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>close</strong> ?r(ead)|w(rite)?</code>
</dt>
<dd>
<p>
    Closes the stream.
    The  two-argument form is a "half-close" on a socket. See the <code>shutdown(2)</code> man page.


</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>copyto</strong> <em>tofd ?size?</em></code>
</dt>
<dd>
<p>
................................................................................
</dt>
<dd>
<p>
    Returns 1 if the stream is a tty device.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>lock</strong></code>
</dt>
<dd>
<p>
    Apply a POSIX lock to the open file associated with the handle using
    fcntl(2).

    The handle must be open for write access.
    Returns 1 if the lock was successfully obtained, 0 otherwise.
    An error occurs if the handle is not suitable for locking (e.g.
    if it is not open for write)
</p>
</dd>
<dt class="hdlist1">
................................................................................
</dt>
<dd>
<p>
    Set O_NDELAY (if arg). Returns current/new setting.
    Note that in general ANSI I/O interacts badly with non-blocking I/O.
    Use with care.
</p>








</dd>
<dt class="hdlist1">
<code>$handle <strong>puts ?-nonewline?</strong> <em>str</em></code>
</dt>
<dd>
<p>
    Write the string, with newline unless -nonewline
................................................................................
</dd>
<dt class="hdlist1">
<code>$handle <strong>recvfrom</strong> <em>maxlen ?addrvar?</em></code>
</dt>
<dd>
<p>
    Receives a message from the handle via recvfrom(2) and returns it.
    At most <code><em>maxlen</em></code> bytes are read.
    If <code><em>addrvar</em></code> is specified, the sending address of the message is stored in
    the named variable in the form <em>addr:port</em>. See <a href="#_socket"><strong><code>socket</code></strong></a> for details.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>seek</strong> <em>offset</em> <strong>?start|current|end?</strong></code>
</dt>
<dd>
<p>
    Seeks in the stream (default <em>current</em>)
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>sendto</strong> <em>str ?addr:?port</em></code>
</dt>
<dd>
<p>
    Sends the string, <code><em>str</em></code>, to the given address via the socket using sendto(2).
    This is intended for udp/dgram sockets and may give an error or behave in unintended
    ways for other handle types.
    Returns the number of bytes written.
</p>








</dd>
<dt class="hdlist1">
<code>$handle <strong>sockopt</strong> <em>?name value?</em></code>
</dt>
<dd>
<p>
    With no arguments, returns a dictionary of socket options currently set for the handle
        (will be empty for a non-socket). With <code><em>name</em></code> and <code><em>value</em></code>, sets the socket option
        to the given value. Currently supports the following boolean socket options:
        <code>broadcast, debug, keepalive, nosigpipe, oobinline, tcp_nodelay</code>, and the following
        integer socket options: <code>sndbuf, rcvbuf</code>
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>sync</strong></code>
</dt>
<dd>
<p>
    Flush the stream, then fsync(2) to commit any changes to storage.
    Only available on platforms that support fsync(2).
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>tell</strong></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>tty</strong> ?settings?</code>
</dt>
<dd>
<p>
        If no arguments are given, returns a dictionary containing the tty settings for the stream.
        If arguments are given, they must either be a dictionary, or <code>setting value ...</code>
        Abbrevations are supported for both settings and values, so the following is acceptable:
        <code>$f tty parity e input c out raw</code>.
    Only available on platforms that support termios(3). Supported settings are:
</p>
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>baud</strong> <em>rate</em></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code><strong>handshake xonxoff|rtscts|none</strong></code>
</dt>
<dd>
<p>
                Handshaking type
</p>
</dd>
<dt class="hdlist1">
<code><strong>input raw|cooked</strong></code>
</dt>
<dd>
<p>
                Input character processing. In raw mode, the usual key sequences such as ^C do
                not generate signals.
</p>
</dd>
<dt class="hdlist1">
<code><strong>output raw|cooked</strong></code>
</dt>
<dd>
<p>
                Output character processing. Typically CR &#8594; CRNL is disabled in raw mode.









</p>
</dd>
<dt class="hdlist1">
<code><strong>vmin</strong> <em>numchars</em></code>
</dt>
<dd>
<p>
                Minimum number of characters to read.
</p>
</dd>
<dt class="hdlist1">
<code><strong>vtime</strong> <em>time</em></code>
</dt>
<dd>
<p>
                Timeout for noncanonical read (units of 0.1 seconds)
</p>
</dd>
</dl></div>
</dd>
<dt class="hdlist1">
<code>$handle <strong>ssl</strong> <strong>?-server cert priv?</strong></code>
</dt>
<dd>
<p>
    Upgrades the stream to a SSL/TLS session and returns the handle.
</p>
</dd>
<dt class="hdlist1">
................................................................................
<div class="paragraph"><p>Various socket types may be created.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>socket unix</strong> <em>path</em></code>
</dt>
<dd>
<p>
    A unix domain socket client.
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket unix.server</strong> <em>path</em></code>
</dt>
<dd>
<p>
    A unix domain socket server.
















</p>
</dd>
<dt class="hdlist1">
<code><strong>socket ?-ipv6? stream</strong> <em>addr:port</em></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket pipe</strong></code>
</dt>
<dd>
<p>
        A synonym for <a href="#_pipe"><strong><code>pipe</code></strong></a>
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket pair</strong></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This command creates a socket connected (client) or bound (server) to the given
address.</p></div>
<div class="paragraph"><p>The returned value is channel and may generally be used with the various file I/O
commands (gets, puts, read, etc.), either as object-based syntax or Tcl-compatible syntax.</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
set f [socket stream www.google.com:80]
    aio.sockstream1
</p>
</li>
<li>
<p>
$f puts -nonewline "GET / HTTP/1.0\r\n\r\n"
</p>
</li>
<li>
<p>
$f gets
    HTTP/1.0 302 Found
</p>
</li>
<li>
<p>
$f close
</p>
</li>
</ol></div>
<div class="paragraph"><p>Server sockets, however support only <em>accept</em>, which is most useful in conjunction with
the EVENTLOOP API.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>set f [socket stream.server 80]
$f readable {
    set client [$f accept]
    $client gets $buf
    ...
    $client puts -nonewline "HTTP/1.1 404 Not found\r\n"
    $client close
}
vwait done</code></pre>
</div></div>
<div class="paragraph"><p>The address, <code><em>addr</em></code>, can be given in one of the following forms:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
For IPv4 socket types, an IPv4 address such as 192.168.1.1
</p>
................................................................................
</p>
</li>
</ol></div>
<div class="paragraph"><p>Note that on many systems, listening on an IPv6 address such as [::] will
also accept requests via IPv4.</p></div>
<div class="paragraph"><p>Where a hostname is specified, the <code><em>first</em></code> returned address is used
which matches the socket type is used.</p></div>
<div class="paragraph"><p>The special type <em>pipe</em> isn&#8217;t really a socket.</p></div>
<div class="literalblock">
<div class="content">
<pre><code>lassign [socket pipe] r w</code></pre>
</div></div>
<div class="literalblock">
<div class="content">
<pre><code># Must close $w after exec
exec ps &gt;@$w &amp;
$w close</code></pre>
</div></div>
<div class="literalblock">
<div class="content">
<pre><code>$r readable ...</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_syslog">syslog</h3>
<div class="paragraph"><p><code><strong>syslog</strong> <em>?options? ?priority? message</em></code></p></div>
<div class="paragraph"><p>This  command sends message to system syslog facility with given
priority. Valid priorities are:</p></div>
<div class="literalblock">
................................................................................
</div>
<div class="sect2">
<h3 id="_binary">binary</h3>
<div class="paragraph"><p>The optional, pure-Tcl <em>binary</em> extension provides the Tcl-compatible <a href="#_binary"><strong><code>binary</code></strong></a> <code>scan</code> and <a href="#_binary"><strong><code>binary</code></strong></a> <code>format</code>
commands based on the low-level <a href="#cmd_3"><strong><code>pack</code></strong></a> and <a href="#cmd_3"><strong><code>unpack</code></strong></a> commands.</p></div>
<div class="paragraph"><p>See the Tcl documentation at: <a href="http://www.tcl.tk/man/tcl8.5/TclCmd/binary.htm">http://www.tcl.tk/man/tcl8.5/TclCmd/binary.htm</a></p></div>
<div class="paragraph"><p>Note that <em>binary format</em> with f/r/R specifiers (single-precision float) uses the value of Infinity
 in case of overflow.</p></div>
</div>
<div class="sect2">
<h3 id="cmd_4">oo: class, super</h3>
<div class="paragraph"><p>The optional, pure-Tcl <em>oo</em> extension provides object-oriented (OO) support for Jim Tcl.</p></div>
<div class="paragraph"><p>See the online documentation (<a href="http://jim.tcl.tk/index.html/doc/www/www/documentation/oo/">http://jim.tcl.tk/index.html/doc/www/www/documentation/oo/</a>) for more details.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
<div class="paragraph"><p>In the interactive shell, press &lt;TAB&gt; to activate command line completion.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>tcl::autocomplete</strong> <em>commandline</em></code>
</dt>
<dd>
<p>
        This command is called with the current command line when the user presses &lt;TAB&gt;.
        The command should return a list of all possible command lines that match the current command line.
        For example if <code><strong>pr</strong></code> is the current command line, the list <code><strong>{prefix proc}</strong></code> may be returned.
</p>
</dd>
</dl></div>
</div>
<div class="sect2">
<h3 id="_history">history</h3>
<div class="paragraph"><p>The optional history extension provides script access to the command line editing
................................................................................
</dd>
<dt class="hdlist1">
<code><strong>history completion</strong> <em>command</em></code>
</dt>
<dd>
<p>
    Sets an autocompletion command (see <a href="#_tcl_autocomplete"><strong><code>tcl::autocomplete</code></strong></a>) that is active during <a href="#_history"><strong><code>history</code></strong></a> <code>getline</code>.
        If the command is empty, autocompletion is disabled.
</p>
</dd>
<dt class="hdlist1">
<code><strong>history add</strong> <em>line</em></code>
</dt>
<dd>
<p>
................................................................................
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>interp</strong></code>
</dt>
<dd>
<p>
    Creates and returns a new interpreter object (command).
        The created interpeter contains any built-in commands along with static extensions,
        but does not include any dynamically loaded commands (package require, load).
        These must be reloaded in the child interpreter if required.
</p>
</dd>
<dt class="hdlist1">
<code><strong>$interp delete</strong></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code><strong>$interp eval</strong> <em>script</em> &#8230;</code>
</dt>
<dd>
<p>
        Evaluates a script in the context for the child interpreter, in the same way as <em>eval</em>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>$interp alias</strong> <em>alias childcmd parentcmd ?arg &#8230;?</em></code>
</dt>
<dd>
<p>
        Similar to <em>alias</em>, but creates a command, <code><em>childcmd</em></code>, in the child interpreter that is an
        alias for <code><em>parentcmd</em></code> in the parent interpreter, with the given, fixed arguments.
        The alias may be deleted in the child with <em>rename</em>.
</p>
</dd>
</dl></div>















































































































































</div>
</div>
</div>
<div class="sect1">
<h2 id="BuiltinVariables">BUILT-IN VARIABLES</h2>
<div class="sectionbody">
<div class="paragraph"><p>The following global variables are created automatically
................................................................................
</dt>
<dd>
<p>
    This variable is set by Jim as an array containing information
    about the platform upon which Jim was built. The following is an
    example of the contents of this array.
</p>


<div class="literalblock">
<div class="content">
<pre><code>tcl_platform(byteOrder)     = littleEndian
tcl_platform(engine)        = Jim
tcl_platform(os)            = Darwin
tcl_platform(platform)      = unix
tcl_platform(pointerSize)   = 8
tcl_platform(threaded)      = 0
tcl_platform(wordSize)      = 8
tcl_platform(pathSeparator) = :</code></pre>
</div></div>
</dd>

<dt class="hdlist1">
<code><strong>argv0</strong></code>
</dt>
<dd>
<p>
    If jimsh is invoked to run a script, this variable contains the name
    of the script.
................................................................................
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>jim::defer</strong></code>
</dt>
<dd>
<p>
    If this variable is set, it is considered to be a list of scripts to evaluate
        when the current proc exits (local variables), or the interpreter exits (global variable).
        See <a href="#_defer"><strong><code>defer</code></strong></a>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>history::multiline</strong></code>
</dt>
<dd>
<p>
    If this variable is set to "1", interactive line editing operates in multiline mode.
        That is, long lines will wrap across multiple lines rather than scrolling within a
        single line.
</p>
</dd>
</dl></div>
</div>
</div>
<div class="sect1">
<h2 id="_changes_in_previous_releases">CHANGES IN PREVIOUS RELEASES</h2>
<div class="sectionbody">




























































































































































































































<div class="sect2">
<h3 id="_in_v0_70">In v0.70</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
<code>platform_tcl()</code> settings are now automatically determined
</p>
>





|







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|

|







 







|

|







 







|

|









|

|
|
|
|







 







|

|





|

|




|

|


|

|




|

|
|


|

|







 







|

|


|

|











|

|


|

|


|

|


|

|

|






|

|


|

|







 







|

|







|

|












|

|







 







|

|







 







|

|
|
|
|







 







|

|





|

|







 







|

|


|

|
|










|

|
|








|

|












|

|











|

|













|

|







|

|






|

|







 







|

|
|




|

|







 







|

|







 







|

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








|







 







|

|






|

|
|







 







|

|
|
|
|
|
<
<
<
>
|
|
|







 







|

|
|


|

|





|

|
|


|

|







 







|

|
|
|
|
|
|
|
|
|
|







 







|

|
|
|
|





|

|
|
|
|







 







|

|
|
|
|
|
|
|
|
|





|

|
|
|
|






|

|
|
|
|
|
|






|

|







 







|

|






|

|



|

|



|

|







|

|







 







|

|






|







 







|


>
>






<
<


>
>






<
<


>
>






<
<


>
>






<
<


>
>






<
<


>
>






<
<


>
>






<
<


>
>






<
<


>
>






<
<


>
>





<
<







 







|

|
|
|
|







 







|
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







|

|
|
|
|
|





|

|







 







|







 







|









>
>
>
>
>
>
>
>
>
|





>







 







|







|

|


|

|







 







|

|
|
|
|







 







|

|
|
|








|

|
|
|
|







 







|


|

|
|







 







>
>
>
>
>
>
>
>
>
>
>







 







|



|
|
|
>










|







 







|

|
|
|
|
|










|







 







|







 







|












|

|


|

|










|

|
|
|







 







|

|
|
|
|
<
<
<
<
>
>
|
|
|



|

|
|
|
|
|
|
<
<
<
>
|
|
|







|

|










|







 







|













|

|


|

|


|

|







 







|

|







 







|




|

|







 







|

|
|
|
|







 







|







 







|












|

|
|






|

|
|







 







|

|
|
|
|







 







|







 







>
>
>
>
>
>
>
>
>
>







 







|

|
|
|
|
|
|
|
|







 







|







 







|

|

|







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>






|







 







|
|
|
|
|
|






|

|
|
|
|
|
|
|
|


|

|
|
|
|
|
|
|
|







 







|

|


|

|







 







|







 







|







 







|







 







|







 







|









|







 







>
>
|

|

<
>







 







>
>
|

|

<
>







 







|







 







|

|
|







 







|

|


|

|
|
|
|
|
|


|

|
|
|
|
|
|









|

|

|

|


|

|
|
|
|
|







 







|

|







 







|

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







 







|

|





|

|







 







|

|
|
|
|







 







>
>
|

|
|

<
>







 







>
|











|




|
>
>







 







|




|
>







 







>
>
>
>
>
>
>
>







 







|
|
|











|



|




>
>
>
>
>
>
>
>







|
|
|
|







|
|







 







|
|
|
|
|







 







|







|
|







|
>
>
>
>
>
>
>
>
>







|







|





|







 







|







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







 







|







 







|
|
<
|

<
<
<
<
|
<
<
<
<
|

<
<
<
<
|
<
<
|


|

|
|
|
|
|
|
|
|
|







 







|
|
|
|
|
<
<
<
<
<
<
<
<
<
<







 







|







 







|
|
|







 







|







 







|
|
|







 







|







|
|
|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
|

|
|
|
|
|
|
|
|

<
>







 







|
|








|
|








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
...
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
...
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
....
1097
1098
1099
1100
1101
1102
1103




























































































































































































































1104
1105
1106
1107
1108
1109
1110
....
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
....
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
....
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
....
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
....
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
....
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
....
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
....
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
....
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
....
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
....
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
....
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
....
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
....
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
....
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723



2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
....
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
....
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
....
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
....
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
....
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
....
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
....
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110


3111
3112
3113
3114
3115
3116
3117
3118
3119
3120


3121
3122
3123
3124
3125
3126
3127
3128
3129
3130


3131
3132
3133
3134
3135
3136
3137
3138
3139
3140


3141
3142
3143
3144
3145
3146
3147
3148
3149
3150


3151
3152
3153
3154
3155
3156
3157
3158
3159
3160


3161
3162
3163
3164
3165
3166
3167
3168
3169
3170


3171
3172
3173
3174
3175
3176
3177
3178
3179
3180


3181
3182
3183
3184
3185
3186
3187
3188
3189
3190


3191
3192
3193
3194
3195
3196
3197
3198
3199


3200
3201
3202
3203
3204
3205
3206
....
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
....
3345
3346
3347
3348
3349
3350
3351
3352

3353




















































3354
3355
3356
3357
3358
3359
3360
....
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
....
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
....
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
....
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
....
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
....
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
....
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
....
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
....
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
....
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
....
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
....
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
....
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826




4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842



4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
....
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
....
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
....
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
....
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
....
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
....
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
....
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
....
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
....
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
....
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
....
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
....
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
....
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
....
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
....
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
....
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
....
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
....
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
....
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
....
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
....
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
....
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198

6199
6200
6201
6202
6203
6204
6205
6206
....
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221

6222
6223
6224
6225
6226
6227
6228
6229
....
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
....
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
....
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
....
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
....
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
....
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
....
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
....
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846

6847
6848
6849
6850
6851
6852
6853
6854
....
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
....
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
....
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
....
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
....
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
....
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
....
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
....
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
....
7440
7441
7442
7443
7444
7445
7446
7447
7448

7449
7450




7451




7452
7453




7454


7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
....
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496










7497
7498
7499
7500
7501
7502
7503
....
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
....
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
....
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
....
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
....
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
....
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311

8312
8313
8314
8315
8316
8317
8318
8319
....
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.10" />
<title>Jim Tcl(n)</title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */

/* Default font. */
body {
  font-family: Georgia,serif;
................................................................................
<body class="manpage">
<div id="header">
<h1>
Jim Tcl(n) Manual Page
</h1>
<h2>NAME</h2>
<div class="sectionbody">
<p>Jim Tcl v0.79 -
   reference manual for the Jim Tcl scripting language
</p>
</div>
</div>
<div id="content">
<div class="sect1">
<h2 id="_synopsis">SYNOPSIS</h2>
................................................................................
</li>
</ol></div>
</div>
</div>
<div class="sect1">
<h2 id="_recent_changes">RECENT CHANGES</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_changes_between_0_78_and_0_79">Changes between 0.78 and 0.79</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Add <a href="#_file"><strong><code>file</code></strong></a> <code>mtimeus</code> for high resolution file timestamps
</p>
</li>
<li>
<p>
<a href="#_aio"><strong><code>aio</code></strong></a> now supports datagram Unix-Domain sockets
</p>
</li>
<li>
<p>
Add support for <a href="#_aio"><strong><code>aio</code></strong></a> <code>lock -wait</code>
</p>
</li>
<li>
<p>
Add <a href="#_signal"><strong><code>signal</code></strong></a> <code>block</code> to prevent delivery of signals
</p>
</li>
<li>
<p>
Add support for <a href="#_file"><strong><code>file</code></strong></a> <code>split</code>
</p>
</li>
<li>
<p>
Add support for <a href="#_json_encode"><strong><code>json::encode</code></strong></a> and <a href="#_json_decode"><strong><code>json::decode</code></strong></a>
</p>
</li>
<li>
<p>
<a href="#_aio"><strong><code>aio</code></strong></a> <code>tty</code> now allows setting <code>echo</code> without full <code>raw</code> mode
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_changes_between_0_77_and_0_78">Changes between 0.77 and 0.78</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Add serial/tty support with <a href="#_aio"><strong><code>aio</code></strong></a> <code>tty</code>
</p>
................................................................................
<a href="#_file"><strong><code>file</code></strong></a> <code>stat</code> no longer requires the variable name
</p>
</li>
<li>
<p>
Add support for <a href="#_file"><strong><code>file</code></strong></a> <code>link</code>
</p>




























































































































































































































</li>
</ol></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_tcl_introduction">TCL INTRODUCTION</h2>
................................................................................
A Tcl command string consists of one or more commands separated
by newline characters or semi-colons.
Each command consists of a collection of fields separated by
white space (spaces or tabs).
The first field must be the name of a command, and the
additional fields, if any, are arguments that will be passed to
that command.  For example, the command:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a 22</code></pre>
</div></div>
<div class="paragraph"><p>has three fields:  the first, <a href="#_set"><strong><code>set</code></strong></a>, is the name of a Tcl command, and
the last two, <em>a</em> and <em>22</em>, will be passed as arguments to
the <a href="#_set"><strong><code>set</code></strong></a> command.  The command name may refer either to a built-in
Tcl command, an application-specific command bound in with the library
procedure <em>Jim_CreateCommand</em>, or a command procedure defined with the
<a href="#_proc"><strong><code>proc</code></strong></a> built-in command.</p></div>
................................................................................
<div class="paragraph"><p>Normally each argument field ends at the next white space, but
double-quotes may be used to create arguments with embedded space.</p></div>
<div class="paragraph"><p>If an argument field begins with a double-quote, then the argument isn&#8217;t
terminated by white space (including newlines) or a semi-colon (see below
for information on semi-colons); instead it ends at the next double-quote
character.  The double-quotes are not included in the resulting argument.
For example, the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a "This is a single argument"</code></pre>
</div></div>
<div class="paragraph"><p>will pass two arguments to <a href="#_set"><strong><code>set</code></strong></a>:  <em>a</em> and <em>This is a single argument</em>.</p></div>
<div class="paragraph"><p>Within double-quotes, command substitutions, variable substitutions,
and backslash substitutions still occur, as described below.  If the
first character of a command field is not a quote, then quotes receive
no special interpretation in the parsing of that field.</p></div>
</div>
................................................................................
Second, the substitutions described below for commands, variables, and
backslashes do <strong>not</strong> occur in arguments enclosed in braces, so braces
can be used to prevent substitutions where they are undesirable.</p></div>
<div class="paragraph"><p>If an argument field begins with a left brace, then the argument ends
at the matching right brace.  Tcl will strip off the outermost layer
of braces and pass the information between the braces to the command
without any further modification.  For example, in the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a {xyz a {b c d}}</code></pre>
</div></div>
<div class="paragraph"><p>the <a href="#_set"><strong><code>set</code></strong></a> command will receive two arguments: <em>a</em>
and <em>xyz a {b c d}</em>.</p></div>
<div class="paragraph"><p>When braces or quotes are in effect, the matching brace or quote need
not be on the same line as the starting quote or brace; in this case
the newline will be included in the argument field along with any other
characters up to the matching brace or quote.  For example, the <a href="#_eval"><strong><code>eval</code></strong></a>
command takes one argument, which is a command string; <a href="#_eval"><strong><code>eval</code></strong></a> invokes
the Tcl interpreter to execute the command string.  The command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    eval {
      set a 22
      set b 33
    }</code></pre>
</div></div>
<div class="paragraph"><p>will assign the value <em>22</em> to <em>a</em> and <em>33</em> to <em>b</em>.</p></div>
<div class="paragraph"><p>If the first character of a command field is not a left
brace, then neither left nor right
braces in the field will be treated specially (except as part of
variable substitution; see below).</p></div>
</div>
................................................................................
<h2 id="_command_substitution_with_brackets">COMMAND SUBSTITUTION WITH BRACKETS</h2>
<div class="sectionbody">
<div class="paragraph"><p>If an open bracket occurs in a field of a command, then command
substitution occurs (except for fields enclosed in braces).  All of the
text up to the matching close bracket is treated as a Tcl command and
executed immediately.  Then the result of that command is substituted
for the bracketed text.  For example, consider the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a [set b]</code></pre>
</div></div>
<div class="paragraph"><p>When the <a href="#_set"><strong><code>set</code></strong></a> command has only a single argument, it is the name of a
variable and <a href="#_set"><strong><code>set</code></strong></a> returns the contents of that variable.  In this case,
if variable <em>b</em> has the value <em>foo</em>, then the command above is equivalent
to the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a foo</code></pre>
</div></div>
<div class="paragraph"><p>Brackets can be used in more complex ways.  For example, if the variable
<em>b</em> has the value <em>foo</em> and the variable <em>c</em> has the value <em>gorp</em>,
then the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a xyz[set b].[set c]</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a xyzfoo.gorp</code></pre>
</div></div>
<div class="paragraph"><p>A bracketed command may contain multiple commands separated by newlines
or semi-colons in the usual fashion.  In this case the value of the last
command is used for substitution.  For example, the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a x[set b 22
    expr $b+2]x</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a x24x</code></pre>
</div></div>
<div class="paragraph"><p>If a field is enclosed in braces then the brackets and the characters
between them are not interpreted specially; they are passed through to
the argument verbatim.</p></div>
</div>
</div>
<div class="sect1">
................................................................................
<div class="paragraph"><p>The dollar sign (<code>$</code>) may be used as a special shorthand form for
substituting variable values.  If <code>$</code> appears in an argument that isn&#8217;t
enclosed in braces then variable substitution will occur.  The characters
after the <code>$</code>, up to the first character that isn&#8217;t a number, letter,
or underscore, are taken as a variable name and the string value of that
variable is substituted for the name.</p></div>
<div class="paragraph"><p>For example, if variable <em>foo</em> has the value <em>test</em>, then the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a $foo.c</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a test.c</code></pre>
</div></div>
<div class="paragraph"><p>There are two special forms for variable substitution.  If the next
character after the name of the variable is an open parenthesis, then
the variable is assumed to be an array name, and all of the characters
between the open parenthesis and the next close parenthesis are taken as
an index into the array.  Command substitutions and variable substitutions
are performed on the information between the parentheses before it is
used as an index.</p></div>
<div class="paragraph"><p>For example, if the variable <em>x</em> is an array with one element named
<em>first</em> and value <em>87</em> and another element named <em>14</em> and value <em>more</em>,
then the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a xyz$x(first)zyx</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a xyz87zyx</code></pre>
</div></div>
<div class="paragraph"><p>If the variable <em>index</em> has the value <em>14</em>, then the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a xyz$x($index)zyx</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a xyzmorezyx</code></pre>
</div></div>
<div class="paragraph"><p>For more information on arrays, see <a href="#_variables_scalars_and_arrays">VARIABLES - SCALARS AND ARRAYS</a> below.</p></div>
<div class="paragraph"><p>The second special form for variables occurs when the dollar sign is
followed by an open curly brace.  In this case the variable name consists
of all the characters up to the next curly brace.</p></div>
<div class="paragraph"><p>Array references are not possible in this form:  the name between braces
is assumed to refer to a scalar variable.  For example, if variable
<em>foo</em> has the value <em>test</em>, then the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a abc${foo}bar</code></pre>
</div></div>
<div class="paragraph"><p>is equivalent to the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a abctestbar</code></pre>
</div></div>
<div class="paragraph"><p>Variable substitution does not occur in arguments that are enclosed in
braces:  the dollar sign and variable name are passed through to the
argument verbatim.</p></div>
<div class="paragraph"><p>The dollar sign abbreviation is simply a shorthand form.  <code>$a</code> is
completely equivalent to <code>[set a]</code>; it is provided as a convenience
to reduce typing.</p></div>
................................................................................
    The <em>U</em> form allows for one to eight hex digits.
    The <em>u{nnn}</em> form allows for one to eight hex digits, but makes it easier to insert
    characters UTF-8 characters which are followed by a hex digit.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>For example, in the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a \{x\[\ yz\141</code></pre>
</div></div>
<div class="paragraph"><p>the second argument to <a href="#_set"><strong><code>set</code></strong></a> will be <code>{x[ yza</code>.</p></div>
<div class="paragraph"><p>If a backslash is followed by something other than one of the options
described above, then the backslash is transmitted to the argument
field without any special processing, and the Tcl scanner continues
normal processing with the next character.  For example, in the
command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set \*a \\\{foo</code></pre>
</div></div>
<div class="paragraph"><p>The first argument to <a href="#_set"><strong><code>set</code></strong></a> will be <code>\*a</code> and the second
argument will be <code>\{foo</code>.</p></div>
<div class="paragraph"><p>If an argument is enclosed in braces, then backslash sequences inside
the argument are parsed but no substitution occurs (except for
backslash-newline):  the backslash
sequence is passed through to the argument as is, without making
any special interpretation of the characters in the backslash sequence.
In particular, backslashed braces are not counted in locating the
matching right brace that terminates the argument.
For example, in the
command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a {\{abc}</code></pre>
</div></div>
<div class="paragraph"><p>the second argument to <a href="#_set"><strong><code>set</code></strong></a> will be <code>\{abc</code>.</p></div>
<div class="paragraph"><p>This backslash mechanism is not sufficient to generate absolutely
any argument structure; it only covers the
most common cases.  To produce particularly complicated arguments
it is probably easiest to use the <a href="#_format"><strong><code>format</code></strong></a> command along with
command substitution.</p></div>
................................................................................
<em>Jim_ExprBoolean</em>, etc.) to evaluate them.</p></div>
<div class="paragraph"><p>The operators permitted in Tcl expressions are a subset of
the operators permitted in C expressions, and they have the
same meaning and precedence as the corresponding C operators.
Expressions almost always yield numeric results
(integer or floating-point values).
For example, the expression</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    8.2 + 6</code></pre>
</div></div>
<div class="paragraph"><p>evaluates to 14.2.</p></div>
<div class="paragraph"><p>Tcl expressions differ from C expressions in the way that
operands are specified, and in that Tcl expressions support
non-numeric operands and string comparisons.</p></div>
<div class="paragraph"><p>A Tcl expression consists of a combination of operands, operators,
and parentheses.</p></div>
................................................................................
<div class="paragraph"><p>As discussed below, it is usually best to enclose expressions
in braces to prevent the command parser from performing substitutions
on the contents.</p></div>
<div class="paragraph"><p>For some examples of simple expressions, suppose the variable <em>a</em> has
the value 3 and the variable <em>b</em> has the value 6.  Then the expression
on the left side of each of the lines below will evaluate to the value
on the right side of the line:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    $a + 3.1                6.1
    2 + "$a.$b"             5.6
    4*[llength "6 2"]       8
    {word one} &lt; "word $a"  0</code></pre>
</div></div>
<div class="paragraph"><p>The valid operators are listed below, grouped in decreasing order
of precedence:</p></div>
<div class="dlist" id="OperatorPrecedence"><dl>
<dt class="hdlist1">
<code>int() double() round() abs(), rand(), srand()</code>
</dt>
................................................................................
</p>
</dd>
</dl></div>
<div class="paragraph"><p>See the C manual for more details on the results
produced by each operator.
All of the binary operators group left-to-right within the same
precedence level.  For example, the expression</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    4*2 &lt; 7</code></pre>
</div></div>
<div class="paragraph"><p>evaluates to 0.</p></div>
<div class="paragraph"><p>The <code>&amp;&amp;</code>, <code>||</code>, and <code>?:</code> operators have <em>lazy evaluation</em>, just as
in C, which means that operands are not evaluated if they are not
needed to determine the outcome.  For example, in</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    $v ? [a] : [b]</code></pre>
</div></div>
<div class="paragraph"><p>only one of <code>[a]</code> or <code>[b]</code> will actually be evaluated,
depending on the value of <code>$v</code>.</p></div>
<div class="paragraph"><p>All internal computations involving integers are done with the C
type <em>long long</em> if available, or <em>long</em> otherwise, and all internal
computations involving floating-point are done with the C type
<em>double</em>.</p></div>
................................................................................
In any case, overflow and underflow are generally not detected
reliably for intermediate results.</p></div>
<div class="paragraph"><p>Conversion among internal representations for integer, floating-point,
string operands is done automatically as needed.
For arithmetic computations, integers are used until some
floating-point number is introduced, after which floating-point is used.
For example,</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    5 / 4</code></pre>
</div></div>
<div class="paragraph"><p>yields the result 1, while</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    5 / 4.0
    5 / ( [string length "abcd"] + 0.0 )</code></pre>
</div></div>
<div class="paragraph"><p>both yield the result 1.25.</p></div>
<div class="paragraph"><p>String values may be used as operands of the comparison operators,
although the expression evaluator tries to do comparisons as integer
or floating-point when it can.
If one of the operands of a comparison is a string and the other
has a numeric value, the numeric operand is converted back to
a string using the C <em>sprintf</em> format specifier
<em>%d</em> for integers and <em>%g</em> for floating-point values.
For example, the expressions</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    "0x03" &gt; "2"
    "0y" &lt; "0x12"</code></pre>
</div></div>
<div class="paragraph"><p>both evaluate to 1.  The first comparison is done using integer
comparison, and the second is done using string comparison after
the second operand is converted to the string <em>18</em>.</p></div>
<div class="paragraph"><p>In general it is safest to enclose an expression in braces when
entering it in a command:  otherwise, if the expression contains
any white space then the Tcl interpreter will split it
among several arguments.  For example, the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    expr $a + $b</code></pre>
</div></div>
<div class="paragraph"><p>results in three arguments being passed to <a href="#_expr"><strong><code>expr</code></strong></a>:  <code>$a</code>,
+, and <code>$b</code>.  In addition, if the expression isn&#8217;t in braces
then the Tcl interpreter will perform variable and command substitution
immediately (it will happen in the command parser rather than in
the expression parser).  In many cases the expression is being
passed to a command that will evaluate the expression later (or
even many times if, for example, the expression is to be used to
decide when to exit a loop).  Usually the desired goal is to re-do
the variable or command substitutions each time the expression is
evaluated, rather than once and for all at the beginning.  For example,
the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    for {set i 1} $i&lt;=10 {incr i} {...}        ** WRONG **</code></pre>
</div></div>
<div class="paragraph"><p>is probably intended to iterate over all values of <code>i</code> from 1 to 10.
After each iteration of the body of the loop, <a href="#_for"><strong><code>for</code></strong></a> will pass
its second argument to the expression evaluator to see whether or not
to continue processing.  Unfortunately, in this case the value of <code>i</code>
in the second argument will be substituted once and for all when the
<a href="#_for"><strong><code>for</code></strong></a> command is parsed.  If <code>i</code> was 0 before the <a href="#_for"><strong><code>for</code></strong></a>
command was invoked then the second argument of <a href="#_for"><strong><code>for</code></strong></a> will be <code>0&lt;=10</code>
which will always evaluate to 1, even though <code>i</code> eventually
becomes greater than 10.  In the above case the loop will never
terminate.  Instead, the expression should be placed in braces:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    for {set i 1} {$i&lt;=10} {incr i} {...}      ** RIGHT **</code></pre>
</div></div>
<div class="paragraph"><p>This causes the substitution of <em>i</em>
to be delayed; it will be re-done each time the expression is
evaluated, which is the desired result.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_lists">LISTS</h2>
<div class="sectionbody">
<div class="paragraph"><p>The third major way that strings are interpreted in Tcl is as lists.
A list is just a string with a list-like structure
consisting of fields separated by white space.  For example, the
string</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    Al Sue Anne John</code></pre>
</div></div>
<div class="paragraph"><p>is a list with four elements or fields.
Lists have the same basic structure as command strings, except
that a newline character in a list is treated as a field separator
just like space or tab.  Conventions for braces and quotes
and backslashes are the same for lists as for commands.  For example,
the string</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    a b\ c {d e {f g h}}</code></pre>
</div></div>
<div class="paragraph"><p>is a list with three elements:  <code>a</code>, <code>b c</code>, and <code>d e {f g h}</code>.</p></div>
<div class="paragraph"><p>Whenever an element is extracted from a list, the same rules about
braces and quotes and backslashes are applied as for commands.  Thus in
the example above when the third element is extracted from the list,
the result is</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    d e {f g h}</code></pre>
</div></div>
<div class="paragraph"><p>(when the field was extracted, all that happened was to strip off
the outermost layer of braces).  Command substitution and
variable substitution are never
made on a list (at least, not by the list-processing commands; the
list can always be passed to the Tcl interpreter for evaluation).</p></div>
<div class="paragraph"><p>The Tcl commands <a href="#_concat"><strong><code>concat</code></strong></a>, <a href="#_foreach"><strong><code>foreach</code></strong></a>, <a href="#_lappend"><strong><code>lappend</code></strong></a>, <a href="#_lindex"><strong><code>lindex</code></strong></a>, <a href="#_linsert"><strong><code>linsert</code></strong></a>,
................................................................................
</div>
<div class="sect1">
<h2 id="_list_expansion">LIST EXPANSION</h2>
<div class="sectionbody">
<div class="paragraph"><p>A new addition to Tcl 8.5 is the ability to expand a list into separate
arguments. Support for this feature is also available in Jim.</p></div>
<div class="paragraph"><p>Consider the following attempt to exec a list:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set cmd {ls -l}
    exec $cmd</code></pre>
</div></div>
<div class="paragraph"><p>This will attempt to exec a command named "ls -l", which will clearly not
work. Typically eval and concat are required to solve this problem, however
it can be solved much more easily with <code>{*}</code>.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    exec {*}$cmd</code></pre>
</div></div>
<div class="paragraph"><p>This will expand the following argument into individual elements and then evaluate
the resulting command.</p></div>
<div class="paragraph"><p>Note that the official Tcl syntax is <code>{*}</code>, however <code>{expand}</code> is retained
for backward compatibility with experimental versions of this feature.</p></div>
</div>
</div>
................................................................................
<li>
<p>
Variable Argument
</p>
</li>
</ol></div>
<div class="paragraph"><p>The following example illustrates precedence. Assume a procedure declaration:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    proc p {{a A} args b {c C} d} {...}</code></pre>
</div></div>
<div class="paragraph"><p>This procedure requires at least two arguments, but can accept an unlimited number.
The following table shows how various numbers of arguments are assigned.
Values marked as <code>-</code> are assigned the default value.</p></div>
<div class="tableblock">
<table rules="all"
width="40%"
................................................................................
accessed by invoking the <a href="#_global"><strong><code>global</code></strong></a> command or via the <code>::</code> prefix.</p></div>
<div class="sect2">
<h3 id="_new_in_jim">New in Jim</h3>
<div class="paragraph"><p>In addition to procedure arguments, Jim procedures may declare static variables.
These variables scoped to the procedure and initialised at procedure definition.
Either from the static variable definition, or from the enclosing scope.</p></div>
<div class="paragraph"><p>Consider the following example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . set a 1
    . proc a {} {a {b 2}} {
        set c 1
        puts "$a $b $c"
        incr a
        incr b
        incr c
    }
    . a
    1 2 1
    . a
    2 3 1</code></pre>
</div></div>
<div class="paragraph"><p>The static variable <code><em>a</em></code> has no initialiser, so it is initialised from
the enclosing scope with the value 1. (Note that it is an error if there
is no variable with the same name in the enclosing scope). However <code><em>b</em></code>
has an initialiser, so it is initialised to 2.</p></div>
<div class="paragraph"><p>Unlike a local variable, the value of a static variable is retained across
invocations of the procedure.</p></div>
<div class="paragraph"><p>See the <a href="#_proc"><strong><code>proc</code></strong></a> command for information on how to define procedures
and what happens when they are invoked. See also <a href="#_namespaces">NAMESPACES</a>.</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_variables_scalars_and_arrays">VARIABLES - SCALARS AND ARRAYS</h2>
<div class="sectionbody">
<div class="paragraph"><p>Tcl allows the definition of variables and the use of their values
................................................................................
<div class="paragraph"><p>Tcl supports two types of variables:  scalars and arrays.
A scalar variable has a single value, whereas an array variable
can have any number of elements, each with a name (called
its <em>index</em>) and a value.</p></div>
<div class="paragraph"><p>Array indexes may be arbitrary strings; they need not be numeric.
Parentheses are used refer to array elements in Tcl commands.
For example, the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set x(first) 44</code></pre>
</div></div>
<div class="paragraph"><p>will modify the element of <em>x</em> whose index is <em>first</em>
so that its new value is <em>44</em>.</p></div>
<div class="paragraph"><p>Two-dimensional arrays can be simulated in Tcl by using indexes
that contain multiple concatenated values.
For example, the commands</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a(2,3) 1
    set a(3,6) 2</code></pre>
</div></div>
<div class="paragraph"><p>set the elements of <em>a</em> whose indexes are <em>2,3</em> and <em>3,6</em>.</p></div>
<div class="paragraph"><p>In general, array elements may be used anywhere in Tcl that scalar
variables may be used.</p></div>
<div class="paragraph"><p>If an array is defined with a particular name, then there may
not be a scalar variable with the same name.</p></div>
<div class="paragraph"><p>Similarly, if there is a scalar variable with a particular
................................................................................
automatically refers to a global variable.  Variable names used
within a procedure normally refer to local variables associated with that
invocation of the procedure.  Local variables are deleted whenever
a procedure exits.  Either <a href="#_global"><strong><code>global</code></strong></a> command may be used to request
that a name refer to a global variable for the duration of the current
procedure (this is somewhat analogous to <em>extern</em> in C), or the variable
may be explicitly scoped with the <code>::</code> prefix. For example</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . set a 1
    . set b 2
    . proc p {} {
        set c 3
        global a




        puts "$a $::b $c"
    }
    . p</code></pre>
</div></div>
<div class="paragraph"><p>will output:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>1 2 3</code></pre>
</div></div>
</div>
................................................................................
<div class="sect1">
<h2 id="_arrays_as_lists_in_jim">ARRAYS AS LISTS IN JIM</h2>
<div class="sectionbody">
<div class="paragraph"><p>Unlike Tcl, Jim can automatically convert between a list (with an even
number of elements) and an array value. This is similar to the way Tcl
can convert between a string and a list.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  set a {1 one 2 two}
  puts $a(2)</code></pre>
</div></div>
<div class="paragraph"><p>will output:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  two</code></pre>
</div></div>
<div class="paragraph"><p>Thus <a href="#_array"><strong><code>array</code></strong></a> <code>set</code> is equivalent to <a href="#_set"><strong><code>set</code></strong></a> when the variable does not
exist or is empty.</p></div>
<div class="paragraph"><p>The reverse is also true where an array will be converted into
a list.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  set a(1) one; set a(2) two
  puts $a</code></pre>
</div></div>
<div class="paragraph"><p>will output:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  1 one 2 two</code></pre>
</div></div>
</div>
</div>
<div class="sect1">
<h2 id="_dictionary_values">DICTIONARY VALUES</h2>
<div class="sectionbody">
<div class="paragraph"><p>Tcl 8.5 introduced the dict command, and Jim Tcl has added a version
................................................................................
keys, only the last value for a particular key is used; the others
are ignored, meaning that, "apple banana" and "apple carrot apple
banana" are equivalent dictionaries (with different string
representations).</p></div>
<div class="paragraph"><p>Note that in Jim, arrays are implemented as dictionaries.
Thus automatic conversion between lists and dictionaries applies
as it does for arrays.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  . dict set a 1 one
  1 one
  . dict set a 2 two
  1 one 2 two
  . puts $a
  1 one 2 two
  . puts $a(2)
  two
  . dict set a 3 T three
  1 one 2 two 3 {T three}</code></pre>
</div></div>
<div class="paragraph"><p>See the <a href="#_dict"><strong><code>dict</code></strong></a> command for more details.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_namespaces">NAMESPACES</h2>
<div class="sectionbody">
................................................................................
These are described briefly below.</p></div>
<div class="paragraph"><p>More information may be found at <a href="http://wiki.tcl.tk/13847">http://wiki.tcl.tk/13847</a></p></div>
<div class="sect2">
<h3 id="_references">References</h3>
<div class="paragraph"><p>A reference can be thought of as holding a value with one level of indirection,
where the value may be garbage collected when unreferenced.
Consider the following example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . set r [ref "One String" test]
    &lt;reference.&lt;test___&gt;.00000000000000000000&gt;
    . getref $r
    One String</code></pre>
</div></div>
<div class="paragraph"><p>The operation <a href="#_ref"><strong><code>ref</code></strong></a> creates a references to the value specified by the
first argument. (The second argument is a "type" used for documentation purposes).</p></div>
<div class="paragraph"><p>The operation <a href="#_getref"><strong><code>getref</code></strong></a> is the dereferencing operation which retrieves the value
stored in the reference.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . setref $r "New String"
    New String
    . getref $r
    New String</code></pre>
</div></div>
<div class="paragraph"><p>The operation <a href="#_setref"><strong><code>setref</code></strong></a> replaces the value stored by the reference. If the old value
is no longer accessible by any reference, it will eventually be automatically be garbage
collected.</p></div>
</div>
<div class="sect2">
<h3 id="_garbage_collection">Garbage Collection</h3>
................................................................................
<div class="paragraph"><p>Normally, all values in Tcl are passed by value. As such values are copied and released
automatically as necessary.</p></div>
<div class="paragraph"><p>With the introduction of references, it is possible to create values whose lifetime
transcend their scope. To support this, case, the Jim system will periodically identify
and discard objects which are no longer accessible by any reference.</p></div>
<div class="paragraph"><p>The <a href="#_collect"><strong><code>collect</code></strong></a> command may be used to force garbage collection.  Consider a reference created
with a finalizer:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . proc f {ref value} { puts "Finaliser called for $ref,$value" }
    . set r [ref "One String" test f]
    &lt;reference.&lt;test___&gt;.00000000000
    . collect
    0
    . set r ""
    . collect
    Finaliser called for &lt;reference.&lt;test___&gt;.00000000000,One String
    1</code></pre>
</div></div>
<div class="paragraph"><p>Note that once the reference, <em>r</em>, was modified so that it no longer
contained a reference to the value, the garbage collector discarded
the value (after calling the finalizer).</p></div>
<div class="paragraph"><p>The finalizer for a reference may be examined or changed with the <a href="#_finalize"><strong><code>finalize</code></strong></a> command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . finalize $r
    f
    . finalize $r newf
    newf</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_lambda_function">Lambda Function</h3>
<div class="paragraph"><p>Jim provides a garbage collected <a href="#_lambda"><strong><code>lambda</code></strong></a> function. This is a procedure
which is able to create an anonymous procedure.  Consider:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . set f [lambda {a} {{x 0}} { incr x $a }]
    . $f 1
    1
    . $f 2
    3
    . set f ""</code></pre>
</div></div>
<div class="paragraph"><p>This create an anonymous procedure (with the name stored in <em>f</em>), with a static variable
which is incremented by the supplied value and the result returned.</p></div>
<div class="paragraph"><p>Once the procedure name is no longer accessible, it will automatically be deleted
when the garbage collector runs.</p></div>
<div class="paragraph"><p>The procedure may also be delete immediately by renaming it "". e.g.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . rename $f ""</code></pre>
</div></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_utf_8_and_unicode">UTF-8 AND UNICODE</h2>
<div class="sectionbody">
................................................................................
<div class="paragraph"><p>Note that even if UTF-8 support is not enabled, the <code>\uNNNN</code> and related syntax
is still available to embed UTF-8 sequences.</p></div>
<div class="paragraph"><p>Jim Tcl supports all currently defined unicode codepoints. That is 21 bits, up to +<em>U+1FFFFF</em>.</p></div>
<div class="sect2">
<h3 id="_string_matching">String Matching</h3>
<div class="paragraph"><p>Commands such as <a href="#_string"><strong><code>string</code></strong></a> <code>match</code>, <a href="#_lsearch"><strong><code>lsearch</code></strong></a> <code>-glob</code>, <a href="#_array"><strong><code>array</code></strong></a> <code>names</code> and others use string
pattern matching rules. These commands support UTF-8. For example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  string match a\[\ua0-\ubf\]b "a\u00a3b"</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_format_and_scan">format and scan</h3>
<div class="paragraph"><p><code>format %c</code> allows a unicode codepoint to be be encoded. For example, the following will return
a string with two bytes and one character. The same as <code>\ub5</code></p></div>
<div class="listingblock">
<div class="content">
<pre><code>  format %c 0xb5</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_format"><strong><code>format</code></strong></a> respects widths as character widths, not byte widths. For example, the following will
return a string with three characters, not three bytes.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  format %.3s \ub5\ub6\ub7\ub8</code></pre>
</div></div>
<div class="paragraph"><p>Similarly, <code>scan &#8230; %c</code> allows a UTF-8 to be decoded to a unicode codepoint. The following will set
<code><em>a</em></code> to 181 (0xb5) and <code><em>b</em></code> to 65 (0x41).</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  scan \u00b5A %c%c a b</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_scan"><strong><code>scan</code></strong></a> <code>%s</code> will also accept a character class, including unicode ranges.</p></div>
</div>
<div class="sect2">
<h3 id="_string_classes">String Classes</h3>
<div class="paragraph"><p><a href="#_string"><strong><code>string</code></strong></a> <code>is</code> has <strong>not</strong> been extended to classify UTF-8 characters. Therefore, the following
will return 0, even though the string may be considered to be alphabetic.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  string is alpha \ub5Test</code></pre>
</div></div>
<div class="paragraph"><p>This does not affect the string classes <em>ascii</em>, <em>control</em>, <em>digit</em>, <em>double</em>, <em>integer</em> or <em>xdigit</em>.</p></div>
</div>
<div class="sect2">
<h3 id="_case_mapping_and_conversion">Case Mapping and Conversion</h3>
<div class="paragraph"><p>Jim provides a simplified unicode case mapping. This means that case conversion
and comparison will not increase or decrease the number of characters in a string.
................................................................................
<div class="sect2">
<h3 id="_invalid_utf_8_sequences">Invalid UTF-8 Sequences</h3>
<div class="paragraph"><p>Some UTF-8 character sequences are invalid, such as those beginning with <em>0xff</em>,
those which represent character sequences longer than 3 bytes (greater than U+FFFF),
and those which end prematurely, such as a lone <em>0xc2</em>.</p></div>
<div class="paragraph"><p>In these situations, the offending bytes are treated as single characters. For example,
the following returns 2.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  string bytelength \xff\xff</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_regular_expressions_2">Regular Expressions</h3>
<div class="paragraph"><p>If UTF-8 support is enabled, the built-in regular expression engine will be
selected which supports UTF-8 strings and patterns.</p></div>
<div class="paragraph"><p>See <a href="#_regular_expressions">REGULAR EXPRESSIONS</a></p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_built_in_commands">BUILT-IN COMMANDS</h2>
<div class="sectionbody">
<div class="paragraph"><p>The Tcl library provides the following built-in commands, which will
................................................................................
<td align="left" valign="top"><p class="table"><a href="#_global"><strong><code>global</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_history"><strong><code>history</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_if"><strong><code>if</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_incr"><strong><code>incr</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_info"><strong><code>info</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_interp"><strong><code>interp</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_join"><strong><code>join</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_json_decode"><strong><code>json::decode</code></strong></a></p></td>
</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#_json_encode"><strong><code>json::encode</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_kill"><strong><code>kill</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lambda"><strong><code>lambda</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lappend"><strong><code>lappend</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lassign"><strong><code>lassign</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lindex"><strong><code>lindex</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_linsert"><strong><code>linsert</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_list"><strong><code>list</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#_llength"><strong><code>llength</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lmap"><strong><code>lmap</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_load"><strong><code>load</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_local"><strong><code>local</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_loop"><strong><code>loop</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lrange"><strong><code>lrange</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lrepeat"><strong><code>lrepeat</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lreplace"><strong><code>lreplace</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#_lreverse"><strong><code>lreverse</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lsearch"><strong><code>lsearch</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lset"><strong><code>lset</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_lsort"><strong><code>lsort</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_namespace"><strong><code>namespace</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_4"><strong><code>oo</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_open"><strong><code>open</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>os.fork</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>os.gethostname</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>os.getids</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>os.uptime</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_3"><strong><code>pack</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_3"><strong><code>pack</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_package"><strong><code>package</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_pid"><strong><code>pid</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_pipe"><strong><code>pipe</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#cmd_1"><strong><code>posix</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_proc"><strong><code>proc</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_puts"><strong><code>puts</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_pwd"><strong><code>pwd</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_rand"><strong><code>rand</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_range"><strong><code>range</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_read"><strong><code>read</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_ref"><strong><code>ref</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#_regexp"><strong><code>regexp</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_regsub"><strong><code>regsub</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_rename"><strong><code>rename</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_return"><strong><code>return</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_scan"><strong><code>scan</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_seek"><strong><code>seek</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_set"><strong><code>set</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_setref"><strong><code>setref</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#_signal"><strong><code>signal</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_sleep"><strong><code>sleep</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_socket"><strong><code>socket</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_source"><strong><code>source</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_split"><strong><code>split</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_stackdump"><strong><code>stackdump</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_stacktrace"><strong><code>stacktrace</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_string"><strong><code>string</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#_subst"><strong><code>subst</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_4"><strong><code>super</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_switch"><strong><code>switch</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_syslog"><strong><code>syslog</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tailcall"><strong><code>tailcall</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tcl_autocomplete"><strong><code>tcl::autocomplete</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tcl_prefix"><strong><code>tcl::prefix</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tell"><strong><code>tell</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#_throw"><strong><code>throw</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_time"><strong><code>time</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_tree"><strong><code>tree</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_try"><strong><code>try</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_unknown"><strong><code>unknown</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_3"><strong><code>unpack</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_unset"><strong><code>unset</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_upcall"><strong><code>upcall</code></strong></a></p></td>


</tr>
<tr>
<td align="left" valign="top"><p class="table"><a href="#cmd_2"><strong><code>update</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_uplevel"><strong><code>uplevel</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_upvar"><strong><code>upvar</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#cmd_2"><strong><code>vwait</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_wait"><strong><code>wait</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_while"><strong><code>while</code></strong></a></p></td>
<td align="left" valign="top"><p class="table"><a href="#_zlib"><strong><code>zlib</code></strong></a></p></td>


<td align="left" valign="top"><p class="table"></p></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="sect2">
................................................................................
(see <a href="#_signal"><strong><code>signal</code></strong></a>), the process will exit on this signal.</p></div>
</div>
<div class="sect2">
<h3 id="_alias">alias</h3>
<div class="paragraph"><p><code><strong>alias</strong> <em>name args...</em></code></p></div>
<div class="paragraph"><p>Creates a single word alias (command) for one or more words. For example,
the following creates an alias for the command <a href="#_info"><strong><code>info</code></strong></a> <code>exists</code>.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    alias e info exists
    if {[e var]} {
      ...
    }</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_alias"><strong><code>alias</code></strong></a> returns <code><em>name</em></code>, allowing it to be used with <a href="#_local"><strong><code>local</code></strong></a>.</p></div>
<div class="paragraph"><p>See also <a href="#_proc"><strong><code>proc</code></strong></a>, <a href="#_curry"><strong><code>curry</code></strong></a>, <a href="#_lambda"><strong><code>lambda</code></strong></a>, <a href="#_local"><strong><code>local</code></strong></a>, <a href="#_info"><strong><code>info</code></strong></a> <code>alias</code>, <a href="#_exists"><strong><code>exists</code></strong></a> <code>-alias</code></p></div>
</div>
<div class="sect2">
<h3 id="_append">append</h3>
<div class="paragraph"><p><code><strong>append</strong> <em>varName value ?value value &#8230;?</em></code></p></div>
................................................................................
<div class="paragraph"><p><code><strong>break</strong></code></p></div>
<div class="paragraph"><p>This command may be invoked only inside the body of a loop command
such as <a href="#_for"><strong><code>for</code></strong></a> or <a href="#_foreach"><strong><code>foreach</code></strong></a> or <a href="#_while"><strong><code>while</code></strong></a>.  It returns a <code>JIM_BREAK</code> code
to signal the innermost containing loop command to return immediately.</p></div>
</div>
<div class="sect2">
<h3 id="_case">case</h3>
<div class="paragraph"><p>The obsolete <em><code><strong>case</strong></code></em> command has been removed from Jim Tcl since v0.75.

Use <a href="#_switch"><strong><code>switch</code></strong></a> instead.</p></div>




















































</div>
<div class="sect2">
<h3 id="_catch">catch</h3>
<div class="paragraph"><p><code><strong>catch</strong> ?-?no?<em>code ...</em>? ?--? <em>command ?resultVarName? ?optionsVarName?</em></code></p></div>
<div class="paragraph"><p>The <a href="#_catch"><strong><code>catch</code></strong></a> command may be used to prevent errors from aborting
command interpretation.  <a href="#_catch"><strong><code>catch</code></strong></a> evaluates <code><em>command</em></code>, and returns a
<code>JIM_OK</code> code, regardless of any errors that might occur while
................................................................................
it will be set to the code given in <a href="#_return"><strong><code>return</code></strong></a> <code>-code</code>. Additionally,
for the return code <code>JIM_ERR</code>, the value of the key <code>-errorinfo</code>
will contain the current stack trace (the same result as <a href="#_info"><strong><code>info</code></strong></a> <code>stacktrace</code>),
the value of the key <code>-errorcode</code> will contain the
same value as the global variable $::errorCode, and the value of
the key <code>-level</code> will be the current return level (see <a href="#_return"><strong><code>return</code></strong></a> <code>-level</code>).
This can be useful to rethrow an error:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    if {[catch {...} msg opts]} {
        ...maybe do something with the error...
        incr opts(-level)
        return {*}$opts $msg
    }</code></pre>
</div></div>
<div class="paragraph"><p>Normally <a href="#_catch"><strong><code>catch</code></strong></a> will <code><em>not</em></code> catch any of the codes <code>JIM_EXIT</code>, <code>JIM_EVAL</code> or <code>JIM_SIGNAL</code>.
The set of codes which will be caught may be modified by specifying the one more codes before
<code><em>command</em></code>.</p></div>
<div class="paragraph"><p>e.g. To catch <code>JIM_EXIT</code> but not <code>JIM_BREAK</code> or <code>JIM_CONTINUE</code></p></div>
<div class="listingblock">
<div class="content">
<pre><code>    catch -exit -nobreak -nocontinue -- { ... }</code></pre>
</div></div>
<div class="paragraph"><p>The use of <code>--</code> is optional. It signifies that no more return code options follow.</p></div>
<div class="paragraph"><p>Note that if a signal marked as <a href="#_signal"><strong><code>signal</code></strong></a> <code>handle</code> is caught with <a href="#_catch"><strong><code>catch</code></strong></a> <code>-signal</code>, the return value
(stored in <code><em>resultVarName</em></code>) is name of the signal caught.</p></div>
</div>
<div class="sect2">
<h3 id="_cd">cd</h3>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code><strong>clock clicks</strong></code>
</dt>
<dd>
<p>
    Returns the current time in "clicks", a system-dependent, high-resolution time.
</p>
</dd>
<dt class="hdlist1">
<code><strong>clock microseconds</strong></code>
</dt>
<dd>
<p>
................................................................................
</dt>
<dd>
<p>
    Returns the current time in milliseconds.
</p>
</dd>
<dt class="hdlist1">
<code><strong>clock format</strong> <em>seconds</em> ?<strong>-format</strong> <em>format?</em> ?<strong>-gmt</strong> <em>boolean?</em></code>
</dt>
<dd>
<p>
    Format the given time (seconds since the epoch) according to the given
    format. See strftime(3) for supported formats.
    If no format is supplied, "%c" is used.
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    If <code><em>boolean</em></code> is true, processing is performed in UTC.
    If <code><em>boolean</em></code> is false (the default), processing  is performeed in the local time zone.
</p>
</dd>
<dt class="hdlist1">
<code><strong>clock scan</strong> <em>str</em> <strong>-format</strong> <em>format</em> ?<strong>-gmt</strong> <em>boolean?</em></code>
</dt>
<dd>
<p>
    Scan the given time string using the given format string.
    See strptime(3) for supported formats.
    See <a href="#_clock"><strong><code>clock</code></strong></a> <code>format</code> for the handling of <em>-gmt</em>.
</p>
</dd>
</dl></div>
</div>
<div class="sect2">
<h3 id="_close">close</h3>
<div class="paragraph"><p><code><strong>close</strong> <em>fileId</em></code></p></div>
................................................................................
used anymore.</p></div>
</div>
<div class="sect2">
<h3 id="_collect">collect</h3>
<div class="paragraph"><p><code><strong>collect</strong></code></p></div>
<div class="paragraph"><p>Normally reference garbage collection is automatically performed periodically.
However it may be run immediately with the <a href="#_collect"><strong><code>collect</code></strong></a> command.</p></div>
<div class="paragraph"><p>See <a href="#_garbage_collection_references_lambda_function">GARBAGE COLLECTION</a> for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_concat">concat</h3>
<div class="paragraph"><p><code><strong>concat</strong> <em>arg ?arg ...?</em></code></p></div>
<div class="paragraph"><p>This command treats each argument as a list and concatenates them
into a single list.  It permits any number of arguments.  For example,
the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    concat a b {c d e} {f {g h}}</code></pre>
</div></div>
<div class="paragraph"><p>will return</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    a b c d e f {g h}</code></pre>
</div></div>
<div class="paragraph"><p>as its result.</p></div>
</div>
<div class="sect2">
<h3 id="_continue">continue</h3>
<div class="paragraph"><p><code><strong>continue</strong></code></p></div>
<div class="paragraph"><p>This command may be invoked only inside the body of a loop command such
................................................................................
</div>
<div class="sect2">
<h3 id="_curry">curry</h3>
<div class="paragraph"><p><code><strong>alias</strong> <em>args...</em></code></p></div>
<div class="paragraph"><p>Similar to <a href="#_alias"><strong><code>alias</code></strong></a> except it creates an anonymous procedure (lambda) instead of
a named procedure.</p></div>
<div class="paragraph"><p>the following creates a local, unnamed alias for the command <a href="#_info"><strong><code>info</code></strong></a> <code>exists</code>.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set e [local curry info exists]
    if {[$e var]} {
      ...
    }</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_curry"><strong><code>curry</code></strong></a> returns the name of the procedure.</p></div>
<div class="paragraph"><p>See also <a href="#_proc"><strong><code>proc</code></strong></a>, <a href="#_alias"><strong><code>alias</code></strong></a>, <a href="#_lambda"><strong><code>lambda</code></strong></a>, <a href="#_local"><strong><code>local</code></strong></a>.</p></div>
</div>
<div class="sect2">
<h3 id="_dict">dict</h3>
<div class="paragraph"><p><code><strong>dict</strong> <em>option ?arg...?</em></code></p></div>
................................................................................
to indicate what went wrong.</p></div>
<div class="paragraph"><p>If the <code><em>stacktrace</em></code> argument is provided and is non-empty,
it is used to initialize the stacktrace.</p></div>
<div class="paragraph"><p>This feature is most useful in conjunction with the <a href="#_catch"><strong><code>catch</code></strong></a> command:
if a caught error cannot be handled successfully, <code><em>stacktrace</em></code> can be used
to return a stack trace reflecting the original point of occurrence
of the error:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    catch {...} errMsg
    ...
    error $errMsg [info stacktrace]</code></pre>
</div></div>
<div class="paragraph"><p>See also <code>errorInfo</code>, <a href="#_info"><strong><code>info</code></strong></a> <code>stacktrace</code>, <a href="#_catch"><strong><code>catch</code></strong></a> and <a href="#_return"><strong><code>return</code></strong></a></p></div>
</div>
<div class="sect2">
<h3 id="_errorinfo">errorInfo</h3>
<div class="paragraph"><p><code><strong>errorInfo</strong> <em>error ?stacktrace?</em></code></p></div>
<div class="paragraph"><p>Returns a human-readable representation of the given error message and stack trace.
Typical usage is:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    if {[catch {...} error]} {
        puts stderr [errorInfo $error [info stacktrace]]
        exit 1
    }</code></pre>
</div></div>
<div class="paragraph"><p>See also <a href="#_error"><strong><code>error</code></strong></a>.</p></div>
</div>
<div class="sect2">
<h3 id="_eval">eval</h3>
<div class="paragraph"><p><code><strong>eval</strong> <em>arg ?arg...?</em></code></p></div>
<div class="paragraph"><p><a href="#_eval"><strong><code>eval</code></strong></a> takes one or more arguments, which together comprise a Tcl
................................................................................
to 0.</p></div>
<div class="paragraph"><p>Note that exit can be caught with <a href="#_catch"><strong><code>catch</code></strong></a>.</p></div>
</div>
<div class="sect2">
<h3 id="_expr">expr</h3>
<div class="paragraph"><p><code><strong>expr</strong> <em>arg</em></code></p></div>
<div class="paragraph"><p>Calls the expression processor to evaluate <code><em>arg</em></code>, and returns
the result as a string.  See the section <a href="#_expressions">EXPRESSIONS</a> above.</p></div>
<div class="paragraph"><p>Note that Jim supports a shorthand syntax for <a href="#_expr"><strong><code>expr</code></strong></a> as <code>$(...)</code>
The following two are identical.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  set x [expr {3 * 2 + 1}]
  set x $(3 * 2 + 1)</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_file">file</h3>
<div class="paragraph"><p><code><strong>file</strong> <em>option name ?arg...?</em></code></p></div>
<div class="paragraph"><p>Operate on a file or a file name.  <code><em>name</em></code> is the name of a file.</p></div>
<div class="paragraph"><p><code><em>option</em></code> indicates what to do with the file name.  Any unique
................................................................................
    Return a decimal string giving the time at which file <code><em>name</em></code>
    was last modified.  The time is measured in the standard UNIX
    fashion as seconds from a fixed starting time (often January 1, 1970).
    If the file doesn&#8217;t exist or its modified time cannot be queried then an
    error is generated. If <code><em>time</em></code> is given, sets the modification time
    of the file to the given value.
</p>
</dd>
<dt class="hdlist1">
<code><strong>file mtimeus</strong> <em>name ?time_us?</em></code>
</dt>
<dd>
<p>
    As for <a href="#_file"><strong><code>file</code></strong></a> <code>mtime</code> except the time value is in microseconds
    since the epoch (see also <a href="#_clock"><strong><code>clock</code></strong></a> <code>microseconds</code>).
    Note that some platforms and some filesystems don&#8217;t support high
    resolution timestamps for files.
</p>
</dd>
<dt class="hdlist1">
<code><strong>file normalize</strong> <em>name</em></code>
</dt>
<dd>
<p>
    Return the normalized path of <code><em>name</em></code>. See <em>realpath(3)</em>.
................................................................................
<p>
    Return all of the characters in <code><em>name</em></code> up to but not including
    the last <em>.</em> character in the name.  If <code><em>name</em></code> doesn&#8217;t contain
    a dot, then return <code><em>name</em></code>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>file split</strong> <em>name</em></code>
</dt>
<dd>
<p>
    Returns a list whose elements are the path components in <code><em>name</em></code>.
    The first element of the list will have the same path type as
    <code><em>name</em></code>. All other elements will be relative. Path separators
    will be discarded.
</p>
</dd>
<dt class="hdlist1">
<code><strong>file stat</strong> <em>name ?varName?</em></code>
</dt>
<dd>
<p>
    Invoke the <em>stat</em> kernel call on <code><em>name</em></code>, and return the result
    as a dictionary with the following keys: <em>atime</em>,
    <em>ctime</em>, <em>dev</em>, <em>gid</em>, <em>ino</em>, <em>mode</em>, <em>mtime</em>,
    <em>nlink</em>, <em>size</em>, <em>type</em>, <em>uid</em>, <em>mtimeus</em> (if supported - see <a href="#_file"><strong><code>file</code></strong></a> <code>mtimeus</code>)
    Each element except <em>type</em> is a decimal string with the value of
    the corresponding field from the <em>stat</em> return structure; see the
    manual entry for <em>stat</em> for details on the meanings of the values.
    The <em>type</em> element gives the type of the file in the same form
    returned by the command <a href="#_file"><strong><code>file</code></strong></a> <code>type</code>.
    If <code><em>varName</em></code> is specified, it is taken to be the name of an array
    variable and the values are also stored into the array.
................................................................................
    Return <em>1</em> if file <code><em>name</em></code> is writable by
    the current user, <em>0</em> otherwise.
</p>
</dd>
</dl></div>
<div class="paragraph"><p>The <a href="#_file"><strong><code>file</code></strong></a> commands that return 0/1 results are often used in
conditional or looping commands, for example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    if {![file exists foo]} {
        error {bad file name}
    } else {
        ...
    }</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_finalize">finalize</h3>
<div class="paragraph"><p><code><strong>finalize</strong> <em>reference ?command?</em></code></p></div>
<div class="paragraph"><p>If <code><em>command</em></code> is omitted, returns the finalizer command for the given reference.</p></div>
<div class="paragraph"><p>Otherwise, sets a new finalizer command for the given reference. <code><em>command</em></code> may be
the empty string to remove the current finalizer.</p></div>
<div class="paragraph"><p>The reference must be a valid reference create with the <a href="#_ref"><strong><code>ref</code></strong></a>
command.</p></div>
<div class="paragraph"><p>See <a href="#_garbage_collection_references_lambda_function">GARBAGE COLLECTION</a> for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_flush">flush</h3>
<div class="paragraph"><p><code><strong>flush</strong> <em>fileId</em></code></p></div>
<div class="paragraph"><p><code><em>fileId</em> <strong>flush</strong></code></p></div>
<div class="paragraph"><p>Flushes any output that has been buffered for <code><em>fileId</em></code>.  <code><em>fileId</em></code> must
have been the return value from a previous call to <a href="#_open"><strong><code>open</code></strong></a>, or it may be
................................................................................
<div class="paragraph"><p>The return value from <a href="#_format"><strong><code>format</code></strong></a> is the formatted string.</p></div>
</div>
<div class="sect2">
<h3 id="_getref">getref</h3>
<div class="paragraph"><p><code><strong>getref</strong> <em>reference</em></code></p></div>
<div class="paragraph"><p>Returns the string associated with <code><em>reference</em></code>. The reference must
be a valid reference create with the <a href="#_ref"><strong><code>ref</code></strong></a> command.</p></div>
<div class="paragraph"><p>See <a href="#_garbage_collection_references_lambda_function">GARBAGE COLLECTION</a> for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_gets">gets</h3>
<div class="paragraph"><p><code><strong>gets</strong> <em>fileId ?varName?</em></code></p></div>
<div class="paragraph"><p><code><em>fileId</em> <strong>gets</strong> <em>?varName?</em></code></p></div>
<div class="paragraph"><p>Reads the next line from the file given by <code><em>fileId</em></code> and discards
the terminating newline character.</p></div>
................................................................................
</div>
<div class="sect2">
<h3 id="_lambda">lambda</h3>
<div class="paragraph"><p><code><strong>lambda</strong> <em>args ?statics? body</em></code></p></div>
<div class="paragraph"><p>The <a href="#_lambda"><strong><code>lambda</code></strong></a> command is identical to <a href="#_proc"><strong><code>proc</code></strong></a>, except rather than
creating a named procedure, it creates an anonymous procedure and returns
the name of the procedure.</p></div>
<div class="paragraph"><p>See <a href="#_proc"><strong><code>proc</code></strong></a> and <a href="#_garbage_collection_references_lambda_function">GARBAGE COLLECTION</a> for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_lappend">lappend</h3>
<div class="paragraph"><p><code><strong>lappend</strong> <em>varName value ?value value ...?</em></code></p></div>
<div class="paragraph"><p>Treat the variable given by <code><em>varName</em></code> as a list and append each of
the <code><em>value</em></code> arguments to that list as a separate element, with spaces
between elements.</p></div>
<div class="paragraph"><p>If <code><em>varName</em></code> doesn&#8217;t exist, it is created as a list with elements given
by the <code><em>value</em></code> arguments. <a href="#_lappend"><strong><code>lappend</code></strong></a> is similar to <a href="#_append"><strong><code>append</code></strong></a> except that
each <code><em>value</em></code> is appended as a list element rather than raw text.</p></div>
<div class="paragraph"><p>This command provides a relatively efficient way to build up large lists.
For example,</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    lappend a $b</code></pre>
</div></div>
<div class="paragraph"><p>is much more efficient than</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a [concat $a [list $b]]</code></pre>
</div></div>
<div class="paragraph"><p>when <code>$a</code> is long.</p></div>
</div>
<div class="sect2">
<h3 id="_lassign">lassign</h3>
<div class="paragraph"><p><code><strong>lassign</strong> <em>list varName ?varName ...?</em></code></p></div>
<div class="paragraph"><p>This command treats the value <code><em>list</em></code> as a list and assigns successive elements from that list to
the variables given by the <code><em>varName</em></code> arguments in order. If there are more variable names than
list elements, the remaining variables are set to the empty string. If there are more list elements
than variables, a list of unassigned elements is returned.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . lassign {1 2 3} a b; puts a=$a,b=$b
    3
    a=1,b=2</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_local">local</h3>
<div class="paragraph"><p><code><strong>local</strong> <em>cmd ?arg...?</em></code></p></div>
<div class="paragraph"><p>First, <a href="#_local"><strong><code>local</code></strong></a> evaluates <code><em>cmd</em></code> with the given arguments. The return value must
be the name of an existing command, which is marked as having local scope.
................................................................................
to automatically close a filehandle.</p></div>
<div class="paragraph"><p>In addition, if a command already exists with the same name,
the existing command will be kept rather than deleted, and may be called
via <a href="#_upcall"><strong><code>upcall</code></strong></a>. The previous command will be restored when the current
procedure exits. See <a href="#_upcall"><strong><code>upcall</code></strong></a> for more details.</p></div>
<div class="paragraph"><p>In this example, a local procedure is created. Note that the procedure
continues to have global scope while it is active.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    proc outer {} {
      # proc ... returns "inner" which is marked local
      local proc inner {} {
        # will be deleted when 'outer' exits




      }

      inner
      ...
    }</code></pre>
</div></div>
<div class="paragraph"><p>In this example, the lambda is deleted at the end of the procedure rather
than waiting until garbage collection.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    proc outer {} {
      set x [lambda inner {args} {
        # will be deleted when 'outer' exits
      }]
      # Use 'function' here which simply returns $x
      local function $x




      $x ...
      ...
    }</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_loop">loop</h3>
<div class="paragraph"><p><code><strong>loop</strong> <em>var first limit ?incr? body</em></code></p></div>
<div class="paragraph"><p>Similar to <a href="#_for"><strong><code>for</code></strong></a> except simpler and possibly more efficient.
With a positive increment, equivalent to:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    for {set var $first} {$var &lt; $limit} {incr var $incr} $body</code></pre>
</div></div>
<div class="paragraph"><p>If <code><em>incr</em></code> is not specified, 1 is used.
Note that setting the loop variable inside the loop does not
affect the loop count.</p></div>
</div>
<div class="sect2">
<h3 id="_lindex">lindex</h3>
<div class="paragraph"><p><code><strong>lindex</strong> <em>list ?index &#8230;?</em></code></p></div>
<div class="paragraph"><p>Treats <code><em>list</em></code> as a Tcl list and returns element <code><em>index</em></code> from it
(0 refers to the first element of the list).
See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>index</em></code>.</p></div>
<div class="paragraph"><p>In extracting the element, <code><em>lindex</em></code> observes the same rules concerning
braces and quotes and backslashes as the Tcl command interpreter; however,
variable substitution and command substitution do not occur.</p></div>
<div class="paragraph"><p>If no index values are given, simply returns <code><em>list</em></code></p></div>
<div class="paragraph"><p>If <code><em>index</em></code> is negative or greater than or equal to the number of elements
in <code><em>list</em></code>, then an empty string is returned.</p></div>
<div class="paragraph"><p>If additional index arguments are supplied, then each argument is
................................................................................
of the <code><em>element</em></code> arguments just before the element <code><em>index</em></code>
of <code><em>list</em></code>. Each <code><em>element</em></code> argument will become
a separate element of the new list. If <code><em>index</em></code> is less than
or equal to zero, then the new elements are inserted at the
beginning of the list. If <code><em>index</em></code> is greater than or equal
to the number of elements in the list, then the new elements are
appended to the list.</p></div>
<div class="paragraph"><p>See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>index</em></code>.</p></div>
</div>
<div class="sect2">
<h3 id="_list">list</h3>
<div class="paragraph"><p><code><strong>list</strong> <em>arg ?arg ...?</em></code></p></div>
<div class="paragraph"><p>This command returns a list comprised of all the arguments, <code><em>arg</em></code>. Braces
and backslashes get added as necessary, so that the <a href="#_lindex"><strong><code>lindex</code></strong></a> command
may be used on the result to re-extract the original arguments, and also
so that <a href="#_eval"><strong><code>eval</code></strong></a> may be used to execute the resulting list, with
<code><em>arg1</em></code> comprising the command&#8217;s name and the other args comprising
its arguments. <a href="#_list"><strong><code>list</code></strong></a> produces slightly different results than
<a href="#_concat"><strong><code>concat</code></strong></a>:  <a href="#_concat"><strong><code>concat</code></strong></a> removes one level of grouping before forming
the list, while <a href="#_list"><strong><code>list</code></strong></a> works directly from the original arguments.
For example, the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    list a b {c d e} {f {g h}}</code></pre>
</div></div>
<div class="paragraph"><p>will return</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    a b {c d e} {f {g h}}</code></pre>
</div></div>
<div class="paragraph"><p>while <a href="#_concat"><strong><code>concat</code></strong></a> with the same arguments will return</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    a b c d e f {g h}</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_llength">llength</h3>
<div class="paragraph"><p><code><strong>llength</strong> <em>list</em></code></p></div>
<div class="paragraph"><p>Treats <code><em>list</em></code> as a list and returns a decimal string giving
the number of elements in it.</p></div>
................................................................................
<div class="paragraph"><p><code><strong>lset</strong> <em>varName ?index ..? newValue</em></code></p></div>
<div class="paragraph"><p>Sets an element in a list.</p></div>
<div class="paragraph"><p>The <a href="#_lset"><strong><code>lset</code></strong></a> command accepts a parameter, <code><em>varName</em></code>, which it interprets
as the name of a variable containing a Tcl list. It also accepts
zero or more indices into the list. Finally, it accepts a new value
for an element of varName. If no indices are presented, the command
takes the form:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    lset varName newValue</code></pre>
</div></div>
<div class="paragraph"><p>In this case, newValue replaces the old value of the variable
varName.</p></div>
<div class="paragraph"><p>When presented with a single index, the <a href="#_lset"><strong><code>lset</code></strong></a> command
treats the content of the varName variable as a Tcl list. It addresses
the index&#8217;th element in it (0 refers to the first element of the
list). When interpreting the list, <a href="#_lset"><strong><code>lset</code></strong></a> observes the same rules
................................................................................
interpreter; however, variable substitution and command substitution
do not occur. The command constructs a new list in which the
designated element is replaced with newValue. This new list is
stored in the variable varName, and is also the return value from
the <a href="#_lset"><strong><code>lset</code></strong></a> command.</p></div>
<div class="paragraph"><p>If index is negative or greater than or equal to the number of
elements in $varName, then an error occurs.</p></div>
<div class="paragraph"><p>See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>index</em></code>.</p></div>
<div class="paragraph"><p>If additional index arguments are supplied, then each argument is
used in turn to address an element within a sublist designated by
the previous indexing operation, allowing the script to alter
elements in sublists. The command,</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    lset a 1 2 newValue</code></pre>
</div></div>
<div class="paragraph"><p>replaces element 2 of sublist 1 with <code><em>newValue</em></code>.</p></div>
<div class="paragraph"><p>The integer appearing in each index argument must be greater than
or equal to zero. The integer appearing in each index argument must
be strictly less than the length of the corresponding list. In other
words, the <a href="#_lset"><strong><code>lset</code></strong></a> command cannot change the size of a list. If an
index is outside the permitted range, an error is reported.</p></div>
................................................................................
</div>
<div class="sect2">
<h3 id="_lmap">lmap</h3>
<div class="paragraph"><p><code><strong>lmap</strong> <em>varName list body</em></code></p></div>
<div class="paragraph"><p><code><strong>lmap</strong> <em>varList list ?varList2 list2 ...? body</em></code></p></div>
<div class="paragraph"><p><a href="#_lmap"><strong><code>lmap</code></strong></a> is a "collecting" <a href="#_foreach"><strong><code>foreach</code></strong></a> which returns a list of its results.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . lmap i {1 2 3 4 5} {expr $i*$i}
    1 4 9 16 25
    . lmap a {1 2 3} b {A B C} {list $a $b}
    {1 A} {2 B} {3 C}</code></pre>
</div></div>
<div class="paragraph"><p>If the body invokes <a href="#_continue"><strong><code>continue</code></strong></a>, no value is added for this iteration.
If the body invokes <a href="#_break"><strong><code>break</code></strong></a>, the loop ends and no more values are added.</p></div>
</div>
<div class="sect2">
<h3 id="_load">load</h3>
<div class="paragraph"><p><code><strong>load</strong> <em>filename</em></code></p></div>
................................................................................
should not be used directly. Instead it is invoked automatically by <a href="#_package"><strong><code>package</code></strong></a> <code>require</code>.</p></div>
</div>
<div class="sect2">
<h3 id="_lrange">lrange</h3>
<div class="paragraph"><p><code><strong>lrange</strong> <em>list first last</em></code></p></div>
<div class="paragraph"><p><code><em>list</em></code> must be a valid Tcl list. This command will return a new
list consisting of elements <code><em>first</em></code> through <code><em>last</em></code>, inclusive.</p></div>
<div class="paragraph"><p>See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>first</em></code> and <code><em>last</em></code>.</p></div>
<div class="paragraph"><p>If <code><em>last</em></code> is greater than or equal to the number of elements
in the list, then it is treated as if it were <code>end</code>.</p></div>
<div class="paragraph"><p>If <code><em>first</em></code> is greater than <code><em>last</em></code> then an empty string
is returned.</p></div>
<div class="paragraph"><p>Note: <code>"<a href="#_lrange"><strong><code>lrange</code></strong></a> <em>list first first</em>"</code> does not always produce the
same result as <code>"<a href="#_lindex"><strong><code>lindex</code></strong></a> <em>list first</em>"</code> (although it often does
for simple fields that aren&#8217;t enclosed in braces); it does, however,
................................................................................
<div class="paragraph"><p><code><em>first</em></code> gives the index in <code><em>list</em></code> of the first element
to be replaced.</p></div>
<div class="paragraph"><p>If <code><em>first</em></code> is less than zero then it refers to the first
element of <code><em>list</em></code>;  the element indicated by <code><em>first</em></code>
must exist in the list.</p></div>
<div class="paragraph"><p><code><em>last</em></code> gives the index in <code><em>list</em></code> of the last element
to be replaced;  it must be greater than or equal to <code><em>first</em></code>.</p></div>
<div class="paragraph"><p>See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>first</em></code> and <code><em>last</em></code>.</p></div>
<div class="paragraph"><p>The <code><em>element</em></code> arguments specify zero or more new arguments to
be added to the list in place of those that were deleted.</p></div>
<div class="paragraph"><p>Each <code><em>element</em></code> argument will become a separate element of
the list.</p></div>
<div class="paragraph"><p>If no <code><em>element</em></code> arguments are specified, then the elements
between <code><em>first</em></code> and <code><em>last</em></code> are simply deleted.</p></div>
</div>
<div class="sect2">
<h3 id="_lrepeat">lrepeat</h3>
<div class="paragraph"><p><code><strong>lrepeat</strong> <em>number element1 ?element2 ...?</em></code></p></div>
<div class="paragraph"><p>Build a list by repeating elements <code><em>number</em></code> times (which must be
a positive integer).</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . lrepeat 3 a b
    a b a b a b</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_lreverse">lreverse</h3>
<div class="paragraph"><p><code><strong>lreverse</strong> <em>list</em></code></p></div>
<div class="paragraph"><p>Returns the list in reverse order.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . lreverse {1 2 3}
    3 2 1</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_lsearch">lsearch</h3>
<div class="paragraph"><p><code><strong>lsearch</strong> <em>?options? list pattern</em></code></p></div>
<div class="paragraph"><p>This command searches the elements <code><em>list</em></code> to see if one of them matches <code><em>pattern</em></code>. If so, the
command returns the index of the first matching element (unless the options <code>-all</code>, <code>-inline</code> or <code>-bool</code> are
................................................................................
be any valid list index, such as <code>1</code>, <code>end</code> or <code>end-2</code>.</p></div>
</div>
<div class="sect2">
<h3 id="_defer">defer</h3>
<div class="paragraph"><p><code><strong>defer</strong> <em>script</em></code></p></div>
<div class="paragraph"><p>This command is a simple helper command to add a script to the <em><code>$jim::defer</code></em> variable
that will run when the current proc or interpreter exits. For example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . proc a {} { defer {puts "Leaving a"}; puts "Exit" }
    . a
    Exit
    Leaving a</code></pre>
</div></div>
<div class="paragraph"><p>If the <em><code>$jim::defer</code></em> variable exists, it is treated as a list of scripts to run
when the proc or interpreter exits.</p></div>
</div>
<div class="sect2">
<h3 id="_open">open</h3>
<div class="paragraph"><p><code><strong>open</strong> <em>fileName ?access?</em></code></p></div>
................................................................................
<h3 id="_proc">proc</h3>
<div class="paragraph"><p><code><strong>proc</strong> <em>name args ?statics? body</em></code></p></div>
<div class="paragraph"><p>The <a href="#_proc"><strong><code>proc</code></strong></a> command creates a new Tcl command procedure, <code><em>name</em></code>.
When the new command is invoked, the contents of <code><em>body</em></code> will be executed.
Tcl interpreter. <code><em>args</em></code> specifies the formal arguments to the procedure.
If specified, <code><em>statics</em></code>, declares static variables which are bound to the
procedure.</p></div>
<div class="paragraph"><p>See &lt;&lt;_procedures,PROCEDURES&gt; for detailed information about Tcl procedures.</p></div>
<div class="paragraph"><p>The <a href="#_proc"><strong><code>proc</code></strong></a> command returns <code><em>name</em></code> (which is useful with <a href="#_local"><strong><code>local</code></strong></a>).</p></div>
<div class="paragraph"><p>When a procedure is invoked, the procedure&#8217;s return value is the
value specified in a <a href="#_return"><strong><code>return</code></strong></a> command.  If the procedure doesn&#8217;t
execute an explicit <a href="#_return"><strong><code>return</code></strong></a>, then its return value is the value
of the last command executed in the procedure&#8217;s body.</p></div>
<div class="paragraph"><p>If an error occurs while executing the procedure body, then the
procedure-as-a-whole will return that same error.</p></div>
................................................................................
switch.</p></div>
<div class="paragraph"><p>Output to files is buffered internally by Tcl; the <a href="#_flush"><strong><code>flush</code></strong></a>
command may be used to force buffered characters to be output.</p></div>
</div>
<div class="sect2">
<h3 id="_pipe">pipe</h3>
<div class="paragraph"><p>Creates a pair of <a href="#_aio"><strong><code>aio</code></strong></a> channels and returns the handles as a list: <code>{read write}</code></p></div>
<div class="listingblock">
<div class="content">
<pre><code>    lassign [pipe] r w

    # Must close $w after exec
    exec ps &gt;@$w &amp;
    $w close

    $r readable ...</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_pwd">pwd</h3>
<div class="paragraph"><p><code><strong>pwd</strong></code></p></div>
<div class="paragraph"><p>Returns the path name of the current working directory.</p></div>
</div>
<div class="sect2">
................................................................................
<div class="paragraph"><p>If only one argument is given, it is interpreted as <code><em>max</em></code>.</p></div>
</div>
<div class="sect2">
<h3 id="_range">range</h3>
<div class="paragraph"><p><code><strong>range</strong> <em>?start? end ?step?</em></code></p></div>
<div class="paragraph"><p>Returns a list of integers starting at <code><em>start</em></code> (defaults to 0)
and ranging up to but not including <code><em>end</em></code> in steps of <code><em>step</em></code> defaults to 1).</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    . range 5
    0 1 2 3 4
    . range 2 5
    2 3 4
    . range 2 10 4
    2 6
    . range 7 4 -2
    7 5</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_read">read</h3>
<div class="paragraph"><p><code><strong>read</strong> ?<strong>-nonewline</strong>? <em>fileId</em></code></p></div>
<div class="paragraph"><p><code><em>fileId</em> <strong>read</strong> ?<strong>-nonewline</strong>?</code></p></div>
<div class="paragraph"><p><code><strong>read</strong> <em>fileId numBytes</em></code></p></div>
................................................................................
to <a href="#_open"><strong><code>open</code></strong></a>; it must refer to a file that was opened for reading.</p></div>
</div>
<div class="sect2">
<h3 id="_regexp">regexp</h3>
<div class="paragraph"><p><code><strong>regexp ?-nocase? ?-line? ?-indices? ?-start</strong> <em>offset</em>? <strong>?-all? ?-inline? ?--?</strong> <em>exp string ?matchVar? ?subMatchVar subMatchVar ...?</em></code></p></div>
<div class="paragraph"><p>Determines whether the regular expression <code><em>exp</em></code> matches part or
all of <code><em>string</em></code> and returns 1 if it does, 0 if it doesn&#8217;t.</p></div>
<div class="paragraph"><p>See <a href="#_regular_expressions">REGULAR EXPRESSIONS</a> above for complete information on the
syntax of <code><em>exp</em></code> and how it is matched against <code><em>string</em></code>.</p></div>
<div class="paragraph"><p>If additional arguments are specified after <code><em>string</em></code> then they
are treated as the names of variables to use to return
information about which part(s) of <code><em>string</em></code> matched <code><em>exp</em></code>.
<code><em>matchVar</em></code> will be set to the range of <code><em>string</em></code> that
matched all of <code><em>exp</em></code>. The first <code><em>subMatchVar</em></code> will contain
the characters in <code><em>string</em></code> that matched the leftmost parenthesized
................................................................................
<h3 id="_ref">ref</h3>
<div class="paragraph"><p><code><strong>ref</strong> <em>string tag ?finalizer?</em></code></p></div>
<div class="paragraph"><p>Create a new reference containing <code><em>string</em></code> of type <code><em>tag</em></code>.
If <code><em>finalizer</em></code> is specified, it is a command which will be invoked
when the a garbage collection cycle runs and this reference is
no longer accessible.</p></div>
<div class="paragraph"><p>The finalizer is invoked as:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    finalizer reference string</code></pre>
</div></div>
<div class="paragraph"><p>See <a href="#_garbage_collection_references_lambda_function">GARBAGE COLLECTION</a> for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_rename">rename</h3>
<div class="paragraph"><p><code><strong>rename</strong> <em>oldName newName</em></code></p></div>
<div class="paragraph"><p>Rename the command that used to be called <code><em>oldName</em></code> so that it
is now called <code><em>newName</em></code>.  If <code><em>newName</em></code> is an empty string
(e.g. {}) then <code><em>oldName</em></code> is deleted.  The <a href="#_rename"><strong><code>rename</code></strong></a> command
................................................................................
</div>
<div class="sect2">
<h3 id="_setref">setref</h3>
<div class="paragraph"><p><code><strong>setref</strong> <em>reference string</em></code></p></div>
<div class="paragraph"><p>Store a new string in <code><em>reference</em></code>, replacing the existing string.
The reference must be a valid reference create with the <a href="#_ref"><strong><code>ref</code></strong></a>
command.</p></div>
<div class="paragraph"><p>See <a href="#_garbage_collection_references_lambda_function">GARBAGE COLLECTION</a> for more detail.</p></div>
</div>
<div class="sect2">
<h3 id="_signal">signal</h3>
<div class="paragraph"><p>Command for signal handling.</p></div>
<div class="paragraph"><p>See <a href="#_kill"><strong><code>kill</code></strong></a> for the different forms which may be used to specify signals.</p></div>
<div class="paragraph"><p>Commands which return a list of signal names do so using the canonical form:
"<code>SIGINT SIGTERM</code>".</p></div>
................................................................................
    being ignored.
    If signals are specified, these are added to the list of signals
    currently being ignored. These signals are still delivered, but
    are not considered by <a href="#_catch"><strong><code>catch</code></strong></a> <code>-signal</code> or <a href="#_try"><strong><code>try</code></strong></a> <code>-signal</code>. Use
    <a href="#_signal"><strong><code>signal</code></strong></a> <code>check</code> to determine which signals have occurred but
    been ignored.
</p>
</dd>
<dt class="hdlist1">
<code><strong>signal block</strong> ?<em>signals ...</em>?</code>
</dt>
<dd>
<p>
    If no signals are given, returns a lists all signals which are currently
    being blocked.
    If signals are specified, these are added to the list of signals
    currently being blocked. These signals are not delivered to the process.
    This can be useful for signals such as <code>SIGPIPE</code>, especially in conjunction
    with <a href="#_exec"><strong><code>exec</code></strong></a> as child processes inherit the parent&#8217;s signal disposition.
</p>
</dd>
<dt class="hdlist1">
<code><strong>signal default</strong> ?<em>signals ...</em>?</code>
</dt>
<dd>
<p>
    If no signals are given, returns a lists all signals which currently have
    the default behaviour.
    If signals are specified, these are added to the list of signals which have
    the default behaviour.
</p>
</dd>
<dt class="hdlist1">
<code><strong>signal check ?-clear?</strong> ?<em>signals ...</em>?</code>
................................................................................
<code><strong>signal throw</strong> ?<em>signal</em>?</code>
</dt>
<dd>
<p>
    Raises the given signal, which defaults to <code>SIGINT</code> if not specified.
    The behaviour is identical to:
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content">
<pre><code>    kill signal [pid]</code></pre>
</div></div>
<div class="paragraph"><p>Note that <a href="#_signal"><strong><code>signal</code></strong></a> <code>handle</code> and <a href="#_signal"><strong><code>signal</code></strong></a> <code>ignore</code> represent two forms of signal
handling. <a href="#_signal"><strong><code>signal</code></strong></a> <code>handle</code> is used in conjunction with <a href="#_catch"><strong><code>catch</code></strong></a> <code>-signal</code> or <a href="#_try"><strong><code>try</code></strong></a> <code>-signal</code>
to immediately abort execution when the signal is delivered. Alternatively, <a href="#_signal"><strong><code>signal</code></strong></a> <code>ignore</code>
is used in conjunction with <a href="#_signal"><strong><code>signal</code></strong></a> <code>check</code> to handle signal synchronously. Consider the
two examples below.</p></div>
<div class="paragraph"><p>Prevent a processing from taking too long</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    signal handle SIGALRM
    alarm 20
    try -signal {
        .. possibly long running process ..
        alarm 0
    } on signal {sig} {
        puts stderr "Process took too long"
    }</code></pre>
</div></div>
<div class="paragraph"><p>Handle SIGHUP to reconfigure:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    signal ignore SIGHUP
    while {1} {
        ... handle configuration/reconfiguration ...
        while {[signal check -clear SIGHUP] eq ""} {
            ... do processing ..
        }
        # Received SIGHUP, so reconfigure
    }</code></pre>
</div></div>
<div class="paragraph"><p>Note: signal handling is currently not supported in child interpreters.
In these interpreters, the signal command does not exist.</p></div>
</div>
<div class="sect2">
<h3 id="_sleep">sleep</h3>
<div class="paragraph"><p><code><strong>sleep</strong> <em>seconds</em></code></p></div>
................................................................................
<div class="paragraph"><p>Empty list elements will be generated if <code><em>string</em></code> contains
adjacent characters in <code><em>splitChars</em></code>, or if the first or last
character of <code><em>string</em></code> is in <code><em>splitChars</em></code>.</p></div>
<div class="paragraph"><p>If <code><em>splitChars</em></code> is an empty string then each character of
<code><em>string</em></code> becomes a separate element of the result list.</p></div>
<div class="paragraph"><p><code><em>splitChars</em></code> defaults to the standard white-space characters.
For example,</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    split "comp.unix.misc" .</code></pre>
</div></div>
<div class="paragraph"><p>returns <code><em>"comp unix misc"</em></code> and</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    split "Hello world" {}</code></pre>
</div></div>
<div class="paragraph"><p>returns <code><em>"H e l l o { } w o r l d"</em></code>.</p></div>
</div>
<div class="sect2">
<h3 id="_stackdump">stackdump</h3>
<div class="paragraph"><p><code><strong>stackdump</strong> <em>stacktrace</em></code></p></div>
<div class="paragraph"><p>Creates a human readable representation of a stack trace.</p></div>
................................................................................
<code><strong>string bytelength</strong> <em>string</em></code>
</dt>
<dd>
<p>
    Returns the length of the string in bytes. This will return
    the same value as <a href="#_string"><strong><code>string</code></strong></a> <code>length</code> if UTF-8 support is not enabled,
    or if the string is composed entirely of ASCII characters.
    See <a href="#_utf_8_and_unicode">UTF-8 AND UNICODE</a>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string byterange</strong> <em>string first last</em></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>firstIndex</em></code>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string index</strong> <em>string charIndex</em></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>charIndex</em></code>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string is</strong> <em>class</em> ?<strong>-strict</strong>? <em>string</em></code>
</dt>
<dd>
<p>
................................................................................
</dl></div>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    Note that string classification does <code><em>not</em></code> respect UTF-8. See <a href="#_utf_8_and_unicode">UTF-8 AND UNICODE</a>.
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>lastIndex</em></code>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string length</strong> <em>string</em></code>
</dt>
<dd>
<p>
    Returns a decimal string giving the number of characters in <code><em>string</em></code>.
    If UTF-8 support is enabled, this may be different than the number of bytes.
    See <a href="#_utf_8_and_unicode">UTF-8 AND UNICODE</a>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>string map ?-nocase?</strong> <em>mapping string</em></code>
</dt>
<dd>
<p>
................................................................................
    replaced with its corresponding value.  If <code>-nocase</code> is specified, then
    matching is done without regard to case differences. Both key and value may
    be multiple characters.  Replacement is done in an ordered manner, so the
    key appearing first in the list will be checked first, and so on. <code><em>string</em></code> is
    only iterated over once, so earlier key replacements will have no affect for
    later key matches. For example,
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content">
<pre><code>      string map {abc 1 ab 2 a 3 1 0} 1abcaababcabababc</code></pre>
</div></div>

<div class="dlist"><dl>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    will return the string <code>01321221</code>.
</p>
................................................................................
 
</dt>
<dd>
<p>
    Note that if an earlier key is a prefix of a later one, it will completely mask the later
    one.  So if the previous example is reordered like this,
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content">
<pre><code>      string map {1 0 ab 2 a 3 abc 1} 1abcaababcabababc</code></pre>
</div></div>

<div class="dlist"><dl>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    it will return the string <code>02c322c222c</code>.
</p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
    See <a href="#_string_and_list_index_specifications">STRING AND LIST INDEX SPECIFICATIONS</a> for all allowed forms for <code><em>first</em></code> and <code><em>last</em></code>.
</p>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
................................................................................
specified, then the corresponding substitutions are not performed.
For example, if <code>-nocommands</code> is specified, no command substitution
is performed: open and close brackets are treated as ordinary
characters with no special interpretation.</p></div>
<div class="paragraph"><p><strong>Note</strong>: when it performs its substitutions, subst does not give any
special treatment to double quotes or curly braces. For example,
the following script returns <code>xyz {44}</code>, not <code>xyz {$a}</code>.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set a 44
    subst {xyz {$a}}</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_switch">switch</h3>
<div class="paragraph"><p><code><strong>switch</strong> <em>?options? string pattern body ?pattern body ...?</em></code></p></div>
<div class="paragraph"><p><code><strong>switch</strong> <em>?options? string {pattern body ?pattern body ...?}</em></code></p></div>
<div class="paragraph"><p>The <a href="#_switch"><strong><code>switch</code></strong></a> command matches its string argument against each of
................................................................................
some cases.</p></div>
<div class="paragraph"><p>If a body is specified as <code>-</code> it means that the body for the next
pattern should also be used as the body for this pattern (if the
next pattern also has a body of <code>-</code> then the body after that is
used, and so on). This feature makes it possible to share a single
body among several patterns.</p></div>
<div class="paragraph"><p>Below are some examples of <a href="#_switch"><strong><code>switch</code></strong></a> commands:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    switch abc a - b {format 1} abc {format 2} default {format 3}</code></pre>
</div></div>
<div class="paragraph"><p>will return 2,</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    switch -regexp aaab {
           ^a.*b$ -
           b {format 1}
           a* {format 2}
           default {format 3}
    }</code></pre>
</div></div>
<div class="paragraph"><p>will return 1, and</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    switch xyz {
           a -
           b {format 1}
           a* {format 2}
           default {format 3}
    }</code></pre>
</div></div>
<div class="paragraph"><p>will return 3.</p></div>
</div>
<div class="sect2">
<h3 id="_tailcall">tailcall</h3>
<div class="paragraph"><p><code><strong>tailcall</strong> <em>cmd ?arg...?</em></code></p></div>
<div class="paragraph"><p>The <a href="#_tailcall"><strong><code>tailcall</code></strong></a> command provides an optimised way of invoking a command whilst replacing
the current call frame. This is similar to <em>exec</em> in Bourne Shell.</p></div>
<div class="paragraph"><p>The following are identical except the first immediately replaces the current call frame.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  tailcall a b c</code></pre>
</div></div>
<div class="listingblock">
<div class="content">
<pre><code>  return [uplevel 1 [list a b c]]</code></pre>
</div></div>
<div class="paragraph"><p><a href="#_tailcall"><strong><code>tailcall</code></strong></a> is useful as a dispatch mechanism:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>  proc a {cmd args} {
    tailcall sub_$cmd {*}$args
  }
  proc sub_cmd1 ...
  proc sub_cmd2 ...</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_tell">tell</h3>
<div class="paragraph"><p><code><strong>tell</strong> <em>fileId</em></code></p></div>
<div class="paragraph"><p><code><em>fileId</em> <strong>tell</strong></code></p></div>
<div class="paragraph"><p>Returns a decimal string giving the current access position in
................................................................................
</div>
<div class="sect2">
<h3 id="_time">time</h3>
<div class="paragraph"><p><code><strong>time</strong> <em>command ?count?</em></code></p></div>
<div class="paragraph"><p>This command will call the Tcl interpreter <code><em>count</em></code>
times to execute <code><em>command</em></code> (or once if <code><em>count</em></code> isn&#8217;t
specified).  It will then return a string of the form</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    503 microseconds per iteration</code></pre>
</div></div>
<div class="paragraph"><p>which indicates the average amount of time required per iteration,
in microseconds.</p></div>
<div class="paragraph"><p>Time is measured in elapsed time, not CPU time.</p></div>
</div>
<div class="sect2">
<h3 id="_try">try</h3>
................................................................................
case where an exception occurs in a matching <em>on</em> handler script or the <em>finally</em> script,
in which case the result is this new exception.</p></div>
<div class="paragraph"><p>The specified <code><em>returncodes</em></code> is a list of return codes either as names (<em>ok</em>, <em>error</em>, <em>break</em>, etc.)
or as integers.</p></div>
<div class="paragraph"><p>If <code><em>resultvar</em></code> and <code><em>optsvar</em></code> are specified, they are set as for <a href="#_catch"><strong><code>catch</code></strong></a> before evaluating
the matching handler.</p></div>
<div class="paragraph"><p>For example:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set f [open input]
    try -signal {
        process $f
    } on {continue break} {} {
        error "Unexpected break/continue"
    } on error {msg opts} {
        puts "Dealing with error"
        return {*}$opts $msg
    } on signal sig {
        puts "Got signal: $sig"
    } finally {
        $f close
    }</code></pre>
</div></div>
<div class="paragraph"><p>If break, continue or error are raised, they are dealt with by the matching
handler.</p></div>
<div class="paragraph"><p>In any case, the file will be closed via the <em>finally</em> clause.</p></div>
<div class="paragraph"><p>See also <a href="#_throw"><strong><code>throw</code></strong></a>, <a href="#_catch"><strong><code>catch</code></strong></a>, <a href="#_return"><strong><code>return</code></strong></a>, <a href="#_error"><strong><code>error</code></strong></a>.</p></div>
</div>
<div class="sect2">
................................................................................
in the variable context of <em>b</em>.  If <code><em>level</em></code> is <code>2</code> or <code>#1</code>
then the command will be executed in the variable context of <em>a</em>.</p></div>
<div class="paragraph"><p>If <code><em>level</em></code> is <em>3</em> or <code>#0</code> then the command will be executed
at top-level (only global variables will be visible).
The <a href="#_uplevel"><strong><code>uplevel</code></strong></a> command causes the invoking procedure to disappear
from the procedure calling stack while the command is being executed.
In the above example, suppose <em>c</em> invokes the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    uplevel 1 {set x 43; d}</code></pre>
</div></div>
<div class="paragraph"><p>where <em>d</em> is another Tcl procedure.  The <a href="#_set"><strong><code>set</code></strong></a> command will
modify the variable <em>x</em> in <em>b&#8217;s context, and 'd</em> will execute
at level 3, as if called from <em>b</em>.  If it in turn executes
the command</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    uplevel {set x 42}</code></pre>
</div></div>
<div class="paragraph"><p>then the <a href="#_set"><strong><code>set</code></strong></a> command will modify the same variable <em>x</em> in <em>b&#8217;s
context:  the procedure 'c</em> does not appear to be on the call stack
when <em>d</em> is executing.  The command <a href="#_info"><strong><code>info</code></strong></a> <code>level</code> may
be used to obtain the level of the current procedure.</p></div>
<div class="paragraph"><p><a href="#_uplevel"><strong><code>uplevel</code></strong></a> makes it possible to implement new control
constructs as Tcl procedures (for example, <a href="#_uplevel"><strong><code>uplevel</code></strong></a> could
................................................................................
an ordinary variable.</p></div>
<div class="paragraph"><p><a href="#_upvar"><strong><code>upvar</code></strong></a> may only be invoked from within procedures.</p></div>
<div class="paragraph"><p><a href="#_upvar"><strong><code>upvar</code></strong></a> returns an empty string.</p></div>
<div class="paragraph"><p>The <a href="#_upvar"><strong><code>upvar</code></strong></a> command simplifies the implementation of call-by-name
procedure calling and also makes it easier to build new control constructs
as Tcl procedures.
For example, consider the following procedure:</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    proc add2 name {
        upvar $name x
        set x [expr $x+2]
    }</code></pre>
</div></div>
<div class="paragraph"><p><em>add2</em> is invoked with an argument giving the name of a variable,
and it adds two to the value of that variable.
Although <em>add2</em> could have been implemented using <a href="#_uplevel"><strong><code>uplevel</code></strong></a>
instead of <a href="#_upvar"><strong><code>upvar</code></strong></a>, <a href="#_upvar"><strong><code>upvar</code></strong></a> makes it simpler for <em>add2</em>
to access the variable in the caller&#8217;s procedure frame.</p></div>
</div>
................................................................................
<dt class="hdlist1">
<code><strong>os.getids</strong></code>
</dt>
<dd>
<p>
    Returns the various user/group ids for the current process.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content">
<pre><code>    . os.getids
    uid 1000 euid 1000 gid 100 egid 100</code></pre>
</div></div>

<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>os.uptime</strong></code>
</dt>
<dd>
<p>
    Returns the number of seconds since system boot. See description of <em>uptime</em> in <em>sysinfo(2)</em>.
</p>
................................................................................
<dt class="hdlist1">
<code>$handle <strong>accept</strong> ?addrvar?</code>
</dt>
<dd>
<p>
    Server socket only: Accept a connection and return stream.
    If <code><em>addrvar</em></code> is specified, the address of the connected client is stored
    in the named variable in the form <em>addr:port</em> for IP sockets or <em>path</em> for Unix domain sockets.
    See <a href="#_socket"><strong><code>socket</code></strong></a> for details.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>buffering none|line|full</strong></code>
</dt>
<dd>
<p>
    Sets the buffering mode of the stream.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>close ?r(ead)|w(rite)|-nodelete?</strong></code>
</dt>
<dd>
<p>
    Closes the stream.
    The <code><em>read</em></code> and <code><em>write</em></code> arguments perform a "half-close" on a socket. See the <em>shutdown(2)</em> man page.
    The <code><em>-nodelete</em></code> option is applicable only for Unix domain sockets. It closes the socket
    but does not delete the bound path (e.g. after <a href="#cmd_1"><strong><code>os.fork</code></strong></a>).
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>copyto</strong> <em>tofd ?size?</em></code>
</dt>
<dd>
<p>
................................................................................
</dt>
<dd>
<p>
    Returns 1 if the stream is a tty device.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>lock ?-wait?</strong></code>
</dt>
<dd>
<p>
    Apply a POSIX lock to the open file associated with the handle using
    <em>fcntl(F_SETLK)</em>, or <em>fcntl(F_SETLKW)</em> to wait for the lock to be available if <code><em>-wait</em></code>
    is specified.
    The handle must be open for write access.
    Returns 1 if the lock was successfully obtained, 0 otherwise.
    An error occurs if the handle is not suitable for locking (e.g.
    if it is not open for write)
</p>
</dd>
<dt class="hdlist1">
................................................................................
</dt>
<dd>
<p>
    Set O_NDELAY (if arg). Returns current/new setting.
    Note that in general ANSI I/O interacts badly with non-blocking I/O.
    Use with care.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>peername</strong></code>
</dt>
<dd>
<p>
    Returns the remote address or path of the connected socket. See <em>getpeername(2)</em>.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>puts ?-nonewline?</strong> <em>str</em></code>
</dt>
<dd>
<p>
    Write the string, with newline unless -nonewline
................................................................................
</dd>
<dt class="hdlist1">
<code>$handle <strong>recvfrom</strong> <em>maxlen ?addrvar?</em></code>
</dt>
<dd>
<p>
    Receives a message from the handle via recvfrom(2) and returns it.
    At most <code><em>maxlen</em></code> bytes are read. If <code><em>addrvar</em></code> is specified, the sending address
    of the message is stored in the named variable in the form <em>addr:port</em> for IP sockets
    or <em>path</em> for Unix domain sockets. See <a href="#_socket"><strong><code>socket</code></strong></a> for details.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>seek</strong> <em>offset</em> <strong>?start|current|end?</strong></code>
</dt>
<dd>
<p>
    Seeks in the stream (default <em>current</em>)
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>sendto</strong> <em>str ?address</em></code>
</dt>
<dd>
<p>
    Sends the string, <code><em>str</em></code>, to the given address (host:port or path) via the socket using <em>sendto(2)</em>.
    This is intended for udp/dgram sockets and may give an error or behave in unintended
    ways for other handle types.
    Returns the number of bytes written.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>sockname</strong></code>
</dt>
<dd>
<p>
    Returns the bound address or path of the socket. See <em>getsockname(2)</em>.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>sockopt</strong> <em>?name value?</em></code>
</dt>
<dd>
<p>
    With no arguments, returns a dictionary of socket options currently set for the handle
    (will be empty for a non-socket). With <code><em>name</em></code> and <code><em>value</em></code>, sets the socket option
    to the given value. Currently supports the following boolean socket options:
    <code>broadcast, debug, keepalive, nosigpipe, oobinline, tcp_nodelay</code>, and the following
    integer socket options: <code>sndbuf, rcvbuf</code>
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>sync</strong></code>
</dt>
<dd>
<p>
    Flush the stream, then <em>fsync(2)</em> to commit any changes to storage.
    Only available on platforms that support <em>fsync(2)</em>.
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>tell</strong></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code>$handle <strong>tty</strong> ?settings?</code>
</dt>
<dd>
<p>
    If no arguments are given, returns a dictionary containing the tty settings for the stream.
    If arguments are given, they must either be a dictionary, or <code>setting value ...</code>
    Abbrevations are supported for both settings and values, so the following is acceptable:
    <code>$f tty parity e input c out raw</code>.
    Only available on platforms that support <em>termios(3)</em>. Supported settings are:
</p>
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>baud</strong> <em>rate</em></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code><strong>handshake xonxoff|rtscts|none</strong></code>
</dt>
<dd>
<p>
        Handshaking type
</p>
</dd>
<dt class="hdlist1">
<code><strong>input raw|cooked</strong></code>
</dt>
<dd>
<p>
        Input character processing. In raw mode, the usual key sequences such as ^C do
        not generate signals.
</p>
</dd>
<dt class="hdlist1">
<code><strong>output raw|cooked</strong></code>
</dt>
<dd>
<p>
        Output character processing. Typically CR &#8594; CRNL is disabled in raw mode.
</p>
</dd>
<dt class="hdlist1">
<code><strong>echo 0|1</strong></code>
</dt>
<dd>
<p>
        Disable or enable echo on input. Note that this is a set-only value.
        Setting <code>input</code> to <code>raw</code> or <code>cooked</code> will overwrite this setting.
</p>
</dd>
<dt class="hdlist1">
<code><strong>vmin</strong> <em>numchars</em></code>
</dt>
<dd>
<p>
        Minimum number of characters to read.
</p>
</dd>
<dt class="hdlist1">
<code><strong>vtime</strong> <em>time</em></code>
</dt>
<dd>
<p>
        Timeout for noncanonical read (units of 0.1 seconds)
</p>
</dd>
</dl></div>
</dd>
<dt class="hdlist1">
<code>$handle <strong>ssl</strong> ?<strong>-server</strong> <em>cert priv</em>?</code>
</dt>
<dd>
<p>
    Upgrades the stream to a SSL/TLS session and returns the handle.
</p>
</dd>
<dt class="hdlist1">
................................................................................
<div class="paragraph"><p>Various socket types may be created.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>socket unix</strong> <em>path</em></code>
</dt>
<dd>
<p>
    A unix domain socket client connected to <em>path</em>
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket unix.server</strong> <em>path</em></code>
</dt>
<dd>
<p>
    A unix domain socket server listening on <em>path</em>
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket unix.dgram</strong> <em>?path?</em></code>
</dt>
<dd>
<p>
    A unix domain socket datagram client, optionally connected to <em>path</em>
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket unix.dgram.server</strong> <em>path</em></code>
</dt>
<dd>
<p>
    A unix domain socket datagram server server listening on <em>path</em>
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket ?-ipv6? stream</strong> <em>addr:port</em></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket pipe</strong></code>
</dt>
<dd>
<p>
    A synonym for <a href="#_pipe"><strong><code>pipe</code></strong></a>
</p>
</dd>
<dt class="hdlist1">
<code><strong>socket pair</strong></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
</dl></div>
<div class="paragraph"><p>This command creates a socket connected (client) or bound (server) to the given
address.</p></div>
<div class="paragraph"><p>The returned value is channel and may generally be used with the various file I/O
commands (gets, puts, read, etc.), either as object-based syntax or Tcl-compatible syntax.</p></div>
<div class="listingblock">
<div class="content">

<pre><code>    . set f [socket stream www.google.com:80]
    aio.sockstream1




    . $f puts -nonewline "GET / HTTP/1.0\r\n\r\n"




    . $f gets
    HTTP/1.0 302 Found




    . $f close</code></pre>


</div></div>
<div class="paragraph"><p>Server sockets, however support only <em>accept</em>, which is most useful in conjunction with
the EVENTLOOP API.</p></div>
<div class="listingblock">
<div class="content">
<pre><code>    set f [socket stream.server 80]
    $f readable {
        set client [$f accept]
        $client gets $buf
        ...
        $client puts -nonewline "HTTP/1.1 404 Not found\r\n"
        $client close
    }
    vwait done</code></pre>
</div></div>
<div class="paragraph"><p>The address, <code><em>addr</em></code>, can be given in one of the following forms:</p></div>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
For IPv4 socket types, an IPv4 address such as 192.168.1.1
</p>
................................................................................
</p>
</li>
</ol></div>
<div class="paragraph"><p>Note that on many systems, listening on an IPv6 address such as [::] will
also accept requests via IPv4.</p></div>
<div class="paragraph"><p>Where a hostname is specified, the <code><em>first</em></code> returned address is used
which matches the socket type is used.</p></div>
<div class="paragraph"><p>An unconnected dgram socket (either <em>dgram</em> or <em>unix.dgram</em>) must use
<code>sendto</code> to specify the destination address.</p></div>
<div class="paragraph"><p>The path for Unix domain sockets is automatically removed when the socket
is closed. Use <a href="#_close"><strong><code>close</code></strong></a> <code>-nodelete</code> in the rare case where this behaviour
should be avoided (e.g. after <a href="#cmd_1"><strong><code>os.fork</code></strong></a>).</p></div>










</div>
<div class="sect2">
<h3 id="_syslog">syslog</h3>
<div class="paragraph"><p><code><strong>syslog</strong> <em>?options? ?priority? message</em></code></p></div>
<div class="paragraph"><p>This  command sends message to system syslog facility with given
priority. Valid priorities are:</p></div>
<div class="literalblock">
................................................................................
</div>
<div class="sect2">
<h3 id="_binary">binary</h3>
<div class="paragraph"><p>The optional, pure-Tcl <em>binary</em> extension provides the Tcl-compatible <a href="#_binary"><strong><code>binary</code></strong></a> <code>scan</code> and <a href="#_binary"><strong><code>binary</code></strong></a> <code>format</code>
commands based on the low-level <a href="#cmd_3"><strong><code>pack</code></strong></a> and <a href="#cmd_3"><strong><code>unpack</code></strong></a> commands.</p></div>
<div class="paragraph"><p>See the Tcl documentation at: <a href="http://www.tcl.tk/man/tcl8.5/TclCmd/binary.htm">http://www.tcl.tk/man/tcl8.5/TclCmd/binary.htm</a></p></div>
<div class="paragraph"><p>Note that <em>binary format</em> with f/r/R specifiers (single-precision float) uses the value of Infinity
in case of overflow.</p></div>
</div>
<div class="sect2">
<h3 id="cmd_4">oo: class, super</h3>
<div class="paragraph"><p>The optional, pure-Tcl <em>oo</em> extension provides object-oriented (OO) support for Jim Tcl.</p></div>
<div class="paragraph"><p>See the online documentation (<a href="http://jim.tcl.tk/index.html/doc/www/www/documentation/oo/">http://jim.tcl.tk/index.html/doc/www/www/documentation/oo/</a>) for more details.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
................................................................................
<div class="paragraph"><p>In the interactive shell, press &lt;TAB&gt; to activate command line completion.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>tcl::autocomplete</strong> <em>commandline</em></code>
</dt>
<dd>
<p>
    This command is called with the current command line when the user presses &lt;TAB&gt;.
    The command should return a list of all possible command lines that match the current command line.
    For example if <code><strong>pr</strong></code> is the current command line, the list <code><strong>{prefix proc}</strong></code> may be returned.
</p>
</dd>
</dl></div>
</div>
<div class="sect2">
<h3 id="_history">history</h3>
<div class="paragraph"><p>The optional history extension provides script access to the command line editing
................................................................................
</dd>
<dt class="hdlist1">
<code><strong>history completion</strong> <em>command</em></code>
</dt>
<dd>
<p>
    Sets an autocompletion command (see <a href="#_tcl_autocomplete"><strong><code>tcl::autocomplete</code></strong></a>) that is active during <a href="#_history"><strong><code>history</code></strong></a> <code>getline</code>.
    If the command is empty, autocompletion is disabled.
</p>
</dd>
<dt class="hdlist1">
<code><strong>history add</strong> <em>line</em></code>
</dt>
<dd>
<p>
................................................................................
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>interp</strong></code>
</dt>
<dd>
<p>
    Creates and returns a new interpreter object (command).
    The created interpeter contains any built-in commands along with static extensions,
    but does not include any dynamically loaded commands (package require, load).
    These must be reloaded in the child interpreter if required.
</p>
</dd>
<dt class="hdlist1">
<code><strong>$interp delete</strong></code>
</dt>
<dd>
<p>
................................................................................
</p>
</dd>
<dt class="hdlist1">
<code><strong>$interp eval</strong> <em>script</em> &#8230;</code>
</dt>
<dd>
<p>
    Evaluates a script in the context for the child interpreter, in the same way as <em>eval</em>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>$interp alias</strong> <em>alias childcmd parentcmd ?arg &#8230;?</em></code>
</dt>
<dd>
<p>
    Similar to <em>alias</em>, but creates a command, <code><em>childcmd</em></code>, in the child interpreter that is an
    alias for <code><em>parentcmd</em></code> in the parent interpreter, with the given, fixed arguments.
    The alias may be deleted in the child with <em>rename</em>.
</p>
</dd>
</dl></div>
</div>
<div class="sect2">
<h3 id="_json_encode">json::encode</h3>
<div class="paragraph"><p>The Tcl &#8594; JSON encoder is part of the optional <em>json</em> package.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>json::encode</strong> <em>value ?schema?</em></code>
</dt>
<dd>
<p>
Encode a Tcl value as JSON according to the schema (defaults to <code><em>str</em></code>). The following schema types are supported:
</p>
<div class="ulist"><ul>
<li>
<p>
<em>str</em> - Tcl string &#8594; JSON string
</p>
</li>
<li>
<p>
<em>num</em> - Tcl value &#8594; bare numeric value or null
</p>
</li>
<li>
<p>
<em>bool</em> - Tcl boolean value &#8594; true, false
</p>
</li>
<li>
<p>
<em>obj ?name subschema &#8230;?</em> - Tcl dict &#8594; JSON object. For each dict key matching <em>name</em>, the corresponding <em>subschema</em>
is applied. The special name <code><em>*</em></code> matches any keys not otherwise matched, otherwise the default <code><em>str</em></code> is used.
</p>
</li>
<li>
<p>
<em>list ?subschema?</em> - Tcl list &#8594; JSON array. The <em>subschema</em> (default <code><em>str</em></code>) is applied for each element of the list/array.
</p>
</li>
<li>
<p>
<em>mixed ?subschema &#8230;?</em> = Tcl list &#8594; JSON array. Each <em>subschema</em> is applied for the corresponding element of the list/array.
</p>
</li>
</ul></div>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
The following are examples:
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content">
<pre><code>    . json::encode {1 2 true false null 5.0} list
    [ "1", "2", "true", "false", "null", "5.0" ]
    . json::encode {1 2 true false null 5.0} {list num}
    [ 1, 2, true, false, null, 5.0 ]
    . json::encode {0 1 2 true false 5.0 off} {list bool}
    [ false, true, true, true, false, true, false ]
    . json::encode {a 1 b hello c {3 4}} obj
    { "a":"1", "b":"hello", "c":"3 4" }
    . json::encode {a 1 b hello c {3 4}} {obj a num c {list num}}
    { "a":1, "b":"hello", "c":[ 3, 4 ] }
    . json::encode {true true {abc def}} {mixed str num obj}
    [ "true", true, { "abc":"def" } ]
    . json::encode {a 1 b 3.0 c hello d null} {obj c str * num}
    { "a":1, "b":3.0, "c":"hello", "d":null }</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_json_decode">json::decode</h3>
<div class="paragraph"><p>The JSON &#8594; Tcl decoder is part of the optional <em>json</em> package.</p></div>
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>json::decode</strong> ?<strong>-index</strong>? ?<strong>-null</strong> <em>string</em>? ?<strong>-schema</strong>? <em>json-string</em></code>
</dt>
<dd>
<p>
Decodes the given JSON string (must be array or object) into a Tcl data structure. If <em><code>-index</code></em> is specified,
decodes JSON arrays as dictionaries with numeric keys. This makes it possible to retrieve data from nested
arrays and dictionaries with just <em><code>dict get</code></em>. With the option <em><code>-schema</code></em> returns a list of <code><em>{data schema}</em></code>
where the schema is compatible with <a href="#_json_encode"><strong><code>json::encode</code></strong></a>. Otherwise just returns the data.
Decoding is as follows (with schema types listed in parentheses):
</p>
<div class="ulist"><ul>
<li>
<p>
object &#8594; dict (<em>obj</em>)
</p>
</li>
<li>
<p>
array &#8594; list (<em>mixed</em> or <em>list</em>)
</p>
</li>
<li>
<p>
number &#8594; as-is (<em>num</em>)
</p>
</li>
<li>
<p>
boolean &#8594; as-is (<em>bool</em>)
</p>
</li>
<li>
<p>
string &#8594; string (<em>str</em>)
</p>
</li>
<li>
<p>
null &#8594; supplied null string or the default <code><em>"null"</em></code> (<em>num</em>)
</p>
</li>
</ul></div>
</dd>
<dt class="hdlist1">
 
</dt>
<dd>
<p>
 Note that an object decoded into a dict will return the keys in the same order as the original string.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content">
<pre><code>    . json::decode {[1, 2]}
    {1 2}
    . json::decode -schema {[1, 2]}
    {1 2} {list num}
    . json::decode -schema {{"a":1, "b":2}}
    {a 1 b 2} {obj a num b num}
    . json::decode -schema {[1, 2, {a:"b", c:false}, "hello"]}
    {1 2 {a b c false} hello} {mixed num num {obj a str c bool} str}
    . json::decode -index {["foo", "bar"]}
    {0 foo 1 bar}</code></pre>
</div></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="BuiltinVariables">BUILT-IN VARIABLES</h2>
<div class="sectionbody">
<div class="paragraph"><p>The following global variables are created automatically
................................................................................
</dt>
<dd>
<p>
    This variable is set by Jim as an array containing information
    about the platform upon which Jim was built. The following is an
    example of the contents of this array.
</p>
</dd>
</dl></div>
<div class="listingblock">
<div class="content">
<pre><code>    tcl_platform(byteOrder)     = littleEndian
    tcl_platform(engine)        = Jim
    tcl_platform(os)            = Darwin
    tcl_platform(platform)      = unix
    tcl_platform(pointerSize)   = 8
    tcl_platform(threaded)      = 0
    tcl_platform(wordSize)      = 8
    tcl_platform(pathSeparator) = :</code></pre>
</div></div>

<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>argv0</strong></code>
</dt>
<dd>
<p>
    If jimsh is invoked to run a script, this variable contains the name
    of the script.
................................................................................
<div class="dlist"><dl>
<dt class="hdlist1">
<code><strong>jim::defer</strong></code>
</dt>
<dd>
<p>
    If this variable is set, it is considered to be a list of scripts to evaluate
    when the current proc exits (local variables), or the interpreter exits (global variable).
    See <a href="#_defer"><strong><code>defer</code></strong></a>.
</p>
</dd>
<dt class="hdlist1">
<code><strong>history::multiline</strong></code>
</dt>
<dd>
<p>
    If this variable is set to "1", interactive line editing operates in multiline mode.
    That is, long lines will wrap across multiple lines rather than scrolling within a
    single line.
</p>
</dd>
</dl></div>
</div>
</div>
<div class="sect1">
<h2 id="_changes_in_previous_releases">CHANGES IN PREVIOUS RELEASES</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_in_v0_74">In v0.74</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Numbers with leading zeros are treated as decimal, not octal
</p>
</li>
<li>
<p>
Add <a href="#_aio"><strong><code>aio</code></strong></a> <code>isatty</code>
</p>
</li>
<li>
<p>
Add LFS (64 bit) support for <a href="#_aio"><strong><code>aio</code></strong></a> <code>seek</code>, <a href="#_aio"><strong><code>aio</code></strong></a> <code>tell</code>, <a href="#_aio"><strong><code>aio</code></strong></a> <code>copyto</code>, <a href="#_file"><strong><code>file</code></strong></a> <code>copy</code>
</p>
</li>
<li>
<p>
<a href="#_string"><strong><code>string</code></strong></a> <code>compare</code> and <a href="#_string"><strong><code>string</code></strong></a> <code>equal</code> now support <em>-length</em>
</p>
</li>
<li>
<p>
<a href="#_glob"><strong><code>glob</code></strong></a> now supports <em>-directory</em>
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_in_v0_73">In v0.73</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Built-in regexp now support non-capturing parentheses: (?:&#8230;)
</p>
</li>
<li>
<p>
Add <a href="#_string"><strong><code>string</code></strong></a> <code>replace</code>
</p>
</li>
<li>
<p>
Add <a href="#_string"><strong><code>string</code></strong></a> <code>totitle</code>
</p>
</li>
<li>
<p>
Add <a href="#_info"><strong><code>info</code></strong></a> <code>statics</code>
</p>
</li>
<li>
<p>
Add <code>build-jim-ext</code> for easy separate building of loadable modules (extensions)
</p>
</li>
<li>
<p>
<a href="#_local"><strong><code>local</code></strong></a> now works with any command, not just procs
</p>
</li>
<li>
<p>
Add <a href="#_info"><strong><code>info</code></strong></a> <code>alias</code> to access the target of an alias
</p>
</li>
<li>
<p>
UTF-8 encoding past the basic multilingual plane (BMP) is supported
</p>
</li>
<li>
<p>
Add <a href="#_tcl_prefix"><strong><code>tcl::prefix</code></strong></a>
</p>
</li>
<li>
<p>
Add <a href="#_history"><strong><code>history</code></strong></a>
</p>
</li>
<li>
<p>
Most extensions are now enabled by default
</p>
</li>
<li>
<p>
Add support for namespaces and the <a href="#_namespace"><strong><code>namespace</code></strong></a> command
</p>
</li>
<li>
<p>
Add <a href="#_apply"><strong><code>apply</code></strong></a>
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_in_v0_72">In v0.72</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
procs now allow <em>args</em> and optional parameters in any position
</p>
</li>
<li>
<p>
Add Tcl-compatible expr functions, <code>rand()</code>, <code>srand()</code> and <code>pow()</code>
</p>
</li>
<li>
<p>
Add support for the <em>-force</em> option to <a href="#_file"><strong><code>file</code></strong></a> <code>delete</code>
</p>
</li>
<li>
<p>
Better diagnostics when <a href="#_source"><strong><code>source</code></strong></a> fails to load a script with a missing quote or bracket
</p>
</li>
<li>
<p>
New <code>tcl_platform(pathSeparator)</code>
</p>
</li>
<li>
<p>
Add support settings the modification time with <a href="#_file"><strong><code>file</code></strong></a> <code>mtime</code>
</p>
</li>
<li>
<p>
<a href="#_exec"><strong><code>exec</code></strong></a> is now fully supported on win32 (mingw32)
</p>
</li>
<li>
<p>
<a href="#_file"><strong><code>file</code></strong></a> <code>join</code>, <a href="#_pwd"><strong><code>pwd</code></strong></a>, <a href="#_glob"><strong><code>glob</code></strong></a> etc. now work for mingw32
</p>
</li>
<li>
<p>
Line editing is now supported for the win32 console (mingw32)
</p>
</li>
<li>
<p>
Add <a href="#_aio"><strong><code>aio</code></strong></a> <code>listen</code> command
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_in_v0_71">In v0.71</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
Allow <em>args</em> to be renamed in procs
</p>
</li>
<li>
<p>
Add <code>$(&#8230;)</code> shorthand syntax for expressions
</p>
</li>
<li>
<p>
Add automatic reference variables in procs with <code>&amp;var</code> syntax
</p>
</li>
<li>
<p>
Support <code>jimsh --version</code>
</p>
</li>
<li>
<p>
Additional variables in <code>tcl_platform()</code>
</p>
</li>
<li>
<p>
<a href="#_local"><strong><code>local</code></strong></a> procs now push existing commands and <a href="#_upcall"><strong><code>upcall</code></strong></a> can call them
</p>
</li>
<li>
<p>
Add <a href="#_loop"><strong><code>loop</code></strong></a> command (TclX compatible)
</p>
</li>
<li>
<p>
Add <a href="#_aio"><strong><code>aio</code></strong></a> <code>buffering</code> command
</p>
</li>
<li>
<p>
<a href="#_info"><strong><code>info</code></strong></a> <code>complete</code> can now return the missing character
</p>
</li>
<li>
<p>
<a href="#_binary"><strong><code>binary</code></strong></a> <code>format</code> and <a href="#_binary"><strong><code>binary</code></strong></a> <code>scan</code> are now (optionally) supported
</p>
</li>
<li>
<p>
Add <a href="#_string"><strong><code>string</code></strong></a> <code>byterange</code>
</p>
</li>
<li>
<p>
Built-in regexp now support non-greedy repetition (*?, +?, ??)
</p>
</li>
</ol></div>
</div>
<div class="sect2">
<h3 id="_in_v0_70">In v0.70</h3>
<div class="olist arabic"><ol class="arabic">
<li>
<p>
<code>platform_tcl()</code> settings are now automatically determined
</p>

Changes to auto.def.

1
2
3
4
5
6
7
8
9
10
11
# vim:se syn=tcl:
#

define JIM_VERSION 78

options-defaults {
    silent-rules 1
}

# Note: modules which support options *must* be included before 'options'
use cc cc-shared cc-db cc-lib pkg-config util



|







1
2
3
4
5
6
7
8
9
10
11
# vim:se syn=tcl:
#

define JIM_VERSION 79

options-defaults {
    silent-rules 1
}

# Note: modules which support options *must* be included before 'options'
use cc cc-shared cc-db cc-lib pkg-config util

Changes to jim_tcl.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
....
5492
5493
5494
5495
5496
5497
5498





















































5499
5500
5501
5502
5503
5504
5505
Jim Tcl(n)
==========

NAME
----
Jim Tcl v0.78+ - reference manual for the Jim Tcl scripting language

SYNOPSIS
--------

  cc <source> -ljim

or
................................................................................
13. Expression shorthand syntax: +$(...)+
14. Modular build allows many features to be omitted or built as dynamic, loadable modules
15. Highly suitable for use in an embedded environment
16. Support for UDP, IPv6, Unix-Domain sockets in addition to TCP sockets

RECENT CHANGES
--------------
Changes since 0.78
~~~~~~~~~~~~~~~~~~
1. Add `file mtimeus` for high resolution file timestamps
2. `aio` now supports datagram Unix-Domain sockets
3. Add support for `aio lock -wait`
4. Add `signal block` to prevent delivery of signals
5. Add support for `file split`
6. Add support for `json::encode` and `json::decode`
7. `aio tty` now allows setting +echo+ without full +raw+ mode
................................................................................
5. Add support for half-close with `aio close` +?r|w?+
6. Add `socket pair` for a bidirectional pipe
7. Add '--random-hash' to randomise hash tables for greater security
8. `dict` now supports 'for', 'values', 'incr', 'append', 'lappend', 'update', 'info' and 'replace'
9. `file stat` no longer requires the variable name
10. Add support for `file link`

Changes between 0.73 and 0.74
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Numbers with leading zeros are treated as decimal, not octal
2. Add `aio isatty`
3. Add LFS (64 bit) support for `aio seek`, `aio tell`, `aio copyto`, `file copy`
4. `string compare` and `string equal` now support '-length'
5. `glob` now supports '-directory'

Changes between 0.72 and 0.73
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Built-in regexp now support non-capturing parentheses: (?:...)
2. Add `string replace`
3. Add `string totitle`
4. Add `info statics`
5. Add +build-jim-ext+ for easy separate building of loadable modules (extensions)
6. `local` now works with any command, not just procs
7. Add `info alias` to access the target of an alias
8. UTF-8 encoding past the basic multilingual plane (BMP) is supported
9. Add `tcl::prefix`
10. Add `history`
11. Most extensions are now enabled by default
12. Add support for namespaces and the `namespace` command
13. Add `apply`

Changes between 0.71 and 0.72
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. procs now allow 'args' and optional parameters in any position
2. Add Tcl-compatible expr functions, `rand()`, `srand()` and `pow()`
3. Add support for the '-force' option to `file delete`
4. Better diagnostics when `source` fails to load a script with a missing quote or bracket
5. New +tcl_platform(pathSeparator)+
6. Add support settings the modification time with `file mtime`
7. `exec` is now fully supported on win32 (mingw32)
8. `file join`, `pwd`, `glob` etc. now work for mingw32
9. Line editing is now supported for the win32 console (mingw32)
10. Add `aio listen` command

Changes between 0.70 and 0.71
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Allow 'args' to be renamed in procs
2. Add +$(...)+ shorthand syntax for expressions
3. Add automatic reference variables in procs with +&var+ syntax
4. Support +jimsh --version+
5. Additional variables in +tcl_platform()+
6. `local` procs now push existing commands and `upcall` can call them
7. Add `loop` command (TclX compatible)
8. Add `aio buffering` command
9. `info complete` can now return the missing character
10. `binary format` and `binary scan` are now (optionally) supported
11. Add `string byterange`
12. Built-in regexp now support non-greedy repetition (*?, +?, ??)

TCL INTRODUCTION
-----------------
Tcl stands for 'tool command language' and is pronounced
'http://www.oxforddictionaries.com/definition/american_english/tickle[tickle]'.
It is actually two things: a language and a library.

First, Tcl is a simple textual language, intended primarily for
................................................................................
+*history::multiline*+::
    If this variable is set to "1", interactive line editing operates in multiline mode.
    That is, long lines will wrap across multiple lines rather than scrolling within a
    single line.

CHANGES IN PREVIOUS RELEASES
----------------------------






















































=== In v0.70 ===

1. +platform_tcl()+ settings are now automatically determined
2. Add aio `$handle filename`
3. Add `info channels`
4. The 'bio' extension is gone. Now `aio` supports 'copyto'.





|







 







|
|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
...
103
104
105
106
107
108
109




















































110
111
112
113
114
115
116
....
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
Jim Tcl(n)
==========

NAME
----
Jim Tcl v0.79 - reference manual for the Jim Tcl scripting language

SYNOPSIS
--------

  cc <source> -ljim

or
................................................................................
13. Expression shorthand syntax: +$(...)+
14. Modular build allows many features to be omitted or built as dynamic, loadable modules
15. Highly suitable for use in an embedded environment
16. Support for UDP, IPv6, Unix-Domain sockets in addition to TCP sockets

RECENT CHANGES
--------------
Changes between 0.78 and 0.79
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Add `file mtimeus` for high resolution file timestamps
2. `aio` now supports datagram Unix-Domain sockets
3. Add support for `aio lock -wait`
4. Add `signal block` to prevent delivery of signals
5. Add support for `file split`
6. Add support for `json::encode` and `json::decode`
7. `aio tty` now allows setting +echo+ without full +raw+ mode
................................................................................
5. Add support for half-close with `aio close` +?r|w?+
6. Add `socket pair` for a bidirectional pipe
7. Add '--random-hash' to randomise hash tables for greater security
8. `dict` now supports 'for', 'values', 'incr', 'append', 'lappend', 'update', 'info' and 'replace'
9. `file stat` no longer requires the variable name
10. Add support for `file link`





















































TCL INTRODUCTION
-----------------
Tcl stands for 'tool command language' and is pronounced
'http://www.oxforddictionaries.com/definition/american_english/tickle[tickle]'.
It is actually two things: a language and a library.

First, Tcl is a simple textual language, intended primarily for
................................................................................
+*history::multiline*+::
    If this variable is set to "1", interactive line editing operates in multiline mode.
    That is, long lines will wrap across multiple lines rather than scrolling within a
    single line.

CHANGES IN PREVIOUS RELEASES
----------------------------

=== In v0.74 ===

1. Numbers with leading zeros are treated as decimal, not octal
2. Add `aio isatty`
3. Add LFS (64 bit) support for `aio seek`, `aio tell`, `aio copyto`, `file copy`
4. `string compare` and `string equal` now support '-length'
5. `glob` now supports '-directory'

=== In v0.73 ===

1. Built-in regexp now support non-capturing parentheses: (?:...)
2. Add `string replace`
3. Add `string totitle`
4. Add `info statics`
5. Add +build-jim-ext+ for easy separate building of loadable modules (extensions)
6. `local` now works with any command, not just procs
7. Add `info alias` to access the target of an alias
8. UTF-8 encoding past the basic multilingual plane (BMP) is supported
9. Add `tcl::prefix`
10. Add `history`
11. Most extensions are now enabled by default
12. Add support for namespaces and the `namespace` command
13. Add `apply`

=== In v0.72 ===

1. procs now allow 'args' and optional parameters in any position
2. Add Tcl-compatible expr functions, `rand()`, `srand()` and `pow()`
3. Add support for the '-force' option to `file delete`
4. Better diagnostics when `source` fails to load a script with a missing quote or bracket
5. New +tcl_platform(pathSeparator)+
6. Add support settings the modification time with `file mtime`
7. `exec` is now fully supported on win32 (mingw32)
8. `file join`, `pwd`, `glob` etc. now work for mingw32
9. Line editing is now supported for the win32 console (mingw32)
10. Add `aio listen` command

=== In v0.71 ===

1. Allow 'args' to be renamed in procs
2. Add +$(...)+ shorthand syntax for expressions
3. Add automatic reference variables in procs with +&var+ syntax
4. Support +jimsh --version+
5. Additional variables in +tcl_platform()+
6. `local` procs now push existing commands and `upcall` can call them
7. Add `loop` command (TclX compatible)
8. Add `aio buffering` command
9. `info complete` can now return the missing character
10. `binary format` and `binary scan` are now (optionally) supported
11. Add `string byterange`
12. Built-in regexp now support non-greedy repetition (*?, +?, ??)


=== In v0.70 ===

1. +platform_tcl()+ settings are now automatically determined
2. Add aio `$handle filename`
3. Add `info channels`
4. The 'bio' extension is gone. Now `aio` supports 'copyto'.