Changeset 327
- Timestamp:
- 07/13/08 21:12:56 (2 months ago)
- Files:
-
- branches/v2new/minid/api.d (modified) (2 diffs)
- branches/v2new/minid/array.d (modified) (10 diffs)
- branches/v2new/minid/baselib.d (modified) (78 diffs)
- branches/v2new/minid/commandline.d (modified) (1 diff)
- branches/v2new/minid/compiler.d (modified) (1 diff)
- branches/v2new/minid/compilertypes.d (modified) (4 diffs)
- branches/v2new/minid/ex.d (modified) (25 diffs)
- branches/v2new/minid/func.d (modified) (3 diffs)
- branches/v2new/minid/funcdef.d (modified) (3 diffs)
- branches/v2new/minid/gc.d (modified) (1 diff)
- branches/v2new/minid/interpreter.d (modified) (183 diffs)
- branches/v2new/minid/lexer.d (modified) (1 diff)
- branches/v2new/minid/misc.d (modified) (5 diffs)
- branches/v2new/minid/namespace.d (modified) (1 diff)
- branches/v2new/minid/obj.d (modified) (3 diffs)
- branches/v2new/minid/string.d (modified) (2 diffs)
- branches/v2new/minid/stringlib.d (modified) (5 diffs)
- branches/v2new/minid/table.d (modified) (2 diffs)
- branches/v2new/minid/thread.d (modified) (1 diff)
- branches/v2new/minid/types.d (modified) (14 diffs)
- branches/v2new/test.d (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/v2new/minid/api.d
r326 r327 50 50 The default memory-allocation function, which uses the C allocator. 51 51 */ 52 public void* DefaultMemFunc(void* ctx, void* p, size_t oldSize, size_tnewSize)52 public void* DefaultMemFunc(void* ctx, void* p, uword oldSize, uword newSize) 53 53 { 54 54 if(newSize == 0) … … 185 185 import tango.stdc.stdlib; 186 186 import tango.stdc.stringz; 187 public nintloadFunc(MDThread* t, char[] filename)187 public word loadFunc(MDThread* t, char[] filename) 188 188 { 189 189 if(system(toStringz("minidc " ~ filename)) != 0) branches/v2new/minid/array.d
r319 r327 39 39 40 40 // Create a new array object of the given length. 41 package MDArray* create(ref Allocator alloc, size_tsize)41 package MDArray* create(ref Allocator alloc, uword size) 42 42 { 43 43 auto a = alloc.allocate!(MDArray); … … 60 60 61 61 // Resize an array object. 62 package void resize(ref Allocator alloc, MDArray* a, size_tnewSize)62 package void resize(ref Allocator alloc, MDArray* a, uword newSize) 63 63 { 64 64 if(newSize == a.slice.length) … … 86 86 87 87 // Slice an array object to create a new array object that references the source's data. 88 package MDArray* slice(ref Allocator alloc, MDArray* a, size_t lo, size_thi)88 package MDArray* slice(ref Allocator alloc, MDArray* a, uword lo, uword hi) 89 89 { 90 90 auto n = alloc.allocate!(MDArray); … … 96 96 97 97 // Assign an entire other array into a slice of the destination array. Handles overlapping copies as well. 98 package void sliceAssign(MDArray* a, size_t lo, size_thi, MDArray* other)98 package void sliceAssign(MDArray* a, uword lo, uword hi, MDArray* other) 99 99 { 100 100 auto dest = a.slice[lo .. hi]; … … 112 112 113 113 // Sets a block of values (only called by the SetArray instruction in the interpreter). 114 package void setBlock(ref Allocator alloc, MDArray* a, size_tblock, MDValue[] data)114 package void setBlock(ref Allocator alloc, MDArray* a, uword block, MDValue[] data) 115 115 { 116 116 auto start = block * Instruction.arraySetFields; … … 177 177 // overallocate only controls whether over-allocation will be done for large (> 1 page) 178 178 // arrays. 179 private MDArrayData* allocData(bool overallocate)(ref Allocator alloc, size_tsize)179 private MDArrayData* allocData(bool overallocate)(ref Allocator alloc, uword size) 180 180 { 181 181 const BigArraySize = overallocate ? "size + (size / 10)" : "size"; 182 size_trealSize = void;182 uword realSize = void; 183 183 184 184 if(size <= ElemsInPage) … … 199 199 200 200 // Figure out the size of an MDArrayData object given that it has 'length' items. 201 private size_t DataSize(size_tlength)201 private uword DataSize(uword length) 202 202 { 203 203 return MDArrayData.sizeof + (MDValue.sizeof * length); … … 207 207 // be true if you want to evaluate at compile time; at runtime it uses a faster 208 208 // bitwise intrinsic function. 209 private size_t largerPow2(bool ct = false)(size_tn)209 private uword largerPow2(bool ct = false)(uword n) 210 210 { 211 211 static if(ct) … … 216 216 return n; 217 217 218 size_tret = 1;218 uword ret = 1; 219 219 220 220 while(n) … … 237 237 // The size of a memory page. I'm just guessing that most OSes use 4k pages. 238 238 // Please change this as necessary. 239 private const size_tPageSize = 4096;239 private const uword PageSize = 4096; 240 240 241 241 // How many elements can fit within an array data object that's only one page. 242 private const size_tElemsInPage = (PageSize - MDArrayData.sizeof) / MDValue.sizeof;242 private const uword ElemsInPage = (PageSize - MDArrayData.sizeof) / MDValue.sizeof; 243 243 244 244 // The largest power of 2 that's < ElemsInPage. 245 private const size_tLargestPow2 = largerPow2!(true)(ElemsInPage) >> 1;245 private const uword LargestPow2 = largerPow2!(true)(ElemsInPage) >> 1; 246 246 } branches/v2new/minid/baselib.d
r323 r327 42 42 import minid.vm; 43 43 44 private void register(MDThread* t, dchar[] name, NativeFunc func, size_tnumUpvals = 0)44 private void register(MDThread* t, dchar[] name, NativeFunc func, uword numUpvals = 0) 45 45 { 46 46 newFunction(t, func, name, numUpvals); … … 165 165 // Object 166 166 167 nuint objectClone(MDThread* t, nuintnumParams)167 uword objectClone(MDThread* t, uword numParams) 168 168 { 169 169 newObject(t, 0); … … 175 175 // Basic functions 176 176 177 nuint getTraceback(MDThread* t, nuintnumParams)177 uword getTraceback(MDThread* t, uword numParams) 178 178 { 179 179 s.push(new MDString(s.context.getTracebackString())); … … 181 181 } 182 182 183 nuint haltThread(MDThread* t, nuintnumParams)183 uword haltThread(MDThread* t, uword numParams) 184 184 { 185 185 if(numParams == 0) … … 196 196 */ 197 197 198 nuint currentThread(MDThread* t, nuintnumParams)198 uword currentThread(MDThread* t, uword numParams) 199 199 { 200 200 if(t is mainThread(getVM(t))) … … 206 206 } 207 207 /* 208 nuint setModuleLoader(MDThread* t, nuintnumParams)208 uword setModuleLoader(MDThread* t, uword numParams) 209 209 { 210 210 s.context.setModuleLoader(s.getParam!(dchar[])(0), s.getParam!(MDClosure)(1)); … … 212 212 } 213 213 214 nuint reloadModule(MDThread* t, nuintnumParams)214 uword reloadModule(MDThread* t, uword numParams) 215 215 { 216 216 s.push(s.context.reloadModule(s.getParam!(MDString)(0).mData, s)); … … 218 218 } 219 219 */ 220 nuint removeKey(MDThread* t, nuintnumParams)220 uword removeKey(MDThread* t, uword numParams) 221 221 { 222 222 checkAnyParam(t, 1); … … 248 248 } 249 249 250 nuint rawSet(MDThread* t, nuintnumParams)250 uword rawSet(MDThread* t, uword numParams) 251 251 { 252 252 if(numParams < 3) … … 266 266 } 267 267 268 nuint rawGet(MDThread* t, nuintnumParams)268 uword rawGet(MDThread* t, uword numParams) 269 269 { 270 270 if(numParams < 2) … … 284 284 } 285 285 286 nuint runMain(MDThread* t, nuintnumParams)286 uword runMain(MDThread* t, uword numParams) 287 287 { 288 288 checkParam(t, 1, MDValue.Type.Namespace); … … 302 302 // Functional stuff 303 303 304 nuint curry(MDThread* t, nuintnumParams)305 { 306 static nuint call(MDThread* t, nuintnumParams)304 uword curry(MDThread* t, uword numParams) 305 { 306 static uword call(MDThread* t, uword numParams) 307 307 { 308 308 auto funcReg = getUpval(t, 0); … … 310 310 getUpval(t, 1); 311 311 312 for( size_ti = 1; i <= numParams; i++)312 for(uword i = 1; i <= numParams; i++) 313 313 dup(t, i); 314 314 … … 323 323 } 324 324 325 nuint bindContext(MDThread* t, nuintnumParams)326 { 327 static nuint call(MDThread* t, nuintnumParams)325 uword bindContext(MDThread* t, uword numParams) 326 { 327 static uword call(MDThread* t, uword numParams) 328 328 { 329 329 auto funcReg = getUpval(t, 0); 330 330 getUpval(t, 1); 331 331 332 for( size_ti = 1; i <= numParams; i++)332 for(uword i = 1; i <= numParams; i++) 333 333 dup(t, i); 334 334 … … 346 346 // Reflection-esque stuff 347 347 348 nuint findGlobal(MDThread* t, nuintnumParams)348 uword findGlobal(MDThread* t, uword numParams) 349 349 { 350 350 if(!.findGlobal(t, checkStringParam(t, 1))) … … 354 354 } 355 355 356 nuint isSet(MDThread* t, nuintnumParams)356 uword isSet(MDThread* t, uword numParams) 357 357 { 358 358 if(!.findGlobal(t, checkStringParam(t, 1))) … … 367 367 } 368 368 369 nuint mdtypeof(MDThread* t, nuintnumParams)369 uword mdtypeof(MDThread* t, uword numParams) 370 370 { 371 371 checkAnyParam(t, 1); … … 374 374 } 375 375 376 nuint fieldsOf(MDThread* t, nuintnumParams)376 uword fieldsOf(MDThread* t, uword numParams) 377 377 { 378 378 checkObjParam(t, 1); … … 381 381 } 382 382 383 nuint allFieldsOf(MDThread* t, nuintnumParams)383 uword allFieldsOf(MDThread* t, uword numParams) 384 384 { 385 385 // Upvalue 0 is the current object 386 386 // Upvalue 1 is the current index into the namespace 387 static nuint iter(MDThread* t, nuintnumParams)387 static uword iter(MDThread* t, uword numParams) 388 388 { 389 389 getUpval(t, 0); … … 430 430 } 431 431 432 nuint hasField(MDThread* t, nuintnumParams)432 uword hasField(MDThread* t, uword numParams) 433 433 { 434 434 checkAnyParam(t, 1); … … 438 438 } 439 439 440 nuint hasMethod(MDThread* t, nuintnumParams)440 uword hasMethod(MDThread* t, uword numParams) 441 441 { 442 442 checkAnyParam(t, 1); … … 447 447 448 448 /* 449 nuint hasAttributes(MDThread* t, nuintnumParams)449 uword hasAttributes(MDThread* t, uword numParams) 450 450 { 451 451 MDTable ret; … … 462 462 } 463 463 464 nuint attributesOf(MDThread* t, nuintnumParams)464 uword attributesOf(MDThread* t, uword numParams) 465 465 { 466 466 MDTable ret; … … 483 483 } 484 484 */ 485 nuint isParam(MDValue.Type Type)(MDThread* t, nuintnumParams)485 uword isParam(MDValue.Type Type)(MDThread* t, uword numParams) 486 486 { 487 487 checkAnyParam(t, 1); … … 493 493 // Conversions 494 494 495 nuint toString(MDThread* t, nuintnumParams)495 uword toString(MDThread* t, uword numParams) 496 496 { 497 497 checkAnyParam(t, 1); … … 513 513 } 514 514 515 nuint rawToString(MDThread* t, nuintnumParams)515 uword rawToString(MDThread* t, uword numParams) 516 516 { 517 517 checkAnyParam(t, 1); … … 520 520 } 521 521 522 nuint toBool(MDThread* t, nuintnumParams)522 uword toBool(MDThread* t, uword numParams) 523 523 { 524 524 checkAnyParam(t, 1); … … 527 527 } 528 528 529 nuint toInt(MDThread* t, nuintnumParams)529 uword toInt(MDThread* t, uword numParams) 530 530 { 531 531 checkAnyParam(t, 1); … … 547 547 } 548 548 549 nuint toFloat(MDThread* t, nuintnumParams)549 uword toFloat(MDThread* t, uword numParams) 550 550 { 551 551 checkAnyParam(t, 1); … … 567 567 } 568 568 569 nuint toChar(MDThread* t, nuintnumParams)569 uword toChar(MDThread* t, uword numParams) 570 570 { 571 571 pushChar(t, cast(dchar)checkIntParam(t, 1)); … … 573 573 } 574 574 575 nuint format(MDThread* t, nuintnumParams)575 uword format(MDThread* t, uword numParams) 576 576 { 577 577 auto buf = StrBuffer(t); … … 584 584 // Console IO 585 585 586 nuint write(MDThread* t, nuintnumParams)587 { 588 for( size_ti = 1; i <= numParams; i++)586 uword write(MDThread* t, uword numParams) 587 { 588 for(uword i = 1; i <= numParams; i++) 589 589 { 590 590 pushToString(t, i); … … 596 596 } 597 597 598 nuint writeln(MDThread* t, nuintnumParams)599 { 600 for( size_ti = 1; i <= numParams; i++)598 uword writeln(MDThread* t, uword numParams) 599 { 600 for(uword i = 1; i <= numParams; i++) 601 601 { 602 602 pushToString(t, i); … … 608 608 } 609 609 610 nuint writef(MDThread* t, nuintnumParams)610 uword writef(MDThread* t, uword numParams) 611 611 { 612 612 uint sink(dchar[] data) … … 621 621 } 622 622 623 nuint writefln(MDThread* t, nuintnumParams)623 uword writefln(MDThread* t, uword numParams) 624 624 { 625 625 uint sink(dchar[] data) … … 634 634 } 635 635 636 nuint dumpVal(MDThread* t, nuintnumParams)636 uword dumpVal(MDThread* t, uword numParams) 637 637 { 638 638 checkAnyParam(t, 1); … … 641 641 auto shown = getUpval(t, 0); 642 642 643 void outputRepr( nintv)643 void outputRepr(word v) 644 644 { 645 645 v = absIndex(t, v); … … 675 675 } 676 676 677 void outputArray( nintarr)677 void outputArray(word arr) 678 678 { 679 679 if(opin(t, arr, shown)) … … 705 705 pop(t); 706 706 707 for( size_ti = 1; i < length; i++)707 for(uword i = 1; i < length; i++) 708 708 { 709 709 // TODO: this … … 722 722 } 723 723 724 void outputTable( ninttab)724 void outputTable(word tab) 725 725 { 726 726 if(opin(t, tab, shown)) … … 823 823 824 824 /* 825 nuint readln(MDThread* t, nuintnumParams)825 uword readln(MDThread* t, uword numParams) 826 826 { 827 827 pushString(t, Cin.copyln()); … … 833 833 // Dynamic Compilation 834 834 835 nuint loadString(MDThread* t, nuintnumParams)835 uword loadString(MDThread* t, uword numParams) 836 836 { 837 837 char[] name; … … 863 863 } 864 864 865 nuint eval(MDThread* t, nuintnumParams)865 uword eval(MDThread* t, uword numParams) 866 866 { 867 867 MDFuncDef def = Compiler().compileExpression(s.getParam!(dchar[])(0), "<loaded by eval>"); … … 876 876 } 877 877 878 nuint loadJSON(MDThread* t, nuintnumParams)878 uword loadJSON(MDThread* t, uword numParams) 879 879 { 880 880 s.push(Compiler().loadJSON(s.getParam!(dchar[])(0))); … … 882 882 } 883 883 884 nuint toJSON(MDThread* t, nuintnumParams)884 uword toJSON(MDThread* t, uword numParams) 885 885 { 886 886 MDValue root = s.getParam(0u); … … 902 902 // Namespace metatable 903 903 */ 904 nuint namespaceApply(MDThread* t, nuintnumParams)905 { 906 static nuint iter(MDThread* t, nuintnumParams)904 uword namespaceApply(MDThread* t, uword numParams) 905 { 906 static uword iter(MDThread* t, uword numParams) 907 907 { 908 908 getUpval(t, 0); … … 939 939 // Thread metatable 940 940 941 nuint threadReset(MDThread* t, nuintnumParams)941 uword threadReset(MDThread* t, uword numParams) 942 942 { 943 943 checkParam(t, 0, MDValue.Type.Thread); … … 954 954 } 955 955 956 nuint threadState(MDThread* t, nuintnumParams)956 uword threadState(MDThread* t, uword numParams) 957 957 { 958 958 checkParam(t, 0, MDValue.Type.Thread); … … 961 961 } 962 962 963 nuint isInitial(MDThread* t, nuintnumParams)963 uword isInitial(MDThread* t, uword numParams) 964 964 { 965 965 checkParam(t, 0, MDValue.Type.Thread); … … 968 968 } 969 969 970 nuint isRunning(MDThread* t, nuintnumParams)970 uword isRunning(MDThread* t, uword numParams) 971 971 { 972 972 checkParam(t, 0, MDValue.Type.Thread); … … 975 975 } 976 976 977 nuint isWaiting(MDThread* t, nuintnumParams)977 uword isWaiting(MDThread* t, uword numParams) 978 978 { 979 979 checkParam(t, 0, MDValue.Type.Thread); … … 982 982 } 983 983 984 nuint isSuspended(MDThread* t, nuintnumParams)984 uword isSuspended(MDThread* t, uword numParams) 985 985 { 986 986 checkParam(t, 0, MDValue.Type.Thread); … … 989 989 } 990 990 991 nuint isDead(MDThread* t, nuintnumParams)991 uword isDead(MDThread* t, uword numParams) 992 992 { 993 993 checkParam(t, 0, MDValue.Type.Thread); … … 996 996 } 997 997 998 nuint threadIterator(MDThread* t, nuintnumParams)998 uword threadIterator(MDThread* t, uword numParams) 999 999 { 1000 1000 checkParam(t, 0, MDValue.Type.Thread); … … 1013 1013 } 1014 1014 1015 nuint threadApply(MDThread* t, nuintnumParams)1015 uword threadApply(MDThread* t, uword numParams) 1016 1016 { 1017 1017 checkParam(t, 0, MDValue.Type.Thread); … … 1041 1041 // Function metatable 1042 1042 1043 nuint functionEnvironment(MDThread* t, nuintnumParams)1043 uword functionEnvironment(MDThread* t, uword numParams) 1044 1044 { 1045 1045 checkParam(t, 0, MDValue.Type.Function); … … 1056 1056 } 1057 1057 1058 nuint functionIsNative(MDThread* t, nuintnumParams)1058 uword functionIsNative(MDThread* t, uword numParams) 1059 1059 { 1060 1060 checkParam(t, 0, MDValue.Type.Function); … … 1063 1063 } 1064 1064 1065 nuint functionNumParams(MDThread* t, nuintnumParams)1065 uword functionNumParams(MDThread* t, uword numParams) 1066 1066 { 1067 1067 checkParam(t, 0, MDValue.Type.Function); … … 1070 1070 } 1071 1071 1072 nuint functionIsVararg(MDThread* t, nuintnumParams)1072 uword functionIsVararg(MDThread* t, uword numParams) 1073 1073 { 1074 1074 checkParam(t, 0, MDValue.Type.Function); … … 1114 1114 } 1115 1115 1116 public nuint clone(MDThread* t, nuintnumParams)1116 public uword clone(MDThread* t, uword numParams) 1117 1117 { 1118 1118 MDStringBuffer ret; … … 1134 1134 } 1135 1135 1136 public nuint opCatAssign(MDThread* t, nuintnumParams)1136 public uword opCatAssign(MDThread* t, uword numParams) 1137 1137 { 1138 1138 MDStringBuffer i = s.getContext!(MDStringBuffer); … … 1164 1164 } 1165 1165 1166 public nuint insert(MDThread* t, nuintnumParams)1166 public uword insert(MDThread* t, uword numParams) 1167 1167 { 1168 1168 MDStringBuffer i = s.getContext!(MDStringBuffer); … … 1190 1190 } 1191 1191 1192 public nuint remove(MDThread* t, nuintnumParams)1192 public uword remove(MDThread* t, uword numParams) 1193 1193 { 1194 1194 MDStringBuffer i = s.getContext!(MDStringBuffer); … … 1203 1203 } 1204 1204 1205 public nuint toString(MDThread* t, nuintnumParams)1205 public uword toString(MDThread* t, uword numParams) 1206 1206 { 1207 1207 s.push(s.getContext!(MDStringBuffer).toMDString()); … … 1209 1209 } 1210 1210 1211 public nuint opLengthAssign(MDThread* t, nuintnumParams)1211 public uword opLengthAssign(MDThread* t, uword numParams) 1212 1212 { 1213 1213 int newLen = s.getParam!(int)(0); … … 1220 1220 } 1221 1221 1222 public nuint opLength(MDThread* t, nuintnumParams)1222 public uword opLength(MDThread* t, uword numParams) 1223 1223 { 1224 1224 s.push(s.getContext!(MDStringBuffer).length); … … 1226 1226 } 1227 1227 1228 public nuint opIndex(MDThread* t, nuintnumParams)1228 public uword opIndex(MDThread* t, uword numParams) 1229 1229 { 1230 1230 s.push(s.getContext!(MDStringBuffer)()[s.getParam!(int)(0)]); … … 1232 1232 } 1233 1233 1234 public nuint opIndexAssign(MDThread* t, nuintnumParams)1234 public uword opIndexAssign(MDThread* t, uword numParams) 1235 1235 { 1236 1236 s.getContext!(MDStringBuffer)()[s.getParam!(int)(0)] = s.getParam!(dchar)(1); … … 1238 1238 } 1239 1239 1240 public nuint iterator(MDThread* t, nuintnumParams)1240 public uword iterator(MDThread* t, uword numParams) 1241 1241 { 1242 1242 MDStringBuffer i = s.getContext!(MDStringBuffer); … … 1254 1254 } 1255 1255 1256 public nuint iteratorReverse(MDThread* t, nuintnumParams)1256 public uword iteratorReverse(MDThread* t, uword numParams) 1257 1257 { 1258 1258 MDStringBuffer i = s.getContext!(MDStringBuffer); … … 1270 1270 } 1271 1271 1272 public nuint opApply(MDThread* t, nuintnumParams)1272 public uword opApply(MDThread* t, uword numParams) 1273 1273 { 1274 1274 MDStringBuffer i = s.getContext!(MDStringBuffer); … … 1290 1290 } 1291 1291 1292 public nuint opSlice(MDThread* t, nuintnumParams)1292 public uword opSlice(MDThread* t, uword numParams) 1293 1293 { 1294 1294 s.push(s.getContext!(MDStringBuffer)()[s.getParam!(int)(0) .. s.getParam!(int)(1)]); … … 1296 1296 } 1297 1297 1298 public nuint opSliceAssign(MDThread* t, nuintnumParams)1298 public uword opSliceAssign(MDThread* t, uword numParams) 1299 1299 { 1300 1300 s.getContext!(MDStringBuffer)()[s.getParam!(int)(0) .. s.getParam!(int)(1)] = s.getParam!(dchar[])(2); … … 1302 1302 } 1303 1303 1304 public nuint reserve(MDThread* t, nuintnumParams)1304 public uword reserve(MDThread* t, uword numParams) 1305 1305 { 1306 1306 s.getContext!(MDStringBuffer).reserve(s.getParam!(uint)(0)); … … 1308 1308 } 1309 1309 1310 public nuint format(MDThread* t, nuintnumParams)1310 public uword format(MDThread* t, uword numParams) 1311 1311 { 1312 1312 auto self = s.getContext!(MDStringBuffer); … … 1322 1322 } 1323 1323 1324 public nuint formatln(MDThread* t, nuintnumParams)1324 public uword formatln(MDThread* t, uword numParams) 1325 1325 { 1326 1326 auto self = s.getContext!(MDStringBuffer); … … 1341 1341 { 1342 1342 protected dchar[] mBuffer; 1343 protected size_tmLength = 0;1343 protected uword mLength = 0; 1344 1344 1345 1345 public this(MDStringBufferClass owner) … … 1349 1349 } 1350 1350 1351 public this(MDStringBufferClass owner, size_tsize)1351 public this(MDStringBufferClass owner, uword size) 1352 1352 { 1353 1353 super("StringBuffer", owner); branches/v2new/minid/commandline.d
r308 r327 258 258 return false; 259 259 260 size_ti = 0;260 uword i = 0; 261 261 262 262 for( ; i < buffer.length && Uni.isWhitespace(buffer[i]); i++) branches/v2new/minid/compiler.d
r326 r327 606 606 protected dchar[] mSource; 607 607 protected OldLocation mLoc; 608 protected size_tmPosition;608 protected uword mPosition; 609 609 protected dchar mCharacter; 610 610 protected dchar mLookaheadCharacter; branches/v2new/minid/compilertypes.d
r326 r327 84 84 private Allocator* mAlloc; 85 85 private T[] mData; 86 private size_tmIndex = 0;86 private uword mIndex = 0; 87 87 88 88 package this(Allocator* alloc) … … 112 112 alias add opCatAssign; 113 113 114 public T opIndex( size_tindex)114 public T opIndex(uword index) 115 115 { 116 116 return mData[index]; 117 117 } 118 118 119 public void length( size_tl)119 public void length(uword l) 120 120 { 121 121 mIndex = l; … … 125 125 } 126 126 127 public size_tlength()127 public uword length() 128 128 { 129 129 return mIndex; … … 151 151 } 152 152 153 public int opApply(int delegate( size_t, ref T) dg)153 public int opApply(int delegate(uword, ref T) dg) 154 154 { 155 155 int result = 0; branches/v2new/minid/ex.d
r325 r327 39 39 private MDThread* t; 40 40 private dchar[] name; 41 private nintidx;41 private word idx; 42 42 43 43 public static void opCall(MDThread* t, dchar[] name, void delegate(CreateObject*) dg) … … 88 88 { 89 89 private MDThread* t; 90 private size_tnumPieces;91 private size_tpos;90 private uword numPieces; 91 private uword pos; 92 92 private dchar[512] data; 93 93 … … 178 178 on top of the stack. The StrBuffer will also be in a state to build a new string if you so desire. 179 179 */ 180 public nintfinish()180 public word finish() 181 181 { 182 182 flush(); … … 210 210 } 211 211 212 public void checkAnyParam(MDThread* t, nintindex)212 public void checkAnyParam(MDThread* t, word index) 213 213 { 214 214 if(!isValidIndex(t, index)) … … 216 216 } 217 217 218 public bool checkBoolParam(MDThread* t, nintindex)218 public bool checkBoolParam(MDThread* t, word index) 219 219 { 220 220 checkAnyParam(t, index); … … 226 226 } 227 227 228 public mdint checkIntParam(MDThread* t, nintindex)228 public mdint checkIntParam(MDThread* t, word index) 229 229 { 230 230 checkAnyParam(t, index); … … 236 236 } 237 237 238 public mdfloat checkFloatParam(MDThread* t, nintindex)238 public mdfloat checkFloatParam(MDThread* t, word index) 239 239 { 240 240 checkAnyParam(t, index); … … 246 246 } 247 247 248 public dchar checkCharParam(MDThread* t, nintindex)248 public dchar checkCharParam(MDThread* t, word index) 249 249 { 250 250 checkAnyParam(t, index); … … 256 256 } 257 257 258 public dchar[] checkStringParam(MDThread* t, nintindex)258 public dchar[] checkStringParam(MDThread* t, word index) 259 259 { 260 260 checkAnyParam(t, index); … … 266 266 } 267 267 268 public void checkObjParam()(MDThread* t, nintindex)268 public void checkObjParam()(MDThread* t, word index) 269 269 { 270 270 checkAnyParam(t, index); … … 274 274 } 275 275 276 public void checkObjParam(bool strict = true)(MDThread* t, nintindex, dchar[] name)276 public void checkObjParam(bool strict = true)(MDThread* t, word index, dchar[] name) 277 277 { 278 278 index = absIndex(t, index); … … 294 294 } 295 295 296 public T* checkObjParam(T, bool strict = true)(MDThread* t, nintindex, dchar[] name)296 public T* checkObjParam(T, bool strict = true)(MDThread* t, word index, dchar[] name) 297 297 { 298 298 checkObjParam!(strict)(t, index, name); … … 300 300 } 301 301 302 public void checkParam(MDThread* t, nintindex, MDValue.Type type)302 public void checkParam(MDThread* t, word index, MDValue.Type type) 303 303 { 304 304 assert(type >= MDValue.Type.Null && type <= MDValue.Type.NativeObj, "invalid type"); … … 310 310 } 311 311 312 public void paramTypeError(MDThread* t, nintindex, dchar[] expected)312 public void paramTypeError(MDThread* t, word index, dchar[] expected) 313 313 { 314 314 pushTypeString(t, index); … … 320 320 } 321 321 322 public bool optBoolParam(MDThread* t, nintindex, bool def)322 public bool optBoolParam(MDThread* t, word index, bool def) 323 323 { 324 324 if(!isValidIndex(t, index) || isNull(t, index)) … … 331 331 } 332 332 333 public mdint optIntParam(MDThread* t, nintindex, mdint def)333 public mdint optIntParam(MDThread* t, word index, mdint def) 334 334 { 335 335 if(!isValidIndex(t, index) || isNull(t, index)) … … 342 342 } 343 343 344 public mdfloat optFloatParam(MDThread* t, nintindex, mdfloat def)344 public mdfloat optFloatParam(MDThread* t, word index, mdfloat def) 345 345 { 346 346 if(!isValidIndex(t, index) || isNull(t, index)) … … 353 353 } 354 354 355 public dchar optCharParam(MDThread* t, nintindex, dchar def)355 public dchar optCharParam(MDThread* t, word index, dchar def) 356 356 { 357 357 if(!isValidIndex(t, index) || isNull(t, index)) … … 364 364 } 365 365 366 public dchar[] optStringParam(MDThread* t, nintindex, dchar[] def)366 public dchar[] optStringParam(MDThread* t, word index, dchar[] def) 367 367 { 368 368 if(!isValidIndex(t, index) || isNull(t, index)) … … 375 375 } 376 376 377 public bool optParam(MDThread* t, nintindex, MDValue.Type type)377 public bool optParam(MDThread* t, word index, MDValue.Type type) 378 378 { 379 379 if(!isValidIndex(t, index) || isNull(t, index)) … … 386 386 } 387 387 388 public T* getMembers(T)(MDThread* t, nintindex)388 public T* getMembers(T)(MDThread* t, word index) 389 389 { 390 390 auto ret = getExtraBytes(t, index); … … 423 423 The stack index of the looked-up value. 424 424 */ 425 public nintlookup(MDThread* t, dchar[] name)425 public word lookup(MDThread* t, dchar[] name) 426 426 { 427 427 validateName(t, name); 428 428 429 429 bool isFirst = true; 430 nintidx = void;430 word idx = void; 431 431 432 432 foreach(n; name.delimiters("."d)) … … 458 458 The stack index of the looked-up value. 459 459 */ 460 public nintlookupCT(char[] name)(MDThread* t)460 public word lookupCT(char[] name)(MDThread* t) 461 461 { 462 462 mixin(NameToAPICalls!(name)); … … 481 481 throwException(t, "Cannot use an empty string for a name"); 482 482 483 size_tidx = 0;483 uword idx = 0; 484 484 485 485 void ident() … … 518 518 } 519 519 520 private template ValidateNameCTImpl(char[] name, size_tstart = 0)521 { 522 private template IdentLoop( size_tidx)520 private template ValidateNameCTImpl(char[] name, uword start = 0) 521 { 522 private template IdentLoop(uword idx) 523 523 { 524 524 static if(idx < name.length && IsIdentChar!(name[idx])) branches/v2new/minid/func.d
r323 r327 50 50 51 51 // Create a native function. 52 package MDFunction* create(ref Allocator alloc, MDNamespace* env, MDString* name, NativeFunc func, size_tnumUpvals)52 package MDFunction* create(ref Allocator alloc, MDNamespace* env, MDString* name, NativeFunc func, uword numUpvals) 53 53 { 54 54 auto f = alloc.allocate!(MDFunction)(NativeClosureSize(numUpvals)); … … 78 78 } 79 79 80 package nintnumParams(MDFunction* f)80 pa
