Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
doc: wiki snapshot
  • Loading branch information
dkl committed Oct 1, 2015
1 parent c8999b1 commit 91a00cc
Show file tree
Hide file tree
Showing 61 changed files with 348 additions and 108 deletions.
6 changes: 6 additions & 0 deletions doc/manual/cache/CatPgCasting.wakka
Expand Up @@ -9,6 +9,8 @@ Operators and procedures that convert between different types.
Operators to convert to floating-point types.
**{{anchor name="STRING|Conversions to/from string types"}}**
Operators to convert top an from string types.
**{{anchor name="BOOLEAN|Conversion to boolean types"}}**
Operators to convert to boolean types.

<<{{anchor name="GENERIC"}}{{fbdoc item="section" value="Generic conversions"}}
=={{fbdoc item="keyword" value="KeyPgCast|CAST"}} and {{fbdoc item="keyword" value="KeyPgCptr|CPTR"}}==
Expand Down Expand Up @@ -42,6 +44,10 @@ Operators and procedures that convert between different types.
Converts numeric string expressions to integer values.
=={{fbdoc item="keyword" value="KeyPgVallng|VALLNG"}} and {{fbdoc item="keyword" value="KeyPgValulng|VALULNG"}}==
Converts numeric string expressions to long values.

{{anchor name="BOOLEAN"}}{{fbdoc item="section" value="Conversion to boolean types"}}
=={{fbdoc item="keyword" value="KeyPgCbool|CBOOL"}}==
Converts a numeric or string expression to a boolean value.
>>::c::

{{fbdoc item="back" value="DocToc|Table of Contents"}}
4 changes: 4 additions & 0 deletions doc/manual/cache/CatPgFullIndex.wakka
Expand Up @@ -121,6 +121,7 @@ Alphabetical listing of keywords, macros and procedures.
- {{fbdoc item="keyword" value="KeyPgBitreset|BITRESET"}}
- {{fbdoc item="keyword" value="KeyPgBitset|BITSET"}}
- {{fbdoc item="keyword" value="KeyPgBload|BLOAD"}}
- {{fbdoc item="keyword" value="KeyPgBoolean|BOOLEAN"}}
- {{fbdoc item="keyword" value="KeyPgBsave|BSAVE"}}
- {{fbdoc item="keyword" value="KeyPgByref|BYREF (parameters)"}}
- {{fbdoc item="keyword" value="KeyPgByrefFunction|BYREF (function results)"}}
Expand All @@ -131,6 +132,7 @@ Alphabetical listing of keywords, macros and procedures.
- {{fbdoc item="keyword" value="KeyPgCallocate|CALLOCATE"}}
- {{fbdoc item="keyword" value="KeyPgCase|CASE"}}
- {{fbdoc item="keyword" value="KeyPgCast|CAST"}}
- {{fbdoc item="keyword" value="KeyPgCbool|CBOOL"}}
- {{fbdoc item="keyword" value="KeyPgCbyte|CBYTE"}}
- {{fbdoc item="keyword" value="KeyPgCdbl|CDBL"}}
- {{fbdoc item="keyword" value="KeyPgCdecl|CDECL"}}
Expand Down Expand Up @@ -244,6 +246,7 @@ Alphabetical listing of keywords, macros and procedures.
- {{fbdoc item="keyword" value="KeyPgExtern|EXTERN"}}
- {{fbdoc item="keyword" value="KeyPgExternBlock|EXTERN...END EXTERN"}}
{{anchor name="f"}}{{fbdoc item="section" value="F"}}
- {{fbdoc item="keyword" value="KeyPgFalse|FALSE"}}
- {{fbdoc item="keyword" value="KeyPgField|FIELD"}}
- {{fbdoc item="keyword" value="KeyPgFileattr|FILEATTR"}}
- {{fbdoc item="keyword" value="KeyPgFilecopy|FILECOPY"}}
Expand Down Expand Up @@ -508,6 +511,7 @@ Alphabetical listing of keywords, macros and procedures.
- {{fbdoc item="keyword" value="KeyPgTo|TO"}}
- {{fbdoc item="keyword" value="KeyPgTransGfx|TRANS (Graphics PUT)"}}
- {{fbdoc item="keyword" value="KeyPgTrim|TRIM"}}
- {{fbdoc item="keyword" value="KeyPgTrue|TRUE"}}
- {{fbdoc item="keyword" value="KeyPgTypeAlias|TYPE (Alias)"}}
- {{fbdoc item="keyword" value="KeyPgTypeTemp|TYPE (Temporary)"}}
- {{fbdoc item="keyword" value="KeyPgType|TYPE (UDT)"}}
Expand Down
6 changes: 5 additions & 1 deletion doc/manual/cache/CatPgFunctIndex.wakka
Expand Up @@ -63,6 +63,7 @@ List of ""FreeBASIC"" keywords sorted by the function they perform.
- {{fbdoc item="keyword" value="KeyPgWrite|WRITE"}}

{{fbdoc item="section" value="Data types and declarations"}}
- {{fbdoc item="keyword" value="KeyPgBoolean|BOOLEAN"}}
- {{fbdoc item="keyword" value="KeyPgByte|BYTE"}}
- {{fbdoc item="keyword" value="KeyPgAs|AS"}}
- {{fbdoc item="keyword" value="KeyPgDim|DIM"}}
Expand Down Expand Up @@ -228,7 +229,7 @@ List of ""FreeBASIC"" keywords sorted by the function they perform.
- {{fbdoc item="keyword" value="KeyPgLprint|LPRINT"}}

{{fbdoc item="section" value="Assignment Operators"}}
- {{fbdoc item="keyword" value="KeyPgOpAssignment|= (Assignment)"}}
- {{fbdoc item="keyword" value="KeyPgOpAssignment|=[>] (Assignment)"}}
- {{fbdoc item="keyword" value="KeyPgOpCombineConcat|&= (Concatenate and Assign)"}}
- {{fbdoc item="keyword" value="KeyPgOpCombineAdd|+= (Add and Assign)"}}
- {{fbdoc item="keyword" value="KeyPgOpCombineSub|-= (Subtract and Assign)"}}
Expand Down Expand Up @@ -433,6 +434,8 @@ List of ""FreeBASIC"" keywords sorted by the function they perform.
- {{fbdoc item="keyword" value="KeyPgDdline|__LINE__"}}
- {{fbdoc item="keyword" value="KeyPgDdpath|__PATH__"}}
- {{fbdoc item="keyword" value="KeyPgDdtime|__TIME__"}}
- {{fbdoc item="keyword" value="KeyPgFalse|FALSE"}}
- {{fbdoc item="keyword" value="KeyPgTrue|TRUE"}}

{{fbdoc item="section" value="Preprocessor"}}
- {{fbdoc item="keyword" value="KeyPgPpassert|#ASSERT"}}
Expand Down Expand Up @@ -580,6 +583,7 @@ List of ""FreeBASIC"" keywords sorted by the function they perform.

{{fbdoc item="section" value="Type casting/conversion"}}
- {{fbdoc item="keyword" value="KeyPgCast|CAST"}}
- {{fbdoc item="keyword" value="KeyPgCbool|CBOOL"}}
- {{fbdoc item="keyword" value="KeyPgCbyte|CBYTE"}}
- {{fbdoc item="keyword" value="KeyPgCdbl|CDBL"}}
- {{fbdoc item="keyword" value="KeyPgCint|CINT"}}
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/cache/CatPgOpAssignment.wakka
Expand Up @@ -3,7 +3,7 @@ Operators that assign values to operands

The assignment operators perform an assignment to the first, or //left-hand side//, operand based on the value of the second, or //right-hand side//, operand. Most of the assignment operators are combination operators, in that they first perform a mathematical or bitwise operation on the two operands, then assign the result to the //left-hand side// operand.

<<=={{fbdoc item="keyword" value="KeyPgOpAssignment|Operator = (Assignment)"}}==
<<=={{fbdoc item="keyword" value="KeyPgOpAssignment|Operator =[>] (Assignment)"}}==
Assigns the value of one operand to the other.
=={{fbdoc item="keyword" value="KeyPgOpCombineConcat|Operator &= (Concatenate and Assign)"}}==
Assigns the value of a concatenation between two operands.
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/cache/CatPgOpIndex.wakka
Expand Up @@ -3,7 +3,7 @@ List of operators used in FreeBASIC.

<<
{{fbdoc item="section" value="Assignment Operators"}}
- {{fbdoc item="keyword" value="KeyPgOpAssignment|= (Assignment)"}}
- {{fbdoc item="keyword" value="KeyPgOpAssignment|=[>] (Assignment)"}}
- {{fbdoc item="keyword" value="KeyPgOpCombineConcat|&= (Concatenate and Assign)"}}
- {{fbdoc item="keyword" value="KeyPgOpCombineAdd|+= (Add and Assign)"}}
- {{fbdoc item="keyword" value="KeyPgOpCombineSub|-= (Subtract and Assign)"}}
Expand Down
6 changes: 6 additions & 0 deletions doc/manual/cache/CatPgStdDataTypes.wakka
Expand Up @@ -5,6 +5,8 @@ Built-in data types
Types that store integer values, whose range is determined by the size of the data type and its signedness.
**{{anchor name="FLOATING|Floating-point types"}}**
Types that store real number values, whose range and precision is determined by the size of the data type.
**{{anchor name="BOOLEAN|Boolean types"}}**
Types that store boolean values.
**{{anchor name="MODIFIERS|Data Type Modifiers"}}**
Specifies additional characteristics of a standard or user-defined data type.
**{{anchor name="STRING|String types"}}**
Expand All @@ -29,6 +31,10 @@ Built-in data types
32-bit wide data types that store real number values.
=={{fbdoc item="keyword" value="KeyPgDouble|DOUBLE"}}==
64-bit wide data types that store real number values.

{{anchor name="BOOLEAN"}}{{fbdoc item="section" value="Boolean types"}}
=={{fbdoc item="keyword" value="KeyPgBoolean|BOOLEAN"}}==
1-bit wide data types that store boolean values.
<<>>{{anchor name="MODIFIERS"}}{{fbdoc item="section" value="Data Type Modifiers"}}
=={{fbdoc item="keyword" value="KeyPgConstQualifier|CONST"}}==
Specifies a read only type.
Expand Down
8 changes: 7 additions & 1 deletion doc/manual/cache/CompilerCmdLine.wakka
Expand Up @@ -145,7 +145,6 @@ Using the **fbc** command-line.
{{fbdoc item="section" value="Meta"}}
=={{fbdoc item="keyword" value="CompilerOptoptfile|@< file >"}}==
Read (additional) command-line options from a file


>>::c::

Expand All @@ -166,6 +165,13 @@ Using the **fbc** command-line.
##fbc -x application.exe main_module.o sub_module.o##
//(Link an executable ##application.exe##)//

**Note:** How to include an icon in a FB executable program
There is a simple command line option to compile a FB program into an executable with an Icon:
- Create a *.rc file, for example appicon.rc, with this info:
FB_PROGRAM_ICON ICON "appicon.ico"
(where appicon.ico is the name of icon)
- Then when compiling program, add appicon.rc in the list of files to compile.

{{fbdoc item="see"}}
- [[CatPgCompOpt Compiler Options]]
- [[CompilerInstalling Installing FreeBASIC]]
Expand Down
4 changes: 2 additions & 2 deletions doc/manual/cache/CompilerOptasm.wakka
Expand Up @@ -13,7 +13,7 @@ Set assembler format for inline assembly under -gen gcc

- ##-gen gcc -asm intel##: FB inline assembly blocks must use FB's usual Intel syntax format. Under -gen gcc, fbc will try to translate it to gcc's format automatically. For example:
%%(freebasic)
dim a as integer = 1
dim a as long = 1
print a
asm
inc dword ptr [a]
Expand All @@ -23,7 +23,7 @@ print a

- ##-gen gcc -asm att##: FB inline assembly blocks must use [[https://gcc.gnu.org/onlinedocs/gcc/Using-Assembly-Language-with-C.html gcc's format]]. For example:
%%(freebasic)
dim a as integer = 1
dim a as long = 1
print a
asm
"incl %0\n" : "+m" (a) : :
Expand Down
4 changes: 4 additions & 0 deletions doc/manual/cache/DevBuildWindows.wakka
Expand Up @@ -92,6 +92,10 @@ This should have produced the ##fbc.exe## compiler and the libraries in ##lib\wi
- ##""C:\MinGW-w64\bin\{ar,as,ld,dlltool}.exe""##
- ##""GoRC.exe""## from [[http://www.godevtool.com/]]

1) For 64bit, or for using -gen gcc on 32bit, gcc.exe and cc1.exe are needed too.
- Copy ##""C:\MinGW-w64\bin\gcc.exe""## to ##""C:\fbc\bin\win{32|64}""##
- Copy ##""C:\MinGW-w64\libexec\gcc\[target]\[version]\cc1.exe""## to ##""C:\fbc\bin\libexec\gcc\[target]\[version]\cc1.exe""##

1) Copy to ##""C:\fbc\lib\win32""## (32bit) or ##""C:\fbc\lib\win64""## (64bit):
- ##""C:\MinGW-w64\[target]\lib\{crt2,dllcrt2,gcrt2}.o""##
- ##""C:\MinGW-w64\[target]\lib\lib{gmon,mingw32,mingwex,moldname}.a""##
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/cache/ExtLibgiflib.wakka
@@ -1,7 +1,7 @@
{{fbdoc item="title" value="GIFLIB"}}----
GIFLIB is a package of portable tools and library routines for working with GIF images

Website: http://giflib.sourceforge.net/doc/
Website: http://giflib.sourceforge.net/intro.html
Platforms supported: ""Win32"", Linux, DOS
Headers to include: gif_lib.bi
Header version: 4.2.1, 5.0.4 (#define ""__GIFLIB_VER__"" to 4 or 5 if needed; default = 5)
Expand Down
31 changes: 31 additions & 0 deletions doc/manual/cache/KeyPgBoolean.wakka
@@ -0,0 +1,31 @@
{{fbdoc item="title" value="BOOLEAN"}}----
Standard data type

{{fbdoc item="syntax"}}##
[[KeyPgDim dim]] //variable// [[KeyPgAs as]] **Boolean**
##
{{fbdoc item="desc"}}
Boolean data type. Can hold the values ##[[KeyPgTrue True]]## or ##[[KeyPgFalse False]]##.

**Notes on definition of boolean data type:** //Ideally, the definition of the boolean data type is that it holds the value of ##[[KeyPgTrue True]]## or ##[[KeyPgFalse False]]##, and that's it. However, to make this concept a reality, we need a definition that uses real world connections. A more realistic definition is that the boolean data type is a 1-bit integer, having the value 0 to indicate ##[[KeyPgFalse False]]## and 1 to indicate ##[[KeyPgTrue True]]##. For a practical definition, we must consider, yet again, additional factors. The most significant factor is that the hardware (processor) on which code is executed does not directly support a 1-bit data type; the smallest register or memory size we can work with is 8-bits or 1-byte. Therefore, a practical definition of boolean data type is an integer, 8 bits wide, having the value 0 or 1, where all other values are undefined. However, because of longstanding differences between C/C""++"" and FB with respect to logical operations, the interpretation of the value must also be considered. Assume "false" is 0 in both C/C""++"" and FB. C/C""++"" has logical 'not' operator '!' such that '!0' produces '1'. FB has a bitwise ##[[KeyPgOpNot Not]]## operator such that 'not 0' produces '-1'. Therefore the definition for a C/C""++"" boolean is an unsigned 1-bit integer, zero extended to fill larger integer types, and the definition for a FB boolean is a signed 1-bit integer, sign extended to fill larger integer types. However, the purpose and intent of the boolean data type remains, that it should only ever hold a ##[[KeyPgTrue True]]## value or ##[[KeyPgFalse False]]## value, regardless of the underlying details.//

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/datatype/boolean.bas"}}%%(freebasic)
Dim boolvar As Boolean
boolvar = True
Print "boolvar = ", boolvar
%%
**Output:**
%%boolvar = true%%

{{fbdoc item="lang"}}
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Boolean""**##.

{{fbdoc item="diff"}}
- New to ""FreeBASIC""

{{fbdoc item="see"}}
- ##[[KeyPgTrue True]]##
- ##[[KeyPgFalse False]]##

{{fbdoc item="back" value="CatPgStdDataTypes|Standard Data Types"}}
2 changes: 1 addition & 1 deletion doc/manual/cache/KeyPgCast.wakka
Expand Up @@ -7,7 +7,7 @@ Converts an expression to a specified data type
{{fbdoc item="desc"}}
Converts ##//expression//## into a different ##[[DataType datatype]]##. Useful to be used in macros when ##[[DataType datatype]]## is unknown and also when converting to [[KeyPgTypeAlias Type Alias]].

Note: this is a general form of conversion operators such as ##[[KeyPgCint Cint]]## or ##[[KeyPgCdbl Cdbl]]##. They are more versatile because they can be used on types that have a ##[[KeyPgOpCast Cast]]## operator, but don't have a built-in keyword for it. e.g. ##**Cast**( //my_type//, //expr//)##. They are also suitable for use in cases where the type of a variable is not fixed in the code - for example, it might be ##[[KeyPgPpdefine Define]]##d earlier, or may be the ##[[KeyPgTypeof Type of]]## a different variable or expression.
Note: this is a general form of conversion operators such as ##[[KeyPgCint Cint]]## or ##[[KeyPgCdbl Cdbl]]##. They are more versatile because they can be used on types that have a ##[[KeyPgOperator Cast operator]]##, but don't have a built-in keyword for it. e.g. ##**Cast**( //my_type//, //expr//)##. They are also suitable for use in cases where the type of a variable is not fixed in the code - for example, it might be ##[[KeyPgPpdefine Define]]##d earlier, or may be the ##[[KeyPgTypeof Type of]]## a different variable or expression.

Note: If you want to use an operator specifically for converting to different types of ##[[KeyPgPointer Pointer]]##s, consider using ##[[KeyPgCptr Cptr]]## instead.

Expand Down
69 changes: 69 additions & 0 deletions doc/manual/cache/KeyPgCbool.wakka
@@ -0,0 +1,69 @@
{{fbdoc item="title" value="CBOOL"}}----
Converts numeric or string expression to a boolean (##[[KeyPgBoolean Boolean]]##)

{{fbdoc item="syntax"}}##
[[KeyPgDeclare declare]] [[KeyPgFunction function]] **Cbool** ( [[KeyPgByval byval]] //expression// [[KeyPgAs as]] [[DataType datatype]] ) [[KeyPgAs as]] [[KeyPgBoolean boolean]]

[[KeyPgType Type]] //typename//
[[KeyPgDeclare declare]] [[KeyPgOperator operator]] [[KeyPgCast cast]] ( ) [[KeyPgAs as]] [[KeyPgBoolean boolean]]
End Type
##
{{fbdoc item="usage"}}##
//result// = **Cbool**( //numeric expression// )
//result// = **Cbool**( //string expression// )
//result// = **Cbool**( //user defined type// )
##
{{fbdoc item="param"}}
##//expression//##
a numeric, string, or user defined type to cast to a ##[[KeyPgBoolean Boolean]]## value
##//datatype//##
any numeric, string, or user defined type
##//typename//##
a user defined type

{{fbdoc item="ret"}}
A ##[[KeyPgBoolean Boolean]]## value.

{{fbdoc item="desc"}}
The ##**Cbool**## function converts a zero value to ##[[KeyPgFalse False]]## and a non-zero value to ##[[KeyPgTrue True]]##.

The name can be explained as 'Convert to Boolean'.

If the argument is a string expression, it is converted to boolean using a case insensitive to the string "false" to return a ##[[KeyPgFalse False]]## value or "true" to return a ##[[KeyPgTrue True]]## value.

{{fbdoc item="ex"}}
{{fbdoc item="filename" value="examples/manual/casting/boolean.bas"}}%%(freebasic)
' Using the CBOOL function to convert a numeric value

'Create an BOOLEAN variable
DIM b AS BOOLEAN

'Convert a numeric value
b = CBOOL(1)

'Print the result, should return True
PRINT b
SLEEP
%%

{{fbdoc item="lang"}}
- Not available in the //[[CompilerOptlang -lang qb]]// dialect unless referenced with the alias ##**""__Cbool""**##.

{{fbdoc item="diff"}}
- New to ""FreeBASIC""

{{fbdoc item="see"}}
- ##[[KeyPgCbyte Cbyte]]##
- ##[[KeyPgCubyte Cubyte]]##
- ##[[KeyPgCshort Cshort]]##
- ##[[KeyPgCushort Cushort]]##
- ##[[KeyPgCint Cint]]##
- ##[[KeyPgCuint Cuint]]##
- ##[[KeyPgClng Clng]]##
- ##[[KeyPgCulng Culng]]##
- ##[[KeyPgClngint Clngint]]##
- ##[[KeyPgCulngint Culngint]]##
- ##[[KeyPgCsng Csng]]##
- ##[[KeyPgCdbl Cdbl]]##

{{fbdoc item="back" value="CatPgCasting|Converting Data Types"}}
2 changes: 1 addition & 1 deletion doc/manual/cache/KeyPgConstructor.wakka
Expand Up @@ -32,7 +32,7 @@ Called automatically when a class or user defined type is created
Note: Even if is defined an explicit default ##**Constructor**##, it is never called by the implicit copy constructor.

Chaining of constructors in nested types is supported. Any fields that have their own default constructor are called first.
The keyword ##**Constructor**(//parameters//)## can be used at the top of a constructor, allowing to chain together constructors of same type. It prevents the compiler from emitting field initalization code (instead, it relies on the chained constructor to initialize everything).
The keyword ##**Constructor**(//parameters//)## can be used at the top of a constructor, allowing to chain together constructors of same type. It prevents the compiler from emitting field initialization code (instead, it relies on the chained constructor to initialize everything).

##**Constructor**## can be also called directly from the ##//typename//## instance like the other member methods (##[[KeyPgSub Sub]]##) and with the same syntax, i.e. using a member access operator, e.g. ##//obj//.**Constructor**(//parameters//)##. In particular, doing ##//this//.**Constructor**(//parameters//)## is not treated as chaining constructor, and it is allowed anywhere (not only at the top of constructors). In general it's not safe to manually call the constructor on an object, because no ##[[KeyPgDestructor destructor]]## is called, and the old object state - if any - is overwritten without any of its old members being destroyed, which could cause memory/resource leaks.

Expand Down
2 changes: 1 addition & 1 deletion doc/manual/cache/KeyPgDim.wakka
Expand Up @@ -101,7 +101,7 @@ Dim array(1 To 2, 6, 3 To 5) As Single
See also //[[ProPgFixLenArrays Fixed-Length Arrays]]// and //[[ProPgVarLenArrays Variable-Length Arrays]]//.

{{fbdoc item="section" value="Initializers"}}
Arrays, variables, strings, and user defined types (UDTs) are initialized to zero or null strings by default when they are created.
Arrays, variables, strings, and user defined types (UDTs) are initialized to zero (or ##[[KeyPgFalse False]]## for ##[[KeyPgBoolean Boolean]]##) or null strings by default when they are created.

To avoid the overhead of default variable initialization, the ##**Any**## initializer can be used with ##**Dim**## to tell the compiler to only reserve the place for the variable in memory but not initialize it, so the variable will contain garbage. In this case the programmer should not make assumptions about the initial values.

Expand Down

0 comments on commit 91a00cc

Please sign in to comment.