Skip to content

Commit 3f3cde5

Browse files
committed
fbdocs: wiki snapshot 2021.06.28
1 parent 37ed4c1 commit 3f3cde5

24 files changed

+224
-161
lines changed

doc/manual/cache/CodeLibrary.wakka

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
==Formats==
3131
[[http://www.freebasic.net/forum/viewtopic.php?t=8024|fbpng library by yetifoot]]
32+
[[https://www.freebasic.net/forum/viewtopic.php?f=14&t=24105|FBImage static Win/Lin 32/64-bit by by D.J.Peters]]
3233

3334
==Animation==
3435
[[http://www.freebasic.net/forum/viewtopic.php?t=7340|ASCII Animation Example by Pritchard]]

doc/manual/cache/KeyPgAllocate.wakka

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ end sub
8888
print "Memory leak!"
8989
end
9090
%%
91-
92-
{{fbdoc item="target"}}
93-
- This procedure is not guaranteed to be thread-safe.
94-
9591
{{fbdoc item="lang"}}
9692
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Allocate""**##
9793

doc/manual/cache/KeyPgCallocate.wakka

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Allocates memory for a certain number of elements from the free store and clears
2222
Similarly, ##**Callocate**## can also be used directly with ##[[KeyPgZstring|Zstring]]## or ##[[KeyPgWstring|Wstring]]## because string data is created with null characters.
2323

2424
{{fbdoc item="ex"}}
25-
{{fbdoc item="filename" value="examples/manual/memory/callocate.bas"}}%%(freebasic)
25+
{{fbdoc item="filename" value="examples/manual/memory/callocate.bas"}}%%(freebasic)
2626
' Allocate and initialize space for 10 integer elements.
2727
dim p as integer ptr = callocate(10, sizeof(integer))
2828

@@ -38,13 +38,10 @@ next
3838

3939
' Free the memory.
4040
deallocate(p)
41-
%%
42-
Outputs:
43-
%% 10 20 30 40 50 60 70 80 90 100%%
44-
45-
{{fbdoc item="target"}}
46-
- This procedure is not guaranteed to be thread-safe.
47-
41+
%%Outputs:
42+
%%
43+
10 20 30 40 50 60 70 80 90 100
44+
%%
4845
{{fbdoc item="lang"}}
4946
- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Callocate""**##.
5047

doc/manual/cache/KeyPgCls.wakka

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ In graphics modes, if you want to clear the entire screen to color ##0##, it can
4040

4141
{{fbdoc item="filename" value="examples/manual/gfx/cls-memset.bas"}}%%(freebasic)
4242
Dim scrbuf As Byte Ptr, scrsize As Integer
43-
Dim As Integer scrhei, scrpitch
43+
Dim As Long scrhei, scrpitch
4444
Dim As Integer r = 0, dr = 1
4545

4646
Screenres 640, 480, 8

doc/manual/cache/KeyPgDeallocate.wakka

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ Frees previously allocated memory
1717
When memory was allocated to hold a string descriptor, the string must always be destroyed (setting to ##"####"##) before deallocate the string descriptor (allowing to deallocate the memory taken up by the string data), otherwise, it is not possible to deallocate it later, and it may induce memory leak in the program continuation.
1818

1919
Calling **##Deallocate##** on a null pointer induces no action.
20-
21-
~&**##Deallocate##** is an alias for the C runtime library's **##free##**, so it's not guaranteed to be thread safe in all platforms.
2220

2321
{{fbdoc item="ex"}}
24-
The following example shows how to free previously allocated memory. Note that the pointer is set to null following the deallocation:
25-
26-
{{fbdoc item="filename" value="examples/manual/memory/deallocate.bas"}}%%(freebasic)
22+
The following example shows how to free previously allocated memory. Note that the pointer is set to null following the deallocation:
23+
{{fbdoc item="filename" value="examples/manual/memory/deallocate.bas"}}%%(freebasic)
2724
sub DeallocateExample1()
2825
dim as integer ptr integerPtr = allocate( len( integer ) ) '' initialize pointer to
2926
'' new memory address
@@ -37,13 +34,12 @@ end sub
3734

3835
DeallocateExample1()
3936
end 0
40-
%%
41-
42-
Although in this case it is unnecessary since the function immediately exits afterwards, setting the pointer to null is a good habit to get into. If the function deallocated memory from a pointer that was passed in by reference, for instance, the pointer that was used in the function call will be rendered invalid, and it is up to the caller to either reassign the pointer or set it to null. Example 3 shows how to correctly handle this kind of situation, and the next example shows the effects of deallocating memory with multiple references.
43-
44-
In the following example, a different pointer is used to free previously allocated memory.
37+
%%
4538

46-
{{fbdoc item="filename" value="examples/manual/memory/deallocate2.bas"}}%%(freebasic)
39+
Although in this case it is unnecessary since the function immediately exits afterwards, setting the pointer to null is a good habit to get into. If the function deallocated memory from a pointer that was passed in by reference, for instance, the pointer that was used in the function call will be rendered invalid, and it is up to the caller to either reassign the pointer or set it to null. Example 3 shows how to correctly handle this kind of situation, and the next example shows the effects of deallocating memory with multiple references.
40+
41+
In the following example, a different pointer is used to free previously allocated memory:
42+
{{fbdoc item="filename" value="examples/manual/memory/deallocate2.bas"}}%%(freebasic)
4743
'' WARNING: "evil" example showing how things should NOT be done
4844

4945
sub DeallocateExample2()
@@ -65,11 +61,11 @@ end sub
6561

6662
DeallocateExample2()
6763
end 0
68-
%%
69-
70-
Note that after the deallocation, //both// pointers are rendered invalid. This illustrates another one of the ways that bugs can arise when working with pointers. As a general rule, only deallocate memory previously allocated when you know that there is only one (1) pointer currently pointing at it.
64+
%%
7165

72-
{{fbdoc item="filename" value="examples/manual/memory/deallocate3.bas"}}%%(freebasic)
66+
Note that after the deallocation, //both// pointers are rendered invalid. This illustrates another one of the ways that bugs can arise when working with pointers. As a general rule, only deallocate memory previously allocated when you know that there is only one (1) pointer currently pointing at it.
67+
68+
{{fbdoc item="filename" value="examples/manual/memory/deallocate3.bas"}}%%(freebasic)
7369
function createInteger() as integer ptr
7470
return allocate( len( integer ) ) '' return pointer to newly
7571
end function '' allocated memory
@@ -92,9 +88,9 @@ end sub
9288

9389
DeallocateExample3()
9490
end 0
95-
%%
91+
%%
9692

97-
In the program above, a reference pointer in a function is set to null after deallocating the memory it points to. An ##[[KeyPgAssert|ASSERT]]## macro is used to test if the original pointer is in fact null after the function call. This example implies the correct way to pass pointers to functions that deallocate the memory they point to is by reference.
93+
In the program above, a reference pointer in a function is set to null after deallocating the memory it points to. An ##[[KeyPgAssert|ASSERT]]## macro is used to test if the original pointer is in fact null after the function call. This example implies the correct way to pass pointers to functions that deallocate the memory they point to is by reference.
9894

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

doc/manual/cache/KeyPgDylibfree.wakka

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
Unloads a dynamic link library from memory
33

44
{{fbdoc item="syntax"}}##
5-
[[KeyPgDeclare|declare]] [[KeyPgSub|sub]] **Dylibfree** ( [[KeyPgByval|byval]] //library// [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|pointer]] )
5+
[[KeyPgDeclare|declare]] [[KeyPgSub|sub]] **Dylibfree** ( [[KeyPgByval|byval]] //libhandle// [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|pointer]] )
66
##
77
{{fbdoc item="usage"}}##
8-
**Dylibfree**( //library// )
8+
**Dylibfree**( //libhandle// )
99
##
1010
{{fbdoc item="param"}}
11-
##//library//##
11+
##//libhandle//##
1212
The handle of a library to unload.
1313

1414
{{fbdoc item="desc"}}

doc/manual/cache/KeyPgDylibload.wakka

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
Loads to a Dynamic Link Library (DLL) into memory at runtime
33

44
{{fbdoc item="syntax"}}##
5-
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Dylibload** ( [[KeyPgByref|byref]] //filename// [[KeyPgAs|as]] [[KeyPgString|string]] ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|Pointer]]
5+
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Dylibload** ( [[KeyPgByref|byref]] //libname// [[KeyPgAs|as]] [[KeyPgString|string]] ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|Pointer]]
66
##
77
{{fbdoc item="usage"}}##
8-
//result// = **Dylibload** ( //filename// )
8+
//result// = **Dylibload** ( //libname// )
99
##
1010
{{fbdoc item="param"}}
11-
##//filename//##
12-
A ##[[KeyPgString|string]]## containing the filename of the library to load.
11+
##//libname//##
12+
A ##[[KeyPgString|string]]## containing the name of the library to load.
1313

1414
{{fbdoc item="ret"}}
1515
The ##[[KeyPgPtr|pointer]]## handle of the library loaded. Zero on error
1616

1717
{{fbdoc item="desc"}}
1818
##[[KeyPgDylibload|Dylibload]]## is used to link at runtime libraries to your program. This function does the link and returns a handle that must be used with ##[[KeyPgDylibsymbol|Dylibsymbol]]## when calling a function in the library and with ##[[KeyPgDylibfree|Dylibfree]]## when releasing the library.
1919

20-
Note: If the ##//filename//## string (without extension) already includes a character dot (##.##), it may be mandatory to explicitly specify the filename extension to avoid any parser ambiguity.
20+
Note: If the ##//libname//## string (without extension) already includes a character dot (##.##), it may be mandatory to explicitly specify the filename extension to avoid any parser ambiguity.
2121

2222
{{fbdoc item="ex"}}
2323
See the dynamic loading example on the [[ProPgSharedLibraries|Shared Libraries]] page.

doc/manual/cache/KeyPgDylibsymbol.wakka

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
Returns the address of a function or variable in a dll
33

44
{{fbdoc item="syntax"}}##
5-
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Dylibsymbol** ( [[KeyPgByval|byval]] //library// [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]], [[KeyPgByref|byref]] //symbol// [[KeyPgAs|as]] [[KeyPgString|string]] ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]]
6-
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Dylibsymbol** ( [[KeyPgByval|byval]] //library// [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]], [[KeyPgByval|byval]] //symbol// [[KeyPgAs|as]] [[KeyPgShort|short]] ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]]
5+
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Dylibsymbol** ( [[KeyPgByval|byval]] //libhandle// [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]], [[KeyPgByref|byref]] //symbol// [[KeyPgAs|as]] [[KeyPgString|string]] ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]]
6+
[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Dylibsymbol** ( [[KeyPgByval|byval]] //libhandle// [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]], [[KeyPgByval|byval]] //symbol// [[KeyPgAs|as]] [[KeyPgShort|short]] ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]]
77
##
88
{{fbdoc item="usage"}}##
9-
//result// = **Dylibsymbol** ( //library//, //symbol// )
9+
//result// = **Dylibsymbol** ( //libhandle//, //symbol// )
1010
##
1111
{{fbdoc item="param"}}
12-
##//library//##
12+
##//libhandle//##
1313
The [[KeyPgAny|any]] [[KeyPgPtr|ptr]] handle of a DLL returned by ##[[KeyPgDylibload|Dylibload]]##
1414
##//symbol//##
1515
A [[KeyPgString|string]] containing name of the function, or variable in the library to return the address of. In Windows only, can also be a ##[[KeyPgShort|short]]## containing the ordinal of the function/variable.

doc/manual/cache/KeyPgImageConvertRow.wakka

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Sleep
6868

6969
'' copy the image data into a 32-bit image
7070
Dim As Byte Ptr p8, p32
71-
Dim As Integer pitch8, pitch32
71+
Dim As Long pitch8, pitch32
7272

7373
#ifndef ImageInfo '' older versions of FB don't have the ImageInfo feature
7474
#define GETPITCH(img_) iif(img_->type=PUT_HEADER_NEW,img_->pitch,img_->old.width*img_->old.bpp)

doc/manual/cache/KeyPgImageInfo.wakka

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Retrieves information about an image
1010
##
1111
{{fbdoc item="usage"}}##
1212
for fbc version < 1.08::
13-
//result// = **Imageinfo**( //image// [, [//width//] [, [//height//] [, [//bypp//] [, [//pitch//] [, [//pixdata//] [, //size//]]]]]] )
13+
//result// = **Imageinfo**( //image// [, [ //width// ] [, [ //height// ] [, [ //bypp// ] [, [ //pitch// ] [, [ //pixdata// ] [, //size// ]]]]]] )
1414
for fbc version >= 1.08:
1515
in the LONG (or INTEGER<32>) version of the function:
16-
//result// = **Imageinfo**( //image// [, //width// [, //height// [, //bypp// [, //pitch// [ , //pixdata// [, //size// ]]]]]] )
16+
//result// = **Imageinfo**( //image// [, [ //width// ] [, [ //height// ] [, [ //bypp// ] [, [ //pitch// ] [ , [ //pixdata// ] [, //size// ]]]]]] )
1717
in the LONGINT (or INTEGER<64>) version of the function:
18-
//result// = **Imageinfo**( //image// , //width// , //height// [, //bypp// [, //pitch// [ , //pixdata// [, //size// ]]]] )
18+
//result// = **Imageinfo**( //image// , //width// , //height// [, [ //bypp// ] [, [ //pitch// ] [ , [ //pixdata// ] [, //size// ]]]] )
1919
##
2020
{{fbdoc item="param"}}
2121
##//image//##
@@ -116,7 +116,7 @@ sleep
116116
screenres 320, 200, 32
117117
dim image as any ptr = imagecreate( 64, 64 )
118118

119-
dim pitch as integer
119+
dim pitch as long
120120
dim pixels as any ptr
121121

122122
'' Get enough information to iterate through the pixel data.

0 commit comments

Comments
 (0)