clean all qobject json code
This commit is contained in:
parent
16894fdb6c
commit
af165d254c
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_aarch64
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_aarch64
|
||||
#define __jit_debug_register_code __jit_debug_register_code_aarch64
|
||||
#define json_lexer json_lexer_aarch64
|
||||
#define json_lexer_destroy json_lexer_destroy_aarch64
|
||||
#define json_lexer_feed json_lexer_feed_aarch64
|
||||
#define json_lexer_feed_char json_lexer_feed_char_aarch64
|
||||
#define json_lexer_flush json_lexer_flush_aarch64
|
||||
#define json_lexer_init json_lexer_init_aarch64
|
||||
#define json_message_parser_destroy json_message_parser_destroy_aarch64
|
||||
#define json_message_parser_feed json_message_parser_feed_aarch64
|
||||
#define json_message_parser_flush json_message_parser_flush_aarch64
|
||||
#define json_message_parser_init json_message_parser_init_aarch64
|
||||
#define json_message_process_token json_message_process_token_aarch64
|
||||
#define json_parser_parse json_parser_parse_aarch64
|
||||
#define json_parser_parse_err json_parser_parse_err_aarch64
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_aarch64
|
||||
#define last_ram_offset last_ram_offset_aarch64
|
||||
#define ldl_be_p ldl_be_p_aarch64
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_aarch64
|
||||
#define module_call_init module_call_init_aarch64
|
||||
#define module_load module_load_aarch64
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_aarch64
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_aarch64
|
||||
#define mpidr_read mpidr_read_aarch64
|
||||
#define msr_mask msr_mask_aarch64
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_aarch64
|
||||
#define parse_error parse_error_aarch64
|
||||
#define parse_escape parse_escape_aarch64
|
||||
#define parse_json parse_json_aarch64
|
||||
#define parse_keyword parse_keyword_aarch64
|
||||
#define parse_literal parse_literal_aarch64
|
||||
#define parse_object parse_object_aarch64
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_aarch64
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_aarch64
|
||||
#define qobject_decref qobject_decref_aarch64
|
||||
#define qobject_from_json qobject_from_json_aarch64
|
||||
#define qobject_from_jsonf qobject_from_jsonf_aarch64
|
||||
#define qobject_from_jsonv qobject_from_jsonv_aarch64
|
||||
#define qobject_incref qobject_incref_aarch64
|
||||
#define qobject_to_json qobject_to_json_aarch64
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_aarch64
|
||||
#define qobject_to_qbool qobject_to_qbool_aarch64
|
||||
#define qobject_to_qdict qobject_to_qdict_aarch64
|
||||
#define qobject_to_qfloat qobject_to_qfloat_aarch64
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_aarch64
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_aarch64
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_aarch64
|
||||
#define to_json to_json_aarch64
|
||||
#define to_json_dict_iter to_json_dict_iter_aarch64
|
||||
#define to_json_list_iter to_json_list_iter_aarch64
|
||||
#define token_get_type token_get_type_aarch64
|
||||
#define token_get_value token_get_value_aarch64
|
||||
#define token_is_escape token_is_escape_aarch64
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_aarch64
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_aarch64
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_aarch64
|
||||
#define wchar_to_utf8 wchar_to_utf8_aarch64
|
||||
#define write_cpustate_to_list write_cpustate_to_list_aarch64
|
||||
#define write_list_to_cpustate write_list_to_cpustate_aarch64
|
||||
#define write_raw_cp_reg write_raw_cp_reg_aarch64
|
||||
|
25
qemu/arm.h
25
qemu/arm.h
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_arm
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_arm
|
||||
#define __jit_debug_register_code __jit_debug_register_code_arm
|
||||
#define json_lexer json_lexer_arm
|
||||
#define json_lexer_destroy json_lexer_destroy_arm
|
||||
#define json_lexer_feed json_lexer_feed_arm
|
||||
#define json_lexer_feed_char json_lexer_feed_char_arm
|
||||
#define json_lexer_flush json_lexer_flush_arm
|
||||
#define json_lexer_init json_lexer_init_arm
|
||||
#define json_message_parser_destroy json_message_parser_destroy_arm
|
||||
#define json_message_parser_feed json_message_parser_feed_arm
|
||||
#define json_message_parser_flush json_message_parser_flush_arm
|
||||
#define json_message_parser_init json_message_parser_init_arm
|
||||
#define json_message_process_token json_message_process_token_arm
|
||||
#define json_parser_parse json_parser_parse_arm
|
||||
#define json_parser_parse_err json_parser_parse_err_arm
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_arm
|
||||
#define last_ram_offset last_ram_offset_arm
|
||||
#define ldl_be_p ldl_be_p_arm
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_arm
|
||||
#define module_call_init module_call_init_arm
|
||||
#define module_load module_load_arm
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_arm
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_arm
|
||||
#define mpidr_read mpidr_read_arm
|
||||
#define msr_mask msr_mask_arm
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_arm
|
||||
#define parse_error parse_error_arm
|
||||
#define parse_escape parse_escape_arm
|
||||
#define parse_json parse_json_arm
|
||||
#define parse_keyword parse_keyword_arm
|
||||
#define parse_literal parse_literal_arm
|
||||
#define parse_object parse_object_arm
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_arm
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_arm
|
||||
#define qobject_decref qobject_decref_arm
|
||||
#define qobject_from_json qobject_from_json_arm
|
||||
#define qobject_from_jsonf qobject_from_jsonf_arm
|
||||
#define qobject_from_jsonv qobject_from_jsonv_arm
|
||||
#define qobject_incref qobject_incref_arm
|
||||
#define qobject_to_json qobject_to_json_arm
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_arm
|
||||
#define qobject_to_qbool qobject_to_qbool_arm
|
||||
#define qobject_to_qdict qobject_to_qdict_arm
|
||||
#define qobject_to_qfloat qobject_to_qfloat_arm
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_arm
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_arm
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_arm
|
||||
#define to_json to_json_arm
|
||||
#define to_json_dict_iter to_json_dict_iter_arm
|
||||
#define to_json_list_iter to_json_list_iter_arm
|
||||
#define token_get_type token_get_type_arm
|
||||
#define token_get_value token_get_value_arm
|
||||
#define token_is_escape token_is_escape_arm
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_arm
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_arm
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_arm
|
||||
#define wchar_to_utf8 wchar_to_utf8_arm
|
||||
#define write_cpustate_to_list write_cpustate_to_list_arm
|
||||
#define write_list_to_cpustate write_list_to_cpustate_arm
|
||||
#define write_raw_cp_reg write_raw_cp_reg_arm
|
||||
|
@ -1966,19 +1966,6 @@ symbols = (
|
||||
'iwmmxt_store_reg',
|
||||
'__jit_debug_descriptor',
|
||||
'__jit_debug_register_code',
|
||||
'json_lexer',
|
||||
'json_lexer_destroy',
|
||||
'json_lexer_feed',
|
||||
'json_lexer_feed_char',
|
||||
'json_lexer_flush',
|
||||
'json_lexer_init',
|
||||
'json_message_parser_destroy',
|
||||
'json_message_parser_feed',
|
||||
'json_message_parser_flush',
|
||||
'json_message_parser_init',
|
||||
'json_message_process_token',
|
||||
'json_parser_parse',
|
||||
'json_parser_parse_err',
|
||||
'kvm_to_cpreg_id',
|
||||
'last_ram_offset',
|
||||
'ldl_be_p',
|
||||
@ -2121,7 +2108,6 @@ symbols = (
|
||||
'mktimegm',
|
||||
'module_call_init',
|
||||
'module_load',
|
||||
'mod_utf8_codepoint',
|
||||
'mpidr_cp_reginfo',
|
||||
'mpidr_read',
|
||||
'msr_mask',
|
||||
@ -2235,7 +2221,6 @@ symbols = (
|
||||
'parse_array',
|
||||
'parse_error',
|
||||
'parse_escape',
|
||||
'parse_json',
|
||||
'parse_keyword',
|
||||
'parse_literal',
|
||||
'parse_object',
|
||||
@ -2544,12 +2529,6 @@ symbols = (
|
||||
'qmp_output_visitor_cleanup',
|
||||
'qmp_output_visitor_new',
|
||||
'qobject_decref',
|
||||
'qobject_from_json',
|
||||
'qobject_from_jsonf',
|
||||
'qobject_from_jsonv',
|
||||
'qobject_incref',
|
||||
'qobject_to_json',
|
||||
'qobject_to_json_pretty',
|
||||
'qobject_to_qbool',
|
||||
'qobject_to_qdict',
|
||||
'qobject_to_qfloat',
|
||||
@ -3027,9 +3006,6 @@ symbols = (
|
||||
'tlb_set_dirty1',
|
||||
'tlb_unprotect_code_phys',
|
||||
'tlb_vaddr_to_host',
|
||||
'to_json',
|
||||
'to_json_dict_iter',
|
||||
'to_json_list_iter',
|
||||
'token_get_type',
|
||||
'token_get_value',
|
||||
'token_is_escape',
|
||||
@ -3110,7 +3086,6 @@ symbols = (
|
||||
'vmsa_ttbcr_reset',
|
||||
'vmsa_ttbcr_write',
|
||||
'vmsa_ttbr_write',
|
||||
'wchar_to_utf8',
|
||||
'write_cpustate_to_list',
|
||||
'write_list_to_cpustate',
|
||||
'write_raw_cp_reg',
|
||||
|
25
qemu/m68k.h
25
qemu/m68k.h
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_m68k
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_m68k
|
||||
#define __jit_debug_register_code __jit_debug_register_code_m68k
|
||||
#define json_lexer json_lexer_m68k
|
||||
#define json_lexer_destroy json_lexer_destroy_m68k
|
||||
#define json_lexer_feed json_lexer_feed_m68k
|
||||
#define json_lexer_feed_char json_lexer_feed_char_m68k
|
||||
#define json_lexer_flush json_lexer_flush_m68k
|
||||
#define json_lexer_init json_lexer_init_m68k
|
||||
#define json_message_parser_destroy json_message_parser_destroy_m68k
|
||||
#define json_message_parser_feed json_message_parser_feed_m68k
|
||||
#define json_message_parser_flush json_message_parser_flush_m68k
|
||||
#define json_message_parser_init json_message_parser_init_m68k
|
||||
#define json_message_process_token json_message_process_token_m68k
|
||||
#define json_parser_parse json_parser_parse_m68k
|
||||
#define json_parser_parse_err json_parser_parse_err_m68k
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_m68k
|
||||
#define last_ram_offset last_ram_offset_m68k
|
||||
#define ldl_be_p ldl_be_p_m68k
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_m68k
|
||||
#define module_call_init module_call_init_m68k
|
||||
#define module_load module_load_m68k
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_m68k
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_m68k
|
||||
#define mpidr_read mpidr_read_m68k
|
||||
#define msr_mask msr_mask_m68k
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_m68k
|
||||
#define parse_error parse_error_m68k
|
||||
#define parse_escape parse_escape_m68k
|
||||
#define parse_json parse_json_m68k
|
||||
#define parse_keyword parse_keyword_m68k
|
||||
#define parse_literal parse_literal_m68k
|
||||
#define parse_object parse_object_m68k
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_m68k
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_m68k
|
||||
#define qobject_decref qobject_decref_m68k
|
||||
#define qobject_from_json qobject_from_json_m68k
|
||||
#define qobject_from_jsonf qobject_from_jsonf_m68k
|
||||
#define qobject_from_jsonv qobject_from_jsonv_m68k
|
||||
#define qobject_incref qobject_incref_m68k
|
||||
#define qobject_to_json qobject_to_json_m68k
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_m68k
|
||||
#define qobject_to_qbool qobject_to_qbool_m68k
|
||||
#define qobject_to_qdict qobject_to_qdict_m68k
|
||||
#define qobject_to_qfloat qobject_to_qfloat_m68k
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_m68k
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_m68k
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_m68k
|
||||
#define to_json to_json_m68k
|
||||
#define to_json_dict_iter to_json_dict_iter_m68k
|
||||
#define to_json_list_iter to_json_list_iter_m68k
|
||||
#define token_get_type token_get_type_m68k
|
||||
#define token_get_value token_get_value_m68k
|
||||
#define token_is_escape token_is_escape_m68k
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_m68k
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_m68k
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_m68k
|
||||
#define wchar_to_utf8 wchar_to_utf8_m68k
|
||||
#define write_cpustate_to_list write_cpustate_to_list_m68k
|
||||
#define write_list_to_cpustate write_list_to_cpustate_m68k
|
||||
#define write_raw_cp_reg write_raw_cp_reg_m68k
|
||||
|
25
qemu/mips.h
25
qemu/mips.h
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_mips
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_mips
|
||||
#define __jit_debug_register_code __jit_debug_register_code_mips
|
||||
#define json_lexer json_lexer_mips
|
||||
#define json_lexer_destroy json_lexer_destroy_mips
|
||||
#define json_lexer_feed json_lexer_feed_mips
|
||||
#define json_lexer_feed_char json_lexer_feed_char_mips
|
||||
#define json_lexer_flush json_lexer_flush_mips
|
||||
#define json_lexer_init json_lexer_init_mips
|
||||
#define json_message_parser_destroy json_message_parser_destroy_mips
|
||||
#define json_message_parser_feed json_message_parser_feed_mips
|
||||
#define json_message_parser_flush json_message_parser_flush_mips
|
||||
#define json_message_parser_init json_message_parser_init_mips
|
||||
#define json_message_process_token json_message_process_token_mips
|
||||
#define json_parser_parse json_parser_parse_mips
|
||||
#define json_parser_parse_err json_parser_parse_err_mips
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_mips
|
||||
#define last_ram_offset last_ram_offset_mips
|
||||
#define ldl_be_p ldl_be_p_mips
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_mips
|
||||
#define module_call_init module_call_init_mips
|
||||
#define module_load module_load_mips
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_mips
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_mips
|
||||
#define mpidr_read mpidr_read_mips
|
||||
#define msr_mask msr_mask_mips
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_mips
|
||||
#define parse_error parse_error_mips
|
||||
#define parse_escape parse_escape_mips
|
||||
#define parse_json parse_json_mips
|
||||
#define parse_keyword parse_keyword_mips
|
||||
#define parse_literal parse_literal_mips
|
||||
#define parse_object parse_object_mips
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_mips
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_mips
|
||||
#define qobject_decref qobject_decref_mips
|
||||
#define qobject_from_json qobject_from_json_mips
|
||||
#define qobject_from_jsonf qobject_from_jsonf_mips
|
||||
#define qobject_from_jsonv qobject_from_jsonv_mips
|
||||
#define qobject_incref qobject_incref_mips
|
||||
#define qobject_to_json qobject_to_json_mips
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_mips
|
||||
#define qobject_to_qbool qobject_to_qbool_mips
|
||||
#define qobject_to_qdict qobject_to_qdict_mips
|
||||
#define qobject_to_qfloat qobject_to_qfloat_mips
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_mips
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_mips
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_mips
|
||||
#define to_json to_json_mips
|
||||
#define to_json_dict_iter to_json_dict_iter_mips
|
||||
#define to_json_list_iter to_json_list_iter_mips
|
||||
#define token_get_type token_get_type_mips
|
||||
#define token_get_value token_get_value_mips
|
||||
#define token_is_escape token_is_escape_mips
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_mips
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_mips
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_mips
|
||||
#define wchar_to_utf8 wchar_to_utf8_mips
|
||||
#define write_cpustate_to_list write_cpustate_to_list_mips
|
||||
#define write_list_to_cpustate write_list_to_cpustate_mips
|
||||
#define write_raw_cp_reg write_raw_cp_reg_mips
|
||||
|
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_mips64
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_mips64
|
||||
#define __jit_debug_register_code __jit_debug_register_code_mips64
|
||||
#define json_lexer json_lexer_mips64
|
||||
#define json_lexer_destroy json_lexer_destroy_mips64
|
||||
#define json_lexer_feed json_lexer_feed_mips64
|
||||
#define json_lexer_feed_char json_lexer_feed_char_mips64
|
||||
#define json_lexer_flush json_lexer_flush_mips64
|
||||
#define json_lexer_init json_lexer_init_mips64
|
||||
#define json_message_parser_destroy json_message_parser_destroy_mips64
|
||||
#define json_message_parser_feed json_message_parser_feed_mips64
|
||||
#define json_message_parser_flush json_message_parser_flush_mips64
|
||||
#define json_message_parser_init json_message_parser_init_mips64
|
||||
#define json_message_process_token json_message_process_token_mips64
|
||||
#define json_parser_parse json_parser_parse_mips64
|
||||
#define json_parser_parse_err json_parser_parse_err_mips64
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_mips64
|
||||
#define last_ram_offset last_ram_offset_mips64
|
||||
#define ldl_be_p ldl_be_p_mips64
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_mips64
|
||||
#define module_call_init module_call_init_mips64
|
||||
#define module_load module_load_mips64
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_mips64
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_mips64
|
||||
#define mpidr_read mpidr_read_mips64
|
||||
#define msr_mask msr_mask_mips64
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_mips64
|
||||
#define parse_error parse_error_mips64
|
||||
#define parse_escape parse_escape_mips64
|
||||
#define parse_json parse_json_mips64
|
||||
#define parse_keyword parse_keyword_mips64
|
||||
#define parse_literal parse_literal_mips64
|
||||
#define parse_object parse_object_mips64
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_mips64
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_mips64
|
||||
#define qobject_decref qobject_decref_mips64
|
||||
#define qobject_from_json qobject_from_json_mips64
|
||||
#define qobject_from_jsonf qobject_from_jsonf_mips64
|
||||
#define qobject_from_jsonv qobject_from_jsonv_mips64
|
||||
#define qobject_incref qobject_incref_mips64
|
||||
#define qobject_to_json qobject_to_json_mips64
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_mips64
|
||||
#define qobject_to_qbool qobject_to_qbool_mips64
|
||||
#define qobject_to_qdict qobject_to_qdict_mips64
|
||||
#define qobject_to_qfloat qobject_to_qfloat_mips64
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_mips64
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_mips64
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_mips64
|
||||
#define to_json to_json_mips64
|
||||
#define to_json_dict_iter to_json_dict_iter_mips64
|
||||
#define to_json_list_iter to_json_list_iter_mips64
|
||||
#define token_get_type token_get_type_mips64
|
||||
#define token_get_value token_get_value_mips64
|
||||
#define token_is_escape token_is_escape_mips64
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_mips64
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_mips64
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_mips64
|
||||
#define wchar_to_utf8 wchar_to_utf8_mips64
|
||||
#define write_cpustate_to_list write_cpustate_to_list_mips64
|
||||
#define write_list_to_cpustate write_list_to_cpustate_mips64
|
||||
#define write_raw_cp_reg write_raw_cp_reg_mips64
|
||||
|
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_mips64el
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_mips64el
|
||||
#define __jit_debug_register_code __jit_debug_register_code_mips64el
|
||||
#define json_lexer json_lexer_mips64el
|
||||
#define json_lexer_destroy json_lexer_destroy_mips64el
|
||||
#define json_lexer_feed json_lexer_feed_mips64el
|
||||
#define json_lexer_feed_char json_lexer_feed_char_mips64el
|
||||
#define json_lexer_flush json_lexer_flush_mips64el
|
||||
#define json_lexer_init json_lexer_init_mips64el
|
||||
#define json_message_parser_destroy json_message_parser_destroy_mips64el
|
||||
#define json_message_parser_feed json_message_parser_feed_mips64el
|
||||
#define json_message_parser_flush json_message_parser_flush_mips64el
|
||||
#define json_message_parser_init json_message_parser_init_mips64el
|
||||
#define json_message_process_token json_message_process_token_mips64el
|
||||
#define json_parser_parse json_parser_parse_mips64el
|
||||
#define json_parser_parse_err json_parser_parse_err_mips64el
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_mips64el
|
||||
#define last_ram_offset last_ram_offset_mips64el
|
||||
#define ldl_be_p ldl_be_p_mips64el
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_mips64el
|
||||
#define module_call_init module_call_init_mips64el
|
||||
#define module_load module_load_mips64el
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_mips64el
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_mips64el
|
||||
#define mpidr_read mpidr_read_mips64el
|
||||
#define msr_mask msr_mask_mips64el
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_mips64el
|
||||
#define parse_error parse_error_mips64el
|
||||
#define parse_escape parse_escape_mips64el
|
||||
#define parse_json parse_json_mips64el
|
||||
#define parse_keyword parse_keyword_mips64el
|
||||
#define parse_literal parse_literal_mips64el
|
||||
#define parse_object parse_object_mips64el
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_mips64el
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_mips64el
|
||||
#define qobject_decref qobject_decref_mips64el
|
||||
#define qobject_from_json qobject_from_json_mips64el
|
||||
#define qobject_from_jsonf qobject_from_jsonf_mips64el
|
||||
#define qobject_from_jsonv qobject_from_jsonv_mips64el
|
||||
#define qobject_incref qobject_incref_mips64el
|
||||
#define qobject_to_json qobject_to_json_mips64el
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_mips64el
|
||||
#define qobject_to_qbool qobject_to_qbool_mips64el
|
||||
#define qobject_to_qdict qobject_to_qdict_mips64el
|
||||
#define qobject_to_qfloat qobject_to_qfloat_mips64el
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_mips64el
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_mips64el
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_mips64el
|
||||
#define to_json to_json_mips64el
|
||||
#define to_json_dict_iter to_json_dict_iter_mips64el
|
||||
#define to_json_list_iter to_json_list_iter_mips64el
|
||||
#define token_get_type token_get_type_mips64el
|
||||
#define token_get_value token_get_value_mips64el
|
||||
#define token_is_escape token_is_escape_mips64el
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_mips64el
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_mips64el
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_mips64el
|
||||
#define wchar_to_utf8 wchar_to_utf8_mips64el
|
||||
#define write_cpustate_to_list write_cpustate_to_list_mips64el
|
||||
#define write_list_to_cpustate write_list_to_cpustate_mips64el
|
||||
#define write_raw_cp_reg write_raw_cp_reg_mips64el
|
||||
|
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_mipsel
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_mipsel
|
||||
#define __jit_debug_register_code __jit_debug_register_code_mipsel
|
||||
#define json_lexer json_lexer_mipsel
|
||||
#define json_lexer_destroy json_lexer_destroy_mipsel
|
||||
#define json_lexer_feed json_lexer_feed_mipsel
|
||||
#define json_lexer_feed_char json_lexer_feed_char_mipsel
|
||||
#define json_lexer_flush json_lexer_flush_mipsel
|
||||
#define json_lexer_init json_lexer_init_mipsel
|
||||
#define json_message_parser_destroy json_message_parser_destroy_mipsel
|
||||
#define json_message_parser_feed json_message_parser_feed_mipsel
|
||||
#define json_message_parser_flush json_message_parser_flush_mipsel
|
||||
#define json_message_parser_init json_message_parser_init_mipsel
|
||||
#define json_message_process_token json_message_process_token_mipsel
|
||||
#define json_parser_parse json_parser_parse_mipsel
|
||||
#define json_parser_parse_err json_parser_parse_err_mipsel
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_mipsel
|
||||
#define last_ram_offset last_ram_offset_mipsel
|
||||
#define ldl_be_p ldl_be_p_mipsel
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_mipsel
|
||||
#define module_call_init module_call_init_mipsel
|
||||
#define module_load module_load_mipsel
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_mipsel
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_mipsel
|
||||
#define mpidr_read mpidr_read_mipsel
|
||||
#define msr_mask msr_mask_mipsel
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_mipsel
|
||||
#define parse_error parse_error_mipsel
|
||||
#define parse_escape parse_escape_mipsel
|
||||
#define parse_json parse_json_mipsel
|
||||
#define parse_keyword parse_keyword_mipsel
|
||||
#define parse_literal parse_literal_mipsel
|
||||
#define parse_object parse_object_mipsel
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_mipsel
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_mipsel
|
||||
#define qobject_decref qobject_decref_mipsel
|
||||
#define qobject_from_json qobject_from_json_mipsel
|
||||
#define qobject_from_jsonf qobject_from_jsonf_mipsel
|
||||
#define qobject_from_jsonv qobject_from_jsonv_mipsel
|
||||
#define qobject_incref qobject_incref_mipsel
|
||||
#define qobject_to_json qobject_to_json_mipsel
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_mipsel
|
||||
#define qobject_to_qbool qobject_to_qbool_mipsel
|
||||
#define qobject_to_qdict qobject_to_qdict_mipsel
|
||||
#define qobject_to_qfloat qobject_to_qfloat_mipsel
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_mipsel
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_mipsel
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_mipsel
|
||||
#define to_json to_json_mipsel
|
||||
#define to_json_dict_iter to_json_dict_iter_mipsel
|
||||
#define to_json_list_iter to_json_list_iter_mipsel
|
||||
#define token_get_type token_get_type_mipsel
|
||||
#define token_get_value token_get_value_mipsel
|
||||
#define token_is_escape token_is_escape_mipsel
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_mipsel
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_mipsel
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_mipsel
|
||||
#define wchar_to_utf8 wchar_to_utf8_mipsel
|
||||
#define write_cpustate_to_list write_cpustate_to_list_mipsel
|
||||
#define write_list_to_cpustate write_list_to_cpustate_mipsel
|
||||
#define write_raw_cp_reg write_raw_cp_reg_mipsel
|
||||
|
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_powerpc
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_powerpc
|
||||
#define __jit_debug_register_code __jit_debug_register_code_powerpc
|
||||
#define json_lexer json_lexer_powerpc
|
||||
#define json_lexer_destroy json_lexer_destroy_powerpc
|
||||
#define json_lexer_feed json_lexer_feed_powerpc
|
||||
#define json_lexer_feed_char json_lexer_feed_char_powerpc
|
||||
#define json_lexer_flush json_lexer_flush_powerpc
|
||||
#define json_lexer_init json_lexer_init_powerpc
|
||||
#define json_message_parser_destroy json_message_parser_destroy_powerpc
|
||||
#define json_message_parser_feed json_message_parser_feed_powerpc
|
||||
#define json_message_parser_flush json_message_parser_flush_powerpc
|
||||
#define json_message_parser_init json_message_parser_init_powerpc
|
||||
#define json_message_process_token json_message_process_token_powerpc
|
||||
#define json_parser_parse json_parser_parse_powerpc
|
||||
#define json_parser_parse_err json_parser_parse_err_powerpc
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_powerpc
|
||||
#define last_ram_offset last_ram_offset_powerpc
|
||||
#define ldl_be_p ldl_be_p_powerpc
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_powerpc
|
||||
#define module_call_init module_call_init_powerpc
|
||||
#define module_load module_load_powerpc
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_powerpc
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_powerpc
|
||||
#define mpidr_read mpidr_read_powerpc
|
||||
#define msr_mask msr_mask_powerpc
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_powerpc
|
||||
#define parse_error parse_error_powerpc
|
||||
#define parse_escape parse_escape_powerpc
|
||||
#define parse_json parse_json_powerpc
|
||||
#define parse_keyword parse_keyword_powerpc
|
||||
#define parse_literal parse_literal_powerpc
|
||||
#define parse_object parse_object_powerpc
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_powerpc
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_powerpc
|
||||
#define qobject_decref qobject_decref_powerpc
|
||||
#define qobject_from_json qobject_from_json_powerpc
|
||||
#define qobject_from_jsonf qobject_from_jsonf_powerpc
|
||||
#define qobject_from_jsonv qobject_from_jsonv_powerpc
|
||||
#define qobject_incref qobject_incref_powerpc
|
||||
#define qobject_to_json qobject_to_json_powerpc
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_powerpc
|
||||
#define qobject_to_qbool qobject_to_qbool_powerpc
|
||||
#define qobject_to_qdict qobject_to_qdict_powerpc
|
||||
#define qobject_to_qfloat qobject_to_qfloat_powerpc
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_powerpc
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_powerpc
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_powerpc
|
||||
#define to_json to_json_powerpc
|
||||
#define to_json_dict_iter to_json_dict_iter_powerpc
|
||||
#define to_json_list_iter to_json_list_iter_powerpc
|
||||
#define token_get_type token_get_type_powerpc
|
||||
#define token_get_value token_get_value_powerpc
|
||||
#define token_is_escape token_is_escape_powerpc
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_powerpc
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_powerpc
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_powerpc
|
||||
#define wchar_to_utf8 wchar_to_utf8_powerpc
|
||||
#define write_cpustate_to_list write_cpustate_to_list_powerpc
|
||||
#define write_list_to_cpustate write_list_to_cpustate_powerpc
|
||||
#define write_raw_cp_reg write_raw_cp_reg_powerpc
|
||||
|
@ -1,3 +1,2 @@
|
||||
util-obj-y = qint.o qstring.o qdict.o qlist.o qfloat.o qbool.o
|
||||
util-obj-y += qjson.o json-lexer.o json-streamer.o json-parser.o
|
||||
util-obj-y += qerror.o
|
||||
|
@ -1,373 +0,0 @@
|
||||
/*
|
||||
* JSON lexer
|
||||
*
|
||||
* Copyright IBM, Corp. 2009
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/qmp/json-lexer.h"
|
||||
|
||||
#define MAX_TOKEN_SIZE (64ULL << 20)
|
||||
|
||||
/*
|
||||
* \"([^\\\"]|(\\\"\\'\\\\\\/\\b\\f\\n\\r\\t\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))*\"
|
||||
* '([^\\']|(\\\"\\'\\\\\\/\\b\\f\\n\\r\\t\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))*'
|
||||
* 0|([1-9][0-9]*(.[0-9]+)?([eE]([-+])?[0-9]+))
|
||||
* [{}\[\],:]
|
||||
* [a-z]+
|
||||
*
|
||||
*/
|
||||
|
||||
enum json_lexer_state {
|
||||
IN_ERROR = 0,
|
||||
IN_DQ_UCODE3,
|
||||
IN_DQ_UCODE2,
|
||||
IN_DQ_UCODE1,
|
||||
IN_DQ_UCODE0,
|
||||
IN_DQ_STRING_ESCAPE,
|
||||
IN_DQ_STRING,
|
||||
IN_SQ_UCODE3,
|
||||
IN_SQ_UCODE2,
|
||||
IN_SQ_UCODE1,
|
||||
IN_SQ_UCODE0,
|
||||
IN_SQ_STRING_ESCAPE,
|
||||
IN_SQ_STRING,
|
||||
IN_ZERO,
|
||||
IN_DIGITS,
|
||||
IN_DIGIT,
|
||||
IN_EXP_E,
|
||||
IN_MANTISSA,
|
||||
IN_MANTISSA_DIGITS,
|
||||
IN_NONZERO_NUMBER,
|
||||
IN_NEG_NONZERO_NUMBER,
|
||||
IN_KEYWORD,
|
||||
IN_ESCAPE,
|
||||
IN_ESCAPE_L,
|
||||
IN_ESCAPE_LL,
|
||||
IN_ESCAPE_I,
|
||||
IN_ESCAPE_I6,
|
||||
IN_ESCAPE_I64,
|
||||
IN_WHITESPACE,
|
||||
IN_START,
|
||||
};
|
||||
|
||||
#define TERMINAL(state) [0 ... 0x7F] = (state)
|
||||
|
||||
/* Return whether TERMINAL is a terminal state and the transition to it
|
||||
from OLD_STATE required lookahead. This happens whenever the table
|
||||
below uses the TERMINAL macro. */
|
||||
#define TERMINAL_NEEDED_LOOKAHEAD(old_state, terminal) \
|
||||
(json_lexer[(old_state)][0] == (terminal))
|
||||
|
||||
static const uint8_t json_lexer[][256] = {
|
||||
/* double quote string */
|
||||
[IN_DQ_UCODE3] = {
|
||||
['0' ... '9'] = IN_DQ_STRING,
|
||||
['a' ... 'f'] = IN_DQ_STRING,
|
||||
['A' ... 'F'] = IN_DQ_STRING,
|
||||
},
|
||||
[IN_DQ_UCODE2] = {
|
||||
['0' ... '9'] = IN_DQ_UCODE3,
|
||||
['a' ... 'f'] = IN_DQ_UCODE3,
|
||||
['A' ... 'F'] = IN_DQ_UCODE3,
|
||||
},
|
||||
[IN_DQ_UCODE1] = {
|
||||
['0' ... '9'] = IN_DQ_UCODE2,
|
||||
['a' ... 'f'] = IN_DQ_UCODE2,
|
||||
['A' ... 'F'] = IN_DQ_UCODE2,
|
||||
},
|
||||
[IN_DQ_UCODE0] = {
|
||||
['0' ... '9'] = IN_DQ_UCODE1,
|
||||
['a' ... 'f'] = IN_DQ_UCODE1,
|
||||
['A' ... 'F'] = IN_DQ_UCODE1,
|
||||
},
|
||||
[IN_DQ_STRING_ESCAPE] = {
|
||||
['b'] = IN_DQ_STRING,
|
||||
['f'] = IN_DQ_STRING,
|
||||
['n'] = IN_DQ_STRING,
|
||||
['r'] = IN_DQ_STRING,
|
||||
['t'] = IN_DQ_STRING,
|
||||
['/'] = IN_DQ_STRING,
|
||||
['\\'] = IN_DQ_STRING,
|
||||
['\''] = IN_DQ_STRING,
|
||||
['\"'] = IN_DQ_STRING,
|
||||
['u'] = IN_DQ_UCODE0,
|
||||
},
|
||||
[IN_DQ_STRING] = {
|
||||
[1 ... 0xBF] = IN_DQ_STRING,
|
||||
[0xC2 ... 0xF4] = IN_DQ_STRING,
|
||||
['\\'] = IN_DQ_STRING_ESCAPE,
|
||||
['"'] = JSON_STRING,
|
||||
},
|
||||
|
||||
/* single quote string */
|
||||
[IN_SQ_UCODE3] = {
|
||||
['0' ... '9'] = IN_SQ_STRING,
|
||||
['a' ... 'f'] = IN_SQ_STRING,
|
||||
['A' ... 'F'] = IN_SQ_STRING,
|
||||
},
|
||||
[IN_SQ_UCODE2] = {
|
||||
['0' ... '9'] = IN_SQ_UCODE3,
|
||||
['a' ... 'f'] = IN_SQ_UCODE3,
|
||||
['A' ... 'F'] = IN_SQ_UCODE3,
|
||||
},
|
||||
[IN_SQ_UCODE1] = {
|
||||
['0' ... '9'] = IN_SQ_UCODE2,
|
||||
['a' ... 'f'] = IN_SQ_UCODE2,
|
||||
['A' ... 'F'] = IN_SQ_UCODE2,
|
||||
},
|
||||
[IN_SQ_UCODE0] = {
|
||||
['0' ... '9'] = IN_SQ_UCODE1,
|
||||
['a' ... 'f'] = IN_SQ_UCODE1,
|
||||
['A' ... 'F'] = IN_SQ_UCODE1,
|
||||
},
|
||||
[IN_SQ_STRING_ESCAPE] = {
|
||||
['b'] = IN_SQ_STRING,
|
||||
['f'] = IN_SQ_STRING,
|
||||
['n'] = IN_SQ_STRING,
|
||||
['r'] = IN_SQ_STRING,
|
||||
['t'] = IN_SQ_STRING,
|
||||
['/'] = IN_SQ_STRING,
|
||||
['\\'] = IN_SQ_STRING,
|
||||
['\''] = IN_SQ_STRING,
|
||||
['\"'] = IN_SQ_STRING,
|
||||
['u'] = IN_SQ_UCODE0,
|
||||
},
|
||||
[IN_SQ_STRING] = {
|
||||
[1 ... 0xBF] = IN_SQ_STRING,
|
||||
[0xC2 ... 0xF4] = IN_SQ_STRING,
|
||||
['\\'] = IN_SQ_STRING_ESCAPE,
|
||||
['\''] = JSON_STRING,
|
||||
},
|
||||
|
||||
/* Zero */
|
||||
[IN_ZERO] = {
|
||||
TERMINAL(JSON_INTEGER),
|
||||
['0' ... '9'] = IN_ERROR,
|
||||
['.'] = IN_MANTISSA,
|
||||
},
|
||||
|
||||
/* Float */
|
||||
[IN_DIGITS] = {
|
||||
TERMINAL(JSON_FLOAT),
|
||||
['0' ... '9'] = IN_DIGITS,
|
||||
},
|
||||
|
||||
[IN_DIGIT] = {
|
||||
['0' ... '9'] = IN_DIGITS,
|
||||
},
|
||||
|
||||
[IN_EXP_E] = {
|
||||
['-'] = IN_DIGIT,
|
||||
['+'] = IN_DIGIT,
|
||||
['0' ... '9'] = IN_DIGITS,
|
||||
},
|
||||
|
||||
[IN_MANTISSA_DIGITS] = {
|
||||
TERMINAL(JSON_FLOAT),
|
||||
['0' ... '9'] = IN_MANTISSA_DIGITS,
|
||||
['e'] = IN_EXP_E,
|
||||
['E'] = IN_EXP_E,
|
||||
},
|
||||
|
||||
[IN_MANTISSA] = {
|
||||
['0' ... '9'] = IN_MANTISSA_DIGITS,
|
||||
},
|
||||
|
||||
/* Number */
|
||||
[IN_NONZERO_NUMBER] = {
|
||||
TERMINAL(JSON_INTEGER),
|
||||
['0' ... '9'] = IN_NONZERO_NUMBER,
|
||||
['e'] = IN_EXP_E,
|
||||
['E'] = IN_EXP_E,
|
||||
['.'] = IN_MANTISSA,
|
||||
},
|
||||
|
||||
[IN_NEG_NONZERO_NUMBER] = {
|
||||
['0'] = IN_ZERO,
|
||||
['1' ... '9'] = IN_NONZERO_NUMBER,
|
||||
},
|
||||
|
||||
/* keywords */
|
||||
[IN_KEYWORD] = {
|
||||
TERMINAL(JSON_KEYWORD),
|
||||
['a' ... 'z'] = IN_KEYWORD,
|
||||
},
|
||||
|
||||
/* whitespace */
|
||||
[IN_WHITESPACE] = {
|
||||
TERMINAL(JSON_SKIP),
|
||||
[' '] = IN_WHITESPACE,
|
||||
['\t'] = IN_WHITESPACE,
|
||||
['\r'] = IN_WHITESPACE,
|
||||
['\n'] = IN_WHITESPACE,
|
||||
},
|
||||
|
||||
/* escape */
|
||||
[IN_ESCAPE_LL] = {
|
||||
['d'] = JSON_ESCAPE,
|
||||
},
|
||||
|
||||
[IN_ESCAPE_L] = {
|
||||
['d'] = JSON_ESCAPE,
|
||||
['l'] = IN_ESCAPE_LL,
|
||||
},
|
||||
|
||||
[IN_ESCAPE_I64] = {
|
||||
['d'] = JSON_ESCAPE,
|
||||
},
|
||||
|
||||
[IN_ESCAPE_I6] = {
|
||||
['4'] = IN_ESCAPE_I64,
|
||||
},
|
||||
|
||||
[IN_ESCAPE_I] = {
|
||||
['6'] = IN_ESCAPE_I6,
|
||||
},
|
||||
|
||||
[IN_ESCAPE] = {
|
||||
['d'] = JSON_ESCAPE,
|
||||
['i'] = JSON_ESCAPE,
|
||||
['p'] = JSON_ESCAPE,
|
||||
['s'] = JSON_ESCAPE,
|
||||
['f'] = JSON_ESCAPE,
|
||||
['l'] = IN_ESCAPE_L,
|
||||
['I'] = IN_ESCAPE_I,
|
||||
},
|
||||
|
||||
/* top level rule */
|
||||
[IN_START] = {
|
||||
['"'] = IN_DQ_STRING,
|
||||
['\''] = IN_SQ_STRING,
|
||||
['0'] = IN_ZERO,
|
||||
['1' ... '9'] = IN_NONZERO_NUMBER,
|
||||
['-'] = IN_NEG_NONZERO_NUMBER,
|
||||
['{'] = JSON_OPERATOR,
|
||||
['}'] = JSON_OPERATOR,
|
||||
['['] = JSON_OPERATOR,
|
||||
[']'] = JSON_OPERATOR,
|
||||
[','] = JSON_OPERATOR,
|
||||
[':'] = JSON_OPERATOR,
|
||||
['a' ... 'z'] = IN_KEYWORD,
|
||||
['%'] = IN_ESCAPE,
|
||||
[' '] = IN_WHITESPACE,
|
||||
['\t'] = IN_WHITESPACE,
|
||||
['\r'] = IN_WHITESPACE,
|
||||
['\n'] = IN_WHITESPACE,
|
||||
},
|
||||
};
|
||||
|
||||
void json_lexer_init(JSONLexer *lexer, JSONLexerEmitter func)
|
||||
{
|
||||
lexer->emit = func;
|
||||
lexer->state = IN_START;
|
||||
lexer->token = qstring_new();
|
||||
lexer->x = lexer->y = 0;
|
||||
}
|
||||
|
||||
static int json_lexer_feed_char(JSONLexer *lexer, char ch, bool flush)
|
||||
{
|
||||
int char_consumed, new_state;
|
||||
|
||||
lexer->x++;
|
||||
if (ch == '\n') {
|
||||
lexer->x = 0;
|
||||
lexer->y++;
|
||||
}
|
||||
|
||||
do {
|
||||
new_state = json_lexer[lexer->state][(uint8_t)ch];
|
||||
char_consumed = !TERMINAL_NEEDED_LOOKAHEAD(lexer->state, new_state);
|
||||
if (char_consumed) {
|
||||
qstring_append_chr(lexer->token, ch);
|
||||
}
|
||||
|
||||
switch (new_state) {
|
||||
case JSON_OPERATOR:
|
||||
case JSON_ESCAPE:
|
||||
case JSON_INTEGER:
|
||||
case JSON_FLOAT:
|
||||
case JSON_KEYWORD:
|
||||
case JSON_STRING:
|
||||
lexer->emit(lexer, lexer->token, new_state, lexer->x, lexer->y);
|
||||
/* fall through */
|
||||
case JSON_SKIP:
|
||||
QDECREF(lexer->token);
|
||||
lexer->token = qstring_new();
|
||||
new_state = IN_START;
|
||||
break;
|
||||
case IN_ERROR:
|
||||
/* XXX: To avoid having previous bad input leaving the parser in an
|
||||
* unresponsive state where we consume unpredictable amounts of
|
||||
* subsequent "good" input, percolate this error state up to the
|
||||
* tokenizer/parser by forcing a NULL object to be emitted, then
|
||||
* reset state.
|
||||
*
|
||||
* Also note that this handling is required for reliable channel
|
||||
* negotiation between QMP and the guest agent, since chr(0xFF)
|
||||
* is placed at the beginning of certain events to ensure proper
|
||||
* delivery when the channel is in an unknown state. chr(0xFF) is
|
||||
* never a valid ASCII/UTF-8 sequence, so this should reliably
|
||||
* induce an error/flush state.
|
||||
*/
|
||||
lexer->emit(lexer, lexer->token, JSON_ERROR, lexer->x, lexer->y);
|
||||
QDECREF(lexer->token);
|
||||
lexer->token = qstring_new();
|
||||
new_state = IN_START;
|
||||
lexer->state = new_state;
|
||||
return 0;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
lexer->state = new_state;
|
||||
} while (!char_consumed && !flush);
|
||||
|
||||
/* Do not let a single token grow to an arbitrarily large size,
|
||||
* this is a security consideration.
|
||||
*/
|
||||
if (lexer->token->length > MAX_TOKEN_SIZE) {
|
||||
lexer->emit(lexer, lexer->token, lexer->state, lexer->x, lexer->y);
|
||||
QDECREF(lexer->token);
|
||||
lexer->token = qstring_new();
|
||||
lexer->state = IN_START;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int json_lexer_feed(JSONLexer *lexer, const char *buffer, size_t size)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
int err;
|
||||
|
||||
err = json_lexer_feed_char(lexer, buffer[i], false);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int json_lexer_flush(JSONLexer *lexer)
|
||||
{
|
||||
return lexer->state == IN_START ? 0 : json_lexer_feed_char(lexer, 0, true);
|
||||
}
|
||||
|
||||
void json_lexer_destroy(JSONLexer *lexer)
|
||||
{
|
||||
QDECREF(lexer->token);
|
||||
}
|
@ -1,713 +0,0 @@
|
||||
/*
|
||||
* JSON Parser
|
||||
*
|
||||
* Copyright IBM, Corp. 2009
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/qmp/qfloat.h"
|
||||
#include "qapi/qmp/qbool.h"
|
||||
#include "qapi/qmp/json-parser.h"
|
||||
#include "qapi/qmp/json-lexer.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
typedef struct JSONParserContext
|
||||
{
|
||||
Error *err;
|
||||
struct {
|
||||
QObject **buf;
|
||||
size_t pos;
|
||||
size_t count;
|
||||
} tokens;
|
||||
} JSONParserContext;
|
||||
|
||||
#define BUG_ON(cond) assert(!(cond))
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* 0) make errors meaningful again
|
||||
* 1) add geometry information to tokens
|
||||
* 3) should we return a parsed size?
|
||||
* 4) deal with premature EOI
|
||||
*/
|
||||
|
||||
static QObject *parse_value(JSONParserContext *ctxt, va_list *ap);
|
||||
|
||||
/**
|
||||
* Token manipulators
|
||||
*
|
||||
* tokens are dictionaries that contain a type, a string value, and geometry information
|
||||
* about a token identified by the lexer. These are routines that make working with
|
||||
* these objects a bit easier.
|
||||
*/
|
||||
static const char *token_get_value(QObject *obj)
|
||||
{
|
||||
return qdict_get_str(qobject_to_qdict(obj), "token");
|
||||
}
|
||||
|
||||
static JSONTokenType token_get_type(QObject *obj)
|
||||
{
|
||||
return qdict_get_int(qobject_to_qdict(obj), "type");
|
||||
}
|
||||
|
||||
static int token_is_operator(QObject *obj, char op)
|
||||
{
|
||||
const char *val;
|
||||
|
||||
if (token_get_type(obj) != JSON_OPERATOR) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
val = token_get_value(obj);
|
||||
|
||||
return (val[0] == op) && (val[1] == 0);
|
||||
}
|
||||
|
||||
static int token_is_keyword(QObject *obj, const char *value)
|
||||
{
|
||||
if (token_get_type(obj) != JSON_KEYWORD) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return strcmp(token_get_value(obj), value) == 0;
|
||||
}
|
||||
|
||||
static int token_is_escape(QObject *obj, const char *value)
|
||||
{
|
||||
if (token_get_type(obj) != JSON_ESCAPE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (strcmp(token_get_value(obj), value) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Error handler
|
||||
*/
|
||||
static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt,
|
||||
QObject *token, const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char message[1024];
|
||||
va_start(ap, msg);
|
||||
vsnprintf(message, sizeof(message), msg, ap);
|
||||
va_end(ap);
|
||||
if (ctxt->err) {
|
||||
error_free(ctxt->err);
|
||||
ctxt->err = NULL;
|
||||
}
|
||||
error_setg(&ctxt->err, "JSON parse error, %s", message);
|
||||
}
|
||||
|
||||
/**
|
||||
* String helpers
|
||||
*
|
||||
* These helpers are used to unescape strings.
|
||||
*/
|
||||
static void wchar_to_utf8(uint16_t wchar, char *buffer, size_t buffer_length)
|
||||
{
|
||||
if (wchar <= 0x007F) {
|
||||
BUG_ON(buffer_length < 2);
|
||||
|
||||
buffer[0] = wchar & 0x7F;
|
||||
buffer[1] = 0;
|
||||
} else if (wchar <= 0x07FF) {
|
||||
BUG_ON(buffer_length < 3);
|
||||
|
||||
buffer[0] = 0xC0 | ((wchar >> 6) & 0x1F);
|
||||
buffer[1] = 0x80 | (wchar & 0x3F);
|
||||
buffer[2] = 0;
|
||||
} else {
|
||||
BUG_ON(buffer_length < 4);
|
||||
|
||||
buffer[0] = 0xE0 | ((wchar >> 12) & 0x0F);
|
||||
buffer[1] = 0x80 | ((wchar >> 6) & 0x3F);
|
||||
buffer[2] = 0x80 | (wchar & 0x3F);
|
||||
buffer[3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int hex2decimal(char ch)
|
||||
{
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
return (ch - '0');
|
||||
} else if (ch >= 'a' && ch <= 'f') {
|
||||
return 10 + (ch - 'a');
|
||||
} else if (ch >= 'A' && ch <= 'F') {
|
||||
return 10 + (ch - 'A');
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* parse_string(): Parse a json string and return a QObject
|
||||
*
|
||||
* string
|
||||
* ""
|
||||
* " chars "
|
||||
* chars
|
||||
* char
|
||||
* char chars
|
||||
* char
|
||||
* any-Unicode-character-
|
||||
* except-"-or-\-or-
|
||||
* control-character
|
||||
* \"
|
||||
* \\
|
||||
* \/
|
||||
* \b
|
||||
* \f
|
||||
* \n
|
||||
* \r
|
||||
* \t
|
||||
* \u four-hex-digits
|
||||
*/
|
||||
static QString *qstring_from_escaped_str(JSONParserContext *ctxt, QObject *token)
|
||||
{
|
||||
const char *ptr = token_get_value(token);
|
||||
QString *str;
|
||||
int double_quote = 1;
|
||||
|
||||
if (*ptr == '"') {
|
||||
double_quote = 1;
|
||||
} else {
|
||||
double_quote = 0;
|
||||
}
|
||||
ptr++;
|
||||
|
||||
str = qstring_new();
|
||||
while (*ptr &&
|
||||
((double_quote && *ptr != '"') || (!double_quote && *ptr != '\''))) {
|
||||
if (*ptr == '\\') {
|
||||
ptr++;
|
||||
|
||||
switch (*ptr) {
|
||||
case '"':
|
||||
qstring_append(str, "\"");
|
||||
ptr++;
|
||||
break;
|
||||
case '\'':
|
||||
qstring_append(str, "'");
|
||||
ptr++;
|
||||
break;
|
||||
case '\\':
|
||||
qstring_append(str, "\\");
|
||||
ptr++;
|
||||
break;
|
||||
case '/':
|
||||
qstring_append(str, "/");
|
||||
ptr++;
|
||||
break;
|
||||
case 'b':
|
||||
qstring_append(str, "\b");
|
||||
ptr++;
|
||||
break;
|
||||
case 'f':
|
||||
qstring_append(str, "\f");
|
||||
ptr++;
|
||||
break;
|
||||
case 'n':
|
||||
qstring_append(str, "\n");
|
||||
ptr++;
|
||||
break;
|
||||
case 'r':
|
||||
qstring_append(str, "\r");
|
||||
ptr++;
|
||||
break;
|
||||
case 't':
|
||||
qstring_append(str, "\t");
|
||||
ptr++;
|
||||
break;
|
||||
case 'u': {
|
||||
uint16_t unicode_char = 0;
|
||||
char utf8_char[4];
|
||||
int i = 0;
|
||||
|
||||
ptr++;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (qemu_isxdigit(*ptr)) {
|
||||
unicode_char |= hex2decimal(*ptr) << ((3 - i) * 4);
|
||||
} else {
|
||||
parse_error(ctxt, token,
|
||||
"invalid hex escape sequence in string");
|
||||
goto out;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
|
||||
wchar_to_utf8(unicode_char, utf8_char, sizeof(utf8_char));
|
||||
qstring_append(str, utf8_char);
|
||||
} break;
|
||||
default:
|
||||
parse_error(ctxt, token, "invalid escape sequence in string");
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
char dummy[2];
|
||||
|
||||
dummy[0] = *ptr++;
|
||||
dummy[1] = 0;
|
||||
|
||||
qstring_append(str, dummy);
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
|
||||
out:
|
||||
QDECREF(str);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static QObject *parser_context_pop_token(JSONParserContext *ctxt)
|
||||
{
|
||||
QObject *token;
|
||||
g_assert(ctxt->tokens.pos < ctxt->tokens.count);
|
||||
token = ctxt->tokens.buf[ctxt->tokens.pos];
|
||||
ctxt->tokens.pos++;
|
||||
return token;
|
||||
}
|
||||
|
||||
/* Note: parser_context_{peek|pop}_token do not increment the
|
||||
* token object's refcount. In both cases the references will continue
|
||||
* to be tracked and cleaned up in parser_context_free(), so do not
|
||||
* attempt to free the token object.
|
||||
*/
|
||||
static QObject *parser_context_peek_token(JSONParserContext *ctxt)
|
||||
{
|
||||
QObject *token;
|
||||
g_assert(ctxt->tokens.pos < ctxt->tokens.count);
|
||||
token = ctxt->tokens.buf[ctxt->tokens.pos];
|
||||
return token;
|
||||
}
|
||||
|
||||
static JSONParserContext parser_context_save(JSONParserContext *ctxt)
|
||||
{
|
||||
JSONParserContext saved_ctxt = {0};
|
||||
saved_ctxt.tokens.pos = ctxt->tokens.pos;
|
||||
saved_ctxt.tokens.count = ctxt->tokens.count;
|
||||
saved_ctxt.tokens.buf = ctxt->tokens.buf;
|
||||
return saved_ctxt;
|
||||
}
|
||||
|
||||
static void parser_context_restore(JSONParserContext *ctxt,
|
||||
JSONParserContext saved_ctxt)
|
||||
{
|
||||
ctxt->tokens.pos = saved_ctxt.tokens.pos;
|
||||
ctxt->tokens.count = saved_ctxt.tokens.count;
|
||||
ctxt->tokens.buf = saved_ctxt.tokens.buf;
|
||||
}
|
||||
|
||||
static void tokens_append_from_iter(QObject *obj, void *opaque)
|
||||
{
|
||||
JSONParserContext *ctxt = opaque;
|
||||
g_assert(ctxt->tokens.pos < ctxt->tokens.count);
|
||||
ctxt->tokens.buf[ctxt->tokens.pos++] = obj;
|
||||
qobject_incref(obj);
|
||||
}
|
||||
|
||||
static JSONParserContext *parser_context_new(QList *tokens)
|
||||
{
|
||||
JSONParserContext *ctxt;
|
||||
size_t count;
|
||||
|
||||
if (!tokens) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
count = qlist_size(tokens);
|
||||
if (count == 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ctxt = g_malloc0(sizeof(JSONParserContext));
|
||||
ctxt->tokens.pos = 0;
|
||||
ctxt->tokens.count = count;
|
||||
ctxt->tokens.buf = g_malloc(count * sizeof(QObject *));
|
||||
qlist_iter(tokens, tokens_append_from_iter, ctxt);
|
||||
ctxt->tokens.pos = 0;
|
||||
|
||||
return ctxt;
|
||||
}
|
||||
|
||||
/* to support error propagation, ctxt->err must be freed separately */
|
||||
static void parser_context_free(JSONParserContext *ctxt)
|
||||
{
|
||||
int i;
|
||||
if (ctxt) {
|
||||
for (i = 0; i < ctxt->tokens.count; i++) {
|
||||
qobject_decref(ctxt->tokens.buf[i]);
|
||||
}
|
||||
g_free(ctxt->tokens.buf);
|
||||
g_free(ctxt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parsing rules
|
||||
*/
|
||||
static int parse_pair(JSONParserContext *ctxt, QDict *dict, va_list *ap)
|
||||
{
|
||||
QObject *key = NULL, *token = NULL, *value, *peek;
|
||||
JSONParserContext saved_ctxt = parser_context_save(ctxt);
|
||||
|
||||
peek = parser_context_peek_token(ctxt);
|
||||
if (peek == NULL) {
|
||||
parse_error(ctxt, NULL, "premature EOI");
|
||||
goto out;
|
||||
}
|
||||
|
||||
key = parse_value(ctxt, ap);
|
||||
if (!key || qobject_type(key) != QTYPE_QSTRING) {
|
||||
parse_error(ctxt, peek, "key is not a string in object");
|
||||
goto out;
|
||||
}
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
parse_error(ctxt, NULL, "premature EOI");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!token_is_operator(token, ':')) {
|
||||
parse_error(ctxt, token, "missing : in object pair");
|
||||
goto out;
|
||||
}
|
||||
|
||||
value = parse_value(ctxt, ap);
|
||||
if (value == NULL) {
|
||||
parse_error(ctxt, token, "Missing value in dict");
|
||||
goto out;
|
||||
}
|
||||
|
||||
qdict_put_obj(dict, qstring_get_str(qobject_to_qstring(key)), value);
|
||||
|
||||
qobject_decref(key);
|
||||
|
||||
return 0;
|
||||
|
||||
out:
|
||||
parser_context_restore(ctxt, saved_ctxt);
|
||||
qobject_decref(key);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static QObject *parse_object(JSONParserContext *ctxt, va_list *ap)
|
||||
{
|
||||
QDict *dict = NULL;
|
||||
QObject *token, *peek;
|
||||
JSONParserContext saved_ctxt = parser_context_save(ctxt);
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!token_is_operator(token, '{')) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
dict = qdict_new();
|
||||
|
||||
peek = parser_context_peek_token(ctxt);
|
||||
if (peek == NULL) {
|
||||
parse_error(ctxt, NULL, "premature EOI");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!token_is_operator(peek, '}')) {
|
||||
if (parse_pair(ctxt, dict, ap) == -1) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
parse_error(ctxt, NULL, "premature EOI");
|
||||
goto out;
|
||||
}
|
||||
|
||||
while (!token_is_operator(token, '}')) {
|
||||
if (!token_is_operator(token, ',')) {
|
||||
parse_error(ctxt, token, "expected separator in dict");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (parse_pair(ctxt, dict, ap) == -1) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
parse_error(ctxt, NULL, "premature EOI");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
(void)parser_context_pop_token(ctxt);
|
||||
}
|
||||
|
||||
return QOBJECT(dict);
|
||||
|
||||
out:
|
||||
parser_context_restore(ctxt, saved_ctxt);
|
||||
QDECREF(dict);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static QObject *parse_array(JSONParserContext *ctxt, va_list *ap)
|
||||
{
|
||||
QList *list = NULL;
|
||||
QObject *token, *peek;
|
||||
JSONParserContext saved_ctxt = parser_context_save(ctxt);
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!token_is_operator(token, '[')) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
list = qlist_new();
|
||||
|
||||
peek = parser_context_peek_token(ctxt);
|
||||
if (peek == NULL) {
|
||||
parse_error(ctxt, NULL, "premature EOI");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!token_is_operator(peek, ']')) {
|
||||
QObject *obj;
|
||||
|
||||
obj = parse_value(ctxt, ap);
|
||||
if (obj == NULL) {
|
||||
parse_error(ctxt, token, "expecting value");
|
||||
goto out;
|
||||
}
|
||||
|
||||
qlist_append_obj(list, obj);
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
parse_error(ctxt, NULL, "premature EOI");
|
||||
goto out;
|
||||
}
|
||||
|
||||
while (!token_is_operator(token, ']')) {
|
||||
if (!token_is_operator(token, ',')) {
|
||||
parse_error(ctxt, token, "expected separator in list");
|
||||
goto out;
|
||||
}
|
||||
|
||||
obj = parse_value(ctxt, ap);
|
||||
if (obj == NULL) {
|
||||
parse_error(ctxt, token, "expecting value");
|
||||
goto out;
|
||||
}
|
||||
|
||||
qlist_append_obj(list, obj);
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
parse_error(ctxt, NULL, "premature EOI");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
(void)parser_context_pop_token(ctxt);
|
||||
}
|
||||
|
||||
return QOBJECT(list);
|
||||
|
||||
out:
|
||||
parser_context_restore(ctxt, saved_ctxt);
|
||||
QDECREF(list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static QObject *parse_keyword(JSONParserContext *ctxt)
|
||||
{
|
||||
QObject *token, *ret;
|
||||
JSONParserContext saved_ctxt = parser_context_save(ctxt);
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (token_get_type(token) != JSON_KEYWORD) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (token_is_keyword(token, "true")) {
|
||||
ret = QOBJECT(qbool_from_int(true));
|
||||
} else if (token_is_keyword(token, "false")) {
|
||||
ret = QOBJECT(qbool_from_int(false));
|
||||
} else {
|
||||
parse_error(ctxt, token, "invalid keyword `%s'", token_get_value(token));
|
||||
goto out;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
out:
|
||||
parser_context_restore(ctxt, saved_ctxt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static QObject *parse_escape(JSONParserContext *ctxt, va_list *ap)
|
||||
{
|
||||
QObject *token = NULL, *obj;
|
||||
JSONParserContext saved_ctxt = parser_context_save(ctxt);
|
||||
|
||||
if (ap == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (token_is_escape(token, "%p")) {
|
||||
obj = va_arg(*ap, QObject *);
|
||||
} else if (token_is_escape(token, "%i")) {
|
||||
obj = QOBJECT(qbool_from_int(va_arg(*ap, int)));
|
||||
} else if (token_is_escape(token, "%d")) {
|
||||
obj = QOBJECT(qint_from_int(va_arg(*ap, int)));
|
||||
} else if (token_is_escape(token, "%ld")) {
|
||||
obj = QOBJECT(qint_from_int(va_arg(*ap, long)));
|
||||
} else if (token_is_escape(token, "%lld") ||
|
||||
token_is_escape(token, "%I64d")) {
|
||||
obj = QOBJECT(qint_from_int(va_arg(*ap, long long)));
|
||||
} else if (token_is_escape(token, "%s")) {
|
||||
obj = QOBJECT(qstring_from_str(va_arg(*ap, const char *)));
|
||||
} else if (token_is_escape(token, "%f")) {
|
||||
obj = QOBJECT(qfloat_from_double(va_arg(*ap, double)));
|
||||
} else {
|
||||
goto out;
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
out:
|
||||
parser_context_restore(ctxt, saved_ctxt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static QObject *parse_literal(JSONParserContext *ctxt)
|
||||
{
|
||||
QObject *token, *obj;
|
||||
JSONParserContext saved_ctxt = parser_context_save(ctxt);
|
||||
|
||||
token = parser_context_pop_token(ctxt);
|
||||
if (token == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (token_get_type(token)) {
|
||||
case JSON_STRING:
|
||||
obj = QOBJECT(qstring_from_escaped_str(ctxt, token));
|
||||
break;
|
||||
case JSON_INTEGER: {
|
||||
/* A possibility exists that this is a whole-valued float where the
|
||||
* fractional part was left out due to being 0 (.0). It's not a big
|
||||
* deal to treat these as ints in the parser, so long as users of the
|
||||
* resulting QObject know to expect a QInt in place of a QFloat in
|
||||
* cases like these.
|
||||
*
|
||||
* However, in some cases these values will overflow/underflow a
|
||||
* QInt/int64 container, thus we should assume these are to be handled
|
||||
* as QFloats/doubles rather than silently changing their values.
|
||||
*
|
||||
* strtoll() indicates these instances by setting errno to ERANGE
|
||||
*/
|
||||
int64_t value;
|
||||
|
||||
errno = 0; /* strtoll doesn't set errno on success */
|
||||
value = strtoll(token_get_value(token), NULL, 10);
|
||||
if (errno != ERANGE) {
|
||||
obj = QOBJECT(qint_from_int(value));
|
||||
break;
|
||||
}
|
||||
/* fall through to JSON_FLOAT */
|
||||
}
|
||||
case JSON_FLOAT:
|
||||
/* FIXME dependent on locale */
|
||||
obj = QOBJECT(qfloat_from_double(strtod(token_get_value(token), NULL)));
|
||||
break;
|
||||
default:
|
||||
goto out;
|
||||
}
|
||||
|
||||
return obj;
|
||||
|
||||
out:
|
||||
parser_context_restore(ctxt, saved_ctxt);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static QObject *parse_value(JSONParserContext *ctxt, va_list *ap)
|
||||
{
|
||||
QObject *obj;
|
||||
|
||||
obj = parse_object(ctxt, ap);
|
||||
if (obj == NULL) {
|
||||
obj = parse_array(ctxt, ap);
|
||||
}
|
||||
if (obj == NULL) {
|
||||
obj = parse_escape(ctxt, ap);
|
||||
}
|
||||
if (obj == NULL) {
|
||||
obj = parse_keyword(ctxt);
|
||||
}
|
||||
if (obj == NULL) {
|
||||
obj = parse_literal(ctxt);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QObject *json_parser_parse(QList *tokens, va_list *ap)
|
||||
{
|
||||
return json_parser_parse_err(tokens, ap, NULL);
|
||||
}
|
||||
|
||||
QObject *json_parser_parse_err(QList *tokens, va_list *ap, Error **errp)
|
||||
{
|
||||
JSONParserContext *ctxt = parser_context_new(tokens);
|
||||
QObject *result;
|
||||
|
||||
if (!ctxt) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
result = parse_value(ctxt, ap);
|
||||
|
||||
error_propagate(errp, ctxt->err);
|
||||
|
||||
parser_context_free(ctxt);
|
||||
|
||||
return result;
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
/*
|
||||
* JSON streaming support
|
||||
*
|
||||
* Copyright IBM, Corp. 2009
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qapi/qmp/json-lexer.h"
|
||||
#include "qapi/qmp/json-streamer.h"
|
||||
|
||||
#define MAX_TOKEN_SIZE (64ULL << 20)
|
||||
#define MAX_NESTING (1ULL << 10)
|
||||
|
||||
static void json_message_process_token(JSONLexer *lexer, QString *token, JSONTokenType type, int x, int y)
|
||||
{
|
||||
JSONMessageParser *parser = container_of(lexer, JSONMessageParser, lexer);
|
||||
QDict *dict;
|
||||
|
||||
if (type == JSON_OPERATOR) {
|
||||
switch (qstring_get_str(token)[0]) {
|
||||
case '{':
|
||||
parser->brace_count++;
|
||||
break;
|
||||
case '}':
|
||||
parser->brace_count--;
|
||||
break;
|
||||
case '[':
|
||||
parser->bracket_count++;
|
||||
break;
|
||||
case ']':
|
||||
parser->bracket_count--;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dict = qdict_new();
|
||||
qdict_put(dict, "type", qint_from_int(type));
|
||||
QINCREF(token);
|
||||
qdict_put(dict, "token", token);
|
||||
qdict_put(dict, "x", qint_from_int(x));
|
||||
qdict_put(dict, "y", qint_from_int(y));
|
||||
|
||||
parser->token_size += token->length;
|
||||
|
||||
qlist_append(parser->tokens, dict);
|
||||
|
||||
if (type == JSON_ERROR) {
|
||||
goto out_emit_bad;
|
||||
} else if (parser->brace_count < 0 ||
|
||||
parser->bracket_count < 0 ||
|
||||
(parser->brace_count == 0 &&
|
||||
parser->bracket_count == 0)) {
|
||||
goto out_emit;
|
||||
} else if (parser->token_size > MAX_TOKEN_SIZE ||
|
||||
parser->bracket_count > MAX_NESTING ||
|
||||
parser->brace_count > MAX_NESTING) {
|
||||
/* Security consideration, we limit total memory allocated per object
|
||||
* and the maximum recursion depth that a message can force.
|
||||
*/
|
||||
goto out_emit;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
out_emit_bad:
|
||||
/* clear out token list and tell the parser to emit and error
|
||||
* indication by passing it a NULL list
|
||||
*/
|
||||
QDECREF(parser->tokens);
|
||||
parser->tokens = NULL;
|
||||
out_emit:
|
||||
/* send current list of tokens to parser and reset tokenizer */
|
||||
parser->brace_count = 0;
|
||||
parser->bracket_count = 0;
|
||||
parser->emit(parser, parser->tokens);
|
||||
if (parser->tokens) {
|
||||
QDECREF(parser->tokens);
|
||||
}
|
||||
parser->tokens = qlist_new();
|
||||
parser->token_size = 0;
|
||||
}
|
||||
|
||||
void json_message_parser_init(JSONMessageParser *parser,
|
||||
void (*func)(JSONMessageParser *, QList *))
|
||||
{
|
||||
parser->emit = func;
|
||||
parser->brace_count = 0;
|
||||
parser->bracket_count = 0;
|
||||
parser->tokens = qlist_new();
|
||||
parser->token_size = 0;
|
||||
|
||||
json_lexer_init(&parser->lexer, json_message_process_token);
|
||||
}
|
||||
|
||||
int json_message_parser_feed(JSONMessageParser *parser,
|
||||
const char *buffer, size_t size)
|
||||
{
|
||||
return json_lexer_feed(&parser->lexer, buffer, size);
|
||||
}
|
||||
|
||||
int json_message_parser_flush(JSONMessageParser *parser)
|
||||
{
|
||||
return json_lexer_flush(&parser->lexer);
|
||||
}
|
||||
|
||||
void json_message_parser_destroy(JSONMessageParser *parser)
|
||||
{
|
||||
json_lexer_destroy(&parser->lexer);
|
||||
QDECREF(parser->tokens);
|
||||
}
|
@ -1,284 +0,0 @@
|
||||
/*
|
||||
* QObject JSON integration
|
||||
*
|
||||
* Copyright IBM, Corp. 2009
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING.LIB file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "qapi/qmp/json-lexer.h"
|
||||
#include "qapi/qmp/json-parser.h"
|
||||
#include "qapi/qmp/json-streamer.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qapi/qmp/qlist.h"
|
||||
#include "qapi/qmp/qbool.h"
|
||||
#include "qapi/qmp/qfloat.h"
|
||||
#include "qapi/qmp/qdict.h"
|
||||
|
||||
typedef struct JSONParsingState
|
||||
{
|
||||
JSONMessageParser parser;
|
||||
va_list *ap;
|
||||
QObject *result;
|
||||
} JSONParsingState;
|
||||
|
||||
static void parse_json(JSONMessageParser *parser, QList *tokens)
|
||||
{
|
||||
JSONParsingState *s = container_of(parser, JSONParsingState, parser);
|
||||
s->result = json_parser_parse(tokens, s->ap);
|
||||
}
|
||||
|
||||
QObject *qobject_from_jsonv(const char *string, va_list *ap)
|
||||
{
|
||||
JSONParsingState state = {};
|
||||
|
||||
state.ap = ap;
|
||||
|
||||
json_message_parser_init(&state.parser, parse_json);
|
||||
json_message_parser_feed(&state.parser, string, strlen(string));
|
||||
json_message_parser_flush(&state.parser);
|
||||
json_message_parser_destroy(&state.parser);
|
||||
|
||||
return state.result;
|
||||
}
|
||||
|
||||
QObject *qobject_from_json(const char *string)
|
||||
{
|
||||
return qobject_from_jsonv(string, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* IMPORTANT: This function aborts on error, thus it must not
|
||||
* be used with untrusted arguments.
|
||||
*/
|
||||
QObject *qobject_from_jsonf(const char *string, ...)
|
||||
{
|
||||
QObject *obj;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, string);
|
||||
obj = qobject_from_jsonv(string, &ap);
|
||||
va_end(ap);
|
||||
|
||||
assert(obj != NULL);
|
||||
return obj;
|
||||
}
|
||||
|
||||
typedef struct ToJsonIterState
|
||||
{
|
||||
int indent;
|
||||
int pretty;
|
||||
int count;
|
||||
QString *str;
|
||||
} ToJsonIterState;
|
||||
|
||||
static void to_json(const QObject *obj, QString *str, int pretty, int indent);
|
||||
|
||||
static void to_json_dict_iter(const char *key, QObject *obj, void *opaque)
|
||||
{
|
||||
ToJsonIterState *s = opaque;
|
||||
QString *qkey;
|
||||
int j;
|
||||
|
||||
if (s->count)
|
||||
qstring_append(s->str, ", ");
|
||||
|
||||
if (s->pretty) {
|
||||
qstring_append(s->str, "\n");
|
||||
for (j = 0 ; j < s->indent ; j++)
|
||||
qstring_append(s->str, " ");
|
||||
}
|
||||
|
||||
qkey = qstring_from_str(key);
|
||||
to_json(QOBJECT(qkey), s->str, s->pretty, s->indent);
|
||||
QDECREF(qkey);
|
||||
|
||||
qstring_append(s->str, ": ");
|
||||
to_json(obj, s->str, s->pretty, s->indent);
|
||||
s->count++;
|
||||
}
|
||||
|
||||
static void to_json_list_iter(QObject *obj, void *opaque)
|
||||
{
|
||||
ToJsonIterState *s = opaque;
|
||||
int j;
|
||||
|
||||
if (s->count)
|
||||
qstring_append(s->str, ", ");
|
||||
|
||||
if (s->pretty) {
|
||||
qstring_append(s->str, "\n");
|
||||
for (j = 0 ; j < s->indent ; j++)
|
||||
qstring_append(s->str, " ");
|
||||
}
|
||||
|
||||
to_json(obj, s->str, s->pretty, s->indent);
|
||||
s->count++;
|
||||
}
|
||||
|
||||
static void to_json(const QObject *obj, QString *str, int pretty, int indent)
|
||||
{
|
||||
switch (qobject_type(obj)) {
|
||||
case QTYPE_QINT: {
|
||||
QInt *val = qobject_to_qint(obj);
|
||||
char buffer[1024];
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "%" PRId64, qint_get_int(val));
|
||||
qstring_append(str, buffer);
|
||||
break;
|
||||
}
|
||||
case QTYPE_QSTRING: {
|
||||
QString *val = qobject_to_qstring(obj);
|
||||
const char *ptr;
|
||||
int cp;
|
||||
char buf[16];
|
||||
char *end;
|
||||
|
||||
ptr = qstring_get_str(val);
|
||||
qstring_append(str, "\"");
|
||||
|
||||
for (; *ptr; ptr = end) {
|
||||
cp = mod_utf8_codepoint(ptr, 6, &end);
|
||||
switch (cp) {
|
||||
case '\"':
|
||||
qstring_append(str, "\\\"");
|
||||
break;
|
||||
case '\\':
|
||||
qstring_append(str, "\\\\");
|
||||
break;
|
||||
case '\b':
|
||||
qstring_append(str, "\\b");
|
||||
break;
|
||||
case '\f':
|
||||
qstring_append(str, "\\f");
|
||||
break;
|
||||
case '\n':
|
||||
qstring_append(str, "\\n");
|
||||
break;
|
||||
case '\r':
|
||||
qstring_append(str, "\\r");
|
||||
break;
|
||||
case '\t':
|
||||
qstring_append(str, "\\t");
|
||||
break;
|
||||
default:
|
||||
if (cp < 0) {
|
||||
cp = 0xFFFD; /* replacement character */
|
||||
}
|
||||
if (cp > 0xFFFF) {
|
||||
/* beyond BMP; need a surrogate pair */
|
||||
snprintf(buf, sizeof(buf), "\\u%04X\\u%04X",
|
||||
0xD800 + ((cp - 0x10000) >> 10),
|
||||
0xDC00 + ((cp - 0x10000) & 0x3FF));
|
||||
} else if (cp < 0x20 || cp >= 0x7F) {
|
||||
snprintf(buf, sizeof(buf), "\\u%04X", cp);
|
||||
} else {
|
||||
buf[0] = cp;
|
||||
buf[1] = 0;
|
||||
}
|
||||
qstring_append(str, buf);
|
||||
}
|
||||
};
|
||||
|
||||
qstring_append(str, "\"");
|
||||
break;
|
||||
}
|
||||
case QTYPE_QDICT: {
|
||||
ToJsonIterState s;
|
||||
QDict *val = qobject_to_qdict(obj);
|
||||
|
||||
s.count = 0;
|
||||
s.str = str;
|
||||
s.indent = indent + 1;
|
||||
s.pretty = pretty;
|
||||
qstring_append(str, "{");
|
||||
qdict_iter(val, to_json_dict_iter, &s);
|
||||
if (pretty) {
|
||||
int j;
|
||||
qstring_append(str, "\n");
|
||||
for (j = 0 ; j < indent ; j++)
|
||||
qstring_append(str, " ");
|
||||
}
|
||||
qstring_append(str, "}");
|
||||
break;
|
||||
}
|
||||
case QTYPE_QLIST: {
|
||||
ToJsonIterState s;
|
||||
QList *val = qobject_to_qlist(obj);
|
||||
|
||||
s.count = 0;
|
||||
s.str = str;
|
||||
s.indent = indent + 1;
|
||||
s.pretty = pretty;
|
||||
qstring_append(str, "[");
|
||||
qlist_iter(val, (void *)to_json_list_iter, &s);
|
||||
if (pretty) {
|
||||
int j;
|
||||
qstring_append(str, "\n");
|
||||
for (j = 0 ; j < indent ; j++)
|
||||
qstring_append(str, " ");
|
||||
}
|
||||
qstring_append(str, "]");
|
||||
break;
|
||||
}
|
||||
case QTYPE_QFLOAT: {
|
||||
QFloat *val = qobject_to_qfloat(obj);
|
||||
char buffer[1024];
|
||||
int len;
|
||||
|
||||
len = snprintf(buffer, sizeof(buffer), "%f", qfloat_get_double(val));
|
||||
while (len > 0 && buffer[len - 1] == '0') {
|
||||
len--;
|
||||
}
|
||||
|
||||
if (len && buffer[len - 1] == '.') {
|
||||
buffer[len - 1] = 0;
|
||||
} else {
|
||||
buffer[len] = 0;
|
||||
}
|
||||
|
||||
qstring_append(str, buffer);
|
||||
break;
|
||||
}
|
||||
case QTYPE_QBOOL: {
|
||||
QBool *val = qobject_to_qbool(obj);
|
||||
|
||||
if (qbool_get_int(val)) {
|
||||
qstring_append(str, "true");
|
||||
} else {
|
||||
qstring_append(str, "false");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QTYPE_QERROR:
|
||||
/* XXX: should QError be emitted? */
|
||||
case QTYPE_NONE:
|
||||
break;
|
||||
case QTYPE_MAX:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
QString *qobject_to_json(const QObject *obj)
|
||||
{
|
||||
QString *str = qstring_new();
|
||||
|
||||
to_json(obj, str, 0, 0);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
QString *qobject_to_json_pretty(const QObject *obj)
|
||||
{
|
||||
QString *str = qstring_new();
|
||||
|
||||
to_json(obj, str, 1, 0);
|
||||
|
||||
return str;
|
||||
}
|
25
qemu/sparc.h
25
qemu/sparc.h
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_sparc
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_sparc
|
||||
#define __jit_debug_register_code __jit_debug_register_code_sparc
|
||||
#define json_lexer json_lexer_sparc
|
||||
#define json_lexer_destroy json_lexer_destroy_sparc
|
||||
#define json_lexer_feed json_lexer_feed_sparc
|
||||
#define json_lexer_feed_char json_lexer_feed_char_sparc
|
||||
#define json_lexer_flush json_lexer_flush_sparc
|
||||
#define json_lexer_init json_lexer_init_sparc
|
||||
#define json_message_parser_destroy json_message_parser_destroy_sparc
|
||||
#define json_message_parser_feed json_message_parser_feed_sparc
|
||||
#define json_message_parser_flush json_message_parser_flush_sparc
|
||||
#define json_message_parser_init json_message_parser_init_sparc
|
||||
#define json_message_process_token json_message_process_token_sparc
|
||||
#define json_parser_parse json_parser_parse_sparc
|
||||
#define json_parser_parse_err json_parser_parse_err_sparc
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_sparc
|
||||
#define last_ram_offset last_ram_offset_sparc
|
||||
#define ldl_be_p ldl_be_p_sparc
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_sparc
|
||||
#define module_call_init module_call_init_sparc
|
||||
#define module_load module_load_sparc
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_sparc
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_sparc
|
||||
#define mpidr_read mpidr_read_sparc
|
||||
#define msr_mask msr_mask_sparc
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_sparc
|
||||
#define parse_error parse_error_sparc
|
||||
#define parse_escape parse_escape_sparc
|
||||
#define parse_json parse_json_sparc
|
||||
#define parse_keyword parse_keyword_sparc
|
||||
#define parse_literal parse_literal_sparc
|
||||
#define parse_object parse_object_sparc
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_sparc
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_sparc
|
||||
#define qobject_decref qobject_decref_sparc
|
||||
#define qobject_from_json qobject_from_json_sparc
|
||||
#define qobject_from_jsonf qobject_from_jsonf_sparc
|
||||
#define qobject_from_jsonv qobject_from_jsonv_sparc
|
||||
#define qobject_incref qobject_incref_sparc
|
||||
#define qobject_to_json qobject_to_json_sparc
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_sparc
|
||||
#define qobject_to_qbool qobject_to_qbool_sparc
|
||||
#define qobject_to_qdict qobject_to_qdict_sparc
|
||||
#define qobject_to_qfloat qobject_to_qfloat_sparc
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_sparc
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_sparc
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_sparc
|
||||
#define to_json to_json_sparc
|
||||
#define to_json_dict_iter to_json_dict_iter_sparc
|
||||
#define to_json_list_iter to_json_list_iter_sparc
|
||||
#define token_get_type token_get_type_sparc
|
||||
#define token_get_value token_get_value_sparc
|
||||
#define token_is_escape token_is_escape_sparc
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_sparc
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_sparc
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_sparc
|
||||
#define wchar_to_utf8 wchar_to_utf8_sparc
|
||||
#define write_cpustate_to_list write_cpustate_to_list_sparc
|
||||
#define write_list_to_cpustate write_list_to_cpustate_sparc
|
||||
#define write_raw_cp_reg write_raw_cp_reg_sparc
|
||||
|
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_sparc64
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_sparc64
|
||||
#define __jit_debug_register_code __jit_debug_register_code_sparc64
|
||||
#define json_lexer json_lexer_sparc64
|
||||
#define json_lexer_destroy json_lexer_destroy_sparc64
|
||||
#define json_lexer_feed json_lexer_feed_sparc64
|
||||
#define json_lexer_feed_char json_lexer_feed_char_sparc64
|
||||
#define json_lexer_flush json_lexer_flush_sparc64
|
||||
#define json_lexer_init json_lexer_init_sparc64
|
||||
#define json_message_parser_destroy json_message_parser_destroy_sparc64
|
||||
#define json_message_parser_feed json_message_parser_feed_sparc64
|
||||
#define json_message_parser_flush json_message_parser_flush_sparc64
|
||||
#define json_message_parser_init json_message_parser_init_sparc64
|
||||
#define json_message_process_token json_message_process_token_sparc64
|
||||
#define json_parser_parse json_parser_parse_sparc64
|
||||
#define json_parser_parse_err json_parser_parse_err_sparc64
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_sparc64
|
||||
#define last_ram_offset last_ram_offset_sparc64
|
||||
#define ldl_be_p ldl_be_p_sparc64
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_sparc64
|
||||
#define module_call_init module_call_init_sparc64
|
||||
#define module_load module_load_sparc64
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_sparc64
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_sparc64
|
||||
#define mpidr_read mpidr_read_sparc64
|
||||
#define msr_mask msr_mask_sparc64
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_sparc64
|
||||
#define parse_error parse_error_sparc64
|
||||
#define parse_escape parse_escape_sparc64
|
||||
#define parse_json parse_json_sparc64
|
||||
#define parse_keyword parse_keyword_sparc64
|
||||
#define parse_literal parse_literal_sparc64
|
||||
#define parse_object parse_object_sparc64
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_sparc64
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_sparc64
|
||||
#define qobject_decref qobject_decref_sparc64
|
||||
#define qobject_from_json qobject_from_json_sparc64
|
||||
#define qobject_from_jsonf qobject_from_jsonf_sparc64
|
||||
#define qobject_from_jsonv qobject_from_jsonv_sparc64
|
||||
#define qobject_incref qobject_incref_sparc64
|
||||
#define qobject_to_json qobject_to_json_sparc64
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_sparc64
|
||||
#define qobject_to_qbool qobject_to_qbool_sparc64
|
||||
#define qobject_to_qdict qobject_to_qdict_sparc64
|
||||
#define qobject_to_qfloat qobject_to_qfloat_sparc64
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_sparc64
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_sparc64
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_sparc64
|
||||
#define to_json to_json_sparc64
|
||||
#define to_json_dict_iter to_json_dict_iter_sparc64
|
||||
#define to_json_list_iter to_json_list_iter_sparc64
|
||||
#define token_get_type token_get_type_sparc64
|
||||
#define token_get_value token_get_value_sparc64
|
||||
#define token_is_escape token_is_escape_sparc64
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_sparc64
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_sparc64
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_sparc64
|
||||
#define wchar_to_utf8 wchar_to_utf8_sparc64
|
||||
#define write_cpustate_to_list write_cpustate_to_list_sparc64
|
||||
#define write_list_to_cpustate write_list_to_cpustate_sparc64
|
||||
#define write_raw_cp_reg write_raw_cp_reg_sparc64
|
||||
|
@ -1,4 +1,4 @@
|
||||
util-obj-y = cutils.o unicode.o qemu-timer-common.o
|
||||
util-obj-y = cutils.o qemu-timer-common.o
|
||||
util-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o
|
||||
util-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o
|
||||
util-obj-y += module.o
|
||||
|
@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Dealing with Unicode
|
||||
*
|
||||
* Copyright (C) 2013 Red Hat, Inc.
|
||||
*
|
||||
* Authors:
|
||||
* Markus Armbruster <armbru@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or
|
||||
* later. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
|
||||
/**
|
||||
* mod_utf8_codepoint:
|
||||
* @s: string encoded in modified UTF-8
|
||||
* @n: maximum number of bytes to read from @s, if less than 6
|
||||
* @end: set to end of sequence on return
|
||||
*
|
||||
* Convert the modified UTF-8 sequence at the start of @s. Modified
|
||||
* UTF-8 is exactly like UTF-8, except U+0000 is encoded as
|
||||
* "\xC0\x80".
|
||||
*
|
||||
* If @n is zero or @s points to a zero byte, the sequence is invalid,
|
||||
* and @end is set to @s.
|
||||
*
|
||||
* If @s points to an impossible byte (0xFE or 0xFF) or a continuation
|
||||
* byte, the sequence is invalid, and @end is set to @s + 1
|
||||
*
|
||||
* Else, the first byte determines how many continuation bytes are
|
||||
* expected. If there are fewer, the sequence is invalid, and @end is
|
||||
* set to @s + 1 + actual number of continuation bytes. Else, the
|
||||
* sequence is well-formed, and @end is set to @s + 1 + expected
|
||||
* number of continuation bytes.
|
||||
*
|
||||
* A well-formed sequence is valid unless it encodes a codepoint
|
||||
* outside the Unicode range U+0000..U+10FFFF, one of Unicode's 66
|
||||
* noncharacters, a surrogate codepoint, or is overlong. Except the
|
||||
* overlong sequence "\xC0\x80" is valid.
|
||||
*
|
||||
* Conversion succeeds if and only if the sequence is valid.
|
||||
*
|
||||
* Returns: the Unicode codepoint on success, -1 on failure.
|
||||
*/
|
||||
int mod_utf8_codepoint(const char *s, size_t n, char **end)
|
||||
{
|
||||
static int min_cp[5] = { 0x80, 0x800, 0x10000, 0x200000, 0x4000000 };
|
||||
const unsigned char *p;
|
||||
unsigned byte, mask, len, i;
|
||||
int cp;
|
||||
|
||||
if (n == 0 || *s == 0) {
|
||||
/* empty sequence */
|
||||
*end = (char *)s;
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = (const unsigned char *)s;
|
||||
byte = *p++;
|
||||
if (byte < 0x80) {
|
||||
cp = byte; /* one byte sequence */
|
||||
} else if (byte >= 0xFE) {
|
||||
cp = -1; /* impossible bytes 0xFE, 0xFF */
|
||||
} else if ((byte & 0x40) == 0) {
|
||||
cp = -1; /* unexpected continuation byte */
|
||||
} else {
|
||||
/* multi-byte sequence */
|
||||
len = 0;
|
||||
for (mask = 0x80; byte & mask; mask >>= 1) {
|
||||
len++;
|
||||
}
|
||||
assert(len > 1 && len < 7);
|
||||
cp = byte & (mask - 1);
|
||||
for (i = 1; i < len; i++) {
|
||||
byte = i < n ? *p : 0;
|
||||
if ((byte & 0xC0) != 0x80) {
|
||||
cp = -1; /* continuation byte missing */
|
||||
goto out;
|
||||
}
|
||||
p++;
|
||||
cp <<= 6;
|
||||
cp |= byte & 0x3F;
|
||||
}
|
||||
if (cp > 0x10FFFF) {
|
||||
cp = -1; /* beyond Unicode range */
|
||||
} else if ((cp >= 0xFDD0 && cp <= 0xFDEF)
|
||||
|| (cp & 0xFFFE) == 0xFFFE) {
|
||||
cp = -1; /* noncharacter */
|
||||
} else if (cp >= 0xD800 && cp <= 0xDFFF) {
|
||||
cp = -1; /* surrogate code point */
|
||||
} else if (cp < min_cp[len - 2] && !(cp == 0 && len == 2)) {
|
||||
cp = -1; /* overlong, not \xC0\x80 */
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
*end = (char *)p;
|
||||
return cp;
|
||||
}
|
@ -1960,19 +1960,6 @@
|
||||
#define iwmmxt_store_reg iwmmxt_store_reg_x86_64
|
||||
#define __jit_debug_descriptor __jit_debug_descriptor_x86_64
|
||||
#define __jit_debug_register_code __jit_debug_register_code_x86_64
|
||||
#define json_lexer json_lexer_x86_64
|
||||
#define json_lexer_destroy json_lexer_destroy_x86_64
|
||||
#define json_lexer_feed json_lexer_feed_x86_64
|
||||
#define json_lexer_feed_char json_lexer_feed_char_x86_64
|
||||
#define json_lexer_flush json_lexer_flush_x86_64
|
||||
#define json_lexer_init json_lexer_init_x86_64
|
||||
#define json_message_parser_destroy json_message_parser_destroy_x86_64
|
||||
#define json_message_parser_feed json_message_parser_feed_x86_64
|
||||
#define json_message_parser_flush json_message_parser_flush_x86_64
|
||||
#define json_message_parser_init json_message_parser_init_x86_64
|
||||
#define json_message_process_token json_message_process_token_x86_64
|
||||
#define json_parser_parse json_parser_parse_x86_64
|
||||
#define json_parser_parse_err json_parser_parse_err_x86_64
|
||||
#define kvm_to_cpreg_id kvm_to_cpreg_id_x86_64
|
||||
#define last_ram_offset last_ram_offset_x86_64
|
||||
#define ldl_be_p ldl_be_p_x86_64
|
||||
@ -2115,7 +2102,6 @@
|
||||
#define mktimegm mktimegm_x86_64
|
||||
#define module_call_init module_call_init_x86_64
|
||||
#define module_load module_load_x86_64
|
||||
#define mod_utf8_codepoint mod_utf8_codepoint_x86_64
|
||||
#define mpidr_cp_reginfo mpidr_cp_reginfo_x86_64
|
||||
#define mpidr_read mpidr_read_x86_64
|
||||
#define msr_mask msr_mask_x86_64
|
||||
@ -2229,7 +2215,6 @@
|
||||
#define parse_array parse_array_x86_64
|
||||
#define parse_error parse_error_x86_64
|
||||
#define parse_escape parse_escape_x86_64
|
||||
#define parse_json parse_json_x86_64
|
||||
#define parse_keyword parse_keyword_x86_64
|
||||
#define parse_literal parse_literal_x86_64
|
||||
#define parse_object parse_object_x86_64
|
||||
@ -2538,12 +2523,6 @@
|
||||
#define qmp_output_visitor_cleanup qmp_output_visitor_cleanup_x86_64
|
||||
#define qmp_output_visitor_new qmp_output_visitor_new_x86_64
|
||||
#define qobject_decref qobject_decref_x86_64
|
||||
#define qobject_from_json qobject_from_json_x86_64
|
||||
#define qobject_from_jsonf qobject_from_jsonf_x86_64
|
||||
#define qobject_from_jsonv qobject_from_jsonv_x86_64
|
||||
#define qobject_incref qobject_incref_x86_64
|
||||
#define qobject_to_json qobject_to_json_x86_64
|
||||
#define qobject_to_json_pretty qobject_to_json_pretty_x86_64
|
||||
#define qobject_to_qbool qobject_to_qbool_x86_64
|
||||
#define qobject_to_qdict qobject_to_qdict_x86_64
|
||||
#define qobject_to_qfloat qobject_to_qfloat_x86_64
|
||||
@ -3021,9 +3000,6 @@
|
||||
#define tlb_set_dirty1 tlb_set_dirty1_x86_64
|
||||
#define tlb_unprotect_code_phys tlb_unprotect_code_phys_x86_64
|
||||
#define tlb_vaddr_to_host tlb_vaddr_to_host_x86_64
|
||||
#define to_json to_json_x86_64
|
||||
#define to_json_dict_iter to_json_dict_iter_x86_64
|
||||
#define to_json_list_iter to_json_list_iter_x86_64
|
||||
#define token_get_type token_get_type_x86_64
|
||||
#define token_get_value token_get_value_x86_64
|
||||
#define token_is_escape token_is_escape_x86_64
|
||||
@ -3104,7 +3080,6 @@
|
||||
#define vmsa_ttbcr_reset vmsa_ttbcr_reset_x86_64
|
||||
#define vmsa_ttbcr_write vmsa_ttbcr_write_x86_64
|
||||
#define vmsa_ttbr_write vmsa_ttbr_write_x86_64
|
||||
#define wchar_to_utf8 wchar_to_utf8_x86_64
|
||||
#define write_cpustate_to_list write_cpustate_to_list_x86_64
|
||||
#define write_list_to_cpustate write_list_to_cpustate_x86_64
|
||||
#define write_raw_cp_reg write_raw_cp_reg_x86_64
|
||||
|
Loading…
Reference in New Issue
Block a user