Please enable JavaScript to view this site.

A-Shell Consolidated Reference

A-Shell programs normally use ANSI strings (one byte per character), with the lower 128 characters using the standard ASCII encoding, and the upper 128 characters using the Latin1 encoding. The Excel file format, on the other hand, internally uses the Windows Wide character format (two bytes per character, aka U16). So it has no trouble supporting the accented and other special characters, but they do have to be converted from ANSI format to wide (or U16). The LibXL API will accomplish this for you, but there are variations of how this can work depending on the platform and flags you can set.

In the Windows environment the LibXL API converts the strings you pass it to wide / U16 format and then passes them to the external library using the « W » functions. The conversion is reversed for any return strings.

In the Unix environment, it is more common for applications requiring special characters to use UTF8 representation (one to five bytes per character), even though the spreadsheet internal file format still uses the U16 format. Depending on the DLF_xxx options you set, the LibXL API will either leave your strings alone, passing them as-is, or it will first convert them to UTF8 before passing them to the LibXL library.

In order for these conversions to work properly in each environment, and to allow your compiled programs to run in either environment without recompiling, you must set the DLF_ASCII or DLF_ANSI flag before calling the Fn’Load’LibXL function. (For simplicity, DLF_ANSI is defined as zero and thus is the default.)

LibXL’Load flags

Description

DLF_ANSI

Application strings assumed to be in ANSI format (i.e. Latin1, one byte per character). They will be converted to/from wide format for Windows, and UTF8 for Unix. (Requires A-Shell 6.3.1542+ for Unix.)

DLF_ASCII

Application strings are assumed to use only the ASCII values 0-127, and thus require no conversion for special characters. They will still be converted to wide format for Windows, but will be passed as-is in Unix.

DLF_UTF8

Application strings are assumed to already be in UTF8 format.  They will be converted from UTF8 to wide for Windows, and passed as is for Unix.

 

For example:

dlflags = DLF_STATUS_BASERR or DLF_STATUS_BASERR

dlflags = dlflags or DLF_PRINT_ERRORS

dlflags = dlflags or DLF_ASCII    ! app uses only ASCII chars

call Fn'LibXL'Load(dlflags=dlflags)