Skip to content

Commit

Permalink
Remove _OFFSET restrictions
Browse files Browse the repository at this point in the history
  • Loading branch information
a740g committed Nov 28, 2024
1 parent 6db75fe commit f2fe842
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 40 deletions.
29 changes: 0 additions & 29 deletions source/qb64pe.bas
Original file line number Diff line number Diff line change
Expand Up @@ -10769,12 +10769,6 @@ DO
e$ = evaluate(e2$, sourcetyp)
IF Error_Happened THEN GOTO errmes

IF sourcetyp AND ISOFFSET THEN
IF (targettyp AND ISOFFSET) = 0 THEN
IF id2.internal_subfunc = 0 THEN a$ = "Cannot convert _OFFSET type to other types": GOTO errmes
END IF
END IF

IF RTRIM$(id2.callname) = "sub_paint" THEN
IF i = 3 THEN
IF (sourcetyp AND ISSTRING) THEN
Expand Down Expand Up @@ -16806,11 +16800,6 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
GOTO evalfuncspecial
END IF '_OFFSET

'*_OFFSET exceptions*
IF sourcetyp AND ISOFFSET THEN
IF n$ = "MKSMBF" AND RTRIM$(id2.musthave) = "$" THEN Give_Error "Cannot convert _OFFSET type to other types": EXIT FUNCTION
IF n$ = "MKDMBF" AND RTRIM$(id2.musthave) = "$" THEN Give_Error "Cannot convert _OFFSET type to other types": EXIT FUNCTION
END IF

'*special case*
IF n$ = "ENVIRON" THEN
Expand Down Expand Up @@ -16999,7 +16988,6 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)

'*special case*
IF n$ = "CDBL" THEN
IF (sourcetyp AND ISOFFSET) THEN Give_Error "Cannot convert _OFFSET type to other types": EXIT FUNCTION
IF (sourcetyp AND ISSTRING) THEN Give_Error "Expected numeric value": EXIT FUNCTION
IF (sourcetyp AND ISREFERENCE) THEN e$ = refer(e$, sourcetyp, 0)
IF Error_Happened THEN EXIT FUNCTION
Expand All @@ -17017,7 +17005,6 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)

'*special case*
IF n$ = "CSNG" THEN
IF (sourcetyp AND ISOFFSET) THEN Give_Error "Cannot convert _OFFSET type to other types": EXIT FUNCTION
IF (sourcetyp AND ISSTRING) THEN Give_Error "Expected numeric value": EXIT FUNCTION
IF (sourcetyp AND ISREFERENCE) THEN e$ = refer(e$, sourcetyp, 0)
IF Error_Happened THEN EXIT FUNCTION
Expand All @@ -17037,7 +17024,6 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)

'*special case*
IF n$ = "CLNG" THEN
IF (sourcetyp AND ISOFFSET) THEN Give_Error "Cannot convert _OFFSET type to other types": EXIT FUNCTION
IF (sourcetyp AND ISSTRING) THEN Give_Error "Expected numeric value": EXIT FUNCTION
IF (sourcetyp AND ISREFERENCE) THEN e$ = refer(e$, sourcetyp, 0)
IF Error_Happened THEN EXIT FUNCTION
Expand All @@ -17060,7 +17046,6 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)

'*special case*
IF n$ = "CINT" THEN
IF (sourcetyp AND ISOFFSET) THEN Give_Error "Cannot convert _OFFSET type to other types": EXIT FUNCTION
IF (sourcetyp AND ISSTRING) THEN Give_Error "Expected numeric value": EXIT FUNCTION
IF (sourcetyp AND ISREFERENCE) THEN e$ = refer(e$, sourcetyp, 0)
IF Error_Happened THEN EXIT FUNCTION
Expand Down Expand Up @@ -17092,7 +17077,6 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
IF n$ = "_MK" THEN mktype = -1
IF mktype THEN
IF mktype <> -1 OR curarg = 2 THEN
'IF (sourcetyp AND ISOFFSET) THEN Give_Error "Cannot convert " + "_OFFSET type to other types": EXIT FUNCTION
'both _MK and trad. process the following
qtyp& = 0
IF mktype$ = "%%" THEN ctype$ = "b": qtyp& = BYTETYPE - ISPOINTER
Expand Down Expand Up @@ -17469,12 +17453,6 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
GOTO dontevaluate
END IF '-8

IF sourcetyp AND ISOFFSET THEN
IF (targettyp AND ISOFFSET) = 0 THEN
IF id2.internal_subfunc = 0 THEN Give_Error "Cannot convert _OFFSET type to other types": EXIT FUNCTION
END IF
END IF

'note: this is used for functions like STR(...) which accept all types...
explicitreference = 0
IF targettyp = -1 THEN
Expand Down Expand Up @@ -17962,13 +17940,6 @@ FUNCTION evaluatetotyp$ (a2$, targettyp AS LONG)
e$ = evaluate(a$, sourcetyp)
IF Error_Happened THEN EXIT FUNCTION

'Offset protection:
IF sourcetyp AND ISOFFSET THEN
IF (targettyp AND ISOFFSET) = 0 AND targettyp >= 0 THEN
Give_Error "Cannot convert _OFFSET type to other types": EXIT FUNCTION
END IF
END IF

'-5 size
'-6 offset
IF targettyp = -4 OR targettyp = -5 OR targettyp = -6 THEN '? -> byte_element(offset,element size in bytes)
Expand Down
9 changes: 0 additions & 9 deletions source/subs_functions/subs_functions.bas
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,6 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion source/subs_functions/syntax_highlighter_list.bas
Original file line number Diff line number Diff line change
Expand Up @@ -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@_CLNGPTR@_CLOCKWISE@_COLORCHOOSERDIALOG@_COMMANDCOUNT@_CONNECTED@_CONNECTIONADDRESS@_CONNECTIONADDRESS$@_CONSOLE@_CONSOLECURSOR@_CONSOLEFONT@_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_GLCOLOR4USV@_GLCOLORMASK@_GLCOLORMATERIAL@_GLCOLORPOINTER@_GLCOPYPIXELS@_GLCOPYTEXIMAGE1D@_GLCOPYTEXIMAGE2D@_GLCOPYTEXSUBIMAGE1D@_GLCOPYTEXSUBIMAGE2D@_GLCULLFACE@"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PrintArray myArray()

DIM arrMem AS _MEM: arrMem = _MEM(myArray())

FOR i = 0 TO (_CLNGPTR(arrMem.SIZE) \ _SIZE_OF_LONG) - 1
FOR i = 0 TO (arrMem.SIZE \ _SIZE_OF_LONG) - 1
_MEMPUT arrMem, arrMem.OFFSET + (i * _SIZE_OF_LONG), i + 1 AS LONG
NEXT i

Expand Down

0 comments on commit f2fe842

Please sign in to comment.