1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 13:50:36 +00:00

Indentation work (.bas files). No actual code changes.

This commit is contained in:
FellippeHeitor 2018-07-17 00:01:23 -03:00
parent 37986c978b
commit 024f27a5b5
4 changed files with 13015 additions and 13015 deletions

View file

@ -2780,7 +2780,7 @@ FUNCTION ide2 (ignore)
idemouseselect = 1 idemouseselect = 1
wholeword.select = 0 wholeword.select = 0
END IF END IF
ELSEIF mX > 1 AND mx =< 1 + maxLineNumberLength AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers THEN ELSEIF mX > 1 AND mX <= 1 + maxLineNumberLength AND mY > 2 AND mY < (idewy - 5) AND ShowLineNumbers THEN
'line numbers are visible and been clicked 'line numbers are visible and been clicked
ideselect = 1 ideselect = 1
idecy = mY - 2 + idesy - 1 idecy = mY - 2 + idesy - 1
@ -8289,7 +8289,7 @@ SUB ideshowtext
LOOP LOOP
END IF END IF
FOR i = 1 TO LEN (listOfCustomKeywords$) FOR i = 1 TO LEN(listOfCustomKeywords$)
checkChar = ASC(listOfCustomKeywords$, i) checkChar = ASC(listOfCustomKeywords$, i)
IF checkChar = 64 THEN IF checkChar = 64 THEN
IF RIGHT$(tempList$, 1) <> "@" THEN tempList$ = tempList$ + "@" IF RIGHT$(tempList$, 1) <> "@" THEN tempList$ = tempList$ + "@"
@ -8719,7 +8719,7 @@ SUB ideshowtext
'Restore BG color in case a matching bracket was printed with different BG 'Restore BG color in case a matching bracket was printed with different BG
IF l = idecy THEN COLOR , 6 IF l = idecy THEN COLOR , 6
IF isKeyword > 0 THEN isKeyword = isKeyword - 1 IF isKeyword > 0 THEN isKeyword = isKeyword - 1
if isKeyword = 0 THEN checkKeyword$ = "": metacommand = 0: is_Number = 0: isCustomKeyword = 0 IF isKeyword = 0 THEN checkKeyword$ = "": metacommand = 0: is_Number = 0: isCustomKeyword = 0
NEXT m NEXT m
'apply selection color change if necessary 'apply selection color change if necessary
@ -12159,7 +12159,7 @@ FUNCTION idechoosecolorsbox
'Build scheme string 'Build scheme string
SchemeString$ = SchemeString$ + "|" SchemeString$ = SchemeString$ + "|"
FOR j = 1 to 9 FOR j = 1 TO 9
SELECT CASE j SELECT CASE j
CASE 1: CurrentColor~& = IDETextColor CASE 1: CurrentColor~& = IDETextColor
CASE 2: CurrentColor~& = IDEKeywordColor CASE 2: CurrentColor~& = IDEKeywordColor
@ -12197,7 +12197,7 @@ FUNCTION idechoosecolorsbox
SchemeString$ = SchemeString$ + "|" SchemeString$ = SchemeString$ + "|"
'Build scheme string 'Build scheme string
FOR j = 1 to 9 FOR j = 1 TO 9
SELECT CASE j SELECT CASE j
CASE 1: CurrentColor~& = IDETextColor CASE 1: CurrentColor~& = IDETextColor
CASE 2: CurrentColor~& = IDEKeywordColor CASE 2: CurrentColor~& = IDEKeywordColor
@ -12372,7 +12372,7 @@ FUNCTION idechoosecolorsbox
i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Keywords" i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Keywords"
i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Numbers" i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Numbers"
i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Strings" i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Strings"
i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Metacommand/custom keywords i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Metacommand/custom keywords"
i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Comments" i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Comments"
i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Background" i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Background"
i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Current line background" i = i + 1: l$ = l$ + sep + SelectionIndicator$(i) + "Current line background"
@ -14520,7 +14520,7 @@ END SUB
'After Cormen, Leiserson, Rivest & Stein "Introduction To Algoritms" via Wikipedia 'After Cormen, Leiserson, Rivest & Stein "Introduction To Algoritms" via Wikipedia
SUB sort (arr() AS STRING * 998) SUB sort (arr() AS STRING * 998)
FOR i& = LBOUND(arr) + 1 TO UBOUND(arr) FOR i& = LBOUND(arr) + 1 TO UBOUND(arr)
x$ = arr(i&) x$ = arr(i&)
j& = i& - 1 j& = i& - 1
WHILE j& >= LBOUND(arr) WHILE j& >= LBOUND(arr)
@ -14529,7 +14529,7 @@ FOR i& = LBOUND(arr) + 1 TO UBOUND(arr)
j& = j& - 1 j& = j& - 1
WEND WEND
arr$(j& + 1) = x$ arr$(j& + 1) = x$
NEXT i& NEXT i&
END SUB END SUB
FUNCTION FindProposedTitle$ FUNCTION FindProposedTitle$

View file

@ -1,30 +1,30 @@
FUNCTION Back2BackName$ (a$) FUNCTION Back2BackName$ (a$)
IF a$ = "Keyword Reference - Alphabetical" THEN Back2BackName$ = "Alphabetical": EXIT FUNCTION IF a$ = "Keyword Reference - Alphabetical" THEN Back2BackName$ = "Alphabetical": EXIT FUNCTION
IF a$ = "Keyword Reference - By usage" THEN Back2BackName$ = "By Usage": EXIT FUNCTION IF a$ = "Keyword Reference - By usage" THEN Back2BackName$ = "By Usage": EXIT FUNCTION
IF a$ = "QB64 Help Menu" THEN Back2BackName$ = "Help": EXIT FUNCTION IF a$ = "QB64 Help Menu" THEN Back2BackName$ = "Help": EXIT FUNCTION
IF a$ = "QB64 FAQ" THEN Back2BackName$ = "FAQ": EXIT FUNCTION IF a$ = "QB64 FAQ" THEN Back2BackName$ = "FAQ": EXIT FUNCTION
Back2BackName$ = a$ Back2BackName$ = a$
END FUNCTION END FUNCTION
FUNCTION Wiki$ (PageName$) FUNCTION Wiki$ (PageName$)
STATIC AlternativeServer AS _BYTE STATIC AlternativeServer AS _BYTE
Help_PageLoaded$ = PageName$ Help_PageLoaded$ = PageName$
PageName2$ = PageName$ PageName2$ = PageName$
DO WHILE INSTR(PageName2$, " ") DO WHILE INSTR(PageName2$, " ")
ASC(PageName2$, INSTR(PageName2$, " ")) = 95 ASC(PageName2$, INSTR(PageName2$, " ")) = 95
LOOP LOOP
DO WHILE INSTR(PageName2$, "&") DO WHILE INSTR(PageName2$, "&")
i = INSTR(PageName2$, "&") i = INSTR(PageName2$, "&")
PageName2$ = LEFT$(PageName2$, i - 1) + "%26" + RIGHT$(PageName2$, LEN(PageName2$) - i) PageName2$ = LEFT$(PageName2$, i - 1) + "%26" + RIGHT$(PageName2$, LEN(PageName2$) - i)
LOOP LOOP
DO WHILE INSTR(PageName2$, "/") DO WHILE INSTR(PageName2$, "/")
i = INSTR(PageName2$, "/") i = INSTR(PageName2$, "/")
PageName2$ = LEFT$(PageName2$, i - 1) + "%2F" + RIGHT$(PageName2$, LEN(PageName2$) - i) PageName2$ = LEFT$(PageName2$, i - 1) + "%2F" + RIGHT$(PageName2$, LEN(PageName2$) - i)
LOOP LOOP
'Is this page in the cache? 'Is this page in the cache?
IF Help_IgnoreCache = 0 THEN IF Help_IgnoreCache = 0 THEN
IF _FILEEXISTS(Cache_Folder$ + "/" + PageName2$ + ".txt") THEN IF _FILEEXISTS(Cache_Folder$ + "/" + PageName2$ + ".txt") THEN
fh = FREEFILE fh = FREEFILE
OPEN Cache_Folder$ + "/" + PageName2$ + ".txt" FOR BINARY AS #fh OPEN Cache_Folder$ + "/" + PageName2$ + ".txt" FOR BINARY AS #fh
@ -34,9 +34,9 @@ IF Help_IgnoreCache = 0 THEN
Wiki$ = a$ Wiki$ = a$
EXIT FUNCTION EXIT FUNCTION
END IF END IF
END IF END IF
IF Help_Recaching = 0 THEN IF Help_Recaching = 0 THEN
a$ = "Downloading '" + PageName$ + "' page..." a$ = "Downloading '" + PageName$ + "' page..."
IF LEN(a$) > 60 THEN a$ = LEFT$(a$, 57) + STRING$(3, 250) IF LEN(a$) > 60 THEN a$ = LEFT$(a$, 57) + STRING$(3, 250)
IF LEN(a$) < 60 THEN a$ = a$ + SPACE$(60 - LEN(a$)) IF LEN(a$) < 60 THEN a$ = a$ + SPACE$(60 - LEN(a$))
@ -45,21 +45,21 @@ IF Help_Recaching = 0 THEN
PRINT a$; PRINT a$;
PCOPY 3, 0 PCOPY 3, 0
END IF END IF
url$ = "www.qb64.net/wiki/index.php?title=" + PageName2$ + "&action=edit" url$ = "www.qb64.net/wiki/index.php?title=" + PageName2$ + "&action=edit"
s1$ = "readonly=" + CHR$(34) + "readonly" + CHR$(34) + ">" s1$ = "readonly=" + CHR$(34) + "readonly" + CHR$(34) + ">"
try: try:
IF AlternativeServer THEN IF AlternativeServer THEN
url$ = "www.qb64.org/wiki/index.php?title=" + PageName2$ + "&action=edit" url$ = "www.qb64.org/wiki/index.php?title=" + PageName2$ + "&action=edit"
'when fetching from .org, look for name="wpTextbox1"> 'when fetching from .org, look for name="wpTextbox1">
s1$ = "name=" + CHR$(34) + "wpTextbox1" + CHR$(34) + ">" s1$ = "name=" + CHR$(34) + "wpTextbox1" + CHR$(34) + ">"
END IF END IF
url2$ = url$ url2$ = url$
x = INSTR(url2$, "/") x = INSTR(url2$, "/")
IF x THEN url2$ = LEFT$(url$, x - 1) IF x THEN url2$ = LEFT$(url$, x - 1)
c = _OPENCLIENT("TCP/IP:80:" + url2$) c = _OPENCLIENT("TCP/IP:80:" + url2$)
IF c = 0 THEN IF c = 0 THEN
IF INSTR(url$, ".org") = 0 THEN IF INSTR(url$, ".org") = 0 THEN
AlternativeServer = -1 AlternativeServer = -1
IF Help_Recaching = 0 THEN IF Help_Recaching = 0 THEN
@ -76,15 +76,15 @@ IF c = 0 THEN
ELSE ELSE
EXIT FUNCTION EXIT FUNCTION
END IF END IF
END IF END IF
e$ = CHR$(13) + CHR$(10) e$ = CHR$(13) + CHR$(10)
url3$ = RIGHT$(url$, LEN(url$) - x + 1) url3$ = RIGHT$(url$, LEN(url$) - x + 1)
x$ = "GET " + url3$ + " HTTP/1.1" + e$ x$ = "GET " + url3$ + " HTTP/1.1" + e$
x$ = x$ + "Host: " + url2$ + e$ + e$ x$ = x$ + "Host: " + url2$ + e$ + e$
PUT #c, , x$ PUT #c, , x$
t! = TIMER t! = TIMER
DO DO
_DELAY 0.1 _DELAY 0.1
GET #c, , a2$ GET #c, , a2$
IF LEN(a2$) THEN IF LEN(a2$) THEN
@ -117,15 +117,15 @@ DO
EXIT FUNCTION EXIT FUNCTION
END IF END IF
END IF END IF
LOOP UNTIL ABS(TIMER - t!) > 20 LOOP UNTIL ABS(TIMER - t!) > 20
CLOSE #c CLOSE #c
END FUNCTION END FUNCTION
SUB Help_AddTxt (t$, col, link) SUB Help_AddTxt (t$, col, link)
IF t$ = CHR$(13) THEN Help_NewLine: EXIT SUB IF t$ = CHR$(13) THEN Help_NewLine: EXIT SUB
FOR i = 1 TO LEN(t$) FOR i = 1 TO LEN(t$)
c = ASC(t$, i) c = ASC(t$, i)
@ -173,51 +173,51 @@ FOR i = 1 TO LEN(t$)
Help_Pos = Help_Pos + 1 Help_Pos = Help_Pos + 1
special: special:
NEXT NEXT
END SUB END SUB
SUB Help_NewLine SUB Help_NewLine
IF Help_Pos > help_w THEN help_w = Help_Pos IF Help_Pos > help_w THEN help_w = Help_Pos
Help_Txt_Len = Help_Txt_Len + 1: ASC(Help_Txt$, Help_Txt_Len) = 13 Help_Txt_Len = Help_Txt_Len + 1: ASC(Help_Txt$, Help_Txt_Len) = 13
Help_Txt_Len = Help_Txt_Len + 1: ASC(Help_Txt$, Help_Txt_Len) = col + Help_BG_Col * 16 Help_Txt_Len = Help_Txt_Len + 1: ASC(Help_Txt$, Help_Txt_Len) = col + Help_BG_Col * 16
Help_Txt_Len = Help_Txt_Len + 1: ASC(Help_Txt$, Help_Txt_Len) = 0 Help_Txt_Len = Help_Txt_Len + 1: ASC(Help_Txt$, Help_Txt_Len) = 0
Help_Txt_Len = Help_Txt_Len + 1: ASC(Help_Txt$, Help_Txt_Len) = 0 Help_Txt_Len = Help_Txt_Len + 1: ASC(Help_Txt$, Help_Txt_Len) = 0
help_h = help_h + 1 help_h = help_h + 1
Help_Line$ = Help_Line$ + MKL$(Help_Txt_Len + 1) Help_Line$ = Help_Line$ + MKL$(Help_Txt_Len + 1)
Help_Wrap_Pos = 0 Help_Wrap_Pos = 0
IF Help_Underline THEN IF Help_Underline THEN
Help_Underline = 0 Help_Underline = 0
w = Help_Pos w = Help_Pos
Help_Pos = 1 Help_Pos = 1
Help_AddTxt STRING$(w - 1, 196), Help_Col, 0 Help_AddTxt STRING$(w - 1, 196), Help_Col, 0
Help_NewLine Help_NewLine
END IF END IF
Help_Pos = 1 Help_Pos = 1
IF Help_NewLineIndent THEN IF Help_NewLineIndent THEN
Help_AddTxt SPACE$(Help_NewLineIndent), Help_Col, 0 Help_AddTxt SPACE$(Help_NewLineIndent), Help_Col, 0
END IF END IF
END SUB END SUB
SUB Help_PreView SUB Help_PreView
OPEN "help_preview.txt" FOR OUTPUT AS #1 OPEN "help_preview.txt" FOR OUTPUT AS #1
FOR i = 1 TO LEN(Help_Txt$) STEP 4 FOR i = 1 TO LEN(Help_Txt$) STEP 4
c = ASC(Help_Txt$, i) c = ASC(Help_Txt$, i)
c$ = CHR$(c) c$ = CHR$(c)
IF c = 13 THEN c$ = CHR$(13) + CHR$(10) IF c = 13 THEN c$ = CHR$(13) + CHR$(10)
PRINT #1, c$; PRINT #1, c$;
NEXT NEXT
CLOSE #1 CLOSE #1
CLS CLS
FOR i = 1 TO LEN(Help_Txt$) STEP 4 FOR i = 1 TO LEN(Help_Txt$) STEP 4
c = ASC(Help_Txt$, i) c = ASC(Help_Txt$, i)
col = ASC(Help_Txt$, i + 1) col = ASC(Help_Txt$, i + 1)
IF c = 13 THEN IF c = 13 THEN
@ -231,66 +231,66 @@ FOR i = 1 TO LEN(Help_Txt$) STEP 4
COLOR col AND 15, col \ 16 COLOR col AND 15, col \ 16
PRINT CHR$(c); PRINT CHR$(c);
END IF END IF
NEXT NEXT
END SUB END SUB
FUNCTION Help_Col 'helps to calculate the default color FUNCTION Help_Col 'helps to calculate the default color
col = Help_Col_Normal col = Help_Col_Normal
IF Help_Italic THEN col = Help_Col_Italic IF Help_Italic THEN col = Help_Col_Italic
IF Help_Bold THEN col = Help_Col_Bold 'Note: Bold overrides italic IF Help_Bold THEN col = Help_Col_Bold 'Note: Bold overrides italic
Help_Col = col Help_Col = col
END FUNCTION END FUNCTION
SUB WikiParse (a$) SUB WikiParse (a$)
'PRINT "Parsing...": _DISPLAY 'PRINT "Parsing...": _DISPLAY
'wiki page interpret 'wiki page interpret
'clear info 'clear info
help_h = 0: help_w = 0: Help_Line$ = "": Help_Link$ = "": Help_LinkN = 0 help_h = 0: help_w = 0: Help_Line$ = "": Help_Link$ = "": Help_LinkN = 0
Help_Txt$ = SPACE$(1000000) Help_Txt$ = SPACE$(1000000)
Help_Txt_Len = 0 Help_Txt_Len = 0
Help_Pos = 1: Help_Wrap_Pos = 0 Help_Pos = 1: Help_Wrap_Pos = 0
Help_Line$ = MKL$(1) Help_Line$ = MKL$(1)
Help_LockWrap = 0 Help_LockWrap = 0
Help_Bold = 0: Help_Italic = 0 Help_Bold = 0: Help_Italic = 0
Help_Underline = 0 Help_Underline = 0
Help_BG_Col = 0 Help_BG_Col = 0
link = 0: elink = 0: cb = 0 link = 0: elink = 0: cb = 0
col = Help_Col col = Help_Col
'Syntax Notes: 'Syntax Notes:
' '''=bold ' '''=bold
' ''=italic ' ''=italic
' {{macroname|macroparam}} or simply {{macroname}} ' {{macroname|macroparam}} or simply {{macroname}}
' eg. {{KW|PRINT}}=a key word, a link to a page ' eg. {{KW|PRINT}}=a key word, a link to a page
' {{Cl|PRINT}}=a key word in a code example, will be printed in bold and aqua ' {{Cl|PRINT}}=a key word in a code example, will be printed in bold and aqua
' {{Parameter|expression}}=a parameter, in italics ' {{Parameter|expression}}=a parameter, in italics
' {{PageSyntax}} {{PageDescription}} {{PageExamples}} ' {{PageSyntax}} {{PageDescription}} {{PageExamples}}
' {{CodeStart}} {{CodeEnd}} {{OutputStart}} {{OutputEnd}} ' {{CodeStart}} {{CodeEnd}} {{OutputStart}} {{OutputEnd}}
' {{PageSeeAlso}} {{PageNavigation}} ' {{PageSeeAlso}} {{PageNavigation}}
' [[SPACE$]]=a link to wikipage called "SPACE$" ' [[SPACE$]]=a link to wikipage called "SPACE$"
' [[INTEGER|integer]]=a link, link's name is on left and text to appear is on right ' [[INTEGER|integer]]=a link, link's name is on left and text to appear is on right
' *=a dot point ' *=a dot point
' **=a sub(ie. further indented) dot point ' **=a sub(ie. further indented) dot point
' &quot;=a quotation mark ' &quot;=a quotation mark
' :=indent (if beginning a new line) ' :=indent (if beginning a new line)
' CHR$(10)=new line character ' CHR$(10)=new line character
DIM c$(16) DIM c$(16)
FOR ii = 1 TO 16 FOR ii = 1 TO 16
c$(ii) = SPACE$(ii) c$(ii) = SPACE$(ii)
NEXT NEXT
n = LEN(a$) n = LEN(a$)
i = 1 i = 1
DO WHILE i <= n DO WHILE i <= n
c = ASC(a$, i): c$ = CHR$(c) c = ASC(a$, i): c$ = CHR$(c)
FOR i1 = 1 TO 16 FOR i1 = 1 TO 16
@ -652,25 +652,25 @@ DO WHILE i <= n
i = i + 1 i = i + 1
nl = 0 nl = 0
special2: special2:
LOOP LOOP
'Trim Help_Txt$ 'Trim Help_Txt$
Help_Txt$ = LEFT$(Help_Txt$, Help_Txt_Len) + CHR$(13) 'chr13 stops reads past end of content Help_Txt$ = LEFT$(Help_Txt$, Help_Txt_Len) + CHR$(13) 'chr13 stops reads past end of content
'generate preview file 'generate preview file
'OPEN "help_preview.txt" FOR OUTPUT AS #1 'OPEN "help_preview.txt" FOR OUTPUT AS #1
'FOR i = 1 TO LEN(Help_Txt$) STEP 4 'FOR i = 1 TO LEN(Help_Txt$) STEP 4
' c = ASC(Help_Txt$, i) ' c = ASC(Help_Txt$, i)
' c$ = CHR$(c) ' c$ = CHR$(c)
' IF c = 13 THEN c$ = CHR$(13) + CHR$(10) ' IF c = 13 THEN c$ = CHR$(13) + CHR$(10)
' PRINT #1, c$; ' PRINT #1, c$;
'NEXT 'NEXT
'CLOSE #1 'CLOSE #1
'PRINT "Finished parsing!": _DISPLAY 'PRINT "Finished parsing!": _DISPLAY
IF Help_PageLoaded$ = "Keyword Reference - Alphabetical" THEN IF Help_PageLoaded$ = "Keyword Reference - Alphabetical" THEN
fh = FREEFILE fh = FREEFILE
OPEN "internal\help\links.bin" FOR OUTPUT AS #fh OPEN "internal\help\links.bin" FOR OUTPUT AS #fh
@ -778,7 +778,7 @@ IF Help_PageLoaded$ = "Keyword Reference - Alphabetical" THEN
NEXT NEXT
CLOSE #fh CLOSE #fh
END IF END IF

File diff suppressed because it is too large Load diff

View file

@ -1,78 +1,78 @@
FUNCTION gl2qb_type_convert$ (a$, symbol$, typ, ctyp$) FUNCTION gl2qb_type_convert$ (a$, symbol$, typ, ctyp$)
symbol$ = "" symbol$ = ""
'unsigned int 'unsigned int
IF a$ = "GLenum" THEN b$ = "_UNSIGNED LONG": symbol$ = "~&": typ = ULONGTYPE - ISPOINTER: ctyp$ = "uint32" IF a$ = "GLenum" THEN b$ = "_UNSIGNED LONG": symbol$ = "~&": typ = ULONGTYPE - ISPOINTER: ctyp$ = "uint32"
IF a$ = "GLbitfield" THEN b$ = "_UNSIGNED LONG": symbol$ = "~&": typ = ULONGTYPE - ISPOINTER: ctyp$ = "uint32" IF a$ = "GLbitfield" THEN b$ = "_UNSIGNED LONG": symbol$ = "~&": typ = ULONGTYPE - ISPOINTER: ctyp$ = "uint32"
IF a$ = "GLuint" THEN b$ = "_UNSIGNED LONG": symbol$ = "~&": typ = ULONGTYPE - ISPOINTER: ctyp$ = "uint32" IF a$ = "GLuint" THEN b$ = "_UNSIGNED LONG": symbol$ = "~&": typ = ULONGTYPE - ISPOINTER: ctyp$ = "uint32"
'int 'int
IF a$ = "GLint" THEN b$ = "LONG": symbol$ = "&": typ = LONGTYPE - ISPOINTER: ctyp$ = "int32" IF a$ = "GLint" THEN b$ = "LONG": symbol$ = "&": typ = LONGTYPE - ISPOINTER: ctyp$ = "int32"
IF a$ = "GLsizei" THEN b$ = "LONG": symbol$ = "&": typ = LONGTYPE - ISPOINTER: ctyp$ = "int32" IF a$ = "GLsizei" THEN b$ = "LONG": symbol$ = "&": typ = LONGTYPE - ISPOINTER: ctyp$ = "int32"
'unsigned char 'unsigned char
IF a$ = "GLboolean" THEN b$ = "_UNSIGNED _BYTE": symbol$ = "~%%": typ = UBYTETYPE - ISPOINTER: ctyp$ = "uint8" IF a$ = "GLboolean" THEN b$ = "_UNSIGNED _BYTE": symbol$ = "~%%": typ = UBYTETYPE - ISPOINTER: ctyp$ = "uint8"
IF a$ = "GLubyte" THEN b$ = "_UNSIGNED _BYTE": symbol$ = "~%%": typ = UBYTETYPE - ISPOINTER: ctyp$ = "uint8" IF a$ = "GLubyte" THEN b$ = "_UNSIGNED _BYTE": symbol$ = "~%%": typ = UBYTETYPE - ISPOINTER: ctyp$ = "uint8"
'char 'char
IF a$ = "GLbyte" THEN b$ = "_BYTE": symbol$ = "%%": typ = BYTETYPE - ISPOINTER: ctyp$ = "int8" IF a$ = "GLbyte" THEN b$ = "_BYTE": symbol$ = "%%": typ = BYTETYPE - ISPOINTER: ctyp$ = "int8"
'unsigned short 'unsigned short
IF a$ = "GLushort" THEN b$ = "_UNSIGNED INTEGER": symbol$ = "~%": typ = UINTEGERTYPE - ISPOINTER: ctyp$ = "uint16" IF a$ = "GLushort" THEN b$ = "_UNSIGNED INTEGER": symbol$ = "~%": typ = UINTEGERTYPE - ISPOINTER: ctyp$ = "uint16"
'short 'short
IF a$ = "GLshort" THEN b$ = "INTEGER": symbol$ = "%": typ = INTEGERTYPE - ISPOINTER: ctyp$ = "int16" IF a$ = "GLshort" THEN b$ = "INTEGER": symbol$ = "%": typ = INTEGERTYPE - ISPOINTER: ctyp$ = "int16"
'float 'float
IF a$ = "GLfloat" THEN b$ = "SINGLE": symbol$ = "!": typ = SINGLETYPE - ISPOINTER: ctyp$ = "float" IF a$ = "GLfloat" THEN b$ = "SINGLE": symbol$ = "!": typ = SINGLETYPE - ISPOINTER: ctyp$ = "float"
IF a$ = "GLclampf" THEN b$ = "SINGLE": symbol$ = "!": typ = SINGLETYPE - ISPOINTER: ctyp$ = "float" IF a$ = "GLclampf" THEN b$ = "SINGLE": symbol$ = "!": typ = SINGLETYPE - ISPOINTER: ctyp$ = "float"
'double 'double
IF a$ = "GLdouble" THEN b$ = "DOUBLE": symbol$ = "#": typ = DOUBLETYPE - ISPOINTER: ctyp$ = "double" IF a$ = "GLdouble" THEN b$ = "DOUBLE": symbol$ = "#": typ = DOUBLETYPE - ISPOINTER: ctyp$ = "double"
IF a$ = "GLclampd" THEN b$ = "DOUBLE": symbol$ = "#": typ = DOUBLETYPE - ISPOINTER: ctyp$ = "double" IF a$ = "GLclampd" THEN b$ = "DOUBLE": symbol$ = "#": typ = DOUBLETYPE - ISPOINTER: ctyp$ = "double"
'void 'void
IF a$ = "GLvoid" THEN b$ = "_OFFSET": symbol$ = "%&": typ = OFFSETTYPE - ISPOINTER: ctyp$ = "ptrszint" IF a$ = "GLvoid" THEN b$ = "_OFFSET": symbol$ = "%&": typ = OFFSETTYPE - ISPOINTER: ctyp$ = "ptrszint"
'typedef unsigned int GLenum; 'typedef unsigned int GLenum;
'typedef unsigned char GLboolean; 'typedef unsigned char GLboolean;
'typedef unsigned int GLbitfield; 'typedef unsigned int GLbitfield;
'typedef signed char GLbyte; 'typedef signed char GLbyte;
'typedef short GLshort; 'typedef short GLshort;
'typedef int GLint; 'typedef int GLint;
'typedef int GLsizei; 'typedef int GLsizei;
'typedef unsigned char GLubyte; 'typedef unsigned char GLubyte;
'typedef unsigned short GLushort; 'typedef unsigned short GLushort;
'typedef unsigned int GLuint; 'typedef unsigned int GLuint;
'typedef float GLfloat; 'typedef float GLfloat;
'typedef float GLclampf; 'typedef float GLclampf;
'typedef double GLdouble; 'typedef double GLdouble;
'typedef double GLclampd; 'typedef double GLclampd;
'typedef void GLvoid; 'typedef void GLvoid;
IF b$ = "" THEN PRINT "Unknown type:" + a$: END IF b$ = "" THEN PRINT "Unknown type:" + a$: END
gl2qb_type_convert$ = b$ gl2qb_type_convert$ = b$
END FUNCTION END FUNCTION
FUNCTION readchunk$ (a$, last_character$) FUNCTION readchunk$ (a$, last_character$)
a$ = LTRIM$(RTRIM$(a$)) a$ = LTRIM$(RTRIM$(a$))
FOR x = 1 TO LEN(a$) FOR x = 1 TO LEN(a$)
c = ASC(a$, x) c = ASC(a$, x)
IF c = 32 OR c = 44 OR c = 40 OR c = 41 THEN last_character$ = CHR$(c): readchunk$ = LEFT$(a$, x - 1): a$ = LTRIM$(RIGHT$(a$, LEN(a$) - x)): EXIT FUNCTION IF c = 32 OR c = 44 OR c = 40 OR c = 41 THEN last_character$ = CHR$(c): readchunk$ = LEFT$(a$, x - 1): a$ = LTRIM$(RIGHT$(a$, LEN(a$) - x)): EXIT FUNCTION
NEXT NEXT
readchunk$ = a$: last_character$ = "": a$ = "" readchunk$ = a$: last_character$ = "": a$ = ""
END FUNCTION END FUNCTION
SUB gl_scan_header SUB gl_scan_header
IF GL_KIT THEN hk = FREEFILE: OPEN "internal\c\parts\core\gl_header_for_parsing\temp\gl_kit.bas" FOR OUTPUT AS #hk IF GL_KIT THEN hk = FREEFILE: OPEN "internal\c\parts\core\gl_header_for_parsing\temp\gl_kit.bas" FOR OUTPUT AS #hk
IF GL_KIT THEN PRINT #hk, "DECLARE LIBRARY" IF GL_KIT THEN PRINT #hk, "DECLARE LIBRARY"
d = 0: a2$ = "" d = 0: a2$ = ""
h = FREEFILE h = FREEFILE
OPEN "internal\c\parts\core\gl_header_for_parsing\gl.h" FOR INPUT AS #h OPEN "internal\c\parts\core\gl_header_for_parsing\gl.h" FOR INPUT AS #h
DO UNTIL EOF(h) DO UNTIL EOF(h)
LINE INPUT #h, a$ LINE INPUT #h, a$
IF LEN(a$) THEN IF LEN(a$) THEN
a$ = LTRIM$(RTRIM$(a$)) a$ = LTRIM$(RTRIM$(a$))
@ -288,50 +288,50 @@ DO UNTIL EOF(h)
discard: discard:
LOOP LOOP
CLOSE #h CLOSE #h
IF GL_KIT THEN PRINT #hk, "END DECLARE" IF GL_KIT THEN PRINT #hk, "END DECLARE"
GL_DEFINES_LAST = d GL_DEFINES_LAST = d
REDIM _PRESERVE GL_DEFINES(d) AS STRING REDIM _PRESERVE GL_DEFINES(d) AS STRING
'PRINT "Defines:"; GL_DEFINES_LAST 'PRINT "Defines:"; GL_DEFINES_LAST
REDIM _PRESERVE GL_COMMANDS(GL_COMMANDS_LAST) AS GL_idstruct REDIM _PRESERVE GL_COMMANDS(GL_COMMANDS_LAST) AS GL_idstruct
'PRINT "Commands:"; GL_COMMANDS_LAST 'PRINT "Commands:"; GL_COMMANDS_LAST
IF GL_KIT THEN IF GL_KIT THEN
FOR i = 1 TO GL_DEFINES_LAST FOR i = 1 TO GL_DEFINES_LAST
PRINT #hk, "CONST " + GL_DEFINES(i) + "="; GL_DEFINES_VALUE(i) PRINT #hk, "CONST " + GL_DEFINES(i) + "="; GL_DEFINES_VALUE(i)
NEXT NEXT
END IF END IF
'FOR i = 1 TO GL_COMMANDS_LAST 'FOR i = 1 TO GL_COMMANDS_LAST
' PRINT ".cn="; GL_COMMANDS(i).cn ' PRINT ".cn="; GL_COMMANDS(i).cn
' PRINT ".callname="; GL_COMMANDS(i).callname ' PRINT ".callname="; GL_COMMANDS(i).callname
' PRINT ".subfunc="; GL_COMMANDS(i).subfunc ' PRINT ".subfunc="; GL_COMMANDS(i).subfunc
' PRINT ".args="; GL_COMMANDS(i).args ' PRINT ".args="; GL_COMMANDS(i).args
' _CONTROLCHR OFF ' _CONTROLCHR OFF
' PRINT ".arg=[" + RTRIM$(GL_COMMANDS(i).arg) + "]" ' PRINT ".arg=[" + RTRIM$(GL_COMMANDS(i).arg) + "]"
' _CONTROLCHR ON ' _CONTROLCHR ON
' PRINT ".ret="; GL_COMMANDS(i).ret ' PRINT ".ret="; GL_COMMANDS(i).ret
'NEXT 'NEXT
IF GL_KIT THEN CLOSE #hk IF GL_KIT THEN CLOSE #hk
fh = FREEFILE fh = FREEFILE
OPEN "internal\c\parts\core\gl_header_for_parsing\temp\gl_helper_code.h" FOR OUTPUT AS #fh OPEN "internal\c\parts\core\gl_header_for_parsing\temp\gl_helper_code.h" FOR OUTPUT AS #fh
PRINT #fh, GL_HELPER_CODE PRINT #fh, GL_HELPER_CODE
CLOSE #fh CLOSE #fh
END SUB END SUB
SUB gl_include_content SUB gl_include_content
'add constants 'add constants
FOR d = 1 TO GL_DEFINES_LAST FOR d = 1 TO GL_DEFINES_LAST
IF ASC(GL_DEFINES(d)) <> 95 THEN IF ASC(GL_DEFINES(d)) <> 95 THEN
GL_DEFINES(d) = "_" + GL_DEFINES(d) GL_DEFINES(d) = "_" + GL_DEFINES(d)
END IF END IF
@ -359,11 +359,11 @@ FOR d = 1 TO GL_DEFINES_LAST
constdefined(i) = 1 constdefined(i) = 1
'add to hash table 'add to hash table
HashAdd constcname(i), HASHFLAG_CONSTANT, i HashAdd constcname(i), HASHFLAG_CONSTANT, i
NEXT NEXT
'add subs/functions 'add subs/functions
FOR c = 1 TO GL_COMMANDS_LAST FOR c = 1 TO GL_COMMANDS_LAST
DIM g AS GL_idstruct DIM g AS GL_idstruct
' TYPE GL_idstruct ' TYPE GL_idstruct
' cn AS STRING * 64 'case sensitive version of n ' cn AS STRING * 64 'case sensitive version of n
@ -387,19 +387,19 @@ FOR c = 1 TO GL_COMMANDS_LAST
id.ret = g.ret id.ret = g.ret
regid regid
reginternalsubfunc = 0 reginternalsubfunc = 0
NEXT NEXT
'add inline function definitions 'add inline function definitions
'SUB gluPerspective (BYVAL fovy#, BYVAL aspect#, BYVAL zNear#, BYVAL zFar#) 'SUB gluPerspective (BYVAL fovy#, BYVAL aspect#, BYVAL zNear#, BYVAL zFar#)
reginternalsubfunc = 1 reginternalsubfunc = 1
clearid clearid
id.n = "_gluPerspective" id.n = "_gluPerspective"
id.subfunc = 2 'sub id.subfunc = 2 'sub
id.callname = "gluPerspective" id.callname = "gluPerspective"
id.args = 4 id.args = 4
id.arg = MKL$(DOUBLETYPE - ISPOINTER) + MKL$(DOUBLETYPE - ISPOINTER) + MKL$(DOUBLETYPE - ISPOINTER) + MKL$(DOUBLETYPE - ISPOINTER) id.arg = MKL$(DOUBLETYPE - ISPOINTER) + MKL$(DOUBLETYPE - ISPOINTER) + MKL$(DOUBLETYPE - ISPOINTER) + MKL$(DOUBLETYPE - ISPOINTER)
regid regid
reginternalsubfunc = 0 reginternalsubfunc = 0
END SUB END SUB