qse/ase/lsp/lsp_i.h

86 lines
2.2 KiB
C
Raw Normal View History

2006-10-24 15:10:25 +00:00
/*
2007-02-01 08:52:10 +00:00
* $Id: lsp_i.h,v 1.6 2007-02-01 08:49:52 bacon Exp $
2006-10-24 15:10:25 +00:00
*/
#ifndef _ASE_LSP_LSPI_H_
#define _ASE_LSP_LSPI_H_
#include <ase/lsp/lsp.h>
2006-10-26 08:17:38 +00:00
#include <ase/lsp/env.h>
#include <ase/lsp/obj.h>
2006-10-24 15:10:25 +00:00
#include <ase/lsp/mem.h>
#include <ase/lsp/misc.h>
#include <ase/lsp/prim.h>
2006-10-26 08:17:38 +00:00
#include <ase/lsp/name.h>
2006-10-24 15:10:25 +00:00
#ifdef _MSC_VER
#pragma warning (disable: 4996)
#endif
2006-11-29 03:19:49 +00:00
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
2006-10-24 15:10:25 +00:00
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#define ASE_LSP_MALLOC(lsp,size) malloc (size)
#define ASE_LSP_REALLOC(lsp,ptr,size) realloc (ptr, size)
#define ASE_LSP_FREE(lsp,ptr) free (ptr)
#else
#define ASE_LSP_MALLOC(lsp,size) \
2007-02-01 08:52:10 +00:00
(lsp)->prmfns.malloc (size, (lsp)->prmfns.custom_data)
2006-10-24 15:10:25 +00:00
#define ASE_LSP_REALLOC(lsp,ptr,size) \
2007-02-01 08:52:10 +00:00
(lsp)->prmfns.realloc (ptr, size, (lsp)->prmfns.custom_data)
2006-10-24 15:10:25 +00:00
#define ASE_LSP_FREE(lsp,ptr) \
2007-02-01 08:52:10 +00:00
(lsp)->prmfns.free (ptr, (lsp)->prmfns.custom_data)
2006-10-24 15:10:25 +00:00
#endif
2007-02-01 08:52:10 +00:00
#define ASE_LSP_ISUPPER(lsp,c) (lsp)->prmfns.is_upper(c)
#define ASE_LSP_ISLOWER(lsp,c) (lsp)->prmfns.is_lower(c)
#define ASE_LSP_ISALPHA(lsp,c) (lsp)->prmfns.is_alpha(c)
#define ASE_LSP_ISDIGIT(lsp,c) (lsp)->prmfns.is_digit(c)
#define ASE_LSP_ISXDIGIT(lsp,c) (lsp)->prmfns.is_xdigit(c)
#define ASE_LSP_ISALNUM(lsp,c) (lsp)->prmfns.is_alnum(c)
#define ASE_LSP_ISSPACE(lsp,c) (lsp)->prmfns.is_space(c)
#define ASE_LSP_ISPRINT(lsp,c) (lsp)->prmfns.is_print(c)
#define ASE_LSP_ISGRAPH(lsp,c) (lsp)->prmfns.is_graph(c)
#define ASE_LSP_ISCNTRL(lsp,c) (lsp)->prmfns.is_cntrl(c)
#define ASE_LSP_ISPUNCT(lsp,c) (lsp)->prmfns.is_punct(c)
#define ASE_LSP_TOUPPER(lsp,c) (lsp)->prmfns.to_upper(c)
#define ASE_LSP_TOLOWER(lsp,c) (lsp)->prmfns.to_lower(c)
2006-10-24 15:10:25 +00:00
2007-02-01 08:52:10 +00:00
#define ASE_LSP_MEMCPY(lsp,dst,src,len) (lsp)->prmfns.memcpy (dst, src, len)
#define ASE_LSP_MEMSET(lsp,dst,val,len) (lsp)->prmfns.memset (dst, val, len)
2006-10-24 15:10:25 +00:00
struct ase_lsp_t
{
2007-02-01 08:52:10 +00:00
ase_lsp_prmfns_t prmfns;
2006-10-24 15:10:25 +00:00
/* error number */
int errnum;
int opt_undef_symbol;
/* for read */
ase_cint_t curc;
2006-10-26 08:17:38 +00:00
struct
{
int type;
2006-10-29 13:00:39 +00:00
ase_long_t ival;
ase_real_t rval;
2006-10-26 08:17:38 +00:00
ase_lsp_name_t name;
} token;
2006-10-24 15:10:25 +00:00
/* io functions */
ase_lsp_io_t input_func;
ase_lsp_io_t output_func;
void* input_arg;
void* output_arg;
/* security options */
ase_size_t max_eval_depth;
ase_size_t cur_eval_depth;
/* memory manager */
ase_lsp_mem_t* mem;
};
#endif