X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=fifth.git;a=blobdiff_plain;f=doc%2Fcommands%2Fstring.txt;fp=doc%2Fcommands%2Fstring.txt;h=0000000000000000000000000000000000000000;hp=c254206c762263c3603ba4eaecc09e39b59b4aa2;hb=7ad7475c2abf891a92b457339aaa0c20c40634d1;hpb=791dce846c524feca7b344307597c1d1224ba1de diff --git a/doc/commands/string.txt b/doc/commands/string.txt deleted file mode 100644 index c254206..0000000 --- a/doc/commands/string.txt +++ /dev/null @@ -1,126 +0,0 @@ - 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. - -Dynamic: - -Dstral ( -- handle ) - Allocate new string. - -Dstrlen ( handle -- length ) - Return string length. - -c+Dstr ( chr handle -- ) - Add one byte to end of the string. - -c+lDstr ( chr handle -- ) - Add one byte to left side (beginning) of the string. - -Dstr. ( handle -- ) - Write contec of string into screen. - -Dstrsure ( size Dstr -- ) - Makes sure that at least rquested - "size" (amount of characters) is allocated for given - dynamic string. - -Dstr2str ( handle address -- ) - Copy dyamic string into static memory space. - -str2Dstr ( address handle -- ) - Copy static string into dyamic string. - -Dstr+str ( Dstr addr -- ) - Add contenc of dynamic string to static string. - -D" any string" ( -- Dstr ) - Moves specified string into dynamic string called "defDstr". - -D> any_string ( -- Dstr ) - Moves specified string into dynamic string called "defDstr". - Space marks end of string! - -D>2 any_string ( -- Dstr ) - Moves specified string into dynamic string called "defDstr2". - Space marks end of string! - -Dstr+Dstr ( Dstr1 Dstr2 -- ) - Adds "Dstr1" to "Dstr2" and places result into "Dstr2". - -Dstrclear ( Dstr -- ) - Clears contenc of dynamic string. - -Dstr2Dstr ( Dstr1 Dstr2 -- ) - Moves "Dstr1" to "Dstr2". -Dstr ( data" name -- ) - Creates new dynamic string and moves specified data into it. - Then creates new constant with given "name" holding created - dynamic string handle. - - ex: Dstr Hello, my name is Sven!" message \ creates it - message Dstr. \ tests it - -Dstrlscan ( char Dstr -- loc ) - Searches dynamic string for "char", from left to right, - returns first found "char" location in string, or 0, - if not found. - -Dstrrscan ( char Dstr -- loc ) - Searches dynamic string for "char", from right to left, - returns first found "char" location in string, or 0, - if not found. - -Dstrlscane ( char Dstr -- loc ) - Same as "Dstrlscan" buf returns string length+1 as location. -ΓΏ -Dstrleft ( amo Dstr -- ) - Only specified amount of characters from left remains - in dynamic string. ie. cut right part out. - -Dstrright ( amo Dstr -- ) - Only specified amount of characters from right remains - in dynamic string. ie. cut left part out. - -Dstrcutl ( amo Dstr -- ) - Cut specified amount of characters from left of dynamic - string out. - -Dstrsp ( char Dstr1 Dstr2 -- ) - Separate dynamic string in Dstr1 into two parts, - using "char" as separator. First part will be stored in - "Dstr2", second part in "Dstr1". - ex: 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 - -Dv ( addr -- ) - Allocates empty dynamic string, and places it's handle - into given address. - -Df ( addr -- ) - Reads dynamic string handle from given address and - deallocates (frees) it. - -ex: var mystring1 - : testmodule - mystring1 Dv \ allocates string - - - - mystring1 Df ; \ deallocates it again when no longer needed.