Skip to content

Commit

Permalink
fbdocs: wiki snapshot 2023.11.27 - update examples/manual
Browse files Browse the repository at this point in the history
  • Loading branch information
jayrm committed Nov 27, 2023
1 parent d6acaf7 commit 2ca9725
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
13 changes: 13 additions & 0 deletions examples/manual/defines/fbjs.bas
@@ -0,0 +1,13 @@
'' examples/manual/defines/fbjs.bas
''
'' Example extracted from the FreeBASIC Manual
'' from topic '__FB_JS__'
''
'' See Also: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgDdfbjs
'' --------

#ifdef __FB_JS__
'...instructions only for emscripten target...
#else
'...instructions not for emscripten target...
#endif
6 changes: 3 additions & 3 deletions examples/manual/gfx/pixelptr.bas
Expand Up @@ -12,11 +12,11 @@ Function pixelptr(ByVal img As Any Ptr, ByVal x As Integer, ByVal y As Integer)

Dim As Long w, h, bypp, pitch
Dim As Any Ptr pixdata
Dim As Long success
Dim As Long result

success = (ImageInfo(img, w, h, bypp, pitch, pixdata) = 0)
result = ImageInfo(img, w, h, bypp, pitch, pixdata)

If success Then
If result = 0 Then '' seems like a valid image
If x < 0 Or x >= w Then Return 0
If y < 0 Or y >= h Then Return 0
Return pixdata + y * pitch + x * bypp
Expand Down
17 changes: 17 additions & 0 deletions examples/manual/prepro/elseifdef.bas
@@ -0,0 +1,17 @@
'' examples/manual/prepro/elseifdef.bas
''
'' Example extracted from the FreeBASIC Manual
'' from topic '#ELSEIFDEF'
''
'' See Also: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgPpelseifdef
'' --------

#define B

#ifdef A
Print "A is defined"
#elseifdef B
Print "A is not defined and B is defined"
#else
Print "both A and B are not defined"
#endif
15 changes: 15 additions & 0 deletions examples/manual/prepro/elseifndef.bas
@@ -0,0 +1,15 @@
'' examples/manual/prepro/elseifndef.bas
''
'' Example extracted from the FreeBASIC Manual
'' from topic '#ELSEIFNDEF'
''
'' See Also: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgPpelseifndef
'' --------

#ifdef A
Print "A is defined"
#elseifndef B
Print "both A and B are not defined"
#else
Print "A is not defined and B is defined"
#endif

0 comments on commit 2ca9725

Please sign in to comment.