3.3.52. scriba_LoadProgramString()

[<<<] [>>>]

Use this function to convert a string containing a BASIC program that is already in memory to ready-to-run binary format. This function is same as @xref{scriba_LoadSourceProgram()} except that this function reads the source code from a string instead of a file.

int scriba_LoadProgramString(pSbProgram pProgram,
                             char *pszSourceCode,
                             unsigned long cbSourceCode
  ){
The argument pProgram is the program object. The argument pszSourceCode is the BASIC program itself in text format. Because the source code may contain ZCHAR just for any chance the caller has to provide the number of characters in the buffer via the argument cbSourceCode. In case the source program is zero terminated the caller can simply say strlen(pszSourceCode) to give this argument.

Before calling this function the function @xref{scriba_SetFileName()} may be called. Altough the source code is read from memory and thus there is no source file the BASIC program may use the command include or import that includes another source file after reading the code. If the program does so the reader functions need to know the actual file name of the source code to find the file to be included. To help this process the caller using this function may set the file name calling @xref{scriba_SetFileName()}. However that file is never used and need not even exist. It is used only to calculate the path of included files that are specified using relative path.

The return value is zero (SCRIBA_ERROR_SUCCESS) or the error code returned by the underlying layer that has detected the error.


[<<<] [>>>]