Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:30:04

0001 #ifndef JQ_H
0002 #define JQ_H
0003 
0004 #include <stdio.h>
0005 #include "jv.h"
0006 
0007 enum {
0008   JQ_DEBUG_TRACE = 1,
0009   JQ_DEBUG_TRACE_DETAIL = 2,
0010   JQ_DEBUG_TRACE_ALL = JQ_DEBUG_TRACE | JQ_DEBUG_TRACE_DETAIL,
0011 };
0012 
0013 typedef struct jq_state jq_state;
0014 typedef void (*jq_msg_cb)(void *, jv);
0015 
0016 jq_state *jq_init(void);
0017 void jq_set_error_cb(jq_state *, jq_msg_cb, void *);
0018 void jq_get_error_cb(jq_state *, jq_msg_cb *, void **);
0019 void jq_set_nomem_handler(jq_state *, void (*)(void *), void *);
0020 jv jq_format_error(jv msg);
0021 void jq_report_error(jq_state *, jv);
0022 int jq_compile(jq_state *, const char*);
0023 int jq_compile_args(jq_state *, const char*, jv);
0024 void jq_dump_disassembly(jq_state *, int);
0025 void jq_start(jq_state *, jv value, int);
0026 jv jq_next(jq_state *);
0027 void jq_teardown(jq_state **);
0028 
0029 void jq_halt(jq_state *, jv, jv);
0030 int jq_halted(jq_state *);
0031 jv jq_get_exit_code(jq_state *);
0032 jv jq_get_error_message(jq_state *);
0033 
0034 typedef jv (*jq_input_cb)(jq_state *, void *);
0035 void jq_set_input_cb(jq_state *, jq_input_cb, void *);
0036 void jq_get_input_cb(jq_state *, jq_input_cb *, void **);
0037 
0038 void jq_set_debug_cb(jq_state *, jq_msg_cb, void *);
0039 void jq_get_debug_cb(jq_state *, jq_msg_cb *, void **);
0040 
0041 void jq_set_attrs(jq_state *, jv);
0042 jv jq_get_attrs(jq_state *);
0043 jv jq_get_jq_origin(jq_state *);
0044 jv jq_get_prog_origin(jq_state *);
0045 jv jq_get_lib_dirs(jq_state *);
0046 void jq_set_attr(jq_state *, jv, jv);
0047 jv jq_get_attr(jq_state *, jv);
0048 
0049 /*
0050  * We use char * instead of jf for filenames here because filenames
0051  * should be in the process' locale's codeset, which may not be UTF-8,
0052  * whereas jv string values must be in UTF-8.  This way the caller
0053  * doesn't have to perform any codeset conversions.
0054  */
0055 typedef struct jq_util_input_state jq_util_input_state;
0056 typedef void (*jq_util_msg_cb)(void *, const char *);
0057 
0058 jq_util_input_state *jq_util_input_init(jq_util_msg_cb, void *);
0059 void jq_util_input_set_parser(jq_util_input_state *, jv_parser *, int);
0060 void jq_util_input_free(jq_util_input_state **);
0061 void jq_util_input_add_input(jq_util_input_state *, const char *);
0062 int jq_util_input_errors(jq_util_input_state *);
0063 jv jq_util_input_next_input(jq_util_input_state *);
0064 jv jq_util_input_next_input_cb(jq_state *, void *);
0065 jv jq_util_input_get_position(jq_state*);
0066 jv jq_util_input_get_current_filename(jq_state*);
0067 jv jq_util_input_get_current_line(jq_state*);
0068 
0069 int jq_set_colors(const char *);
0070 
0071 #endif /* !JQ_H */