diff options
Diffstat (limited to 'include/sg_pr2serr.h')
-rw-r--r-- | include/sg_pr2serr.h | 99 |
1 files changed, 50 insertions, 49 deletions
diff --git a/include/sg_pr2serr.h b/include/sg_pr2serr.h index 54b8150c..556ff596 100644 --- a/include/sg_pr2serr.h +++ b/include/sg_pr2serr.h @@ -227,55 +227,6 @@ sgj_opaque_p sgj_js_nv_b(sgj_state * jsp, sgj_opaque_p jop, sgj_opaque_p sgj_js_nv_o(sgj_state * jsp, sgj_opaque_p jop, const char * name, sgj_opaque_p ua_jop); -/* The '_haj_' refers to generating output both for human readable and/or - * JSON with a single invocation. If jsp is non-NULL and jsp->pr_out_hr is - * true then both JSON and human readable output is formed (and the latter is - * placed in the jsp->out_hrp JSON array). The human readable form will have - * leadin_sp spaces followed by 'name' then a separator, then 'value' with a - * trailing LF. If 'name' is NULL then it and the separator are ignored. If - * there is JSON output, then leadin_sp and sep are ignored. If 'jop' is NULL - * then basep->basep is used. If 'name' is NULL then a JSON string object, - * made from 'value' is added to the JSON array pointed to by 'jop'. - * Otherwise a 'name'-d JSON object whose value is a JSON string object made - * from 'value' is added at 'jop'. */ -void sgj_haj_vs(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, - const char * name, enum sgj_separator_t sep, - const char * value); - -/* Similar to sgj_haj_vs()'s description with 'JSON string object' - * replaced by 'JSON integer object'. */ -void sgj_haj_vi(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, - const char * name, enum sgj_separator_t sep, - int64_t value, bool hex_as_well); -void sgj_haj_vistr(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, - const char * name, enum sgj_separator_t sep, - int64_t value, bool hex_as_well, const char * val_s); - -/* The '_nex' refers to a "name_extra" (information) sub-object (a JSON - * string) which explains a bit more about the 'name' entry. This is useful - * when T10 specifies the name as an abbreviation (e.g. SYSV). Whether this - * sub-object is shown in the JSON output is controlled by the 'n' control - * character. */ -void sgj_haj_vi_nex(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, - const char * name, enum sgj_separator_t sep, - int64_t value, bool hex_as_well, const char * nex_s); -void sgj_haj_vistr_nex(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, - const char * name, enum sgj_separator_t sep, - int64_t value, bool hex_as_well, - const char * val_s, const char * nex_s); - -/* Similar to above '_haj_' calls but a named sub-object is always formed - * containing a JSON integer object named "i" whose value is 'value'. The - * returned pointer is to that sub-object. */ -sgj_opaque_p sgj_haj_subo_r(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, - const char * name, enum sgj_separator_t sep, - int64_t value, bool hex_as_well); - -/* Similar to sgj_haj_vs()'s description with 'JSON string object' replaced - * by 'JSON boolean object'. */ -void sgj_haj_vb(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, - const char * name, enum sgj_separator_t sep, bool value); - /* This function only produces JSON output if jsp is non-NULL and * jsp->pr_as_json is true. It adds a named object at 'jop' (or jop->basep * if jop is NULL) along with a value. If jsp->pr_hex is true then that @@ -298,6 +249,7 @@ void sgj_js_nv_istr(sgj_state * jsp, sgj_opaque_p jop, const char * name, int64_t val_i, const char * str_name, const char * val_s); +/* Similar to sgj_js_nv_istr(). The hex output is conditional jsp->pr_hex . */ void sgj_js_nv_ihexstr(sgj_state * jsp, sgj_opaque_p jop, const char * name, int64_t val_i, const char * str_name, const char * val_s); @@ -327,6 +279,55 @@ void sgj_js_nv_ihexstr_nex(sgj_state * jsp, sgj_opaque_p jop, void sgj_js_nv_hex_bytes(sgj_state * jsp, sgj_opaque_p jop, const char * name, const uint8_t * byte_arr, int num_bytes); +/* The '_haj_' refers to generating output both for human readable and/or + * JSON with a single invocation. If jsp is non-NULL and jsp->pr_out_hr is + * true then both JSON and human readable output is formed (and the latter is + * placed in the jsp->out_hrp JSON array). The human readable form will have + * leadin_sp spaces followed by 'name' then a separator, then 'value' with a + * trailing LF. If 'name' is NULL then it and the separator are ignored. If + * there is JSON output, then leadin_sp and sep are ignored. If 'jop' is NULL + * then basep->basep is used. If 'name' is NULL then a JSON string object, + * made from 'value' is added to the JSON array pointed to by 'jop'. + * Otherwise a 'name'-d JSON object whose value is a JSON string object made + * from 'value' is added at 'jop'. */ +void sgj_haj_vs(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, + const char * name, enum sgj_separator_t sep, + const char * value); + +/* Similar to sgj_haj_vs()'s description with 'JSON string object' + * replaced by 'JSON integer object'. */ +void sgj_haj_vi(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, + const char * name, enum sgj_separator_t sep, + int64_t value, bool hex_as_well); +void sgj_haj_vistr(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, + const char * name, enum sgj_separator_t sep, + int64_t value, bool hex_as_well, const char * val_s); + +/* The '_nex' refers to a "name_extra" (information) sub-object (a JSON + * string) which explains a bit more about the 'name' entry. This is useful + * when T10 specifies the name as an abbreviation (e.g. SYSV). Whether this + * sub-object is shown in the JSON output is controlled by the 'n' control + * character. */ +void sgj_haj_vi_nex(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, + const char * name, enum sgj_separator_t sep, + int64_t value, bool hex_as_well, const char * nex_s); +void sgj_haj_vistr_nex(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, + const char * name, enum sgj_separator_t sep, + int64_t value, bool hex_as_well, + const char * val_s, const char * nex_s); + +/* Similar to above '_haj_' calls but a named sub-object is always formed + * containing a JSON integer object named "i" whose value is 'value'. The + * returned pointer is to that sub-object. */ +sgj_opaque_p sgj_haj_subo_r(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, + const char * name, enum sgj_separator_t sep, + int64_t value, bool hex_as_well); + +/* Similar to sgj_haj_vs()'s description with 'JSON string object' replaced + * by 'JSON boolean object'. */ +void sgj_haj_vb(sgj_state * jsp, sgj_opaque_p jop, int leadin_sp, + const char * name, enum sgj_separator_t sep, bool value); + /* Breaks up the string pointed to by 'sp' into lines and adds them to the * jsp->out_hrp array. Treat '\n' in sp as line breaks. Consumes characters * from sp until either a '\0' is found or slen is exhausted. Add each line |