home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2001 August
/
PCWorld_2001-08_cd.bin
/
Komunikace
/
sambar
/
_setup.1
/
cspublic.h
< prev
next >
Wrap
C/C++ Source or Header
|
2001-04-10
|
6KB
|
272 lines
/*
** CSPUBLIC.H
**
** CScript Engine Public Header
**
**
** History:
** Chg# Date Description Resp
** ---- ------- ------------------------------------------------------- ----
** 4JAN98 Created sambar
*/
#if !defined(__CSPUBLIC_H__)
#define __CSPUBLIC_H__
/*
** CScript Types
*/
typedef short CS_RETCODE;
/*
** CScript Defines
*/
#define CS_CTX void
#define CS_PROG void
#define CS_MAIN void
#define CS_STACK void
#define CS_ARGS void
#define CS_RESULT void
#define CS_FAIL 0
#define CS_SUCCEED 1
/*
** CScript Filetype Defines
*/
#define CS_PARSEFLAGS_ASP 0x0001
/*
** CScript Error Defines
*/
#define CS_ERRORFLAGS_TRYCATCH 0x0001
#define CS_SEVERITY_FATAL 999
#define CS_SEVERITY_ERROR 1
#define CS_SEVERITY_INFO 0
typedef struct cs__error
{
int e_flags;
int e_severity;
char *e_msg;
char *i_func;
char *i_filename;
int i_linenum;
char *p_filename;
char *p_func;
int p_linenum;
} CS_ERROR;
typedef struct cs__constdefn
{
char *cd_name;
int cd_type;
void *cd_obj;
char *cd_string;
long cd_int;
double cd_double;
} CS_CONSTDEFN;
typedef struct cs__funcarg
{
char *fa_name;
int fa_datatype;
int fa_min;
int fa_max;
char *fa_pattern;
char *fa_desc;
} CS_FUNCARG;
typedef CS_RETCODE (* CS_USERFUNC)(CS_CTX *ctx, void *sactx, void *saconn,
CS_STACK *stack, CS_ARGS *args, int numargs,
CS_RESULT *result);
typedef struct cs__funcdefn
{
char *fd_name;
CS_USERFUNC fd_func;
int fd_returntype;
int fd_flags;
int fd_numargs;
CS_FUNCARG *fd_args;
char *fd_desc;
} CS_FUNCDEFN;
#define CS_FUNCARGS_UNLIMITED -1
#define CS_DATATYPE_UNDEFINED 0
#define CS_DATATYPE_NUMBER 1 /* double */
#define CS_DATATYPE_INT 2 /* int */
#define CS_DATATYPE_STRING 3 /* char * */
#define CS_DATATYPE_VOID 4
#define CS_DATATYPE_OBJECT 5 /* void * */
#define CS_DATATYPE_ARRAY 6
#define CS_DATATYPE_NULL 7
#define CS_FUNCFLAGS_EXCEPTION 0x0001 /* Function throws exception */
typedef void (* CS_ERRORFUNC)(CS_CTX *ctx, CS_PROG *prog,
void *sactx, void *saconn, CS_ERROR *error);
typedef void (* CS_FREEFUNC)(CS_CTX *ctx, void *sactx, void *saconn,
void *obj);
/*
** CScript Function Prototypes
*/
#ifdef WIN32
#define CS_PUBLIC __cdecl
#define CS_EXPORT __declspec(dllexport)
#else /* UNIX */
#define CS_PUBLIC
#define CS_EXPORT
#endif
#if defined(__cplusplus)
extern "C" {
#endif
extern CS_RETCODE CS_EXPORT cs_ctx_init(
void *cmctx,
CS_CTX **csctxp,
int *infop
);
extern CS_RETCODE CS_EXPORT cs_ctx_library(
CS_CTX *csctx,
CS_ERRORFUNC errfunc,
void *sactx
);
extern CS_RETCODE CS_EXPORT cs_ctx_global(
CS_CTX **csctxp
);
extern CS_RETCODE CS_EXPORT cs_ctx_exit(
CS_CTX *csctx
);
extern CS_RETCODE CS_EXPORT cs_package_define(
CS_CTX *csctx,
char *package,
char *desc,
CS_FUNCDEFN *funcs,
int numfuncs,
CS_CONSTDEFN *consts,
int numconsts
);
extern void CS_EXPORT cs_throw(
CS_STACK *csstack,
char *msg
);
extern CS_RETCODE CS_EXPORT cs_object_clear(
CS_STACK *csstack,
void *obj,
int objid
);
extern CS_RETCODE CS_EXPORT cs_result_void(
CS_STACK *csstack,
CS_RESULT *result
);
extern CS_RETCODE CS_EXPORT cs_result_array(
CS_STACK *csstack,
CS_RESULT *result
);
extern CS_RETCODE CS_EXPORT cs_result_int(
CS_STACK *csstack,
CS_RESULT *result,
int arraypos,
long data
);
extern CS_RETCODE CS_EXPORT cs_result_number(
CS_STACK *csstack,
CS_RESULT *result,
int arraypos,
double data
);
extern CS_RETCODE CS_EXPORT cs_result_string(
CS_STACK *csstack,
CS_RESULT *result,
int arraypos,
char *data,
int copy
);
extern CS_RETCODE CS_EXPORT cs_result_object(
CS_STACK *csstack,
CS_RESULT *result,
int arraypos,
void *obj,
int objid,
CS_FREEFUNC freefunc
);
extern CS_RETCODE CS_EXPORT cs_arg_get(
CS_STACK *csstack,
CS_ARGS *args,
int argnum,
int *datatypep,
void **valuep
);
extern CS_RETCODE CS_EXPORT cs_arg_set(
CS_STACK *csstack,
CS_ARGS *args,
int argnum,
int datatype,
void *value
);
extern CS_RETCODE CS_EXPORT cs_prog_alloc(
CS_CTX *csctx,
CS_ERRORFUNC errfunc,
void *sactx,
void *saconn,
CS_PROG **csprogp
);
extern CS_RETCODE CS_EXPORT cs_prog_free(
CS_CTX *csctx,
CS_PROG *csprog
);
extern CS_RETCODE CS_EXPORT cs_prog_parsefile(
CS_CTX *csctx,
CS_PROG *csprog,
char *filename,
int flags
);
extern CS_RETCODE CS_EXPORT cs_prog_parsebuf(
CS_CTX *csctx,
CS_PROG *csprog,
char *buffer,
int buflen
);
extern CS_RETCODE CS_EXPORT cs_prog_prepare(
CS_CTX *csctx,
CS_PROG *csprog,
void *saconn,
CS_MAIN **csmain
);
extern CS_RETCODE CS_EXPORT cs_main_var(
CS_MAIN *csmain,
char *name,
int namelen,
int type,
int id,
void *data,
int datalen,
int copybuf
);
extern CS_RETCODE CS_EXPORT cs_main_run(
CS_MAIN *csmain
);
#if defined(__cplusplus)
}
#endif
#endif /* __CSPUBLIC_H__ */