diff --git a/source/subs_functions/subs_functions.bas b/source/subs_functions/subs_functions.bas index 2cc8cd2aa..9df877f12 100644 --- a/source/subs_functions/subs_functions.bas +++ b/source/subs_functions/subs_functions.bas @@ -87,12 +87,20 @@ SUB reginternal clearid id.n = "_Continue": id.subfunc = 2: id.callname = "sub_stub": regid + clearid + id.n = "_CLngPtr" + id.subfunc = 1 + id.args = 1 + id.arg = MKL$(UOFFSETTYPE - ISPOINTER) + id.ret = UINTEGER64TYPE - ISPOINTER + id.hr_syntax = "_CLngPtr(offsetValue)" + regid + clearid id.n = "_IIf" id.subfunc = 1 id.args = 3 id.arg = MKL$(OFFSETTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) + MKL$(STRINGTYPE - ISPOINTER) ' overridden in qb64pe.bas - id.specialformat = "?,?,?" id.ret = STRINGTYPE - ISPOINTER ' overridden in qb64pe.bas id.hr_syntax = "_IIF(expression, truePart, falsePart)" regid diff --git a/source/subs_functions/syntax_highlighter_list.bas b/source/subs_functions/syntax_highlighter_list.bas index 180fc1650..fe2b27e8e 100644 --- a/source/subs_functions/syntax_highlighter_list.bas +++ b/source/subs_functions/syntax_highlighter_list.bas @@ -20,7 +20,7 @@ listOfKeywords$ = listOfKeywords$ +_ ' [C] - Keywords alphabetical (1st line = QB64, 2nd line = QB4.5, 3rd line = OpenGL) listOfKeywords$ = listOfKeywords$ +_ -"_CAPSLOCK@_CEIL@_CINP@_CLEAR@_CLEARCOLOR@_CLIP@_CLIPBOARD$@_CLIPBOARDIMAGE@_CLOCKWISE@_COLORCHOOSERDIALOG@_COMMANDCOUNT@_CONNECTED@_CONNECTIONADDRESS@_CONNECTIONADDRESS$@_CONSOLE@_CONSOLECURSOR@_CONSOLEFONT@_CONSOLEINPUT@_CONSOLETITLE@_CONTINUE@_CONTROLCHR@_COPYIMAGE@_COPYPALETTE@_COSH@_COT@_COTH@_CRC32@_CSC@_CSCH@_CV@_CWD$@" +_ +"_CAPSLOCK@_CEIL@_CINP@_CLEA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COPYTEXSUBIMAGE2D@_GLCULLFACE@" diff --git a/tests/compile_tests/clngptr/clngptr_test.bas b/tests/compile_tests/clngptr/clngptr_test.bas new file mode 100644 index 000000000..8b39a884b --- /dev/null +++ b/tests/compile_tests/clngptr/clngptr_test.bas @@ -0,0 +1,33 @@ +$CONSOLE:ONLY +OPTION _EXPLICIT + +DIM myArray(1 TO 10) AS LONG +DIM i AS LONG + +FOR i = LBOUND(myArray) TO UBOUND(myArray) + myArray(i) = 2 ^ i +NEXT i + +PrintArray myArray() + +DIM arrMem AS _MEM: arrMem = _MEM(myArray()) + +FOR i = 0 TO (_CLNGPTR(arrMem.SIZE) \ _SIZE_OF_LONG) - 1 + _MEMPUT arrMem, arrMem.OFFSET + (i * _SIZE_OF_LONG), i + 1 AS LONG +NEXT i + +_MEMFREE arrMem + +PrintArray myArray() + +SYSTEM + +SUB PrintArray (arr() AS LONG) + DIM i AS LONG + + PRINT "Array("; LBOUND(arr); "To"; UBOUND(arr); ") = {"; + FOR i = LBOUND(arr) TO UBOUND(arr) + PRINT arr(i); _IIF(i < UBOUND(arr), ",", ""); + NEXT i + PRINT "}" +END SUB diff --git a/tests/compile_tests/clngptr/clngptr_test.output b/tests/compile_tests/clngptr/clngptr_test.output new file mode 100644 index 000000000..039f15a71 --- /dev/null +++ b/tests/compile_tests/clngptr/clngptr_test.output @@ -0,0 +1,2 @@ +Array( 1 To 10 ) = { 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 } +Array( 1 To 10 ) = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 }