Skip to content

Commit 9b04508

Browse files
committed
fbdoc: wiki snapshot 2018-06-28
1 parent fcb253f commit 9b04508

File tree

5 files changed

+181
-44
lines changed

5 files changed

+181
-44
lines changed

doc/manual/cache/CatPgStdDataTypes.wakka

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Built-in data types
77
Types that store real number values, whose range and precision is determined by the size of the data type.
88
**{{anchor name="BOOLEAN|Boolean types"}}**
99
Types that store boolean values.
10+
**{{anchor name="PROCTYPES|Procedure Types"}}**
11+
Types that store pointers to procedures
1012
**{{anchor name="MODIFIERS|Data Type Modifiers"}}**
1113
Specifies additional characteristics of a standard or user-defined data type.
1214
**{{anchor name="STRING|String types"}}**
@@ -35,6 +37,12 @@ Built-in data types
3537
{{anchor name="BOOLEAN"}}{{fbdoc item="section" value="Boolean types"}}
3638
=={{fbdoc item="keyword" value="KeyPgBoolean|BOOLEAN"}}==
3739
1-bit wide data types that store boolean values.
40+
41+
{{anchor name="PROCTYPES"}}{{fbdoc item="section" value="Procedure Types"}}
42+
=={{fbdoc item="keyword" value="KeyPgFunctionPtr|FUNCTION Pointer"}}==
43+
Types that store a pointer to a function procedure
44+
=={{fbdoc item="keyword" value="KeyPgSubPtr|SUB Pointer"}}==
45+
Types that store a pointer to a sub procedure
3846
<<>>{{anchor name="MODIFIERS"}}{{fbdoc item="section" value="Data Type Modifiers"}}
3947
=={{fbdoc item="keyword" value="KeyPgConstQualifier|CONST"}}==
4048
Specifies a read only type.
Lines changed: 71 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,79 @@
11
{{fbdoc item="title" value="User Defined Types"}}----
22

3-
<<{{fbdoc item="section" value="Declaration"}}
4-
- {{fbdoc item="keyword" value="KeyPgEnum|ENUM...END ENUM"}}
5-
- {{fbdoc item="keyword" value="KeyPgType|TYPE...END TYPE"}}
6-
- {{fbdoc item="keyword" value="KeyPgClass|CLASS...END CLASS"}}
7-
- {{fbdoc item="keyword" value="KeyPgUnion|UNION...END UNION"}}
8-
- {{fbdoc item="keyword" value="KeyPgExtends|EXTENDS"}}
9-
- {{fbdoc item="keyword" value="KeyPgImplements|IMPLEMENTS"}}
10-
- {{fbdoc item="keyword" value="KeyPgField|FIELD"}}
11-
- {{fbdoc item="keyword" value="KeyPgObject|OBJECT"}}
3+
**{{anchor name="DECLARATION|Declaration"}}**
4+
Declaring and describing user defined types
5+
**{{anchor name="REFERENCING|Referencing"}}**
6+
Accessing data in a user defined type
7+
**{{anchor name="MEMBERPROC|Member Procedures"}}**
8+
Declaring and defining methods related to a user defined type
9+
**{{anchor name="MEMBERACCESS|Member Access Control"}}**
10+
Controlling when data and member procedures are accessed
1211

13-
{{fbdoc item="section" value="Referencing"}}
14-
- {{fbdoc item="keyword" value="KeyPgTypeTemp|Temporary Types"}}
15-
- {{fbdoc item="keyword" value="KeyPgThis|THIS"}}
16-
- {{fbdoc item="keyword" value="KeyPgBase|BASE (member access)"}}
17-
- {{fbdoc item="keyword" value="KeyPgTypeAlias|Type Alias"}}
18-
- {{fbdoc item="keyword" value="KeyPgWith|WITH"}}
19-
<<>>{{fbdoc item="section" value="Member Procedures"}}
20-
- {{fbdoc item="keyword" value="KeyPgBaseInit|BASE (initialization)"}}
21-
- {{fbdoc item="keyword" value="KeyPgConstructor|CONSTRUCTOR"}}
22-
- {{fbdoc item="keyword" value="KeyPgDestructor|DESTRUCTOR"}}
23-
- {{fbdoc item="keyword" value="KeyPgMemberFunction|FUNCTION"}}
24-
- {{fbdoc item="keyword" value="KeyPgOperator|OPERATOR"}}
25-
- {{fbdoc item="keyword" value="KeyPgOverride|OVERRIDE"}}
26-
- {{fbdoc item="keyword" value="KeyPgProperty|PROPERTY"}}
27-
- {{fbdoc item="keyword" value="KeyPgMemberSub|SUB"}}
28-
- {{fbdoc item="keyword" value="KeyPgStaticMember|STATIC (Member)"}}
29-
- {{fbdoc item="keyword" value="KeyPgVirtual|VIRTUAL"}}
30-
- {{fbdoc item="keyword" value="KeyPgAbstract|ABSTRACT"}}
31-
- {{fbdoc item="keyword" value="KeyPgConstMember|CONST (Member)"}}
12+
<<{{anchor name="DECLARATION"}}{{fbdoc item="section" value="Declarations"}}
13+
=={{fbdoc item="keyword" value="KeyPgEnum|ENUM...END ENUM"}}==
14+
User defined enumeration of values
15+
=={{fbdoc item="keyword" value="KeyPgType|TYPE...END TYPE"}}==
16+
User defined structure of non overlapping data and member procedures
17+
=={{fbdoc item="keyword" value="KeyPgClass|CLASS...END CLASS"}}==
18+
Not implemented. Keyword reserved.
19+
=={{fbdoc item="keyword" value="KeyPgUnion|UNION...END UNION"}}==
20+
User defined structure of overlapping data
21+
=={{fbdoc item="keyword" value="KeyPgExtends|EXTENDS"}}==
22+
Extends an user defined type to derive another
23+
=={{fbdoc item="keyword" value="KeyPgImplements|IMPLEMENTS"}}==
24+
Not implemented. Keyword reserved.
25+
=={{fbdoc item="keyword" value="KeyPgField|FIELD"}}==
26+
Specifies field alignment within a user defined type
27+
=={{fbdoc item="keyword" value="KeyPgObject|OBJECT"}}==
28+
Built-in type providing run-time type information
3229

33-
{{fbdoc item="section" value="Member Access Control"}}
34-
- {{fbdoc item="keyword" value="KeyPgVisPublic|PUBLIC: (Access Control)"}}
35-
- {{fbdoc item="keyword" value="KeyPgVisPrivate|PRIVATE: (Access Control)"}}
36-
- {{fbdoc item="keyword" value="KeyPgVisProtected|PROTECTED: (Access Control)"}}
30+
{{anchor name="REFERENCING"}}{{fbdoc item="section" value="Referencing"}}
31+
=={{fbdoc item="keyword" value="KeyPgTypeTemp|Temporary Types"}}==
32+
Creates a temporary copy of a user defined type
33+
=={{fbdoc item="keyword" value="KeyPgThis|THIS"}}==
34+
Built-in, hidden, parameter passed to non-static member procedures to access the user defined type instance
35+
=={{fbdoc item="keyword" value="KeyPgBase|BASE (member access)"}}==
36+
Built-in, hidden, variable to access the base user defined type instance in derived user defined types
37+
=={{fbdoc item="keyword" value="KeyPgTypeAlias|Type Alias"}}==
38+
Declares a user defined type from other user defined or standard data types
39+
=={{fbdoc item="keyword" value="KeyPgWith|WITH"}}==
40+
Compound statement to access the data and members of a user defined type
41+
42+
<<>>{{anchor name="MEMBERPROC"}}{{fbdoc item="section" value="Member Procedures"}}
43+
=={{fbdoc item="keyword" value="KeyPgBaseInit|BASE (initialization)"}}==
44+
Specifies an initializer for the base user defined type in derived user defined type constructors
45+
=={{fbdoc item="keyword" value="KeyPgConstructor|CONSTRUCTOR"}}==
46+
Declares or defines a member procedure that is automatically called when a user defined type is created
47+
=={{fbdoc item="keyword" value="KeyPgDestructor|DESTRUCTOR"}}==
48+
Declares or defines a member procedure that is automatically called when a user defined type is destroyed or goes out of scope
49+
=={{fbdoc item="keyword" value="KeyPgMemberFunction|FUNCTION"}}==
50+
Declares or defines a member procedure returning a value
51+
=={{fbdoc item="keyword" value="KeyPgOperator|OPERATOR"}}==
52+
Declares or defines an overloaded operator
53+
=={{fbdoc item="keyword" value="KeyPgOverride|OVERRIDE"}}==
54+
Member method attribute that specifies that the method is expected to override a virtual method in the base user defined type
55+
=={{fbdoc item="keyword" value="KeyPgProperty|PROPERTY"}}==
56+
Declares or defines property member procedures for a user defined type
57+
=={{fbdoc item="keyword" value="KeyPgMemberSub|SUB"}}==
58+
Declare or defines a member procedure
59+
=={{fbdoc item="keyword" value="KeyPgStaticMember|STATIC (Member)"}}==
60+
Declares or defines a member procedure or variable is static
61+
=={{fbdoc item="keyword" value="KeyPgVirtual|VIRTUAL"}}==
62+
Member method attribute that declares that a member must have an implementation
63+
=={{fbdoc item="keyword" value="KeyPgAbstract|ABSTRACT"}}==
64+
Member method attribute that declares that a member must be implemented in a derived user defined type
65+
=={{fbdoc item="keyword" value="KeyPgConstMember|CONST (Member)"}}==
66+
Member method attribute that declares or defines that the method is readonly and does not modify the user defined types's data
67+
68+
{{anchor name="MEMBERACCESS"}}{{fbdoc item="section" value="Member Access Control"}}
69+
=={{fbdoc item="keyword" value="KeyPgVisPublic|PUBLIC: (Access Control)"}}==
70+
Data and members in a user defined type have public visibility
71+
=={{fbdoc item="keyword" value="KeyPgVisPrivate|PRIVATE: (Access Control)"}}==
72+
Data and members in a user defined type have private visibility
73+
=={{fbdoc item="keyword" value="KeyPgVisProtected|PROTECTED: (Access Control)"}}==
74+
Data and members in a user defined type have protected visibility
3775
>>
3876

3977
::c::
4078

41-
{{fbdoc item="back" value="DocToc|Table of Contents"}}
42-
43-
44-
45-
79+
{{fbdoc item="back" value="DocToc|Table of Contents"}}

doc/manual/cache/CatPgVariables.wakka

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{{fbdoc item="title" value="Variable Declarations"}}----
22
Statements to declare and allocate space for variables.
33

4-
<<**{{fbdoc item="keyword" value="KeyPgDim|DIM"}}**
4+
<<=={{fbdoc item="keyword" value="KeyPgDim|DIM"}}==
55
Declares a variable at the current scope.
6-
**{{fbdoc item="keyword" value="KeyPgConst|CONST"}}**
6+
=={{fbdoc item="keyword" value="KeyPgConst|CONST"}}==
77
Declares a non-modifiable variable.
8-
**{{fbdoc item="keyword" value="KeyPgScope|SCOPE"}}**
8+
=={{fbdoc item="keyword" value="KeyPgScope|SCOPE"}}==
99
Begins a new scope block.
10-
**{{fbdoc item="keyword" value="KeyPgStatic|STATIC"}}**
10+
=={{fbdoc item="keyword" value="KeyPgStatic|STATIC"}}==
1111
Declares variables in a procedure that retain their value between calls.
12-
<<>>**{{fbdoc item="keyword" value="KeyPgShared|SHARED"}}**
12+
<<>>=={{fbdoc item="keyword" value="KeyPgShared|SHARED"}}==
1313
Used with ##[[KeyPgDim|Dim]]## allows variables to be visible throughout a module.
14-
**{{fbdoc item="keyword" value="KeyPgVar|VAR"}}**
14+
=={{fbdoc item="keyword" value="KeyPgVar|VAR"}}==
1515
Declares variables where the data type is implied from an initializer.
16-
**{{fbdoc item="keyword" value="KeyPgByrefVariables|BYREF (variables)"}}**
16+
=={{fbdoc item="keyword" value="KeyPgByrefVariables|BYREF (variables)"}}==
1717
Used with ##[[KeyPgDim|Dim]]## or ##[[KeyPgStatic|Static]]## or ##[[KeyPgVar|Var]]## allows to declare references.
1818
>>
1919

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{{fbdoc item="title" value="FUNCTION Pointer"}}----
2+
Data type that stores a pointer to a ##[[KeyPgFunction|FUNCTION]]## procedure returning a value
3+
4+
{{fbdoc item="syntax"}}##
5+
[[KeyPgDim|dim]] //variable// [[KeyPgAs|as]] [[KeyPgFunction|Function]] [[[KeyPgCdecl|CDecl]]|[[KeyPgPascal|Pascal]]|[[KeyPgStdcall|StdCall]]] [( [//parameter_list//] )] [ [[KeyPgByrefFunction|ByRef]] ] [[[KeyPgAs|As]] //return_type//] [= //initializer//]
6+
##
7+
{{fbdoc item="param"}}
8+
##//parameter_list//##: parameter[, parameter[, ...]]
9+
##//parameter//##: ##[[[KeyPgByref|ByRef]]|[[KeyPgByval|ByVal]]] //identifier// [[[KeyPgAs|As]] //type//] [= //default_value//]##
10+
##//identifier//##: the name of the variable referenced in the subroutine
11+
##//type//##: the type of variable
12+
##//default_value//##: the value of the argument if none is specified in the call
13+
##//return_value//##: the value returned from the function
14+
##//intializer//##: address of a subroutine to set as the intial value
15+
16+
{{fbdoc item="desc"}}
17+
A ##[[KeyPgFunction|Function]]## pointer is a procedure pointer that stores the memory location of compiled code that returns a value. If no intializer is given the default initial value is zero (0).
18+
19+
The memory address for the ##[[KeyPgFunction|Function]]## procedure can be assigned to the variable by taking the address of a subroutine with ##[[KeyPgOpProcPtr|ProcPtr]]## or ##[[KeyPgOpAt|Operator @ (Address of)]]##.
20+
21+
The procedure must match the same ##[[KeyPgFunction|Function]]## declaration as the declared ##[[KeyPgFunction|Function]]## pointer.
22+
23+
To call the subroutine assigned, use the ##//variable//## name as if it were a normal declared ##[[KeyPgFunction|Function]]##.
24+
25+
{{fbdoc item="ex"}}
26+
{{fbdoc item="filename" value="examples/manual/datatype/funcptr.bas"}}%%(freebasic)
27+
function ConcatSelf( x as string ) as string
28+
return x & x
29+
end function
30+
31+
dim x as Function( x as string ) as string = procptr( ConcatSelf )
32+
33+
print x( "Hello" )
34+
%%
35+
36+
{{fbdoc item="diff"}}
37+
- New to ""FreeBASIC""
38+
39+
{{fbdoc item="see"}}
40+
- ##[[KeyPgSub|Sub]]##
41+
- ##[[KeyPgOpProcPtr|ProcPtr]]##
42+
- ##[[KeyPgOpAt|Operator @ (Address of)]]##
43+
44+
{{fbdoc item="back" value="CatPgStdDataTypes|Standard Data Types"}}

doc/manual/cache/KeyPgSubPtr.wakka

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{{fbdoc item="title" value="SUB Pointer"}}----
2+
Data type that stores a pointer to a ##[[KeyPgSub|SUB]]## procedure
3+
4+
{{fbdoc item="syntax"}}##
5+
[[KeyPgDim|dim]] //variable// [[KeyPgAs|as]] [[KeyPgSub|Sub]] [[[KeyPgCdecl|CDecl]]|[[KeyPgPascal|Pascal]]|[[KeyPgStdcall|StdCall]]] [( [//parameter_list//] )] [= //initializer//]
6+
##
7+
{{fbdoc item="param"}}
8+
##//parameter_list//##: parameter[, parameter[, ...]]
9+
##//parameter//##: ##[[[KeyPgByref|ByRef]]|[[KeyPgByval|ByVal]]] //identifier// [[[KeyPgAs|As]] //type//] [= //default_value//]##
10+
##//identifier//##: the name of the variable referenced in the subroutine
11+
##//type//##: the type of variable
12+
##//default_value//##: the value of the argument if none is specified in the call
13+
##//intializer//##: address of a subroutine to set as the intial value
14+
15+
{{fbdoc item="desc"}}
16+
A ##[[KeyPgSub|Sub]]## pointer is a procedure pointer that stores the memory location of compiled code. If no intializer is given the default initial value is zero (0).
17+
18+
The memory address for the ##[[KeyPgSub|Sub]]## procedure can be assigned to the variable by taking the address of a subroutine with ##[[KeyPgOpProcPtr|ProcPtr]]## or ##[[KeyPgOpAt|Operator @ (Address of)]]##.
19+
20+
The procedure must match the same ##[[KeyPgSub|Sub]]## declaration as the declared ##[[KeyPgSub|Sub]]## pointer.
21+
22+
To call the subroutine assigned, use the ##//variable//## name as if it were a normal declared ##[[KeyPgSub|Sub]]##.
23+
24+
{{fbdoc item="ex"}}
25+
{{fbdoc item="filename" value="examples/manual/datatype/funcptr.bas"}}%%(freebasic)
26+
sub Hello()
27+
print "Hello"
28+
end sub
29+
30+
sub Goodbye()
31+
print "Goodbye"
32+
end sub
33+
34+
dim x as Sub() = procptr( Hello )
35+
36+
x()
37+
38+
x = @Goodbye '' or procptr(Goodbye)
39+
40+
x()
41+
%%
42+
43+
{{fbdoc item="diff"}}
44+
- New to ""FreeBASIC""
45+
46+
{{fbdoc item="see"}}
47+
- ##[[KeyPgSub|Sub]]##
48+
- ##[[KeyPgOpProcPtr|ProcPtr]]##
49+
- ##[[KeyPgOpAt|Operator @ (Address of)]]##
50+
51+
{{fbdoc item="back" value="CatPgStdDataTypes|Standard Data Types"}}

0 commit comments

Comments
 (0)