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

Merge pull request #118 from QB64Team/Fix-ResizingScreen

Fixes resizing screen and tweaks help system
This commit is contained in:
Fellippe Heitor 2021-01-26 23:44:26 -03:00 committed by GitHub
commit e3b9c468fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 243 additions and 207 deletions

View file

@ -2,11 +2,15 @@ The [[DIM]] statement is used to declare a variable or a list of variables as a
{{PageSyntax}}
::''Syntax 1:'' [[DIM]] [{{KW|SHARED}}] ''variable''[{suffix| {{KW|AS}} ''type''}] [, ''variable2''...]]
::''To declare variables:''
:::[[DIM]] [{{KW|SHARED}}] ''variable''[{suffix| {{KW|AS}} [{{KW|_UNSIGNED}}] ''type''}] [, ''variable2''...]]
::''Syntax 2:'' [[DIM]] [{{KW|SHARED}}] ''array(lowest% [{{KW|TO}}) highest%])''[{suffix| {{KW|AS}} ''type''}] [, ''variable2''...]
::''To declare arrays:''
:::[[DIM]] [{{KW|SHARED}}] ''array([lowest% {{KW|TO}}] highest%])''[{suffix| {{KW|AS}} [{{KW|_UNSIGNED}}] ''type''}] [, ''variable2''...]
:'' '''QB64''' Syntax:'' [[DIM]] [{{KW|SHARED}}] ''variable''[{suffix| {{KW|AS}} [{{KW|_UNSIGNED}}] ''type''}] [, ''variable2''...]
::'' '''QB64''' Alternative Syntax:''
:::[[DIM]] [{{KW|SHARED}}] {{KW|AS}} [{{KW|_UNSIGNED}}] ''type'' ''variable'' [, ''variable2''...]
:::[[DIM]] [{{KW|SHARED}}] {{KW|AS}} [{{KW|_UNSIGNED}}] ''type'' ''array([lowest% {{KW|TO}}] highest%])'' [, ''array2(elements)''...]
{{PageDescription}}
@ -26,7 +30,8 @@ The [[DIM]] statement is used to declare a variable or a list of variables as a
** [[_FLOAT]] (or use variable suffix '''##''')
** [[_OFFSET]] (or use variable suffix '''%&''')
** DIM AS [[_MEM]] (the _MEM type has no type suffix).
* '''Note: When a variable has not been defined or has no type suffix, the value defaults to [[SINGLE]].'''
* '''Note: When a variable has not been defined or has no type suffix, the type defaults to [[SINGLE]].'''
* When using the '''AS type variable-list''' syntax, type symbols cannot be used.
* When the [[$DYNAMIC]] metacommand or [[REDIM]] is used, array element sizes are changeable (not [[$STATIC]]).
* Use [[REDIM]] instead of DIM to dimension arrays as dynamic without the {{KW|$DYNAMIC}} metacommand.
* Use [[REDIM]] [[_PRESERVE]] in '''QB64''' to retain previous array values when changing the size of an array.
@ -84,6 +89,13 @@ x = 1 'x is a {{Cl|SINGLE}} variable
: ''Explanation:'' QB64 gives an error because the creation of the new variable would make referring to the existing one impossible.
''Example 8:'' Using QB64's alternative syntax to declare multiple variables/arrays of the same type.
{{CodeStart}} '' ''
{{Cl|DIM}} {{Cl|AS}} {{Cl|LONG}} w, h, id, weight, index 'all of these variables are created as type LONG
{{Cl|DIM}} {{Cl|AS}} {{Cl|SINGLE}} x, y, z ' all of these variables are created as type SINGLE
{{CodeEnd}} '' ''
{{PageSeeAlso}}
* [[_DEFINE]], [[_PRESERVE]]
* [[REDIM]], [[TYPE]]

View file

@ -3,23 +3,24 @@ A {{KW|REDIM}} statement can re-dimension one [[$DYNAMIC|dynamic]](flexible) [[A
{{PageSyntax}}
:[[REDIM]] [{{KW|_PRESERVE}}] [{{KW|SHARED}}] ArrayName[''typesuffix''] ({''max_element''|low_element[{{KW|TO}} ''upper_element'', ...]}) [{{KW|AS}} {{KW|TYPE|Type}}]
:[[REDIM]] [{{KW|_PRESERVE}}] [{{KW|SHARED}}] [{{KW|AS}} {{KW|TYPE|Type}}] ArrayName({''max_element''|low_element[{{KW|TO}} ''upper_element'', ...]})
{{PageDescription}}
* Can change the number of elements in an array (the present array data is lost unless [[_PRESERVE]] is used).
* Dynamic array elements can also be sized or resized by a program user's entry.
* The [[_PRESERVE]] option also allows the ''element'' range values to be moved upward or downward in '''QB64 only!'''
* The [[_PRESERVE]] option also allows the ''element'' range values to be moved upward or downward.
* {{Parameter|Array}} is the name of the array to be dimensioned or re-dimensioned.
* {{Parameter|elements}} is the number of elements the array should hold. Use the optional [[TO]] {{Parameter|elements2}} to set a range.
* '''Always use the same array [[TYPE]] suffix ([[AS]] type) or a new array type with the same name may be created.'''
* REDIM cannot change [[$STATIC]] arrays created with a [[DIM]] statement unless the [[$DYNAMIC]] [[Metacommand]] is used!
* REDIM cannot change [[$STATIC]] arrays created with a [[DIM]] statement unless the [[$DYNAMIC]] [[Metacommand]] is used.
* To create a dynamic array use the [[$DYNAMIC]] metacommand or use [[REDIM]] rather than [[DIM]] when first creating the array.
* Use REDIM [[_PRESERVE]] to change the range or number of array elements without losing the remaining elements. Data may move up or down to accommodate those boundary changes.
* '''REDIM [[_PRESERVE]] cannot change the number of array dimensions or type!'''
* '''REDIM [[_PRESERVE]] cannot change the number of array dimensions or type.'''
* [[$DYNAMIC|Dynamic]] arrays MUST be [[REDIM]]ensioned if [[ERASE]] or [[CLEAR]] are used to clear the arrays as they no longer exist.
* When [[AS]] is used to declare the type, use [[AS]] to retain that type or it will change to [[SINGLE]]!
* '''NOTE: Many Qbasic keyword variable names CAN be used with a [[STRING]] suffix($) ONLY! You CANNOT use them without the suffix, use a numerical suffix or use [[DIM]], [[REDIM]], [[_DEFINE]], [[BYVAL]] or [[TYPE]] variable [[AS]] statements!'''
* '''Warning! Do not use negative array upper bound index values as OS access or "Out of Memory" [[ERROR Codes|errors]] will occur!'''
* '''Warning! Do not use negative array upper bound index values as OS access or "Out of Memory" [[ERROR Codes|errors]] will occur.'''
* When using the '''AS type variable-list''' syntax, type symbols cannot be used.
''Example 1:'' The [[$DYNAMIC]] Metacommand allows an array to be re-sized using [[DIM]] and REDIM.

View file

@ -4,12 +4,14 @@ The '''SHARED''' statement allows variables to be passed automatically to any [[
{{PageSyntax}}
:: DIM SHARED Qt AS STRING * 1
:: DIM SHARED AS STRING * 1 Qt
* [[DIM]]ensioned variables are shared with all procedures in the program module.
* When used with [[DIM]] in the main module, it eliminates the need to pass a parameter variable to a [[SUB]] or [[FUNCTION]].
* Use [[COMMON SHARED]] to share a list of variable values with sub-procedures or other modules. See also: [[COMMON]]
* SHARED ('''without [[DIM]]''') can share a list of variables inside of [[SUB]] or [[FUNCTION]] procedures with the main module only.
* When using the '''AS type variable-list''' syntax, type symbols cannot be used.
:'''Note: SHARED variables in sub-procedures will not be passed to other sub-procedures, only the main module.'''

View file

@ -1,31 +1,40 @@
'''TYPE''' definitions are used to create variables that can hold more than one variable type of a fixed byte length.
'''TYPE''' definitions are used to create variables that can hold more than one element.
{{PageSyntax}}
::'''TYPE''' typename
::: element-name1 AS type
::: element-name2 AS type
::: .
::: .
::: .
::: element-nameN AS type
::'''END TYPE'''
::.
::. variable(s) AS type
::.
::'''TYPE''' typename
::: AS type element-list1
::: AS type element-list2
::: .
::: .
::: .
::: AS type element-listN
::'''END TYPE'''
* Typename is an undefined type name holder as it can hold any variable types.
* TYPE definitions should be placed in the main module before the start of the program code execution.
* TYPE definitions CAN be placed in [[SUB]] or [[FUNCTION]] procedures using QB64 only!
* TYPE definitions cannot contain Array variables! Arrays can be [[DIM]]ensioned as a TYPE definition.
* TYPE definitions cannot be inside of another TYPE definition, but variables can be defined AS another type.(See Example 3)
* TYPE definitions are usually placed in the main module before the start of the program code execution.
* TYPE definitions cam also be placed in [[SUB]] or [[FUNCTION]] procedures.
* TYPE definitions cannot contain Array variables. Arrays can be [[DIM]]ensioned as a TYPE definition.
* TYPE definitions cannot be inside of another TYPE definition, but variables can be defined AS another type.(See Example 4)
* TYPE definitions must be ended with [[END TYPE]].
* A TYPE variable MUST be assigned to the type after it is defined. Array variables are allowed.
* A TYPE variable must be assigned to the type after it is defined. Array variables are allowed.
* Type variables must be defined in every SUB or FUNCTION unless the type variable is [[DIM]]ensioned as [[SHARED]].
* Type variables use DOT variable names to read or write specific values. They do not use type suffixes as they can hold ANY variable type values! The name before the dot is the one you defined after the type definition and the name after is the variable name used inside of the TYPE. The name of the dimensioned type variable alone can be used to [[PUT]] # or [[GET]] # all of the data at once!
* Once the TYPE variable is created you can find the record or byte size by using [[LEN]](typevariable).
* TYPE definitions can also be placed in [[$INCLUDE]] .BI text files such as [[QB.BI]] is used by [[INTERRUPT]] and [[INTERRUPTX]].
* '''[[_BIT]] is not currently supported in User Defined [[TYPE]]s'''.
* '''NOTE: Many Qbasic keyword variable names CAN be used with a [[STRING]] suffix($) ONLY! You CANNOT use them without the suffix, use a numerical suffix or use [[DIM]], [[REDIM]], [[_DEFINE]], [[BYVAL]] or [[TYPE]] variable [[AS]] statements!'''
* You can mix the '''element-name AS type''' syntax with the '''AS type element-list''' syntax in the same TYPE block.
* '''[[_BIT]] is not supported in User Defined [[TYPE]]s'''.
{{DataTypeTable}}
@ -58,11 +67,20 @@
::::Each TYPE variable is designated as the DOT variable's suffix.
'''* Note: Omitting variables in the RegType definition can change other program variable values!'''
'''* Note: Omitting variables in the RegType definition can change other program variable values.'''
''Example 2:'' Simplifying the TYPE from Example 1 using the alternative TYPE syntax.
{{CodeStart}}
TYPE RegType
AS INTEGER AX, BX, CX, DX, BP, SI, DI, Flags, FS, ES
END TYPE
{{CodeEnd}}
:''Explanation:'' By using '''AS type element-list''' you reduce typing in your TYPE definition, while achieving the same results.
''Example 2:'' Creating an addressbook database for a [[RANDOM]] file.
''Example 4:'' Creating an addressbook database for a [[RANDOM]] file.
{{CodeStart}}
TYPE ContactInfo
First AS STRING * 10
@ -85,10 +103,10 @@
{{CodeEnd}}
:''Explanation:'' Use the assigned type variable to find the RANDOM record length which is 118 bytes.
::::The DOT variable names consist of Contact as the prefix:
''Example 3:'' Defining a TYPE variable as another variable type from a previous TYPE definition in QB64.
''Example 4:'' Defining a TYPE variable as another variable type from a previous TYPE definition in QB64.
{{CodeStart}}
{{Cl|TYPE}} bar
b {{Cl|AS}} {{Cl|STRING}} * 10
@ -108,7 +126,7 @@ PRINT foobar.a, foobar.c.b
{{CodeEnd}}
''Example 4:'' A bitmap header information TYPE [[$INCLUDE]] File.
''Example 5:'' A bitmap header information TYPE [[$INCLUDE]] File.
{{TextStart}}
' ********
'Bitmap.BI can be included at start of program
@ -153,6 +171,7 @@ PRINT foobar.a, foobar.c.b
''See also:''
* [[DIM]], [[REDIM]]
* [[INTEGER]], [[SINGLE]], [[DOUBLE]]
* [[LONG]], [[_INTEGER64]], [[_FLOAT]]
* [[STRING]], [[_BYTE]], [[_BIT]], [[_OFFSET]]

View file

@ -770,6 +770,7 @@ FUNCTION ide2 (ignore)
_PALETTECOLOR 13, IDETextColor, 0
_PALETTECOLOR 14, IDEQuoteColor, 0
SCREEN , , 3, 0
'static background
COLOR 0, 7
_PRINTSTRING (1, 1), SPACE$(idewx)
@ -800,8 +801,10 @@ FUNCTION ide2 (ignore)
ideshowtext
END IF
PCOPY 3, 0
_DISPLAY
_LIMIT 30
_LIMIT 15
LOOP WHILE _RESIZE
IF retval = 1 THEN 'screen dimensions have changed and everything must be redrawn/reapplied
@ -2442,177 +2445,155 @@ FUNCTION ide2 (ignore)
contextualhelp:
IdeContextHelpSF = 0
'identify word or character at current cursor position
a$ = idegetline(idecy)
x = idecx
IF LEN(a$) > 0 AND x = LEN(a$) + 1 THEN x = x - 1
IF x <= LEN(a$) THEN
a2$ = UCASE$(getWordAtCursor$)
'check if F1 is in help links
fh = FREEFILE
OPEN "internal\help\links.bin" FOR INPUT AS #fh
lnks = 0: lnks$ = CHR$(0)
DO UNTIL EOF(fh)
LINE INPUT #fh, l$
c = INSTR(l$, ","): l1$ = LEFT$(l$, c - 1): l2$ = RIGHT$(l$, LEN(l$) - c)
IF a2$ = UCASE$(l1$) OR (qb64prefix_set = 1 AND LEFT$(l1$, 1) = "_" AND a2$ = MID$(l1$, 2)) THEN
IF INSTR(lnks$, CHR$(0) + l2$ + CHR$(0)) = 0 THEN
lnks = lnks + 1
IF l2$ = l1$ THEN
lnks$ = CHR$(0) + l2$ + lnks$
ELSE
lnks$ = lnks$ + l2$ + CHR$(0)
END IF
END IF
END IF
LOOP
CLOSE #fh
IF lnks THEN
lnks$ = MID$(lnks$, 2, LEN(lnks$) - 2)
lnk$ = lnks$
IF lnks > 1 THEN
'clarify context
lnk$ = idef1box$(lnks$, lnks)
IF lnk$ = "C" THEN GOTO ideloop
a2$ = UCASE$(getWordAtCursor$)
lnks = 0
lnks$ = findHelpTopic$(a2$, lnks, 0)
IF lnks THEN
lnks$ = MID$(lnks$, 2, LEN(lnks$) - 2)
lnk$ = lnks$
IF lnks > 1 THEN
'clarify context
lnk$ = idef1box$(lnks$, lnks)
IF lnk$ = "C" THEN GOTO ideloop
END IF
IF INSTR(UCASE$(lnk$), "PARENTHESIS") THEN GOTO ideloop
OpenHelpLnk:
Help_Back(Help_Back_Pos).sx = Help_sx 'update position
Help_Back(Help_Back_Pos).sy = Help_sy
Help_Back(Help_Back_Pos).cx = Help_cx
Help_Back(Help_Back_Pos).cy = Help_cy
top = UBOUND(back$)
IF Back$(Help_Back_Pos) = lnk$ THEN Help_Back_Pos = Help_Back_Pos - 1: GOTO usenextentry2
IF Help_Back_Pos < top THEN
IF Back$(Help_Back_Pos + 1) = lnk$ THEN
GOTO usenextentry2
END IF
END IF
OpenHelpLnk:
top = top + 1
REDIM _PRESERVE Back(top) AS STRING
REDIM _PRESERVE Help_Back(top) AS Help_Back_Type
REDIM _PRESERVE Back_Name(top) AS STRING
'Shuffle array upwards after current pos
FOR x = top - 1 TO Help_Back_Pos + 1 STEP -1
Back_Name$(x + 1) = Back_Name$(x)
Back$(x + 1) = Back$(x)
Help_Back(x + 1).sx = Help_Back(x).sx
Help_Back(x + 1).sy = Help_Back(x).sy
Help_Back(x + 1).cx = Help_Back(x).cx
Help_Back(x + 1).cy = Help_Back(x).cy
NEXT
usenextentry2:
Help_Back_Pos = Help_Back_Pos + 1
Back$(Help_Back_Pos) = lnk$
Back_Name$(Help_Back_Pos) = Back2BackName$(lnk$)
Help_Back(Help_Back_Pos).sx = 1
Help_Back(Help_Back_Pos).sy = 1
Help_Back(Help_Back_Pos).cx = 1
Help_Back(Help_Back_Pos).cy = 1
Help_sx = 1: Help_sy = 1: Help_cx = 1: Help_cy = 1
a$ = Wiki(lnk$)
Help_Back(Help_Back_Pos).sx = Help_sx 'update position
Help_Back(Help_Back_Pos).sy = Help_sy
Help_Back(Help_Back_Pos).cx = Help_cx
Help_Back(Help_Back_Pos).cy = Help_cy
top = UBOUND(back$)
IF Back$(Help_Back_Pos) = lnk$ THEN Help_Back_Pos = Help_Back_Pos - 1: GOTO usenextentry2
IF Help_Back_Pos < top THEN
IF Back$(Help_Back_Pos + 1) = lnk$ THEN
GOTO usenextentry2
END IF
END IF
top = top + 1
REDIM _PRESERVE Back(top) AS STRING
REDIM _PRESERVE Help_Back(top) AS Help_Back_Type
REDIM _PRESERVE Back_Name(top) AS STRING
'Shuffle array upwards after current pos
FOR x = top - 1 TO Help_Back_Pos + 1 STEP -1
Back_Name$(x + 1) = Back_Name$(x)
Back$(x + 1) = Back$(x)
Help_Back(x + 1).sx = Help_Back(x).sx
Help_Back(x + 1).sy = Help_Back(x).sy
Help_Back(x + 1).cx = Help_Back(x).cx
Help_Back(x + 1).cy = Help_Back(x).cy
NEXT
usenextentry2:
Help_Back_Pos = Help_Back_Pos + 1
Back$(Help_Back_Pos) = lnk$
Back_Name$(Help_Back_Pos) = Back2BackName$(lnk$)
Help_Back(Help_Back_Pos).sx = 1
Help_Back(Help_Back_Pos).sy = 1
Help_Back(Help_Back_Pos).cx = 1
Help_Back(Help_Back_Pos).cy = 1
Help_sx = 1: Help_sy = 1: Help_cx = 1: Help_cy = 1
a$ = Wiki(lnk$)
IF idehelp = 0 THEN
IF idesubwindow THEN PCOPY 3, 0: SCREEN , , 3, 0: GOTO ideloop
idesubwindow = idewy \ 2: idewy = idewy - idesubwindow
Help_wx1 = 2: Help_wy1 = idewy + 1: Help_wx2 = idewx - 1: Help_wy2 = idewy + idesubwindow - 2: Help_ww = Help_wx2 - Help_wx1 + 1: Help_wh = Help_wy2 - Help_wy1 + 1
WikiParse a$
idehelp = 1
skipdisplay = 0
IdeSystem = 3
retval = 1
END IF
IF idehelp = 0 THEN
IF idesubwindow THEN PCOPY 3, 0: SCREEN , , 3, 0: GOTO ideloop
idesubwindow = idewy \ 2: idewy = idewy - idesubwindow
Help_wx1 = 2: Help_wy1 = idewy + 1: Help_wx2 = idewx - 1: Help_wy2 = idewy + idesubwindow - 2: Help_ww = Help_wx2 - Help_wx1 + 1: Help_wh = Help_wy2 - Help_wy1 + 1
WikiParse a$
idehelp = 1
skipdisplay = 0
IdeSystem = 3
GOSUB redrawitall
GOTO specialchar
retval = 1
END IF
ELSE
'No help found; Does the user want help for a SUB or FUNCTION?
a2$ = LTRIM$(RTRIM$(a2$))
IF LEN(a2$) THEN
DO UNTIL alphanumeric(ASC(RIGHT$(a2$, 1)))
a2$ = LEFT$(a2$, LEN(a2$) - 1) 'removes sigil, if any
IF LEN(a2$) = 0 THEN GOTO NoKeywordFound
LOOP
WikiParse a$
IdeSystem = 3
GOSUB redrawitall
GOTO specialchar
FOR y = 1 TO iden
a$ = idegetline(y)
a$ = LTRIM$(RTRIM$(a$))
sf = 0
nca$ = UCASE$(a$)
IF LEFT$(nca$, 4) = "SUB " THEN sf = 1: sf$ = "SUB "
IF LEFT$(nca$, 9) = "FUNCTION " THEN sf = 2: sf$ = "FUNCTION "
IF sf THEN
IF RIGHT$(nca$, 7) = " STATIC" THEN
a$ = RTRIM$(LEFT$(a$, LEN(a$) - 7))
END IF
ELSE
'No help found; Does the user want help for a SUB or FUNCTION?
a2$ = LTRIM$(RTRIM$(a2$))
IF LEN(a2$) THEN
DO UNTIL alphanumeric(ASC(RIGHT$(a2$, 1)))
a2$ = LEFT$(a2$, LEN(a2$) - 1) 'removes sigil, if any
IF LEN(a2$) = 0 THEN GOTO NoKeywordFound
LOOP
IF sf = 1 THEN
a$ = RIGHT$(a$, LEN(a$) - 4)
ELSE
a$ = RIGHT$(a$, LEN(a$) - 9)
END IF
a$ = LTRIM$(RTRIM$(a$))
x = INSTR(a$, "(")
IF x THEN
n$ = RTRIM$(LEFT$(a$, x - 1))
args$ = RIGHT$(a$, LEN(a$) - x + 1)
x = INSTR(args$, ")"): IF x THEN args$ = LEFT$(args$, x)
ELSE
n$ = a$
args$ = ""
cleanSubName n$
END IF
backupn$ = n$
DO UNTIL alphanumeric(ASC(RIGHT$(n$, 1)))
n$ = LEFT$(n$, LEN(n$) - 1) 'removes sigil, if any
LOOP
IF UCASE$(n$) = a2$ THEN
a$ = "'''" + backupn$ + "''' is a symbol that is used in your program as follows:"
a$ = a$ + CHR$(10) + CHR$(10) + "{{PageSyntax}}" + CHR$(10)
a$ = a$ + ": " + sf$ + "'''" + backupn$ + "''' " + args$
a$ = a$ + CHR$(10) + "{{PageNavigation}}"
IdeContextHelpSF = -1
IF idehelp = 0 THEN
IF idesubwindow THEN PCOPY 3, 0: SCREEN , , 3, 0: GOTO ideloop
idesubwindow = idewy \ 2: idewy = idewy - idesubwindow
Help_wx1 = 2: Help_wy1 = idewy + 1: Help_wx2 = idewx - 1: Help_wy2 = idewy + idesubwindow - 2: Help_ww = Help_wx2 - Help_wx1 + 1: Help_wh = Help_wy2 - Help_wy1 + 1
WikiParse a$
idehelp = 1
skipdisplay = 0
IdeSystem = 3
retval = 1
END IF
WikiParse a$
IdeSystem = 3
GOTO specialchar
EXIT FOR
END IF
FOR y = 1 TO iden
a$ = idegetline(y)
a$ = LTRIM$(RTRIM$(a$))
sf = 0
nca$ = UCASE$(a$)
IF LEFT$(nca$, 4) = "SUB " THEN sf = 1: sf$ = "SUB "
IF LEFT$(nca$, 9) = "FUNCTION " THEN sf = 2: sf$ = "FUNCTION "
IF sf THEN
IF RIGHT$(nca$, 7) = " STATIC" THEN
a$ = RTRIM$(LEFT$(a$, LEN(a$) - 7))
END IF
NEXT
END IF
NoKeywordFound:
END IF 'lnks
END IF
IF sf = 1 THEN
a$ = RIGHT$(a$, LEN(a$) - 4)
ELSE
a$ = RIGHT$(a$, LEN(a$) - 9)
END IF
a$ = LTRIM$(RTRIM$(a$))
x = INSTR(a$, "(")
IF x THEN
n$ = RTRIM$(LEFT$(a$, x - 1))
args$ = RIGHT$(a$, LEN(a$) - x + 1)
x = INSTR(args$, ")"): IF x THEN args$ = LEFT$(args$, x)
ELSE
n$ = a$
args$ = ""
cleanSubName n$
END IF
backupn$ = n$
DO UNTIL alphanumeric(ASC(RIGHT$(n$, 1)))
n$ = LEFT$(n$, LEN(n$) - 1) 'removes sigil, if any
LOOP
IF UCASE$(n$) = a2$ THEN
a$ = "'''" + backupn$ + "''' is a symbol that is used in your program as follows:"
a$ = a$ + CHR$(10) + CHR$(10) + "{{PageSyntax}}" + CHR$(10)
a$ = a$ + ": " + sf$ + "'''" + backupn$ + "''' " + args$
a$ = a$ + CHR$(10) + "{{PageNavigation}}"
IdeContextHelpSF = -1
IF idehelp = 0 THEN
IF idesubwindow THEN PCOPY 3, 0: SCREEN , , 3, 0: GOTO ideloop
idesubwindow = idewy \ 2: idewy = idewy - idesubwindow
Help_wx1 = 2: Help_wy1 = idewy + 1: Help_wx2 = idewx - 1: Help_wy2 = idewy + idesubwindow - 2: Help_ww = Help_wx2 - Help_wx1 + 1: Help_wh = Help_wy2 - Help_wy1 + 1
WikiParse a$
idehelp = 1
skipdisplay = 0
IdeSystem = 3
retval = 1
END IF
WikiParse a$
IdeSystem = 3
GOTO specialchar
EXIT FOR
END IF
END IF
NEXT
END IF
NoKeywordFound:
END IF 'lnks
GOTO specialchar
END IF
@ -13124,27 +13105,15 @@ SUB IdeMakeContextualMenu
END IF
IF LEN(a2$) > 0 THEN
'check if F1 is in help links
fh = FREEFILE
OPEN "internal\help\links.bin" FOR INPUT AS #fh
lnks = 0: lnks$ = CHR$(0)
DO UNTIL EOF(fh)
LINE INPUT #fh, l$
c = INSTR(l$, ","): l1$ = LEFT$(l$, c - 1): l2$ = RIGHT$(l$, LEN(l$) - c)
IF a2$ = UCASE$(l1$) OR (qb64prefix_set = 1 AND LEFT$(l1$, 1) = "_" AND a2$ = MID$(l1$, 2)) THEN
IF INSTR(lnks$, CHR$(0) + l2$ + CHR$(0)) = 0 THEN
lnks = lnks + 1
EXIT DO
END IF
END IF
LOOP
CLOSE #fh
'check if a2$ is in help links
lnks = 0
l2$ = findHelpTopic$(a2$, lnks, -1)
IF lnks THEN
IF LEN(l2$) > 15 THEN
l2$ = LEFT$(l2$, 12) + STRING$(3, 250)
END IF
IF INSTR(l2$, "Parenthesis") = 0 THEN
IF INSTR(l2$, "PARENTHESIS") = 0 THEN
menu$(m, i) = "#Help On '" + l2$ + "'": i = i + 1
END IF
END IF
@ -14413,6 +14382,10 @@ FUNCTION getWordAtCursor$
a$ = idegetline(idecy)
x = idecx
IF x <= LEN(a$) THEN
IF ASC(a$, x) = 32 AND x > 1 THEN
IF ASC(a$, x - 1) <> 32 THEN x = x - 1
END IF
try:
IF alphanumeric(ASC(a$, x)) THEN
x1 = x
DO WHILE x1 > 1
@ -14427,6 +14400,8 @@ FUNCTION getWordAtCursor$
a2$ = CHR$(ASC(a$, x))
END IF
getWordAtCursor$ = a2$ 'a2$ now holds the word or character at current cursor position
ELSEIF x = LEN(a$) + 1 AND x > 1 THEN
IF ASC(a$, x - 1) <> 32 THEN x = x - 1: GOTO try
END IF
END FUNCTION
@ -14502,4 +14477,31 @@ SUB insertAtCursor (tempk$)
idechangemade = 1
END SUB
FUNCTION findHelpTopic$(topic$, lnks, firstOnly AS _BYTE)
'check if topic$ is in help links
' - returns a list of help links separated by CHR$(0)
' - returns the total number of links found by changing 'lnks'
a2$ = UCASE$(topic$)
fh = FREEFILE
OPEN "internal\help\links.bin" FOR BINARY AS #fh
lnks = 0: lnks$ = CHR$(0)
DO UNTIL EOF(fh)
LINE INPUT #fh, l$
c = INSTR(l$, ","): l1$ = LEFT$(l$, c - 1): l2$ = RIGHT$(l$, LEN(l$) - c)
IF a2$ = UCASE$(l1$) OR (qb64prefix_set = 1 AND LEFT$(l1$, 1) = "_" AND a2$ = MID$(l1$, 2)) THEN
IF INSTR(lnks$, CHR$(0) + l2$ + CHR$(0)) = 0 THEN
lnks = lnks + 1
IF firstOnly THEN findHelpTopic$ = l2$: CLOSE #fh: EXIT FUNCTION
IF l2$ = l1$ THEN
lnks$ = CHR$(0) + l2$ + lnks$
ELSE
lnks$ = lnks$ + l2$ + CHR$(0)
END IF
END IF
END IF
LOOP
CLOSE #fh
findHelpTopic$ = lnks$
END FUNCTION
'$INCLUDE:'wiki\wiki_methods.bas'

View file

@ -3257,7 +3257,7 @@ DO
s = Labels(r).Scope
IF s = subfuncn OR s = -1 THEN 'same scope?
IF s = -1 THEN Labels(r).Scope = subfuncn 'acquire scope
IF Labels(r).State = 1 THEN a$ = "Duplicate label": GOTO errmes
IF Labels(r).State = 1 THEN a$ = "Duplicate label (" + RTRIM$(Labels(r).cn) + ")": GOTO errmes
'aquire state 0 types
tlayout$ = RTRIM$(Labels(r).cn)
GOTO addlabaq100
@ -3319,7 +3319,7 @@ DO
s = Labels(r).Scope
IF s = subfuncn OR s = -1 THEN 'same scope?
IF s = -1 THEN Labels(r).Scope = subfuncn 'acquire scope
IF Labels(r).State = 1 THEN a$ = "Duplicate label": GOTO errmes
IF Labels(r).State = 1 THEN a$ = "Duplicate label (" + RTRIM$(Labels(r).cn) + ")": GOTO errmes
'aquire state 0 types
tlayout$ = RTRIM$(Labels(r).cn)
GOTO addlabaq
@ -25366,7 +25366,7 @@ SUB free_udt_varstrings (n$, udt, file, base_offset)
element = udtenext(element)
LOOP
END SUB
SUB initialise_array_udt_varstrings (n$, udt, base_offset, bytesperelement$, acc$)
IF NOT udtxvariable(udt) THEN EXIT SUB
offset = base_offset
@ -25420,7 +25420,7 @@ SUB copy_full_udt (dst$, src$, file, base_offset, udt)
element = udtenext(element)
LOOP
END SUB
SUB dump_udts
f = FREEFILE
OPEN "types.txt" FOR OUTPUT AS #f