G:/ScriptBasic/source/extensions/t/interface.c File Reference

#include <stdio.h>
#include "../../basext.h"

Go to the source code of this file.

Defines

#define my_strcpy(a, b)   do{if(copy)strcpy(a,b);}while(0)
#define XMLSTART   "<?xml version=\"1.0\" encoding=\"UTF-8\"?><V>"
#define XMLEND   "</V>"

Functions

besVERSION_NEGOTIATE return (int)
static long serconv (VARIABLE vVAR, unsigned char *buf)
static long serconvXML (VARIABLE vVAR, unsigned char *buf, int copy)
static VARIABLE unserconv (pExecuteObject pEo, unsigned char **buf, int *piError)
 besCOMMAND (serialize)
 if (RESULT==NULL)
besEND besFUNCTION (savestring)
 besHOOK_FWRITE (pszString, 1, cbString, fp)
 besHOOK_FCLOSE (fp)
 besFREE (pszFileName)
besEND besFUNCTION (loadstring)
 if (fp==NULL)
 besHOOK_FREAD (STRINGVALUE(besRETURNVALUE), 1, cbString, fp)
besEND besFUNCTION (md5fun)

Variables

 vARR = _besEVALUATEEXPRESSION_A(CAR(nItem))
 ASSERTOKE
 size = sersize(vARR,pSt)
 RESULT = besNEWMORTALSTRING(size)
 vARR = _besEVALUATEEXPRESSION_A(CAR(nItem))
 ASSERTOKE
 size = serconvXML(vARR,NULL,0) + strlen(XMLSTART) + strlen(XMLEND)
 RESULT = besNEWMORTALSTRING(size)
return iError
 fp = besHOOK_FOPEN(pszFileName,"rb")
 vARR = _besEVALUATEEXPRESSION_A(CAR(nItem))
 ASSERTOKE
 size = sersize(vARR,pSt)
 RESULT = besNEWMORTALSTRING(size + 16)
return iError


Define Documentation

#define my_strcpy a,
 )     do{if(copy)strcpy(a,b);}while(0)
 

Referenced by serconvXML().

#define XMLEND   "</V>"
 

Definition at line 317 of file interface.c.

#define XMLSTART   "<?xml version=\"1.0\" encoding=\"UTF-8\"?><V>"
 

Definition at line 316 of file interface.c.


Function Documentation

besCOMMAND serialize   ) 
 

=section ArrayToString =H s = t::ArrayToString(Array)

Call this function to convert an array to a binary string. This string can be saved to a file or stored in memory and the function R<StringToArray> can convert it back to array. Note that arrays and associative arrays are not different in ScriptBasic.

Note that the include file T<t.bas> also defines the T<Array2String> name to the same function.

Also note that though the name of the function is T<ArrayToString> you can convert any variable to binary string using this function. However this is most useful when the argumentum is an array.

Definition at line 250 of file interface.c.

References NULL, RESULT, and RETURN.

besFREE pszFileName   ) 
 

besEND besFUNCTION md5fun   ) 
 

=section MD5 =H Calculate MD5 Calculate the MD5 value of a string

=verbatim q = t::MD5("string") =noverbatim

Note that the return value is a 16 byte binary strig thus do not try to print it without first converting to some printable string.

Definition at line 453 of file interface.c.

References RESULT, and RETURN.

besEND besFUNCTION loadstring   ) 
 

=section loadstring =H s = t::LoadString(file)

This function opens a file, reads its content into a new string variable and returns it. See also R<savestring>

Definition at line 408 of file interface.c.

References besFREE(), and COMMAND_ERROR_MEMORY_LOW.

besEND besFUNCTION savestring   ) 
 

=section savestring =H t::SaveString file,string

Save a string to a file. This subroutine opens the file, creates it if it did not exist and prints the binary string to the file and closes the file. See also R<loadstring>

Definition at line 368 of file interface.c.

References besFREE(), and COMMAND_ERROR_FILE_CANNOT_BE_OPENED.

besHOOK_FCLOSE fp   ) 
 

Referenced by if().

besHOOK_FREAD STRINGVALUE(besRETURNVALUE ,
,
cbString  ,
fp 
 

besHOOK_FWRITE pszString  ,
,
cbString  ,
fp 
 

if fp  = NULL  ) 
 

Definition at line 429 of file interface.c.

References besFREE(), COMMAND_ERROR_FILE_CANNOT_BE_OPENED, and pszFileName.

if RESULT  = NULL  ) 
 

Definition at line 270 of file interface.c.

besVERSION_NEGOTIATE return int   ) 
 

=H Tools module

This module contains handy functions. These are general, system-independant functions that can be used to write effective programs, but are more complex or special purpose to include them into the core language.

The functions include file handling, string handling, array to string conversion and many more. See below:

Definition at line 29 of file interface.c.

References ArrayHighLimit, besDEREFERENCE(), i, NULL, size, and STRLEN().

static long serconv VARIABLE  vVAR,
unsigned char *  buf
[static]
 

Definition at line 73 of file interface.c.

References ArrayHighLimit, i, LONGVALUE(), memcpy(), NULL, size, STRINGVALUE(), and STRLEN().

static long serconvXML VARIABLE  vVAR,
unsigned char *  buf,
int  copy
[static]
 

Definition at line 115 of file interface.c.

References ArrayHighLimit, i, LONGVALUE(), my_strcpy, NULL, size, sprintf(), STRINGVALUE(), and STRLEN().

static VARIABLE unserconv pExecuteObject  pEo,
unsigned char **  buf,
int *  piError
[static]
 

Definition at line 181 of file interface.c.

References ArrayHighLimit, ArrayLowLimit, COMMAND_ERROR_MEMORY_LOW, COMMAND_ERROR_SUCCESS, i, memcpy(), NULL, pSt, and StringLen.


Variable Documentation

ASSERTOKE
 

Definition at line 510 of file interface.c.

ASSERTOKE
 

Definition at line 315 of file interface.c.

ASSERTOKE
 

Definition at line 267 of file interface.c.

fp = besHOOK_FOPEN(pszFileName,"rb")
 

Definition at line 428 of file interface.c.

return iError
 

Definition at line 554 of file interface.c.

return iError
 

Definition at line 357 of file interface.c.

RESULT = besNEWMORTALSTRING(size + 16)
 

Definition at line 512 of file interface.c.

RESULT = besNEWMORTALSTRING(size)
 

Definition at line 319 of file interface.c.

RESULT = besNEWMORTALSTRING(size)
 

Definition at line 269 of file interface.c.

size = sersize(vARR,pSt)
 

Definition at line 511 of file interface.c.

size = serconvXML(vARR,NULL,0) + strlen(XMLSTART) + strlen(XMLEND)
 

Definition at line 318 of file interface.c.

size = sersize(vARR,pSt)
 

Definition at line 268 of file interface.c.

vARR = _besEVALUATEEXPRESSION_A(CAR(nItem))
 

Definition at line 509 of file interface.c.

vARR = _besEVALUATEEXPRESSION_A(CAR(nItem))
 

Definition at line 314 of file interface.c.

vARR = _besEVALUATEEXPRESSION_A(CAR(nItem))
 

Definition at line 266 of file interface.c.


Generated on Sun Mar 12 23:56:36 2006 for ScriptBasic by  doxygen 1.4.6-NO