Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-17 09:55:36

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