Fifth - language
Table of Contents
- 1. Fifth source format
- 2. Fifth commands
- 2.1. Compilation & miscellaneous
- 2.1.1. init ( – )
- 2.1.2. head <name> ( – )
- 2.1.3. : <name> ( – )
- 2.1.4. ; ( – )
- 2.1.5. const <name> ( n – )
- 2.1.6. :i <name> ( – )
- 2.1.7. create <name> ( – )
- 2.1.8. allot ( n – )
- 2.1.9. " <string>" ( – )
- 2.1.10. str <name> <string>" ( – )
- 2.1.11. var <name> ( – )
- 2.1.12. ' <module> ( – n )
- 2.1.13. forget <name> ( – )
- 2.1.14. [ ( – )
- 2.1.15. ] ( n – )
- 2.1.16. defer <name> ( – )
- 2.1.17. is ( address1 address2 – )
- 2.1.18. asc <char> ( – )
- 2.1.19. dyninc ( handle – )
- 2.1.20. include ( filenumber – )
- 2.1.21. words ( – )
- 2.1.22. bye ( – )
- 2.1.23. fkey ( – c )
- 2.1.24. sadd ( c addr – )
- 2.1.25. scan ( c – )
- 2.1.26. skey ( – c )
- 2.1.27. str=str? ( adr1 adr2 – result )
- 2.1.28. find ( – addr )
- 2.1.29. execute ( – )
- 2.1.30. dta ( addr – DataAddr )
- 2.1.31. 2num ( – num result )
- 2.1.32. dadd ( addr length – )
- 2.1.33. lit ( n – )
- 2.1.34. incmod ( addr – )
- 2.1.35. here ( – n )
- 2.1.36. mode ( var, 8 bit )
- 2.1.37. pad ( var, 128 bytes )
- 2.1.38. h ( var, 32 bit )
- 2.1.39. lp ( var, 32 bit )
- 2.1.40. modulechk ( Dstr<filename> – )
- 2.1.41. ne ( entrydata entrytype – )
- 2.2. Conditionals & control flow
- 2.3. Disk & file access
- 2.3.1. diskload ( FromDisk ToMem amount – )
- 2.3.2. disksave ( FromMem ToDisk amount – )
- 2.3.3. format ( – )
- 2.3.4. fsDfilesize@ ( handle – size )
- 2.3.5. fsDcurloc@ ( handle – location )
- 2.3.6. fsDupdated@ ( handle – updated? )
- 2.3.7. fssave ( FromMem DestFileHandle amount – )
- 2.3.8. fsload ( SrcFileHandle ToMem amount – )
- 2.3.9. fseof ( handle – bytesLeft )
- 2.3.10. fsls ( – )
- 2.3.11. fslsr ( – )
- 2.3.12. fscl ( DynStrHand – )
- 2.3.13. fscreate ( DynStrHand – DescPnt )
- 2.3.14. fsDsave ( DynHand<data> DynStrHand<filename> – )
- 2.3.15. fsDload ( DynStr<SrcFileName> DynHand<DataDest> – )
- 2.3.16. fsDloadnew ( DynStr<SrcFileName> – DynHand<DataDest> )
- 2.4. Dynamic memory
- 2.4.1. dynal ( size – handle )
- 2.4.2. dynde ( handle – )
- 2.4.3. dynp ( handle – addr )
- 2.4.4. dyns ( handle – size )
- 2.4.5. dynresize ( NewSize handle – )
- 2.4.6. dync@ ( addr handle )
- 2.4.7. dync! ( byte addr dynhandle )
- 2.4.8. dyn@ ( addr handle )
- 2.4.9. dyn! ( 32BitNum addr dynhandle )
- 2.4.10. dyncon ( size "name" – )
- 2.4.11. dyn. ( handle – )
- 2.5. Graphics and text
- 2.5.1. . ( n – )
- 2.5.2. d. ( n – )
- 2.5.3. ? ( addr – )
- 2.5.4. ." <string>" ( – )
- 2.5.5. tab. ( – )
- 2.5.6. calccol ( b g r – c )
- 2.5.7. imgalloc ( xsize ysize – imgbuf )
- 2.5.8. imgsize ( imgbuf – )
- 2.5.9. point ( x y imgbuf – addr )
- 2.5.10. pset ( color x y imgbuf – )
- 2.5.11. boxf ( x1 x2 y1 y2 imgbuf color – )
- 2.5.12. cls ( imgbuf – )
- 2.5.13. setpal ( b g r color – )
- 2.5.14. putchar ( char color x y imgbuf – )
- 2.5.15. scroll ( x y imgbuf – )
- 2.5.16. scrollf ( color x y screen – )
- 2.5.17. at! ( x y – )
- 2.5.18. curc! ( color – )
- 2.5.19. curb! ( color – )
- 2.5.20. colnorm ( – )
- 2.5.21. colneg ( – )
- 2.5.22. dyntype ( dynhandle – )
- 2.5.23. fsdisp ( file – )
- 2.5.24. type ( addr length – )
- 2.5.25. write ( addr – )
- 2.5.26. screen ( const, 32 bit )
- 2.5.27. copyscreen ( SrcImgHandle DestImgHandle – )
- 2.6. Math, memory & stack manipulation
- 2.6.1. off ( n – )
- 2.6.2. on ( n – )
- 2.6.3. 2dup ( n1 n2 – n1 n2 n1 n2 )
- 2.6.4. 2drop ( n1 n2 – )
- 2.6.5. nip ( n1 n2 – n2 )
- 2.6.6. neg ( n1 – -n1 )
- 2.6.7. bit@ ( n bit – result )
- 2.6.8. to32bit ( n1 n2 n3 n4 – n32 )
- 2.6.9. to8bit ( n32 – n1 n2 n3 n4 )
- 2.6.10. mod ( n1 n2 – reminder )
- 2.6.11. bound ( low n high – n )
- 2.6.12. bound? ( low n high – result )
- 2.6.13. tab ( col – spaces )
- 2.6.14. count ( addr – addr+1 n )
- 2.6.15. c, ( n – )
- 2.6.16. , ( n – )
- 2.6.17. cmove ( addr1 addr2 n – )
- 2.6.18. rnd ( limit – result )
- 2.6.19. abs ( n – |n| )
- 2.7. Dynamic & static strings
- 2.7.1. Dstral ( – handle )
- 2.7.2. Dstrlen ( handle – length )
- 2.7.3. c+Dstr ( chr handle – )
- 2.7.4. c+lDstr ( chr handle – )
- 2.7.5. Dstr. ( handle – )
- 2.7.6. Dstrsure ( size Dstr – )
- 2.7.7. Dstr2str ( handle address – )
- 2.7.8. str2Dstr ( address handle – )
- 2.7.9. Dstr+str ( Dstr addr – )
- 2.7.10. D" any string" ( – Dstr )
- 2.7.11. D> any_string ( – Dstr )
- 2.7.12. D>2 any_string ( – Dstr )
- 2.7.13. Dstr+Dstr ( Dstr1 Dstr2 – )
- 2.7.14. Dstrclear ( Dstr – )
- 2.7.15. Dstr2Dstr ( Dstr1 Dstr2 – )
- 2.7.16. Dstr ( data" name – )
- 2.7.17. Dstrlscan ( char Dstr – loc )
- 2.7.18. Dstrrscan ( char Dstr – loc )
- 2.7.19. Dstrlscane ( char Dstr – loc )
- 2.7.20. Dstrleft ( amo Dstr – )
- 2.7.21. Dstrright ( amo Dstr – )
- 2.7.22. Dstrcutl ( amo Dstr – )
- 2.7.23. Dstrsp ( char Dstr1 Dstr2 – )
- 2.7.24. Dv ( addr – )
- 2.7.25. Df ( addr – )
- 2.1. Compilation & miscellaneous
1. Fifth source format
Fifth uses a different character table and codes than ASCII (still almost similar). I call it FSCII (Fifth Standard Code for Information Interchange) for example space character is not 32 but 255 instead. I plan to use mainly HEX numbers, and create new characters to represent numeric values. So typical nemric characters "0123…" is treated like ordinary letters.
1.1. FSCII
| DEC | HEX | function |
|---|---|---|
| 0 - 15 | 0 - F | HEX numbers |
| 252 | FC | backspace |
| 253 | FD | tabulator (TAB) |
| 254 | FE | carriage return (CR) |
| 255 | FF | space |
| else | ordinary characters, same as in ASCII. |
2. Fifth commands
2.1. Compilation & miscellaneous
2.1.1. init ( – )
- Description
- First module, control is passed to on startup. Contains initialization routines. Also it is the last core module. All new modules on top of it comes as result of executing external source files.
2.1.2. head <name> ( – )
- Description
- Compiles new dictionary entry without specifying new module type.
- Example
head myentry
2.1.3. : <name> ( – )
- Description
- Creates new code module.
2.1.4. ; ( – )
- Description
- Ends module (immideate).
- Example
: hello ." hi there" ;
2.1.5. const <name> ( n – )
- Description
- Defines new constant.
- Example
2147483647 const max
2.1.6. :i <name> ( – )
- Description
- Same as
:but this module will be executed immideately even in compile mode. - Example
:i ( 41 scan ;
2.1.7. create <name> ( – )
- Description
- Same as
head, but specify module type as data. - Example
create LotoResults 5 , 13 , 52 , 12 , 11 , 3 ,
2.1.8. allot ( n – )
- Description
- Allocate n bytes in dictionary.
- Example
create MyArray 100 allot
2.1.9. " <string>" ( – )
- Description
- Compile string and its size into core.
- Example
create Mystring " This is it's contects"
2.1.10. str <name> <string>" ( – )
- Description
- Just shorter way for defining strings.
- Example
str Mystring This is it's contenc"
2.1.11. var <name> ( – )
- Description
- Define new 32 bit variable.
- Example
var result
2.1.12. ' <module> ( – n )
- Description
- Return memory address of given entry.
- Example
' init
2.1.13. forget <name> ( – )
- Description
- Erases from RAM given entry and all entries what was defined after it.
- Example
forget myprog
2.1.14. [ ( – )
- Description
- Set interpret mode (immideate).
2.1.15. ] ( n – )
- Description
- Set compile mode and compile top stack element in as
literal. Together
[ .... ]combination provides good way to compute some values only once, at compile time, rather than every time while program is running. - Example
: calculate - [ 4 MyConst1 + MyConst2 * ] ;
2.1.16. defer <name> ( – )
- Description
- Creates new module, with jump instruction. Later
address where to jump can be modified by
iscommand. This provides method of forward referencing. So you can use modules what not yet exist.
2.1.17. is ( address1 address2 – )
- Description
- address1 - where to jump, address2 - address of
module created by
defercommand. - Example
defer dispver : run dispver ." running ..." ; ... whatever ... : (dispver ." Version 9.99 " ; ' (dispver ' dispver isNow if I type "run" on the screen appears:
Version 9.99 running ...
2.1.18. asc <char> ( – )
- Description
- Reads char ascii code and treats it as literal (immideate).
- Example
: BreakLine 30 do asc - emit loop ;
same as:
: BreakLine 30 do 45 emit loop ;
2.1.19. dyninc ( handle – )
- Description
- Execute code in dynamic memory handle. Automatically deallocates it when done.
2.1.20. include ( filenumber – )
- Description
- Execute code in specified file.
2.1.21. words ( – )
- Description
- Display existing blocks in core.
2.1.22. bye ( – )
- Description
- Exit from Fifth.
2.1.23. fkey ( – c )
- Description
- Read one byte from input stream.
2.1.24. sadd ( c addr – )
- Description
- Add one byte c to string located at addr and updates string length.
2.1.25. scan ( c – )
- Description
- Read input stream and store it to
paduntil it finds c. It ignores all c bytes until it finds any non c byte. Is useful for breaking text lines into words. - Example
c is: " input stream: """"This is test !"aoeu idh result: This is test !
2.1.26. skey ( – c )
- Description
- So called safe
fkey. Reads data from input stream but converts characters with ASCII codes: 9 13 10 to spaces.
2.1.27. str=str? ( adr1 adr2 – result )
- Description
- Compares string at adr1 with string at adr2, returns true flag if they are equal or false if they are not. true = -1, false = 0.
2.1.28. find ( – addr )
- Description
- Searches whole dictionary for word in
pad. If found, returns its address, if not, returns 0.
2.1.29. execute ( – )
- Description
- Execute word located in
pad. Depending onmode.
2.1.30. dta ( addr – DataAddr )
- Description
- Calculates address of dictionary entry data area, from entry point.
2.1.31. 2num ( – num result )
- Description
- Attempt to convert string located in
padinto numeric value. If succeed returns number and true as result. If not, returns whatever and false as result.
2.1.32. dadd ( addr length – )
- Description
- Add to dictionary data located at addr, with specified length.
2.1.33. lit ( n – )
- Description
- Act with number depending on
mode. When interpreting, leaves it in stack.
2.1.34. incmod ( addr – )
- Description
- Add to dictionary data located at addr*+1, length is taken from *addr.
2.1.35. here ( – n )
- Description
- Return
hcontents.
2.1.36. mode ( var, 8 bit )
- Description
- Holds input stream parser operation mode. 0 = interpreting, 1 = compiling.
2.1.37. pad ( var, 128 bytes )
- Description
- Holds temporary strings.
2.1.38. h ( var, 32 bit )
- Description
- Pointer to free byte in memory, always at the end of
the dictionary. Each time when something is stored by
c,command, pointer is increased.
2.1.39. lp ( var, 32 bit )
- Description
- Pointer to last dictionary word. Each time when new
word is compiled or erased by
forget, this pointer is updated.
2.1.40. modulechk ( Dstr<filename> – )
- Description
- Check if module is loaded, if not immideately load it.
2.1.41. ne ( entrydata entrytype – )
- Description
- Compile new dictionary entry. Its name must be in
pad.
2.2. Conditionals & control flow
2.2.1. if ( flag – )
- Description
if 1.. else 2.. thenorif 1.. thenconstruction. Conditional execution (immideate). Performs "1.." if flag was true, elseway performs "2.." if exist. Execution continues after wordthen.- Example
1 if ." nonzero" else ." zero" then
2.2.2. >= ( n1 n2 – result )
- Description
- True if (n1 = n2) or (n1 > n2).
- Example
5 3 >= if ." first number is greater or equal" then
2.2.3. <= ( n1 n2 – result )
- Description
- True if (n1 = n2) or (n1 < n2).
2.2.4. = ( n1 n2 – result )
- Description
- True if n1 = n2.
2.2.5. do ( count – )
- Description
do .. loopconstruction (immideate). Performs ".." count times. In every step count is decreased until it is 0.- Example
: test 5 do i .d loop ;
result: 4 3 2 1 0
2.2.6. doexit ( – )
- Description
- Exit from
do .. loop.
2.2.7. for ( count top – )
- Description
for .. loopconstruction (immideate). Performs ".." (top - count) times. In every step count is increased until it reaches top.- Example
: test 4 10 for i .d loop ;
result: 4 5 6 7 8 9
2.2.8. forexit ( – )
- Description
- Exit from
for .. loop.
2.2.9. until ( – )
- Description
until .. loopconstruction (immideate). Performs ".." until flag become true. False by default. Top of return stack holds flag.
2.2.10. done ( – )
- Description
- Exit from
until .. loop.
2.3. Disk & file access
2.3.1. diskload ( FromDisk ToMem amount – )
- Description
- Load specified amount of bytes from disk into memory.
2.3.2. disksave ( FromMem ToDisk amount – )
- Description
- Save specified amount of bytes from memory into disk.
2.3.3. format ( – )
- Description
- Erase all files.
2.3.4. fsDfilesize@ ( handle – size )
- Description
- Return size of opened file.
2.3.5. fsDcurloc@ ( handle – location )
- Description
- Return current location in file.
2.3.6. fsDupdated@ ( handle – updated? )
- Description
- Return true if file was updated, ie. write operations occurred.
2.3.7. fssave ( FromMem DestFileHandle amount – )
- Description
- Save data to file.
2.3.8. fsload ( SrcFileHandle ToMem amount – )
- Description
- Load data from file.
2.3.9. fseof ( handle – bytesLeft )
- Description
- Return amount of bytes left till end of file. Useful before read operation.
2.3.10. fsls ( – )
- Description
- List all files and lists (directories, folders) in current path.
2.3.11. fslsr ( – )
- Description
- Same as
fslsbut recursively scans also sub lists.
2.3.12. fscl ( DynStrHand – )
- Description
- Change list (path).
2.3.13. fscreate ( DynStrHand – DescPnt )
- Description
- Create new file or list. Can create multiple lists at once.
- Example
When creating:
"\listGAMES\listSTRATEGY\listSIMWORLD\5th-runme"
and only
\listGAMES\already exist, thenlistSTRATEGYandlistSIMWORLDlists will be created, and empty file5th-runmeplaced in there.
2.3.14. fsDsave ( DynHand<data> DynStrHand<filename> – )
- Description
- Create new file and save all data from dynamic memory block to it.
2.3.15. fsDload ( DynStr<SrcFileName> DynHand<DataDest> – )
- Description
- Load whole file into dynamic memory block.
2.3.16. fsDloadnew ( DynStr<SrcFileName> – DynHand<DataDest> )
- Description
- Load whole file into new dynamic memory block.
2.4. Dynamic memory
2.4.1. dynal ( size – handle )
- Description
- Allocate dynamic memory block and return its handle.
2.4.2. dynde ( handle – )
- Description
- Deallocate dynamic memory block.
2.4.3. dynp ( handle – addr )
- Description
- Returns pointer to memory where dynamic block data begins.
2.4.4. dyns ( handle – size )
- Description
- Returns size of dynamic block.
2.4.5. dynresize ( NewSize handle – )
- Description
- Nondestructively resize dynamic block.
2.4.6. dync@ ( addr handle )
- Description
- Read one byte from dynamic block.
2.4.7. dync! ( byte addr dynhandle )
- Description
- Write one byte to dynamic block.
2.4.8. dyn@ ( addr handle )
- Description
- Read 32 bit number from dynamic block. Address will specify which number, not byte.
2.4.9. dyn! ( 32BitNum addr dynhandle )
- Description
- Write 32 bit number to dynamic block. Address will specify which number, not byte.
2.4.10. dyncon ( size "name" – )
- Description
- Allocate dynamic block with specified size, and create constant holding its handle.
- Example
100 dyncon MyNewBlock
2.4.11. dyn. ( handle – )
- Description
- Write content of dynamic memory block to screen.
2.5. Graphics and text
2.5.1. . ( n – )
- Description
- Print number on screen.
2.5.2. d. ( n – )
- Description
- Print number on screen in decimal.
2.5.3. ? ( addr – )
- Description
- Print 32 bit value located at addr.
2.5.4. ." <string>" ( – )
- Description
- Print string into screen. Immideately compiles.
- Example
: greeting ." Hello, World" ;
2.5.5. tab. ( – )
- Description
- Print tabulator.
2.5.6. calccol ( b g r – c )
- Description
- Calculate color what best matches given Blue Green & Red values. Values must be in range 0 - 255.
2.5.7. imgalloc ( xsize ysize – imgbuf )
- Description
- Allocate image buffer for specified size.
2.5.8. imgsize ( imgbuf – )
- Description
- Print on the screen X & Y size of image buffer.
2.5.9. point ( x y imgbuf – addr )
- Description
- Returns memory address for specified pixel.
2.5.10. pset ( color x y imgbuf – )
- Description
- Set graphic point.
2.5.11. boxf ( x1 x2 y1 y2 imgbuf color – )
- Description
- Draw filled box.
2.5.12. cls ( imgbuf – )
- Description
- Clear image buffer.
2.5.13. setpal ( b g r color – )
- Description
- Set palette value for specified color. Values must be in range 0 - 63.
2.5.14. putchar ( char color x y imgbuf – )
- Description
- Put graphic character in imagebuffer to specified (x & y) location.
2.5.15. scroll ( x y imgbuf – )
- Description
- Scroll in imgbuf.
2.5.16. scrollf ( color x y screen – )
- Description
- Scroll and fill empty space with given color.
2.5.17. at! ( x y – )
- Description
- Set cursor location.
2.5.18. curc! ( color – )
- Description
- Set text color.
2.5.19. curb! ( color – )
- Description
- Set background color.
2.5.20. colnorm ( – )
- Description
- Set text color to normal.
2.5.21. colneg ( – )
- Description
- Set text color to negative (selected).
2.5.22. dyntype ( dynhandle – )
- Description
- Display content of dynamic memory on screen.
2.5.23. fsdisp ( file – )
- Description
- Clear screen, display file, and wait for key.
2.5.24. type ( addr length – )
- Description
- Types on the screen string, from memory at addr and specified length.
2.5.25. write ( addr – )
- Description
- Types on the screen string, from memory at addr*+1, length is taken from *addr.
2.5.26. screen ( const, 32 bit )
- Description
- Holds handle of screen buffer.
2.5.27. copyscreen ( SrcImgHandle DestImgHandle – )
- Description
- Copy content of source image to destination image. Source and destination images must have same size.
2.6. Math, memory & stack manipulation
2.6.1. off ( n – )
- Description
- Writes 0 to given address, good for zeroing variable.
- Example
MyVariable off
2.6.2. on ( n – )
- Description
- Writes -1 (true flag) to given address.
- Example
MyVariable on
2.6.3. 2dup ( n1 n2 – n1 n2 n1 n2 )
2.6.4. 2drop ( n1 n2 – )
2.6.5. nip ( n1 n2 – n2 )
2.6.6. neg ( n1 – -n1 )
- See also: abs ( n – |n| )
- Invert sign (negate) of a numerical value.
2.6.7. bit@ ( n bit – result )
- Description
- Return specified bit from n.
- Example
38 2 bit@
result will be 1
2.6.8. to32bit ( n1 n2 n3 n4 – n32 )
- Description
- Treat 4 last stack elements as bytes and unite them into 32 bit double word. Most significant byte on top.
- Example
12 76 23 11 to32bit
result: 186076172
2.6.9. to8bit ( n32 – n1 n2 n3 n4 )
- Description
- Break 32 bit number into 4 bytes. Useful if you need to send 32 bit numbers though 8 bit COM port.
- Example
186076172 to8bit
result: 12 76 23 11
2.6.10. mod ( n1 n2 – reminder )
- Description
- Divide n1 by n2 and returns reminder.
- Example
12 5 mod
result: 2
2.6.11. bound ( low n high – n )
- Description
- Check if n is in given bounds (upper and lower bounds are both inclusive). If n if outside of bounds, increase or decrease its value accordingly to stay within bounds.
- Examples
5 80 15 bound
result: 15
5 10 15 bound
result: 10
5 -10 15 bound
result: 5
2.6.12. bound? ( low n high – result )
- Description
- Returns true if n is in the given bounds. Upper and lower bounds are both inclusive.
2.6.13. tab ( col – spaces )
- Description
- Calculate amount of spaces to add to reach next tabulation from given column.
2.6.14. count ( addr – addr+1 n )
- Description
- Useful for returning bytes from constantly
incareasing address. Module
typeis nice example.
2.6.15. c, ( n – )
- Description
- Store one byte at memory specified by
h. And incareasehby 1.
2.6.16. , ( n – )
- Description
- Store 32 bit number at memory specified by
h. And incareasehby 4.
2.6.17. cmove ( addr1 addr2 n – )
- Description
- Copy n amount of bytes from memory at addr1 to memory at addr2.
2.6.18. rnd ( limit – result )
- Description
- Generates random number in range 0 to
limit- 1.
2.6.19. abs ( n – |n| )
- See also: neg ( n1 – -n1 )
- Returns absolute value of n.
2.7. Dynamic & static strings
Fifth supports both static and dynamic strings. Static strings must have predefined space reserved, and string mustn't exceed this length. They manipulation is faster. But they use more memory. Static string memory address is used to refer to the string.
Dynamic strings can have at any time length form 0 to 0FFh, They take up only memory they currently need. They are held in dynamic memory blocks, so dynamic block handle is used to refer to this string.
Both types of strings are stored in the way, where first (0th) byte holds current string length, following bytes are string itself.
2.7.1. Dstral ( – handle )
- Description
- Allocate new dynamic string.
2.7.2. Dstrlen ( handle – length )
- Description
- Return string length.
2.7.3. c+Dstr ( chr handle – )
- Description
- Add one byte to end of the string.
2.7.4. c+lDstr ( chr handle – )
- Description
- Add one byte to left side (beginning) of the string.
2.7.5. Dstr. ( handle – )
- Description
- Write content of string into screen.
2.7.6. Dstrsure ( size Dstr – )
- Description
- Makes sure that at least requested size (amount of characters) is allocated for given dynamic string.
2.7.7. Dstr2str ( handle address – )
- Description
- Copy dynamic string into static memory space.
2.7.8. str2Dstr ( address handle – )
- Description
- Copy static string into dynamic string.
2.7.9. Dstr+str ( Dstr addr – )
- Description
- Add content of dynamic string to static string.
2.7.10. D" any string" ( – Dstr )
- Description
- Moves specified string into dynamic string called
defDstr.
2.7.11. D> any_string ( – Dstr )
- Description
- Moves specified string into dynamic string called
defDstr. Space marks end of string!
2.7.12. D>2 any_string ( – Dstr )
- Description
- Moves specified string into dynamic string called
defDstr2. Space marks end of string!
2.7.13. Dstr+Dstr ( Dstr1 Dstr2 – )
- Description
- Adds Dstr1 to Dstr2 and places result into Dstr2.
2.7.14. Dstrclear ( Dstr – )
- Description
- Clears content of dynamic string.
2.7.15. Dstr2Dstr ( Dstr1 Dstr2 – )
- Description
- Moves Dstr1 to Dstr2.
2.7.16. Dstr ( data" name – )
- Description
- Creates new dynamic string and moves specified data into it. Then creates new constant with given name holding created dynamic string handle.
- Example
Dstr Hello, my name is Sven!" message \ creates it message Dstr. \ tests it
2.7.17. Dstrlscan ( char Dstr – loc )
- Description
- Searches dynamic string for char, from left to right, returns first found char location in string, or 0, if not found.
2.7.18. Dstrrscan ( char Dstr – loc )
- Description
- Searches dynamic string for char, from right to left, returns first found char location in string, or 0, if not found.
2.7.19. Dstrlscane ( char Dstr – loc )
- Description
- Same as
Dstrlscanbut returns string length+1 as location.
2.7.20. Dstrleft ( amo Dstr – )
- Description
- Only specified amount of characters from left remains in dynamic string. ie. cut right part out.
2.7.21. Dstrright ( amo Dstr – )
- Description
- Only specified amount of characters from right remains in dynamic string. ie. cut left part out.
2.7.22. Dstrcutl ( amo Dstr – )
- Description
- Cut specified amount of characters from left of dynamic string out.
2.7.23. Dstrsp ( char Dstr1 Dstr2 – )
- Description
- Separate dynamic string in Dstr1 into two parts, using char as separator. First part will be stored in Dstr2, second part in Dstr1.
- Example
asc \ \ ..separator D> listF\listLIB\5TH_DRVMOUSE \ ..separate from defDstr2 \ ..place result in Dstrsp \ separation command defDstr Dstr. \ will be: listLIB\5TH_DRVMOUSE defDstr2 Dstr. \ will be: listF
2.7.24. Dv ( addr – )
- Description
- Allocates empty dynamic string, and places its handle into given address.
2.7.25. Df ( addr – )
- Description
- Reads dynamic string handle from given address and deallocates (frees) it.
- Example
var mystring1 : testmodule mystring1 Dv \ allocates string <whatever> mystring1 Df ; \ deallocates it again when no longer needed.