Skip to content

Commit 692db8e

Browse files
committed
fbdoc: wiki snapshot 2018-09-17
1 parent 9e05939 commit 692db8e

File tree

9 files changed

+75
-3
lines changed

9 files changed

+75
-3
lines changed

doc/manual/cache/CatPgDddefines.wakka

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ Preprocessor symbols defined by the compiler.
7070
Defined to either ##"gas"## or ##"gcc"## depending on [[CompilerOptgen|-gen]].
7171
=={{fbdoc item="keyword" value="KeyPgDdfbgcc|__FB_GCC__"}}==
7272
True (##-1##) if -gen gcc is used, false (##0##) otherwise.
73+
=={{fbdoc item="keyword" value="KeyPgDdfbgui|__FB_GUI__"}}==
74+
True (##-1##) if the ##"-s gui"## switch was used, false (##0##) otherwise.
7375
=={{fbdoc item="keyword" value="KeyPgDdFBMain|__FB_MAIN__"}}==
7476
Defined if compiling a module with an entry point.
7577
=={{fbdoc item="keyword" value="KeyPgDdfbdebug|__FB_DEBUG__"}}==

doc/manual/cache/CatPgFullIndex.wakka

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Alphabetical listing of keywords, macros and procedures.
3030
- {{fbdoc item="keyword" value="KeyPgDdfbfpu|__FB_FPU__"}}
3131
- {{fbdoc item="keyword" value="KeyPgDdfbfreebsd|__FB_FREEBSD__"}}
3232
- {{fbdoc item="keyword" value="KeyPgDdfbgcc|__FB_GCC__"}}
33+
- {{fbdoc item="keyword" value="KeyPgDdfbgui|__FB_GUI__"}}
3334
- {{fbdoc item="keyword" value="KeyPgDdfblang|__FB_LANG__"}}
3435
- {{fbdoc item="keyword" value="KeyPgDdfblinux|__FB_LINUX__"}}
3536
- {{fbdoc item="keyword" value="KeyPgDdFBMain|__FB_MAIN__"}}

doc/manual/cache/CatPgFunctIndex.wakka

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ List of ""FreeBASIC"" keywords sorted by the function they perform.
411411
- {{fbdoc item="keyword" value="KeyPgDdfbfpu|__FB_FPFPU__"}}
412412
- {{fbdoc item="keyword" value="KeyPgDdfbfreebsd|__FB_FREEBSD__"}}
413413
- {{fbdoc item="keyword" value="KeyPgDdfbgcc|__FB_GCC__"}}
414+
- {{fbdoc item="keyword" value="KeyPgDdfbgui|__FB_GUI__"}}
414415
- {{fbdoc item="keyword" value="KeyPgDdfblang|__FB_LANG__"}}
415416
- {{fbdoc item="keyword" value="KeyPgDdfblinux|__FB_LINUX__"}}
416417
- {{fbdoc item="keyword" value="KeyPgDdFBMain|__FB_MAIN__"}}

doc/manual/cache/CompilerOpts.wakka

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ Sets the executable subsystem
1010

1111
{{fbdoc item="desc"}}
1212
The ##-s## compiler option specifies the executable subsystem. Allowed subsystems are ##gui## and ##console## (by default, ##console## is used). Specifying a ##gui## subsystem prevents the console window from appearing behind the program window.
13+
14+
The intrinsic macro ##[[KeyPgDdfbgui|__FB_GUI__]]## is set to non-zero (-1) if the option with ##gui## as subsystem was specified, and set to zero (0) otherwise.
1315

1416
{{fbdoc item="target"}}
1517
- Supported on Windows and Cygwin only.
1618

1719
{{fbdoc item="see"}}
20+
- ##[[KeyPgDdfbgui|__FB_GUI__]]##
1821
- [[CompilerCmdLine|Using the Command Line]]
1922

2023
{{fbdoc item="back" value="CatPgCompOpt|Compiler Options"}}

doc/manual/cache/KeyPgErase.wakka

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Statement to erase arrays
1515
Using ##**Erase**## on a fixed-length array resets all elements without freeing the allocated memory.
1616
In case of objects, there is destruction then re-construction.
1717

18-
Using ##**Erase**## on a variable-length array (array already sized) frees the memory used by the element data (does not allow to after resize it with a different number of dimensions).
18+
Using ##**Erase**## on a variable-length array (array already sized) frees the memory allocated for the array elements, but the array remains declared at its same scope level (with the same datatype and number of dimensions).
1919
In case of objects, there is destruction before freeing memory.
2020

2121
{{fbdoc item="ex"}}

doc/manual/cache/KeyPgOpDeleteOverload.wakka

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Member operator to overload memory deallocation process part provided by ##[[Key
1515

1616
##**Delete[] Overload**## operator is the array-version of ##**Delete Overload**## operator and overloads the memory deallocation process provided by the ##**Delete[] Statement**## operator when applying to a UDT (User Defined Type).
1717

18-
Memory freed with ##**Delete Overload**## operator must have be allocated with ##[[KeyPgOpNewOverload|New Overload]]## operator. Memory freed with ##**Delete[] Overload**## operator must have been allocated with ##**New[] Overload operator**##, the array-version of ##[[KeyPgOpNewOverload|New Overload]]## operator. You cannot mix and match the different versions of the operators.
18+
Memory freed with ##**Delete Overload**## operator must have be allocated by also defining a ##[[KeyPgOpNewOverload|New Overload]]## operator. Memory freed with ##**Delete[] Overload**## operator must have been allocated by also defining a ##**New[] Overload operator**##, the array-version of ##[[KeyPgOpNewOverload|New Overload]]## operator. You cannot mix and match the different versions of the operators.
1919

2020
Member operators ##**Delete Overload**##, and ##**Delete[] Overload**## are always static, even if not explicitly declared (##[[KeyPgStaticMember|static]]## keyword is unnecessary but allowed). Thus, they do not have an implicit ##[[KeyPgThis|This]]## instance argument passed to them (because instance already been destroyed).
2121

doc/manual/cache/KeyPgOpNewOverload.wakka

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,74 @@ Member operator to overload dynamic memory allocation process part provided by #
1818

1919
##**New[] Overload**## operator is the array-version of the ##**New Overload**## operator and overloads the dynamic memory allocation process provided by the ##**New[] Expression**## operator when applying to a UDT (User Defined Type).
2020

21-
Memory allocated with ##**New Overload**## operator must be freed with ##[[KeyPgOpDeleteOverload|Delete Overload]]## operator. Memory allocated with ##**New[] Overload**## operator must be freed with ##**Delete[] Overload**## operator, the array-version of ##[[KeyPgOpDeleteOverload|Delete Overload]]## operator. You cannot mix and match the different versions of the operators.
21+
Memory allocated with ##**New Overload**## operator must be freed by also defining a ##[[KeyPgOpDeleteOverload|Delete Overload]]## operator. Memory allocated with ##**New[] Overload**## operator must be freed by also defining a ##**Delete[] Overload**## operator, the array-version of ##[[KeyPgOpDeleteOverload|Delete Overload]]## operator. You cannot mix and match the different versions of the operators.
2222

2323
Member operators ##**New Overload**##, and ##**New[] Overload**## are always static, even if not explicitly declared (##[[KeyPgStaticMember|static]]## keyword is unnecessary but allowed). Thus, they do not have an implicit ##[[KeyPgThis|This]]## instance argument passed to them (because instance not yet been constructed).
2424

2525
{{fbdoc item="ex"}}
26+
Dynamic allocation displayer for UDT, by using the member operators "New([]) Overload" and "Delete([]) Overload" (very simple example, only for syntax usage):
27+
- displaying of memory allocations: addresses, sizes,
28+
- displaying of memory deallocations: addresses.
29+
{{fbdoc item="filename" value="examples/manual/udt/newoverload0.bas"}}
30+
%%(freebasic)
31+
Type UDTdisplayer
32+
'' user UDT fields:
33+
Dim As Byte b(1 To 1024*1024)
34+
'' display fields:
35+
Public:
36+
Declare Operator New (ByVal size As UInteger) As Any Ptr
37+
Declare Operator Delete (ByVal buf As Any Ptr)
38+
Declare Operator New[] (ByVal size As UInteger) As Any Ptr
39+
Declare Operator Delete[] (ByVal buf As Any Ptr)
40+
Private:
41+
Declare Static Function allocation (Byref N As String, Byval size As Uinteger) As Any Ptr
42+
Declare Static Sub deallocation (Byref D As String, Byval p As Any Ptr)
43+
End Type
44+
45+
Operator UDTdisplayer.New (ByVal size As UInteger) As Any Ptr
46+
Return UDTdisplayer.allocation("New", size)
47+
End Operator
48+
49+
Operator UDTdisplayer.Delete (ByVal buf As Any Ptr)
50+
UDTdisplayer.deallocation("Delete", buf)
51+
End Operator
52+
53+
Operator UDTdisplayer.New[] (ByVal size As UInteger) As Any Ptr
54+
Return UDTdisplayer.allocation("New[]", size)
55+
End Operator
56+
57+
Operator UDTdisplayer.Delete[] (ByVal buf As Any Ptr)
58+
UDTdisplayer.deallocation("Delete[]", buf)
59+
End Operator
60+
61+
Function UDTdisplayer.allocation (Byref N As String, Byval size As Uinteger) As Any Ptr
62+
Dim As Any Ptr p = Allocate(size)
63+
Print "memory allocation for " & size & " bytes from '" & N & "' at address: " & p
64+
Return p
65+
End Function
66+
67+
Sub UDTdisplayer.deallocation (Byref D As String, Byval p As Any Ptr)
68+
Print "memory deallocation from '" & D & "' at address " & p
69+
Deallocate p
70+
End Sub
71+
72+
73+
Randomize
74+
Dim As UDTdisplayer Ptr pu1 = New UDTdisplayer
75+
Dim As UDTdisplayer Ptr pu2 = New UDTdisplayer[3]
76+
Delete pu1
77+
Delete[] pu2
78+
79+
Sleep
80+
%%
81+
82+
Output example:
83+
%%
84+
memory allocation for 1048576 bytes from 'New' at address: 32677920
85+
memory allocation for 3145728 bytes from 'New[]' at address: 33775648
86+
memory deallocation from 'Delete' at address 32677920
87+
memory deallocation from 'Delete[]' at address 33775648
88+
%%
2689

2790
Aligned memory allocator:
2891
- by using the member operators "New Overload" and "Delete Overload", any created User object is aligned to a multiple of "ALIGN" bytes (256 bytes in this example),

doc/manual/cache/PrintToc.wakka

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
[[KeyPgDdfbfpu|__FB_FPU__]]
2828
[[KeyPgDdfbfreebsd|__FB_FREEBSD__]]
2929
[[KeyPgDdfbgcc|__FB_GCC__]]
30+
[[KeyPgDdfbgui|__FB_GUI__]]
3031
[[KeyPgDdfblang|__FB_LANG__]]
3132
[[KeyPgDdfblinux|__FB_LINUX__]]
3233
[[KeyPgDdFBMain|__FB_MAIN__]]

doc/manual/templates/default/keywords.lst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ __FB_FPMODE__
491491
__FB_FPU__
492492
__FB_FREEBSD__
493493
__FB_GCC__
494+
__FB_GUI__
494495
__FB_LANG__
495496
__FB_LINUX__
496497
__FB_MAIN__

0 commit comments

Comments
 (0)