Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /usr/share/doc/autogen/autogen.html/ drwxr-xr-x | |
| Viewing file: Select action/file-type: Next: SCM string-table-size, Previous: SCM string-table-add-ref, Up: Common Functions [Contents][Index] 3.5.56 string-table-new - create a string tableUsage: (string-table-new st-name)
With these functions, it should be much easier to construct structures containing string offsets instead of string pointers. That can be very useful when transmitting, storing or sharing data with different address spaces. Here is a brief example copied from the strtable.test test: [+ (string-table-new "scribble")
(out-push-new) ;; redirect output to temporary
(define ct 1) +][+
FOR str IN that was the week that was +][+
(set! ct (+ ct 1))
+]
[+ (string-table-add-ref "scribble" (get "str")) +],[+
ENDFOR +]
[+ (out-suspend "main")
(emit-string-table "scribble")
(ag-fprintf 0 "\nchar const *ap[%d] = {" ct)
(out-resume "main")
(out-pop #t) ;; now dump out the redirected output +]
NULL };
Some explanation: I added the Here is the result. Note that duplicate strings are not repeated in the string table: static char const scribble[18] =
"that\0" "was\0" "the\0" "week\0";
char const *ap[7] = {
scribble+0,
scribble+5,
scribble+9,
scribble+13,
scribble+0,
scribble+5,
NULL };
These functions use the global name space If you utilize this in your programming, it is recommended that you
prevent printf format usage warnings with the GCC option
Arguments:
Next: SCM string-table-size, Previous: SCM string-table-add-ref, Up: Common Functions [Contents][Index] |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0081 ]-- |