This commit is contained in:
@ -31,7 +31,7 @@
|
||||
* This file defines functions and data types that help you create
|
||||
* an hawk interpreter with less effort. It is designed to be as close
|
||||
* to conventional hawk implementations as possible.
|
||||
*
|
||||
*
|
||||
* The source script handler does not evaluate a file name of the "var=val"
|
||||
* form as an assignment expression. Instead, it just treats it as a
|
||||
* normal file name.
|
||||
@ -49,7 +49,7 @@ enum hawk_parsestd_type_t
|
||||
HAWK_PARSESTD_OOCS = 4, /**< length-bounded string */
|
||||
HAWK_PARSESTD_BCS = 5,
|
||||
HAWK_PARSESTD_UCS = 6
|
||||
|
||||
|
||||
};
|
||||
typedef enum hawk_parsestd_type_t hawk_parsestd_type_t;
|
||||
|
||||
@ -65,37 +65,37 @@ struct hawk_parsestd_t
|
||||
struct
|
||||
{
|
||||
/** file path to open. #HAWK_NULL or '-' for stdin/stdout. */
|
||||
const hawk_ooch_t* path;
|
||||
const hawk_ooch_t* path;
|
||||
|
||||
/** a stream created with the file path is set with this
|
||||
* cmgr if it is not #HAWK_NULL. */
|
||||
hawk_cmgr_t* cmgr;
|
||||
hawk_cmgr_t* cmgr;
|
||||
} file;
|
||||
|
||||
struct
|
||||
{
|
||||
/** file path to open. #HAWK_NULL or '-' for stdin/stdout. */
|
||||
const hawk_bch_t* path;
|
||||
const hawk_bch_t* path;
|
||||
|
||||
/** a stream created with the file path is set with this
|
||||
* cmgr if it is not #HAWK_NULL. */
|
||||
hawk_cmgr_t* cmgr;
|
||||
hawk_cmgr_t* cmgr;
|
||||
} fileb;
|
||||
|
||||
struct
|
||||
{
|
||||
/** file path to open. #HAWK_NULL or '-' for stdin/stdout. */
|
||||
const hawk_uch_t* path;
|
||||
const hawk_uch_t* path;
|
||||
|
||||
/** a stream created with the file path is set with this
|
||||
* cmgr if it is not #HAWK_NULL. */
|
||||
hawk_cmgr_t* cmgr;
|
||||
hawk_cmgr_t* cmgr;
|
||||
} fileu;
|
||||
|
||||
/**
|
||||
/**
|
||||
* input string or dynamically allocated output string
|
||||
*
|
||||
* For input, the ptr and the len field of str indicates the
|
||||
* For input, the ptr and the len field of str indicates the
|
||||
* pointer and the length of a string to read. You must set
|
||||
* these fields before calling hawk_parsestd().
|
||||
*
|
||||
@ -105,8 +105,8 @@ struct hawk_parsestd_t
|
||||
* fields before calling hawk_parsestd() because they are set
|
||||
* by hawk_parsestd() and valid while the relevant hawk object
|
||||
* is alive. You must free the memory chunk pointed to by the
|
||||
* ptr field with hawk_freemem() once you're done with it to
|
||||
* avoid memory leaks.
|
||||
* ptr field with hawk_freemem() once you're done with it to
|
||||
* avoid memory leaks.
|
||||
*/
|
||||
hawk_oocs_t oocs;
|
||||
hawk_bcs_t bcs;
|
||||
@ -121,7 +121,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The hawk_openstd() function creates an hawk object using the default
|
||||
* The hawk_openstd() function creates an hawk object using the default
|
||||
* memory manager and primitive functions. Besides, it adds a set of
|
||||
* standard intrinsic functions like atan, system, etc. Use this function
|
||||
* over hawk_open() if you don't need finer-grained customization.
|
||||
@ -132,8 +132,8 @@ HAWK_EXPORT hawk_t* hawk_openstd (
|
||||
);
|
||||
|
||||
/**
|
||||
* The hawk_openstdwithmmgr() function creates an hawk object with a
|
||||
* user-defined memory manager. It is equivalent to hawk_openstd(),
|
||||
* The hawk_openstdwithmmgr() function creates an hawk object with a
|
||||
* user-defined memory manager. It is equivalent to hawk_openstd(),
|
||||
* except that you can specify your own memory manager.
|
||||
*/
|
||||
HAWK_EXPORT hawk_t* hawk_openstdwithmmgr (
|
||||
@ -145,7 +145,7 @@ HAWK_EXPORT hawk_t* hawk_openstdwithmmgr (
|
||||
|
||||
/**
|
||||
* The hawk_parsestd() functions parses source script.
|
||||
* The code below shows how to parse a literal string 'BEGIN { print 10; }'
|
||||
* The code below shows how to parse a literal string 'BEGIN { print 10; }'
|
||||
* and deparses it out to a buffer 'buf'.
|
||||
* \code
|
||||
* int n;
|
||||
@ -158,7 +158,7 @@ HAWK_EXPORT hawk_t* hawk_openstdwithmmgr (
|
||||
* in[1].type = HAWK_PARSESTD_NULL;
|
||||
* out.type = HAWK_PARSESTD_OOCS;
|
||||
* n = hawk_parsestd(hawk, in, &out);
|
||||
* if (n >= 0)
|
||||
* if (n >= 0)
|
||||
* {
|
||||
* hawk_printf (HAWK_T("%s\n"), out.u.str.ptr);
|
||||
* HAWK_MMGR_FREE (out.u.str.ptr);
|
||||
@ -167,7 +167,7 @@ HAWK_EXPORT hawk_t* hawk_openstdwithmmgr (
|
||||
*/
|
||||
HAWK_EXPORT int hawk_parsestd (
|
||||
hawk_t* hawk,
|
||||
hawk_parsestd_t in[],
|
||||
hawk_parsestd_t in[],
|
||||
hawk_parsestd_t* out
|
||||
);
|
||||
|
||||
@ -204,12 +204,12 @@ HAWK_EXPORT hawk_rtx_t* hawk_rtx_openstdwithucstr (
|
||||
#if defined(HAWK_OOCH_IS_BCH)
|
||||
# define hawk_rtx_openstd hawk_rtx_openstdwithbcstr
|
||||
#else
|
||||
# define hawk_rtx_openstd hawk_rtx_openstdwithucstr
|
||||
# define hawk_rtx_openstd hawk_rtx_openstdwithucstr
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The hawk_rtx_getiocmgrstd() function gets the current character
|
||||
* manager associated with a particular I/O target indicated by the name
|
||||
* The hawk_rtx_getiocmgrstd() function gets the current character
|
||||
* manager associated with a particular I/O target indicated by the name
|
||||
* \a ioname if #HAWK_OOCH_IS_UCH is defined. It always returns #HAWK_NULL
|
||||
* if #HAWK_OOCH_IS_BCH is defined.
|
||||
*/
|
||||
@ -265,7 +265,7 @@ HAWK_EXPORT int hawk_stdplainfileexists (
|
||||
);
|
||||
|
||||
HAWK_EXPORT const hawk_ooch_t* hawk_stdgetfileindirs (
|
||||
hawk_t* hawk,
|
||||
hawk_t* hawk,
|
||||
const hawk_oocs_t* dirs,
|
||||
const hawk_ooch_t* file
|
||||
);
|
||||
|
Reference in New Issue
Block a user