need help with xstrings

My Rabbit based embedded web server is running out of Constant Data space on error messages and HTML strings. I want to move static strings to xmem, but cannot find samples or references.

The Dynamic C User Guide shows the xstring data type but no support functions. The Samples have exactly one instance of xstring, in ftp_server_full.c. That file has a function call xmem_strdup for which I cannot find docs. It doesn’t even come up on Google.

So far, I have changed this:
const char * ErrorNames[] = {
[indent]“No Errors” ,
“Home Error” ,
“Position Error” ,
[/indent]
to this:
xstring xErrorNames {
[indent] “No Errors” ,
“Home Error” ,
“Position Error” ,
[/indent]
That compiles, but I don’t know where to go from there. This line does not compile:

strcpy (szMostSevereError, xErrorNames[ix]) ; 

line 2983 : ERROR xxxx.C : Cannot subscript object ‘xErrorNames’ of type ‘unsigned long’; an array or pointer is required.

So, the question is, where are documents and samples on the use of xstrings?

Thanks,
Larry

After finding the xmem* functions in the DC Func Ref, and reading the source in XMEM.LIB, I tried some stuff and am more lost than before.

I got away from the string table thing and set up single strings in xmem:

xstring xErrorName0 { “No Errors” } ;

Then tried to dump the memory:

        printf("xmem: %04x %04x %04x %04x

",
xgetint(xErrorName0),
xgetint(xErrorName0 + 2),
xgetint(xErrorName0 + 4),
xgetint(xErrorName0 + 6)
) ;

“No Errors” should have dumped as 4e6f 2045 7272 6f72, but my stdio output was:

xmem: 0d0b 0002 6154 706d

So where is my data?

Found my data in the .ROM file:

12:ed0b[ a] -> 4e 6f 20 45 72 72 6f 72 73 00…This is my data!
12:ed15[ 4] -> 0b 0d 02 00…xErrorName0 == 0x00020d15, this is the xgetint result
12:ed19[ 10] -> 54 61 6d 70 20 48 6f 6d 65 20 45 72 72 6f 72 00…This is the next string
12:ed29[ 4] -> 19 0d 02 00…but I bet this is the next pointer

Somebody with a clue, please tell me what’s going on.

Here is a correct code snip for accessing xstring data:

        xmem2root (szMostSevereError, 
                   xgetlong(xErrorName0), 
                   sizeof(szMostSevereError)) ;

That is, the identifier xErrorName0 is not the address of your xstring initialization data, but a pointer to that data. You have to dereference the pointer to get the data.

Knowing this, and going back to the text of the DC User Manual:

The keyword xstring declares a table of strings in extended flash memory. The disadvantage
is that the strings cannot be accessed directly with pointers, since the table entries
are 20-bit physical addresses. As illustrated above, the function xmem2root() may be
used to store the table in temporary stack space.

It looks like the writer presented accurate information, but not in a way that anyone could use.

Geez. I wasted about 6 hours on this. Hopefully the next victim will find this post.