https://wiki.bennugd.org/api.php?action=feedcontributions&user=188.106.184.91&feedformat=atomBennu Wiki - User contributions [en]2024-03-28T21:36:03ZUser contributionsMediaWiki 1.36.2https://wiki.bennugd.org/index.php?title=Unload_pal&diff=10643Unload pal2012-07-19T17:04:32Z<p>188.106.184.91: Redirected page to Pal unload</p>
<hr />
<div>#REDIRECT [[pal_unload]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Pal_unload&diff=10641Pal unload2012-07-19T17:03:46Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:palettes]]<br />
[[Category:mod_map]]<br />
<br />
== Syntax ==<br />
'''INT''' pal_unload ( <'''INT''' paletteID> )<br />
<br />
== Description ==<br />
<br />
This function unloads the palette, thus freeing the memory it ouccupies.<br />
<br />
Also called [[pal_del]](). The previous name [[unload_pal]]() is deprecated. <br />
<br />
== Parameters ==<br />
{| <br />
|'''INT''' paletteID || - The handle of the [[palette]] that was loaded with [[Load_pal]](). <br />
|}<br />
<br />
<br />
== Returns ==<br />
'''INT''' : Status.<br />
{|<br />
| 1 || - Operation completed.<br />
|}<br />
<br />
<br />
<br />
{{Moduledocbox<br />
| module = Mod_map<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Pal_new&diff=10640Pal new2012-07-19T16:42:08Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:palettes]]<br />
[[Category:mod_map]]<br />
<br />
== Syntax ==<br />
'''INT''' pal_new ()<br />
<br />
== Description ==<br />
<br />
This function creates a new palette in memory and returns the handle, for later use by other [[palette]] functions such as [[Pal_save]](), [[Pal_get]](), [[Pal_set]], etc. When you're done, you can free the memory with [[Pal_unload]]().<br />
<br />
The previous name [[new_pal()]] is deprecated. <br />
<br />
== Returns ==<br />
'''INT''' : Status.<br />
{|<br />
| id || - The identification code of the memory area for the newly created palette.<br />
|}<br />
<br />
<br />
<br />
{{Moduledocbox<br />
| module = Mod_map<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=New_pal()&diff=10639New pal()2012-07-19T16:41:36Z<p>188.106.184.91: Redirected page to Pal new</p>
<hr />
<div>#REDIRECT [[pal_new]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Fpg_unload&diff=10636Fpg unload2012-07-19T16:37:38Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:fpg]]<br />
[[Category:mod_map]]<br />
<br />
==Definition==<br />
'''INT''' fpg_unload ( <'''INT''' fileID> )<br />
<br />
Unloads a certain [[file]] from memory.<br />
<br />
Also called [[fpg_del]](). The previous name [[unload_fpg]]() is deprecated. <br />
<br />
== Parameters ==<br />
{|<br />
| '''INT''' fileID || - The [[fileID]] of the [[file]] to unload. <br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
{{Moduledocbox<br />
| module = Mod_map<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Fpg_load&diff=10635Fpg load2012-07-19T16:34:32Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:fpg]]<br />
[[Category:mod_map]]<br />
<br />
==Definition==<br />
'''INT''' fpg_load ( <'''STRING''' filename>, [<'''INT POINTER'''> complete>] )<br />
<br />
Loads a graphics library into your program.<br />
<br />
This function loads the whole contents of an [[FPG]] graphics library into your project, enabling the contained [[graphics]] to be used in your program as [[process]]' graphs, screen backgrounds ([[put_screen]]()) or other graphics.<br />
<br />
The previous name [[load_fpg]]() is deprecated. <br />
<br />
== Parameters ==<br />
{| <br />
| '''STRING''' filename || - The filename of the FPG that you wish to load (including extension and possible path).<br />
|-<br />
| ['''INT POINTER''' complete] || - If this argument is specified the [[FPG]] is loaded asynchroneous, setting '''complete''' to [[FileID]] on completion.<br />
|}<br />
<br />
== Returns ==<br />
<br />
'''INT''' : [[graphID]]<br />
{|<br />
| -2 || - Waiting for the file to be loaded, see notes.<br />
|-<br />
| -1 || - There was an error loading the file.<br />
|-<br />
| >=0 || - The [[FileID]] assigned to the archive.<br />
|}<br />
<br />
<br />
''the following applies for versions prior rc282:''<br />
<br />
'''INT''' : [[FileID]]<br />
{|<br />
| -1 || - The specified archive could not be loaded.<br />
|-<br />
| >=0 || - The [[FileID]] assigned to the archive.<br />
|}<br />
<br />
== Errors ==<br />
{|<br />
| Archive not found || - The specified archive could not be found.<br />
|}<br />
<br />
== Notes ==<br />
Using an FPG file to contain all or some of the graphics used in a Bennu program is convenient, but isn't always the best way to load graphics. Other methods of loading graphics into your program include [[load_map]]() and [[load_png]]() which load individual graphic files. Graphics loaded individually will be given [[FileID]] 0 and a [[GraphID]] starting at 1000. This is because mod_map reserves room for the first FPG loaded (FPG files can contain 999 different graphics max.), sometimes referred to as the [[system file]] or [[environment file]].<br />
<br />
The first FPG file loaded using mod_map returns and uses the [[FileID]] 0, which is reserved by mod_map for use as the [[system file]]. All extra FPG files loaded will have a different FileID, progressing from 1 upwards.<br />
<br />
An FPG file holds all its contained graphs in memory simultaneously. Having a lot of large graphs being read from a single FPG file at once has been known to cause a slowdown.<br />
<br />
Once an FPG file is no longer necessary to be held in the memory, its memory space can be released by using the function [[unload_fpg]](). It is not necessary to unload files at the termination of a program, as Bennu always releases all used memory at the end of program execution.<br />
<br />
<br />
== Notes ==<br />
<br />
The optional parameter '''id''' was introduced in version rc282 and allows you to load resources in the background.<br />
It used with the [[Offset]] operator. See example below:<br />
<br />
<pre><br />
load_fpg("archivo_gordo.fpg", &idFpg);<br />
while(idFpg==-2)<br />
say("Big File Loading ....");<br />
frame;<br />
end<br />
if(idFpg==-1)<br />
say("Something went wrong!!");<br />
exit(); // o return<br />
end<br />
<br />
say("Big file loaded ok!!");<br />
<br />
file=idFpg;<br />
<br />
graph = 7;<br />
</pre><br />
<br />
<br />
== Example ==<br />
<pre><br />
Program example;<br />
Global<br />
int my_fpg;<br />
Begin<br />
my_fpg=load_fpg("test.fpg"); //Loads the FPG file into memory<br />
put_screen(my_fpg,1); //Puts graphic with code 1 onto screen<br />
Repeat<br />
frame;<br />
Until(key(_esc))<br />
unload_fpg(my_fpg);<br />
End<br />
</pre><br />
Used in example: [[put_screen]](), [[unload_fpg]]()<br />
<br />
{{Moduledocbox<br />
| module = Mod_map<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Graphical_infotypes&diff=10632Graphical infotypes2012-07-19T16:19:42Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:constantcategories]]<br />
[[Category:mod_map]]<br />
<br />
== Definition ==<br />
Graphical infotypes are used in [[graphic_info]](), to specify what information about a graph is wanted.<br />
<br />
== List ==<br />
{|<br />
| ''Constant'' || - ''Value'' || - ''Description''<br />
|-<br />
| G_WIDTH || - 0 || - Width in [[pixels]]. G_WIDE is equivalent, but deprecated.<br />
|-<br />
| G_HEIGHT || - 1 || - Height in pixels.<br />
|-<br />
| G_X_CENTER || - 2 || - X-axis center. Also called G_CENTER_X<br />
|-<br />
| G_Y_CENTER || - 3 || - Y-axis center. Also called G_CENTER_Y<br />
|-<br />
| G_PITCH || - 4 || - Width in bytes.<br />
|-<br />
| G_DEPTH || - 5 || - [[Color depth]] in bits per pixel.<br />
|-<br />
| G_FRAMES || - 6 || - Number of frames.<br />
|-<br />
| G_ANIMATION_STEP || - 7 || - Current frame in animation.<br />
|-<br />
| G_ANIMATION_STEPS || - 8 || - Number of frames in animation.<br />
|-<br />
| G_ANIMATION_SPEED || - 9 || - Current speed of animation.<br />
|-<br />
| B_CLEAR || - 1 || - Used in function [[map_new]](), indicates if a bitmap is cleared.<br />
|-<br />
| CHARSET_ISO8859 || - 0 || - Used to select [http://en.wikipedia.org/wiki/ISO/IEC_8859-15 iso8859] character set in the function [[fnt_new]]().<br />
|-<br />
| CHARSET_CP850 || - 1 || - Used to select [http://en.wikipedia.org/wiki/Code_page_850 cp850] character set in the function [[fnt_new]]().<br />
|-<br />
| NFB_VARIABLEWIDTH || - 0 || - Flag for the function [[fnt_new]]().<br />
|-<br />
| NFB_FIXEDWIDTH || - 1 || - Flag for the function [[fnt_new]]().<br />
|}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Map_new&diff=10631Map new2012-07-19T16:18:30Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:maps]]<br />
[[Category:mod_map]]<br />
<br />
==Definition==<br />
'''INT''' map_new ( <'''INT''' width> , <'''INT''' height> , <'''INT''' depth>, [ <'''INT''' flags> ] )<br />
<br />
Creates a new [[graphic]], sets the color of all pixels to 0 (transparent) and puts it in the [[system file]].<br />
<br />
The previous name [[new_map]]() is deprecated.<br />
<br />
== Parameters ==<br />
{|<br />
| '''INT''' width || - The width of the to be created graph in [[pixel]]s.<br />
|-<br />
| '''INT''' height || - The height of the to be created graph in pixels.<br />
|-<br />
| '''INT''' depth || - The [[color depth]] of the to be created graph in [[bit]]s<br />
|-<br />
| ['''INT''' flags] || - can be: [[B_CLEAR]] (bitmap clear) or 0 (no clear new bitmap)<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[GraphID]]<br />
{|<br />
| 0 || - There was an error.<br />
|-<br />
| >0 || - The graphID of the newly created graphic.<br />
|}<br />
<br />
== Errors ==<br />
{|<br />
| Unsupported color depth || - The specified color depth is not supported. ''(Console)''<br />
|-<br />
| Insufficient memory || - There is insufficient memory available. This error doesn't occur often. ''(Console)''<br />
|}<br />
<br />
== Example ==<br />
<pre><br />
import "mod_map"<br />
import "mod_screen"<br />
import "mod_key"<br />
<br />
Process Main()<br />
Private<br />
int map;<br />
Begin<br />
<br />
// Create a new graph of size 100x100 and color depth of 8bit<br />
map = map_new(100,100,8);<br />
<br />
// Clear the map red<br />
map_clear(0,map,rgb(255,0,0));<br />
<br />
// Put it in the center of the screen<br />
put(0,map,160,100);<br />
<br />
Repeat<br />
frame;<br />
Until(key(_ESC))<br />
<br />
End<br />
</pre><br />
Used in example: [[map_new]](), [[map_clear]](), [[put]](), [[key]]()<br />
<br />
This will result in something like:<br /><br />
{{Image<br />
| image = New_map.png<br />
| caption = Putting a new map<br />
}}<br />
<br />
{{Moduledocbox<br />
| module = Mod_map<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=NFB_VARIABLEWIDTH&diff=10623NFB VARIABLEWIDTH2012-07-18T13:06:56Z<p>188.106.184.91: Redirected page to Graphical infotypes</p>
<hr />
<div>#REDIRECT [[graphical_infotypes]]<br />
<br />
[[Category:constants]]<br />
[[Category:mod_map]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=NFB_FIXEDWIDTH&diff=10622NFB FIXEDWIDTH2012-07-18T13:06:40Z<p>188.106.184.91: Redirected page to Graphical infotypes</p>
<hr />
<div>#REDIRECT [[graphical_infotypes]]<br />
<br />
[[Category:constants]]<br />
[[Category:mod_map]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=CHARSET_CP850&diff=10621CHARSET CP8502012-07-18T13:04:49Z<p>188.106.184.91: Redirected page to Graphical infotypes</p>
<hr />
<div>#REDIRECT [[graphical_infotypes]]<br />
<br />
[[Category:constants]]<br />
[[Category:mod_map]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=CHARSET_ISO8859&diff=10620CHARSET ISO88592012-07-18T13:03:26Z<p>188.106.184.91: Redirected page to Graphical infotypes</p>
<hr />
<div>#REDIRECT [[graphical_infotypes]]<br />
<br />
[[Category:constants]]<br />
[[Category:mod_map]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=B_CLEAR&diff=10618B CLEAR2012-07-18T12:58:44Z<p>188.106.184.91: Redirected page to Graphical infotypes</p>
<hr />
<div>#REDIRECT [[graphical_infotypes]]<br />
<br />
[[Category:constants]]<br />
[[Category:mod_map]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=G_Y_CENTER&diff=10616G Y CENTER2012-07-18T12:53:04Z<p>188.106.184.91: Redirected page to Graphical infotypes</p>
<hr />
<div>#REDIRECT [[graphical_infotypes]]<br />
<br />
[[Category:constants]]<br />
[[Category:mod_map]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Memory_total&diff=10603Memory total2012-07-17T17:02:36Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Definition==<br />
'''INT''' memory_total ( )<br />
<br />
Returns the memory total in bytes.<br />
<br />
Also called [[mem_total]]().<br />
<br />
== Returns ==<br />
'''INT''' : Memory total in bytes.<br />
<br />
== Example ==<br />
<pre><br />
import "mod_mem"<br />
import "mod_say"<br />
<br />
Process Main()<br />
Begin<br />
<br />
say("Total memory: " + memory_total());<br />
say("Free memory: " + memory_free() );<br />
<br />
End<br />
</pre><br />
Used in example: [[say]](), [[memory_total]](), [[memory_free]]()<br />
<br />
{{Moduledocbox<br />
| module = Mod_mem<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Memory_free&diff=10596Memory free2012-07-17T16:54:05Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Syntax==<br />
'''INT''' memory_free ( )<br />
<br />
== Description ==<br />
Returns the free memory total in bytes.<br />
<br />
Also called [[mem_available]]().<br />
<br />
== Returns ==<br />
'''INT''' : Free memory total in bytes.<br />
<br />
== Example ==<br />
<pre><br />
import "mod_mem"<br />
import "mod_say"<br />
<br />
Process Main()<br />
Begin<br />
<br />
say("Total memory: " + memory_total());<br />
say("Free memory: " + memory_free() );<br />
<br />
End<br />
</pre><br />
Used in example: [[say]](), [[memory_total]](), [[memory_free]]()<br />
<br />
{{Moduledocbox<br />
| module = Mod_mem<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Memmove&diff=10591Memmove2012-07-17T16:49:13Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Definition==<br />
'''INT''' memmove ( <'''VOID POINTER''' destination> , <'''VOID POINTER''' origin> , <'''INT''' size> )<br />
<br />
Copies a certain number of [[byte]]s from one point in [[memory]] to another.<br />
<br />
Difference between [[memmove]]() and [[memcopy]]() is that the first one can be used if the destination section and origin section overlap. With [[memcopy]](), this can go wrong, though some systems make [[memcopy]]() safe too.<br />
<br />
Also called [[mem_move]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''VOID POINTER''' destination || - Pointer to the first byte of the destination.<br />
|-<br />
| '''VOID POINTER''' origin || - Pointer to the first byte of the origin.<br />
|-<br />
| '''INT''' size || - The size of the to be copied memory in bytes.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
== Example ==<br />
<pre><br />
import "mod_mem"<br />
import "mod_say"<br />
<br />
Const<br />
elements = 5;<br />
End<br />
<br />
Process Main()<br />
Private<br />
byte bytearray[elements-1];<br />
byte* pbyte;<br />
int i;<br />
End<br />
Begin<br />
<br />
// Allocate memory<br />
pbyte = alloc(elements);<br />
<br />
// Set numbers<br />
for(i=0; i<elements; i++)<br />
bytearray[i] = i;<br />
end<br />
<br />
// Copy bytes to bytearray<br />
memmove(pbyte,&bytearray[0],elements);<br />
<br />
// Show numbers<br />
for(i=0; i<elements; i++)<br />
say("byte["+i+"] = " + pbyte[i]);<br />
end<br />
<br />
OnExit<br />
<br />
// Free the used memory<br />
free(pbyte);<br />
<br />
End<br />
</pre><br />
Used in example: [[alloc]](), [[memmove]](), [[say]](), [[free]](), [[array]], [[pointer]]<br />
<br />
{{Moduledocbox<br />
| module = Memory<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Memcopy&diff=10589Memcopy2012-07-17T16:47:32Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Syntax==<br />
'''INT''' memcopy ( <'''VOID POINTER''' destination> , <'''VOID POINTER''' origin> , <'''INT''' size> )<br />
<br />
== Description ==<br />
Copies a certain number of [[byte]]s from one point in [[memory]] to another.<br />
<br />
Difference between [[memmove]]() and [[memcopy]]() is that the first one can be used if the destination section and origin section overlap. With [[memcopy]](), this can go wrong, though some systems make [[memcopy]]() safe too.<br />
<br />
Also called [[mem_copy]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''VOID POINTER''' destination || - Pointer to the first byte of the destination.<br />
|-<br />
| '''VOID POINTER''' origin || - Pointer to the first byte of the origin.<br />
|-<br />
| '''INT''' size || - The size of the to be copied memory in bytes.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
== Example ==<br />
<pre><br />
import "mod_mem"<br />
import "mod_say"<br />
<br />
Const<br />
elements = 5;<br />
End<br />
<br />
Process Main()<br />
Private<br />
byte bytearray[elements-1];<br />
byte* pbyte;<br />
int i;<br />
End<br />
Begin<br />
<br />
// Allocate memory<br />
pbyte = alloc(elements);<br />
<br />
// Set numbers<br />
for(i=0; i<elements; i++)<br />
bytearray[i] = i;<br />
end<br />
<br />
// Copy bytes to bytearray<br />
memcopy(pbyte,&bytearray[0],elements);<br />
<br />
// Show numbers<br />
for(i=0; i<elements; i++)<br />
say("byte["+i+"] = " + pbyte[i]);<br />
end<br />
<br />
OnExit<br />
<br />
// Free the used memory<br />
free(pbyte);<br />
<br />
End<br />
</pre><br />
Used in example: [[alloc]](), [[memcopy]](), [[say]](), [[free]](), [[array]], [[pointer]]<br />
<br />
{{Moduledocbox<br />
| module = Memory<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Memseti&diff=10587Memseti2012-07-17T16:45:50Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Syntax==<br />
'''INT''' memseti ( <'''VOID POINTER''' data> , <'''INT''' value> , <'''INT''' ints> )<br />
<br />
== Description ==<br />
Sets all [[int]]s in the specified memory block to the specified value.<br />
<br />
Also called [[mem_seti]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''VOID POINTER''' data || - Pointer to the block of ints in memory.<br />
|-<br />
| '''INT''' value || - Value to set all ints to.<br />
|-<br />
| '''INT''' ints || - Number of ints to change the value of.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
== Example ==<br />
See [[alloc]]().<br />
<br />
Also useful in conjunction with [[map_buffer]]() with 32bit [[map]]s. (''Example needed.'')<br />
<br />
{{Moduledocbox<br />
| module = Mod_mem<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Memsetw&diff=10585Memsetw2012-07-17T16:44:02Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Syntax==<br />
'''INT''' memsetw ( <'''VOID POINTER''' data> , <'''WORD''' value> , <'''INT''' words> )<br />
<br />
== Description ==<br />
Sets all words in the specified memory block to the specified value.<br />
<br />
Also called [[mem_setw]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''VOID POINTER''' data || - Pointer to the block of words in memory.<br />
|-<br />
| '''WORD''' value || - Value to set all words to.<br />
|-<br />
| '''INT''' words || - Number of words to change the value of.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
== Example ==<br />
See [[alloc]]().<br />
<br />
Also useful in conjunction with [[map_buffer]]() with 16bit [[map]]s. (''Example needed.'')<br />
<br />
{{Moduledocbox<br />
| module = Mod_mem<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Memset&diff=10583Memset2012-07-17T16:42:15Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Syntax==<br />
'''INT''' memset ( <'''VOID POINTER''' data> , <'''BYTE''' value> , <'''INT''' bytes> )<br />
<br />
== Description ==<br />
Sets all bytes in the specified memory block to the specified value.<br />
<br />
Also called [[mem_set]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''VOID POINTER''' data || - Pointer to the block of bytes in memory<br />
|-<br />
| '''BYTE''' value || - Value to set all bytes to.<br />
|-<br />
| '''INT''' bytes || - Number of bytes to change the value of.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
== Example ==<br />
See [[alloc]]().<br />
<br />
Also useful in conjunction with [[map_buffer]]() with 8bit [[map]]s. (''Example can be found in the map_buffer article.'')<br />
<br />
{{Moduledocbox<br />
| module = Mod_mem<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Memcmp&diff=10581Memcmp2012-07-17T16:39:49Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Definition==<br />
'''INT''' memcmp ( <'''VOID POINTER''' ptr1> , <'''VOID POINTER''' ptr2> , <'''INT''' number> )<br />
<br />
Compares the first ''number'' bytes of the block of memory pointed by ''ptr1'' to the first ''number'' bytes pointed by ''ptr2'', returning zero if they all match or a value different from zero representing which is greater if they do not.<br />
<br />
Also called [[mem_cmp]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''VOID POINTER''' ptr1|| - Pointer to a block of memory<br />
|-<br />
| '''VOID POINTER''' ptr2 || - Pointer to a block of memory.<br />
|-<br />
| '''INT''' number || - The number of bytes to be checked.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : Difference<br />
{|<br />
| 0 || - The blocks of memory are identical.<br />
|-<br />
| >0 || - The first differing byte in both memory blocks has a greater value in ''ptr1''.<br />
|-<br />
| <0 || - The first differing byte in both memory blocks has a greater value in ''ptr2''.<br />
|}<br />
A byte ranges from 0 to 255, meaning 189 is a greater value than 105.<br />
<br />
== Example ==<br />
<pre><br />
Program example;<br />
Const<br />
elements = 10;<br />
End<br />
Private<br />
byte pointer pbyte1;<br />
byte pointer pbyte2;<br />
int result;<br />
End<br />
Begin<br />
<br />
// Allocate memory<br />
pbyte1 = alloc(elements);<br />
pbyte2 = alloc(elements);<br />
<br />
// Make the blocks the same and compare<br />
memset(pbyte1,3,elements);<br />
memset(pbyte2,3,elements);<br />
result = memcmp(pbyte1,pbyte2,elements); // You can also compare the first 5 bytes,<br />
// or the first elements/2 bytes, it<br />
// depends on what you want.<br />
say("Memcmp 1: " + result);<br />
<br />
// Make the first block have a greater value and compare<br />
pbyte1[0] = 4;<br />
result = memcmp(pbyte1,pbyte2,elements);<br />
say("Memcmp 2: " + result);<br />
<br />
// Make the blocks the same and compare<br />
pbyte2[0] = 4;<br />
result = memcmp(pbyte1,pbyte2,elements);<br />
say("Memcmp 3: " + result);<br />
<br />
// Make the first block have a greater value and compare<br />
pbyte2[1] = 5;<br />
result = memcmp(pbyte1,pbyte2,elements);<br />
say("Memcmp 4: " + result);<br />
<br />
Repeat<br />
frame;<br />
Until(key(_esc))<br />
<br />
// Free the used memory<br />
free(pbyte1);<br />
free(pbyte2);<br />
<br />
End<br />
</pre><br />
Used in example: [[alloc]](), [[memset]](), [[memcmp]](), [[say]](), [[free]](), [[pointer]]<br />
<br />
{{Funcbox<br />
| category = Memory<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Realloc&diff=10579Realloc2012-07-17T16:37:37Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Syntax==<br />
'''VOID POINTER''' realloc ( <'''VOID POINTER''' data> , <'''INT''' size> )<br />
<br />
== Description ==<br />
Resizes the given block of memory.<br />
<br />
It allocates a new block of memory, copying the old data. If the new size is smaller than the old size, the last part of the data is lost. If the new size of the block of memory requires movement of the block, the old memory block is freed.<br />
<br />
Also called [[mem_realloc]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''VOID POINTER''' data || - Pointer to the block of memory to be resized.<br />
|-<br />
| '''INT''' size || - The new size of the block of memory in bytes.<br />
|}<br />
<br />
== Returns ==<br />
'''VOID POINTER''' : Pointer to (the first element of) the newly allocated memory block.<br />
{|<br />
| [[NULL]] || - There was are an error allocating the memory, like insufficient memory available.<br />
|-<br />
| ![[NULL]] || - Pointer to (the first element of) the newly allocated memory block.<br />
|}<br />
<br />
== Example ==<br />
<pre><br />
import "mod_mem"<br />
import "mod_say"<br />
<br />
Process Main()<br />
Private<br />
byte pointer pbyte;<br />
byte pointer pbyte2;<br />
int elements = 10;<br />
int newelements = 15;<br />
int i;<br />
Begin<br />
<br />
// Allocate memory<br />
pbyte = alloc(elements);<br />
<br />
// Set them to 13<br />
memset(pbyte,13,elements);<br />
<br />
// Relocate it to a larger, newly made memory block<br />
pbyte2 = realloc(pbyte,newelements);<br />
<br />
// Set the added part's elements to 16 (newelements > elements)<br />
memset(pbyte+elements,16,newelements-elements);<br />
<br />
// Show numbers<br />
for(i=0; i<newelements; i++)<br />
say("byte2["+i+"] = " + pbyte2[i]);<br />
end<br />
<br />
OnExit<br />
<br />
// Free the used memory<br />
free(pbyte2);<br />
<br />
End<br />
</pre><br />
<br />
== Example 2 ==<br />
<br />
<pre><br />
<br />
// Alloc, calloc and realloc tutorial, by handsource-dyko.<br />
<br />
// This sample program demonstrates how create integer array's with alloc, and calloc, <br />
// and how to resize them with realloc. <br />
<br />
// Some general remarks with manual memory managment, ALWAYS free data after use, and test if an<br />
// allocation was successfull with IF (p_test_array2==NULL). When one of these memory allocation<br />
// functions returns a NULL, the allocation was NOT sucessfull, and any kind of unpredicatable things<br />
// can happen. With manual memory managment, you'll have to really know what you're doing, as the slightest<br />
// mistake can cause crashes and unpredicatable behaviour, wich is one of the dangers with using pointers.<br />
<br />
<br />
<br />
// import modules<br />
IMPORT "mod_say";<br />
IMPORT "mod_debug";<br />
IMPORT "mod_mem";<br />
<br />
<br />
/*<br />
alloc(int size);<br />
returns: void pointer<br />
purpose: create a block of memory, of a certain size, the returned pointer indicates the start adress of this block.<br />
*/<br />
<br />
/*<br />
calloc(int size,type);<br />
returns: void pointer<br />
purpose: create a block of memory, of a certain size, the returned pointer indicates the start adress of this block.<br />
is used for creating arrays.<br />
*/<br />
<br />
/*<br />
<br />
realloc (void pointer data, int size);<br />
returns: void pointer<br />
purpose: resizes the given block of memory, it allocates a new block of memory, copying the old data. <br />
if the new size is smaller than the old size, the last part of the data is lost. <br />
if the new size of the block of memory requires movement of the block, the old memory block is freed. <br />
<br />
*/<br />
<br />
<br />
GLOBAL<br />
<br />
int pointer p_first_array; // 10 elments, created with alloc()<br />
int pointer p_third_array; // 10 elments, created with calloc()<br />
int pointer p_second_array; // resized copy of p_first_array, 15 elements, created with realloc()<br />
int pointer p_fourth_array; // resized copy of p_second_array, 15 elements, created with realloc()<br />
<br />
<br />
int test[9]; // simple array with 10 elements<br />
int pointer p_test_array; // will be used for storing the pointer to test[0]<br />
int pointer p_test_array2; // will be the resized array, created with realloc, is now 15 elements<br />
<br />
int elements=10; // initial array size<br />
int new_elements=15; // new array size<br />
<br />
int count; // general purpose loop counter<br />
<br />
<br />
<br />
PROCESS main();<br />
<br />
BEGIN<br />
<br />
<br />
// standard array<br />
say("");<br />
say("");<br />
// print the array<br />
FOR (count=0; count<elements; count+=1)<br />
say("test["+count+"]="+test[count]);<br />
END<br />
<br />
say("");<br />
say("");<br />
say("the size of the array 'test' is "+sizeof(test)+" bytes"); <br />
say("");<br />
say("");<br />
<br />
<br />
<br />
<br />
<br />
// Allocate memory (10 integers), this way we create an array of integers from (0-9, so 10 elements)<br />
// The alloc() function works with bytes. It is always good practice to use the sizeof() operator, because<br />
// you'd have to know exactly how many bytes make up a particulair data. An integer is 4 bytes in bennu,<br />
// so for an array of 10 elements, you need to allocate 40 bytes. If you do "alloc(elements)",like in the<br />
// wiki, you only get 10 bytes! so that is totally too small for you array! always use this syntax:<br />
// <br />
// alloc(sizeof(<data_type>)), or for arrays: alloc(elements*sizeof(<data_type>)). Note that <data_type> can <br />
// also be a user-defined type.<br />
<br />
p_first_array=alloc(elements*sizeof(int));<br />
//p_first_array=calloc(elements,sizeof(int));<br />
<br />
// check if the allocation succeeded<br />
IF (p_first_array==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_first_array="+p_first_array);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
memseti(p_first_array ,0,elements);<br />
<br />
say("");<br />
say("");<br />
// print the array<br />
FOR (count=0; count<elements; count+=1)<br />
say("p_first_array["+count+"]="+p_first_array[count]);<br />
END<br />
<br />
say("");<br />
say("");<br />
say("the size of the array is "+(elements*sizeof(int))+" bytes"); <br />
say("");<br />
say("");<br />
END<br />
<br />
<br />
<br />
<br />
<br />
// Now let's use calloc to create the same array, but calloc is a bit smarter. It's more suited to array's and<br />
// it even initializes all the data to 0 for you, so that you can omit the memset() function. In this case I <br />
// kept memseti() in there, but you can omit it when using calloc(). But with alloc() you need to use it!<br />
<br />
// Note the small difference between alloc() and calloc().<br />
<br />
//p_second_array=alloc(elements*sizeof(int));<br />
p_second_array=calloc(elements,sizeof(int));<br />
<br />
<br />
// check if the allocation succeeded<br />
IF (p_second_array==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_second_array="+p_second_array);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
memseti(p_second_array ,0,elements);<br />
<br />
say("");<br />
say("");<br />
// print the array<br />
FOR (count=0; count<elements; count+=1)<br />
say("p_second_array["+count+"]="+p_second_array[count]);<br />
END<br />
<br />
say("");<br />
say("");<br />
say("the size of the array is "+(elements*sizeof(int))+" bytes");<br />
say("");<br />
say("");<br />
END <br />
<br />
<br />
<br />
<br />
// Let's resize p_first_array to a bigger size (15). This is where realloc() is used for. Also, just as with<br />
// alloc(), it is important to remember that it works with bytes! So we use this (new_elements*sizeof(int)) again.<br />
p_third_array=realloc(p_first_array,(new_elements*sizeof(int)));<br />
<br />
// check if the allocation succeeded<br />
IF (p_third_array==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_third_array="+p_third_array);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
memseti(p_third_array ,0,new_elements);<br />
<br />
<br />
say("");<br />
say("");<br />
// print the array<br />
FOR (count=0; count<new_elements; count+=1)<br />
say("p_third_array["+count+"]="+p_third_array[count]);<br />
END<br />
<br />
say("");<br />
say("");<br />
say("the size of the array is "+(new_elements*sizeof(int))+" bytes"); <br />
say("");<br />
say("");<br />
END<br />
<br />
<br />
<br />
// Let's resize p_second_array to a bigger size (15).<br />
p_fourth_array=realloc(p_second_array,(new_elements*sizeof(int)));<br />
<br />
<br />
// check if the allocation succeeded<br />
IF (p_fourth_array==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_fourth_array="+p_fourth_array);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
memseti(p_fourth_array ,0,new_elements);<br />
<br />
say("");<br />
say("");<br />
<br />
// print the array<br />
<br />
FOR (count=0; count<new_elements; count+=1)<br />
say("p_fourth_array["+count+"]="+p_fourth_array[count]);<br />
END<br />
<br />
say("");<br />
say("the size of the array is "+(new_elements*sizeof(int))+" bytes"); <br />
say("");<br />
say("");<br />
END<br />
<br />
<br />
// Let's try to resize an standard array (the array test[9]) to 15 <br />
p_test_array=test[0]; // <-- p_test_array is a pointer, we store the ADRESS of the first element (wich is 0) in it.<br />
// test[0] is actually a pointer itself, it represents the start adress of the array.<br />
// The whole concept of array indexing is actuallty a concealed form of pointer artihmatic,<br />
// consult any good C book about the details of this. <br />
p_test_array2=realloc(p_test_array,(new_elements*sizeof(int)));<br />
<br />
<br />
// check if the allocation succeeded<br />
IF (p_test_array2==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_test_array2="+p_test_array2);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
memseti(p_test_array2 ,0,new_elements);<br />
<br />
say("");<br />
say("");<br />
<br />
// print the array<br />
<br />
FOR (count=0; count<new_elements; count+=1)<br />
say("p_test_array2["+count+"]="+p_test_array2[count]);<br />
END<br />
<br />
say("");<br />
say("the size of the array is "+(new_elements*sizeof(int))+" bytes"); <br />
say("");<br />
say("");<br />
END<br />
<br />
<br />
<br />
<br />
ONEXIT<br />
<br />
// Free the used memory<br />
say("freeing old memory........");<br />
say("p_first_array...");<br />
free(p_first_array);<br />
say("ok");<br />
say("p_second_array...");<br />
free(p_second_array);<br />
say("ok"); <br />
say("p_third_array...");<br />
free(p_third_array);<br />
say("ok");<br />
say("p_fourth_array...");<br />
free(p_fourth_array);<br />
say("ok"); <br />
say("p_test_array...");<br />
free(p_test_array);<br />
say("ok"); <br />
say("p_test_array2...");<br />
free(p_test_array2);<br />
say("ok");<br />
<br />
END<br />
<br />
<br />
<br />
<br />
</pre><br />
<br />
Used in example: [[alloc]](), [[memset]](), [[realloc]](), [[say]](), [[free]](), [[pointer]]<br />
<br />
{{Moduledocbox<br />
| module = Mod_mem<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Free&diff=10577Free2012-07-17T16:35:12Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Definition==<br />
'''INT''' free ( <'''VOID POINTER''' data> )<br />
<br />
Frees a block of memory.<br />
<br />
The pointer used must be a pointer to a previously allocated block of memory, else the behavior of free() is undefined.<br />
<br />
Also called [[mem_free]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''VOID POINTER''' data || - Pointer to the block of memory to be freed.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
== Example ==<br />
<pre><br />
Program example;<br />
Private<br />
byte pointer pbyte;<br />
word pointer pword;<br />
int pointer pint;<br />
int elements = 10;<br />
int i;<br />
Begin<br />
<br />
// Allocate memory<br />
pbyte = alloc(elements);<br />
pword = alloc(elements*sizeof(word));<br />
pint = alloc(elements*sizeof(int));<br />
<br />
// Reset memory to 0's<br />
memset (pbyte,0,elements);<br />
memsetw(pword,0,elements); // same as memset(pword,0,elements*sizeof(word));<br />
// because value-parameter is 0.<br />
memset (pint ,0,elements*sizeof(int)); // There isn't a "memseti()", so we need to<br />
// set the individual bytes to 0. To change<br />
// ints to nonzero values, memset() can't be<br />
// used easily<br />
<br />
// Write numbers to bytes and ints<br />
for(i=0; i<elements; i++)<br />
pbyte[i] = 133; // pbyte[i] is the same as *(pbyte+i)<br />
*(pint+i) = 4555; // pint[i] is the same as *(pint+i)<br />
end<br />
<br />
// Write numbers to words<br />
memsetw(pword,345,elements);<br />
<br />
// Show numbers<br />
for(i=0; i<elements; i++)<br />
say("byte["+i+"] = " + *(pbyte+i));<br />
say("word["+i+"] = " + pword[i]);<br />
say("int ["+i+"] = " + pint[i]);<br />
end<br />
<br />
Repeat<br />
frame;<br />
Until(key(_esc))<br />
<br />
// Free the used memory<br />
free(pbyte);<br />
free(pword);<br />
free(pint);<br />
<br />
End<br />
</pre><br />
Used in example: [[alloc]](), [[memset]](), [[memsetw]](), [[sizeof]](), [[say]](), [[free]](), [[pointer]]<br />
<br />
{{Funcbox<br />
| category = Memory<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Calloc&diff=10575Calloc2012-07-17T16:32:44Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Syntax==<br />
'''VOID POINTER''' calloc (<'''INT''' num> ,<'''INT''' size>)<br />
<br />
== Description ==<br />
<br />
Allocates (creates) a [[memoryblock|block of memory]] of a certain size. Calloc is slightly different from alloc, as it is more natively suited for creating arrays. It also automatically initialises the data with zeros, so that the use of [[memset]]() or [[memseti]]() can be omitted. Returns a pointer to the newly allocating memory block, or [[NULL]] on failure.<br />
<br />
Also called [[mem_calloc]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''INT''' num || - The amount of elements to be created in [[int]]s.<br />
| '''INT''' size || - The size of the to be allocated memory in [[byte]]s.<br />
|}<br />
<br />
== Returns ==<br />
'''VOID POINTER''' : Pointer to the first element of the allocated memory block.<br />
{|<br />
| [[NULL]] || - There was are an error allocating the memory, like insufficient memory available.<br />
|-<br />
| ![[NULL]] || - Pointer to the first element of the allocated memory block.<br />
|}<br />
<br />
== Example ==<br />
<pre><br />
<br />
<br />
// Some general remarks with manual memory managment, ALWAYS free data after use, and test if an<br />
// allocation was successfull with IF (p_array==NULL). When one of these memory allocation<br />
// functions returns a NULL, the allocation was NOT sucessfull, and any kind of unpredicatable things<br />
// can happen. With manual memory managment, you'll have to really know what you're doing, as the slightest<br />
// mistake can cause crashes and unpredicatable behaviour, wich is one of the dangers with using pointers.<br />
<br />
<br />
<br />
// import modules<br />
IMPORT "mod_say";<br />
IMPORT "mod_debug";<br />
IMPORT "mod_mem";<br />
<br />
<br />
/*<br />
calloc(int size,type);<br />
returns: void pointer<br />
purpose: create a block of memory, of a certain size, the returned pointer indicates the start adress of this block.<br />
*/<br />
<br />
<br />
<br />
GLOBAL<br />
<br />
int pointer p_array; // 10 elments, created with calloc()<br />
<br />
int elements=10; // initial array size<br />
<br />
<br />
int count; // general purpose loop counter<br />
<br />
<br />
<br />
PROCESS main();<br />
<br />
BEGIN<br />
<br />
// Now let's use calloc to create an array, but calloc is a bit smarter then alloc. It's more suited to array's and<br />
// it even initializes all the data to 0 for you, so that you can omit the memset() function. In this case I <br />
// kept memseti() in there, but you can omit it when using calloc(). But with alloc() you need to use it!<br />
<br />
// Note the small difference between alloc() and calloc().<br />
<br />
//p_array=alloc(elements*sizeof(int));<br />
p_array=calloc(elements,sizeof(int)); // 10 * 4 bytes (the size of an int)<br />
<br />
<br />
// check if the allocation succeeded<br />
IF (p_array==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_array="+p_array);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
/*<br />
memseti(p_array ,0,elements); // not need for calloc();<br />
*/<br />
<br />
say("");<br />
say("");<br />
// print the array<br />
FOR (count=0; count<elements; count+=1)<br />
say("p_array["+count+"]="+p_array[count]);<br />
END<br />
<br />
say("");<br />
say("");<br />
say("the size of the array is "+(elements*sizeof(int))+" bytes");<br />
say("");<br />
say("");<br />
END <br />
<br />
<br />
<br />
<br />
<br />
ONEXIT<br />
<br />
// Free the used memory<br />
say("freeing old memory........");<br />
<br />
say("p_array...");<br />
free(p_array);<br />
say("ok"); <br />
<br />
END<br />
<br />
<br />
<br />
</pre><br />
Used in example: [[alloc]](), [[memset]](), [[memsetw]](), [[memseti]](), [[sizeof]](), [[say]](), [[free]](), [[OnExit]], [[pointer]], [[sizeof]]<br />
<br />
{{Moduledocbox<br />
| module = Mod_mem<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Alloc&diff=10573Alloc2012-07-17T16:28:11Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:memory]]<br />
[[Category:mod_mem]]<br />
<br />
==Syntax==<br />
'''VOID POINTER''' alloc ( <'''INT''' size> )<br />
<br />
== Description ==<br />
<br />
Allocates a [[memoryblock|block of memory]] of a certain size. Returns a pointer to the newly allocating memory block, or [[NULL]] on failure.<br />
<br />
Also called [[mem_alloc]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''INT''' size || - The size of the to be allocated memory in [[byte]]s.<br />
|}<br />
<br />
== Returns ==<br />
'''VOID POINTER''' : Pointer to the first element of the allocated memory block.<br />
{|<br />
| [[NULL]] || - There was are an error allocating the memory, like insufficient memory available.<br />
|-<br />
| ![[NULL]] || - Pointer to the first element of the allocated memory block.<br />
|}<br />
<br />
== Example ==<br />
<pre><br />
import "mod_mem"<br />
import "mod_say"<br />
<br />
Process Main()<br />
Private<br />
byte* pbyte;<br />
word* pword;<br />
int* pint;<br />
int elements = 10;<br />
int i;<br />
Begin<br />
<br />
// Allocate memory<br />
pbyte = alloc(elements);<br />
pword = alloc(elements*sizeof(*pword)); // note the sizeof() here, this is possible!<br />
pint = alloc(elements*sizeof(int));<br />
<br />
// Reset memory to 0's<br />
memset (pbyte,0,elements);<br />
memsetw(pword,0,elements); // same as memset(pword,0,elements*sizeof(word));<br />
// because value-parameter is 0.<br />
memseti(pint ,0,elements); // same as memset(pint,0,elements*sizeof(int));<br />
// because value-parameter is 0.<br />
<br />
// Write numbers to bytes and ints<br />
for(i=0; i<elements; i++)<br />
pbyte[i] = 133; // pbyte[i] is the same as *(pbyte+i)<br />
*(pint+i) = 4555; // pint[i] is the same as *(pint+i)<br />
end<br />
<br />
// Write numbers to words<br />
memsetw(pword,345,elements);<br />
<br />
// Show numbers<br />
for(i=0; i<elements; i++)<br />
say("byte["+i+"] = " + *(pbyte+i));<br />
say("word["+i+"] = " + pword[i]);<br />
say("int ["+i+"] = " + pint[i]);<br />
end<br />
<br />
OnExit<br />
<br />
// Free the used memory<br />
free(pbyte);<br />
free(pword);<br />
free(pint);<br />
<br />
End<br />
</pre><br />
<br />
== Example 2 ==<br />
<br />
The following three examples show the difference in size, when array's are created.<br />
Note the use of the [[sizeof]]() operator, to calculate the amount of bytes required for the data type.<br />
You can also allocate user defined types and even structs. Be carefull with strings though, as they show<br />
up as 4 bytes, but in the case of strings, you get a [[pointer]] (start adress) of the [[string]], wich is a 4 byte<br />
integer.<br />
<br />
{|<br />
| Example 1 || - array of 10 (4 byte) integers<br />
|-<br />
| Example 2 || - array of 10 (1 byte) byte (could also be char)<br />
|-<br />
| Example 3 || - array of 10 (2 byte) short integers<br />
|}<br />
<br />
<br />
<pre><br />
// Some general remarks with manual memory managment, ALWAYS free data after use, and test if an<br />
// allocation was successfull with IF (p_test_array2==NULL). When one of these memory allocation<br />
// functions returns a NULL, the allocation was NOT sucessfull, and any kind of unpredicatable things<br />
// can happen. With manual memory managment, you'll have to really know what you're doing, as the slightest<br />
// mistake can cause crashes and unpredicatable behaviour, wich is one of the dangers with using pointers.<br />
<br />
<br />
<br />
// import modules<br />
IMPORT "mod_say";<br />
IMPORT "mod_debug";<br />
IMPORT "mod_mem";<br />
<br />
<br />
/*<br />
alloc(int size);<br />
returns: void pointer<br />
purpose: create a block of memory, of a certain size, the returned pointer indicates the start adress of this block.<br />
*/<br />
<br />
<br />
<br />
<br />
GLOBAL<br />
<br />
int pointer p_first_array; // 10 elments, created with alloc(), 10 integers (4 byte elements)<br />
byte pointer p_second_array; // 10 elments, created with alloc(), 10 bytes (1 byte elements)<br />
short pointer p_third_array; // 10 elments, created with alloc(), 10 short integers (2 byte elements)<br />
<br />
int elements=10; // initial array size<br />
<br />
int count; // general purpose loop counter<br />
<br />
<br />
<br />
PROCESS main();<br />
<br />
BEGIN<br />
<br />
<br />
<br />
<br />
// Allocate memory (10 integers), this way we create an array of integers from (0-9, so 10 elements)<br />
// The alloc() function works with bytes. It is always good practice to use the sizeof() operator, because<br />
// you'd have to know exactly how many bytes make up a particulair data. An integer is 4 bytes in bennu,<br />
// so for an array of 10 elements, you need to allocate 40 bytes. If you do "alloc(elements)",like in the<br />
// wiki, you only get 4 bytes! so that is totally too small for you array! always use this syntax:<br />
// <br />
// alloc(sizeof(<data_type>)), or for arrays: alloc(elements*sizeof(<data_type>)). Note that <data_type> can <br />
// also be a user-defined type.<br />
<br />
p_first_array=alloc(elements*sizeof(int));<br />
<br />
// check if the allocation succeeded<br />
IF (p_first_array==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_first_array="+p_first_array);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
memseti(p_first_array ,0,elements);<br />
<br />
say("");<br />
say("");<br />
// print the array<br />
FOR (count=0; count<elements; count+=1)<br />
say("p_first_array["+count+"]="+p_first_array[count]);<br />
END<br />
<br />
say("");<br />
say("");<br />
say("the size of the array is "+(elements*sizeof(int))+" bytes"); <br />
say("");<br />
say("");<br />
END<br />
<br />
<br />
// now let's create an array of 10 bytes, the size of the array will be 10 * 1 byte =10 bytes<br />
p_second_array=alloc(elements*sizeof(byte));<br />
<br />
// check if the allocation succeeded<br />
IF (p_first_array==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_second_array="+p_second_array);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
memseti(p_second_array ,0,elements);<br />
<br />
say("");<br />
say("");<br />
// print the array<br />
FOR (count=0; count<elements; count+=1)<br />
say("p_second_array["+count+"]="+p_second_array[count]);<br />
END<br />
<br />
say("");<br />
say("");<br />
say("the size of the array is "+(elements*sizeof(byte))+" bytes"); <br />
say("");<br />
say("");<br />
END<br />
<br />
<br />
// now let's create an array of 10 short integers, the size of the array will be 10 * 2 bytes =20 bytes<br />
p_third_array=alloc(elements*sizeof(short));<br />
<br />
// check if the allocation succeeded<br />
IF (p_first_array==NULL)<br />
// allocation failed<br />
say("allocation failed!! p_second_array="+p_third_array);<br />
<br />
ELSE<br />
<br />
// allocation succeeded<br />
// set the value's to zero<br />
memseti(p_third_array ,0,elements);<br />
<br />
say("");<br />
say("");<br />
// print the array<br />
FOR (count=0; count<elements; count+=1)<br />
say("p_third_array["+count+"]="+p_third_array[count]);<br />
END<br />
<br />
say("");<br />
say("");<br />
say("the size of the array is "+(elements*sizeof(short))+" bytes"); <br />
say("");<br />
say("");<br />
END <br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
ONEXIT<br />
<br />
// Free the used memory<br />
say("freeing old memory........");<br />
say("p_first_array...");<br />
free(p_first_array);<br />
say("ok");<br />
<br />
say("freeing old memory........");<br />
say("p_second_array...");<br />
free(p_second_array);<br />
say("ok");<br />
<br />
say("freeing old memory........");<br />
say("p_third_array...");<br />
free(p_third_array);<br />
say("ok");<br />
END<br />
</pre><br />
<br />
<br />
Used in example: [[alloc]](), [[memset]](), [[memsetw]](), [[memseti]](), [[sizeof]](), [[say]](), [[free]](), [[OnExit]], [[pointer]], [[sizeof]]<br />
<br />
{{Moduledocbox<br />
| module = Mod_mem<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Scroll_start&diff=10563Scroll start2012-07-17T11:28:42Z<p>188.106.184.91: Redirected page to Start scroll</p>
<hr />
<div>#REDIRECT [[start_scroll]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Scroll_stop&diff=10560Scroll stop2012-07-17T11:02:09Z<p>188.106.184.91: Redirected page to Stop scroll</p>
<hr />
<div>#REDIRECT [[stop_scroll]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Stop_scroll&diff=10559Stop scroll2012-07-17T11:01:31Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:scrolls]]<br />
[[Category:mod_scroll]]<br />
<br />
==Definition==<br />
'''INT''' Stop_scroll ( <'''INT''' scrollnumber>)<br />
<br />
This functions stops an active [[scroll window]]. There can be up to 10 (0-9) [[scroll window]]s active.<br />
When the scroll is stopped, all the processes in it will no longer be displayed. This function is usefull for<br />
switching the game's state from active gameplay to a loading screen state or similair situations. Another use is, when there are multiple scroll [[region]]s active, and the game changes from split screen to single screen. This way you can have individual control over the display of the scroll.<br />
<br />
Also called [[scroll_stop]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''INT''' scrollnumber || - The ID for the scroll window to be stopped<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
<br />
== Example ==<br />
<br />
<pre><br />
<br />
IMPORT "mod_video";<br />
IMPORT "mod_map";<br />
IMPORT "mod_scroll";<br />
IMPORT "mod_screen";<br />
IMPORT "mod_key";<br />
IMPORT "mod_proc";<br />
<br />
GLOBAL<br />
<br />
int graphics;<br />
<br />
PROCESS main();<br />
<br />
<br />
BEGIN<br />
<br />
graphics=load_fpg("help.fpg");<br />
<br />
say("Press [ENTER] to activate the scroll window.");<br />
say("Press [SPACE] to stop the scroll.");<br />
<br />
<br />
LOOP<br />
IF (scan_code==_space)<br />
<br />
stop_scroll(0); // The scroll is stopped.<br />
<br />
END<br />
IF (scan_code==_enter)<br />
start_scroll(0, 0, 103, 102, 0, 15);<br />
END<br />
<br />
FRAME;<br />
END<br />
END<br />
<br />
</pre><br />
<br />
<br />
== Using Scrolling ==<br />
For each [[process]] that you want to be part of a [[scroll window]], you must set the [[local variable]] [[ctype]] to value [[C_SCROLL]]. It should also be noted that the local variable [[c_number]] is used for selecting in which scroll a process should be displayed. Additionally, you must set the camera property of the [[scroll|scroll structure]] to the [[processID]] of the process you wish to be followed.</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Scroll_move&diff=10558Scroll move2012-07-17T11:00:02Z<p>188.106.184.91: Redirected page to Move scroll</p>
<hr />
<div>#REDIRECT [[move_scroll]]</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Move_scroll&diff=10557Move scroll2012-07-17T10:57:33Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:scrolls]]<br />
[[Category:mod_scroll]]<br />
<br />
==Definition==<br />
'''INT''' Move_scroll ( <'''INT''' scrollnumber>)<br />
<br />
The move_scroll function is a slighty more advanced function. It allow the scroll's internal coordinates x0, y0, x1 and y1 of the [[scroll|scroll structure]] to be updated in a forcefull way. This gives great flexibility when multiple [[scroll window]]s are used.<br />
<br />
For instance, in a situation where multiple scroll windows are active on screen, and one scroll is controlled by the main player, the other scrolls can be updated manually. However, the function can also be usefull when there's only one scroll active. In that case you can have any process take control over the scroll.<br />
<br />
Also called [[scroll_move]]().<br />
<br />
== Parameters ==<br />
{|<br />
| '''INT''' scrollnumber || - The ID for the scroll window to be moved<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
<br />
== Example ==<br />
<br />
<br />
<pre><br />
<br />
IMPORT "mod_video";<br />
IMPORT "mod_map";<br />
IMPORT "mod_scroll";<br />
IMPORT "mod_screen";<br />
IMPORT "mod_key";<br />
IMPORT "mod_proc";<br />
<br />
GLOBAL<br />
<br />
int graphics;<br />
int counter;<br />
<br />
PRIVATE<br />
<br />
<br />
<br />
PROCESS main();<br />
<br />
<br />
BEGIN<br />
set_fps(100, 0);<br />
graphics=load_fpg("help.fpg");<br />
start_scroll(0, graphics, 103, 102, 0, 15);<br />
<br />
scroll.camera=id; // assign the "main" process instance (this one) to the scroll's camera.<br />
priority=100;<br />
<br />
FROM counter=-2000 TO 2000 step 100;<br />
movable_process(counter);<br />
END<br />
<br />
say("Use the right and left cursors to move");<br />
<br />
graph=101;<br />
ctype=c_scroll;<br />
<br />
<br />
LOOP<br />
if (key(_right))<br />
x+=2;<br />
flags=0;<br />
END<br />
if (key(_left))<br />
x-=2;<br />
flags=1;<br />
END<br />
<br />
move_scroll(0); // Updates the scroll structure[], in this case affect scroll 0.<br />
<br />
FRAME;<br />
END<br />
END<br />
<br />
PROCESS movable_process(x_scroll);<br />
<br />
PRIVATE<br />
<br />
BEGIN<br />
ctype=c_scroll;<br />
z=100;<br />
graph=104;<br />
LOOP<br />
x=x_scroll-scroll.x0; <br />
FRAME;<br />
END<br />
END<br />
</pre><br />
<br />
<br />
== Using Scrolling ==<br />
For each [[process]] that you want to be part of a [[scroll window]], you must set the [[local variable]] [[ctype]] to value [[C_SCROLL]]. It should also be noted that the local variable [[c_number]] is used for selecting in which scroll a process should be displayed. Additionally, you must set the camera property of the [[scroll|scroll structure]] to the [[processID]] of the process you wish to be followed.</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Get_pixel&diff=10551Get pixel2012-07-15T23:37:27Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:maps]]<br />
[[Category:mod_draw]]<br />
[[Category:mod_map]]<br />
<br />
==Definition==<br />
'''INT''' get_pixel ( <'''INT''' x> , <'''INT''' y> )<br />
<br />
Returns the [[color]] of the specified [[pixel]] on the [[background]]. Is equivalent to [[map_get_pixel]]( 0, 0, x, y ). <br />
<br />
== Parameters ==<br />
{| <br />
| '''INT''' x || - The X-coordinate of the [[pixel]] the color is wanted.<br />
|-<br />
| '''INT''' y || - The Y-coordinate of the [[pixel]] the color is wanted.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : The color<br />
<br />
== Example ==<br />
<pre><br />
import "mod_video"<br />
import "mod_wm"<br />
import "mod_draw"<br />
import "mod_map";<br />
import "mod_screen";<br />
import "mod_mouse";<br />
<br />
Process Main()<br />
<br />
Begin<br />
<br />
set_mode(640,480,16); <br />
<br />
// Creates a white box as mouse's cursor<br />
mouse.graph = new_map(20,20,16);<br />
map_clear(0,mouse.graph,rgb(255,255,255));<br />
<br />
// This area will show the pixel's color behind the cursor<br />
graph=new_map(100,50,16);<br />
x=50;<br />
y=25; <br />
<br />
//Puts the background<br />
put_screen(0,load_png("image.png")); <br />
<br />
Repeat<br />
map_clear(0,graph,get_pixel(mouse.x,mouse.y));<br />
frame;<br />
Until(exit_status)<br />
<br />
End<br />
</pre><br />
Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[put_screen]](), [[get_pixel]]()<br />
<br />
{{Moduledocbox<br />
| module = Mod_draw<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Put_pixel&diff=10550Put pixel2012-07-15T23:32:30Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:maps]]<br />
[[Category:mod_draw]]<br />
[[Category:mod_map]]<br />
<br />
==Definition==<br />
'''INT''' put_pixel ( <'''INT''' x> , <'''INT''' y> , <'''INT''' color> )<br />
<br />
Draws a single colored [[pixel]] on the [[background]]. Is equivalent to [[map_put_pixel]] ( 0, 0, x, y, color ).<br />
<br />
== Parameters ==<br />
{| <br />
| '''INT''' x || - Where on the background's x-axis to put the pixel.<br />
|-<br />
| '''INT''' y || - Where on the background's y-axis to put the pixel.<br />
|-<br />
| '''INT''' color || - What [[color]] to draw.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
== Example ==<br />
<pre><br />
import "mod_video"<br />
import "mod_map"<br />
import "mod_wm"<br />
import "mod_draw"<br />
import "mod_rand";<br />
<br />
Process Main()<br />
Private<br />
int i;<br />
int direction;<br />
end<br />
Begin<br />
<br />
// Set the mode to 16bit and some res<br />
set_mode(320,200,16);<br />
<br />
// Create a blue-ish square map<br />
graph = new_map(20,20,16);<br />
map_clear(0,graph,rgb(50,100,150));<br />
y=100;<br />
x=10;<br />
<br />
// Puts 100 yellow-ish pixels in random places in the background<br />
for(i=0; i<100; i++)<br />
put_pixel(rand(0,320),rand(0,200),rgb(255,255,55));<br />
end<br />
<br />
Repeat<br />
x=x+direction; <br />
if (x>=310) direction=-3; end <br />
if (x<=10) direction=3; end<br />
frame;<br />
Until(exit_status)<br />
<br />
End<br />
</pre><br />
Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[rand]](), [[put_pixel]]()<br />
<br />
{{Moduledocbox<br />
| module = Mod_draw<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Map_put_pixel&diff=10540Map put pixel2012-07-15T20:24:13Z<p>188.106.184.91: </p>
<hr />
<div>[[Category:functions]]<br />
[[Category:maps]]<br />
[[Category:mod_draw]]<br />
[[Category:mod_map]]<br />
<br />
==Definition==<br />
'''INT''' map_put_pixel ( <'''INT''' fileID> , <'''INT''' graphID> , <'''INT''' x> , <'''INT''' y> , <'''INT''' color> )<br />
<br />
Draws a single colored [[pixel]] on a [[graph]].<br />
<br />
== Parameters ==<br />
{| <br />
| '''INT''' fileID || - The [[file]] that holds the graph.<br />
|-<br />
| '''INT''' graphID || - The [[graph]] to draw on.<br />
|-<br />
| '''INT''' x || - Where on the graph's x-axis to put the pixel.<br />
|-<br />
| '''INT''' y || - Where on the graph's y-axis to put the pixel.<br />
|-<br />
| '''INT''' color || - What [[color]] to draw.<br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : [[true]]<br />
<br />
== Errors ==<br />
{|<br />
| Invalid map || - Map doesn't exist.<br />
|-<br />
| Unsupported color depth || - Destination graph is of an unsupported colordepth.<br />
|}<br />
<br />
== Example ==<br />
<pre><br />
import "mod_video"<br />
import "mod_map"<br />
import "mod_screen"<br />
import "mod_wm"<br />
import "mod_draw"<br />
<br />
Process Main()<br />
Private<br />
int map;<br />
int i;<br />
Begin<br />
<br />
// Set the mode to 16bit and some res<br />
set_mode(320,200,16);<br />
<br />
// Create a blue-ish square map<br />
map = new_map(100,100,16);<br />
map_clear(0,map,rgb(50,100,150));<br />
<br />
// Puts 100 yellow-ish pixels in random places in the graphic<br />
for(i=0; i<100; i++)<br />
map_put_pixel(0,map,rand(0,100),rand(0,100),rgb(255,255,55));<br />
end<br />
<br />
// Puts the map in the center of the screen<br />
put(0,map,160,100);<br />
<br />
Repeat<br />
frame;<br />
Until(exit_status)<br />
<br />
End<br />
</pre><br />
Used in example: [[set_mode]](), [[new_map]](), [[map_clear]](), [[map_put_pixel]](), [[rand]](), [[put]]()<br />
<br />
{{Moduledocbox<br />
| module = Mod_draw<br />
}}</div>188.106.184.91https://wiki.bennugd.org/index.php?title=Type&diff=6752Type2009-03-03T23:20:38Z<p>188.106.184.91: Counting to 3.</p>
<hr />
<div>[[category:language]]<br />
[[category:operator]]<br />
<br />
== Datatype declaration ==<br />
<br />
=== Definition ===<br />
'''Type''' <name><br />
:<variables><br />
'''End'''<br />
<br />
Creates a new [[datatype]]. It's handled as if it were a [[struct]], so the declared variables are members of the struct.<br />
<br />
While it's a convention to use a '_' as first character in the name of a datatype, it's not mandatory.<br />
<br />
When used as an [[argument]] in a [[function]] or [[process]], the [[parameter]] is not a copy, but the variable itself, as shown in the first example, and any change made to the parameter is also changed in the argument. It's more elegant to use a [[pointer]] though, as it also displayed.<br />
<br />
=== Example ===<br />
<br />
A file with name and path. Note that the assignment <code>myFile2 = myFile;</code> makes a copy of ''myFile'' and throws it into ''myFile2'', which is normal. But when it's used as an argument in a function, the parameter is not a copy but the _file itself.<br />
<br />
<pre><br />
Type _file<br />
String path;<br />
String name;<br />
End<br />
<br />
Process Main()<br />
Private<br />
_file myFile;<br />
_file myFile2;<br />
Begin<br />
<br />
myFile.path = "C:\";<br />
myFile.name = "autoexec.bat";<br />
say("1: " + myFile.path + myFile.name);<br />
<br />
myFile2 = myFile;<br />
myFile2.name = "config";<br />
say("1: " + myFile.path + myFile.name);<br />
say("2: " + myFile2.path + myFile2.name);<br />
<br />
setName(myFile,"pagefile");<br />
say("1: " + myFile.path + myFile.name);<br />
<br />
setName2(&myFile2,"pagefile");<br />
say("2: " + myFile2.path + myFile2.name);<br />
<br />
Repeat<br />
frame;<br />
Until(key(_ESC))<br />
<br />
End<br />
<br />
Function setName(_file f, string name)<br />
Begin<br />
f.name = name;<br />
End<br />
<br />
Function setName2(_file* f, string name)<br />
Begin<br />
f.name = name; // this is actually (*f).name = name, but . can be used like this<br />
End<br />
</pre><br />
Used in example: [[say]](), [[key]](), [[Pointer]]<br />
<br />
This will result in something like:<br><br />
{{Image<br />
| image = Type3.PNG<br />
| caption = Type results<br />
}}<br />
<br />
<br />
A point with x and y.<br />
<pre><br />
// Declare the type _point<br />
Type _point<br />
float x;<br />
float y;<br />
End<br />
<br />
// Declare the function distance(), because the function returns a datatype<br />
// other than int, so it needs to be declared before usage.<br />
Declare float distance(_point a,_point b)<br />
End<br />
<br />
Process Main()<br />
Private<br />
_point p1,p2;<br />
Begin<br />
<br />
p1.x = 15.3;<br />
p1.y = 34.9;<br />
p2.x = 165.4;<br />
p2.y = 137.2;<br />
<br />
write(0,0,0,0,"Distance: " + distance(p1,p2));<br />
drw_line(p1,p2);<br />
<br />
Repeat<br />
frame;<br />
Until(key(_ESC))<br />
<br />
End<br />
<br />
Function float distance(_point a, _point b)<br />
Begin<br />
return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) );<br />
End<br />
<br />
Function int drw_line(_point a, _point b)<br />
Begin<br />
return draw_line( a.x , a.y , b.x , b.y );<br />
End<br />
</pre><br />
Used in example: [[write]](), [[key]](), [[sqrt]](), [[draw_line]]()<br />
<br />
This will result in something like:<br><br />
{{Image<br />
| image = Type.PNG<br />
| caption = A line and its distance<br />
}}<br />
<br />
== ProcessType ==<br />
<br />
=== Definition ===<br />
'''Type''' <processname><br />
<br />
Acquires the [[processTypeID]] of a [[processType]] or [[function]]. This can be useful for example with the functions [[get_id]]() and [[signal]]().<br />
<br />
=== Example ===<br />
<pre><br />
Program example;<br />
Private<br />
proc proc_id; //int could be used too<br />
Begin<br />
<br />
// Start 3 proc's<br />
proc();<br />
proc();<br />
proc();<br />
<br />
// Display all alive proc's<br />
y = 0;<br />
while( (proc_id=get_id(type proc)) )<br />
write(0,0,(y++)*10,0,"proc: " + proc_id);<br />
end<br />
<br />
// Wait for key ESC<br />
Repeat<br />
frame;<br />
Until(key(_ESC))<br />
<br />
End<br />
<br />
Process proc()<br />
Begin<br />
Loop<br />
frame;<br />
End<br />
End<br />
</pre><br />
Used in example: [[get_id]](), [[write]](), [[key]]()<br />
<br />
This will result in something like:<br><br />
{{Image<br />
| image = Type2.PNG<br />
| caption = A list of active proc's<br />
}}</div>188.106.184.91