summaryrefslogtreecommitdiff
path: root/src/json.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix integer overflow check in json codePaul Eggert2018-12-311-1/+1
| | | | | * src/json.c (json_to_lisp): Check for ptrdiff_t overflow, not fixnum overflow.
* Update more copyright yearsPaul Eggert2018-12-311-1/+1
| | | | | | | | Update some other copyright years automatically, by running: Run 'UPDATE_COPYRIGHT_YEAR=2019 \ UPDATE_COPYRIGHT_USE_INTERVALS=1 \ UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79 admin/update-copyright' followed by 'admin/merge-gnulib'.
* Add make_vector and make_nil_vectorPaul Eggert2018-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the callers a bit easier to read, and doubtless improves efficiency very slightly. It also simplifies possible future changes to allow bignum indexes to buffers. * src/alloc.c (allocate_vectorlike): Prefer ptrdiff_t to size_t when either will do. (make_vector): New function. (Fmake_vector): Use it. * src/buffer.c (syms_of_buffer): * src/bytecode.c (syms_of_bytecode): * src/category.c (Fmake_category_table, init_category_once): * src/ccl.c (syms_of_ccl): * src/character.c (syms_of_character): * src/charset.c (Fdefine_charset_internal) (Ffind_charset_region, Ffind_charset_string): * src/chartab.c (copy_char_table): * src/coding.c (Fdefine_coding_system_internal, syms_of_coding): * src/composite.c (get_composition_id, Fcomposition_get_gstring): * src/composite.h (LGLYPH_NEW): * src/fns.c (concat, Flocale_info, make_hash_table): * src/font.c (font_otf_ValueRecord, font_otf_anchor) (build_style_table, syms_of_font): * src/fontset.c (RFONT_DEF_NEW, fontset_find_font) (dump_fontset, syms_of_fontset): * src/image.c (xpm_make_color_table_v): * src/keyboard.c (modify_event_symbol, menu_bar_items) (parse_menu_item, parse_tool_bar_item, init_tool_bar_items) (syms_of_keyboard): * src/keymap.c (Fdefine_key, describe_map, describe_vector): * src/lread.c (read_vector): * src/macfont.m (macfont_shape): * src/menu.c (init_menu_items): * src/nsfns.m (ns_make_monitor_attribute_list): * src/process.c (conv_sockaddr_to_lisp, network_interface_info): * src/profiler.c (make_log): * src/window.c (Fcurrent_window_configuration): * src/xdisp.c (with_echo_area_buffer_unwind_data) (format_mode_line_unwind_data): * src/xfaces.c (Finternal_make_lisp_face) (Fface_attributes_as_vector): * src/xfns.c (x_make_monitor_attribute_list) (Fx_display_monitor_attributes_list): * src/xfont.c (syms_of_xfont): * src/xselect.c (x_handle_dnd_message): * src/xwidget.c (save_script_callback): Prefer make_nil_vector (N) to Fmake_vector (make_fixnum (N), Qnil). * src/callint.c (Fcall_interactively): * src/charset.c (load_charset_map): * src/chartab.c (Fmake_char_table, uniprop_encode_value_numeric): * src/composite.c (get_composition_id) * src/dispnew.c (Fframe_or_buffer_changed_p) (syms_of_display): * src/fns.c (make_hash_table, maybe_resize_hash_table): * src/font.c (font_style_to_value): * src/fontset.c (FONTSET_ADD, fontset_add): * src/json.c (json_to_lisp): * src/keymap.c (syms_of_keymap): * src/lread.c (init_obarray): * src/profiler.c (make_log, Fprofiler_cpu_log): * src/term.c (term_get_fkeys_1): Prefer make_vector (N, V) to Fmake_vector (make_fixnum (N), V). * src/font.c (build_style_table): * src/macfont.m (macfont_shape): * src/process.c (conv_sockaddr_to_lisp, network_interface_info): Prefer make_uninit_vector if the vector will be initialized soon. * src/lisp.h (make_nil_vector): New function.
* Improve 'json-insert' so it doesn't cons a string from JSONEli Zaretskii2018-10-131-13/+89
| | | | | | | | | | | | | | | | | | | | * src/json.c (struct json_buffer_and_size): New member inserted_bytes. (json_insert): Instead of creating a string and inserting it into the current buffer, copy the unibyte text into the gap. (struct json_insert_data): New member inserted_bytes. (json_insert_callback): Update commentary. Pass the inserted_bytes value to json_insert and on its return copy the updated value back into DATA. (Fjson_insert): Decode the unibyte text inserted into the gap. Call before-change-functions and after-change-functions only once, before and after processing the insertion of the entire JSON representation. * test/src/json-tests.el (json-insert/throw): Adapt to the modified implementation of json-insert: it no longer calls the modification hooks once for each inserted chunk of JSON representation.
* Use new function overflow_error in a few placesPhilipp Stephani2018-09-211-2/+2
| | | | | | * src/emacs-module.c (module_make_global_ref, module_funcall) (module_make_string, Fmodule_load): * src/json.c (json_to_lisp): Use overflow_error.
* Support bignums when serializing JSONPhilipp Stephani2018-09-211-3/+7
| | | | | * src/json.c (lisp_to_json): Support bignums. * test/src/json-tests.el (json-serialize/bignum): New test.
* Improve bignum support for system typesPaul Eggert2018-08-271-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use bignums when Emacs converts to and from system types like off_t for file sizes whose values can exceed fixnum range. Formerly, Emacs sometimes generted floats and sometimes ad-hoc conses of integers. Emacs still accepts floats and conses for these system types, in case some stray Lisp code is generating them, though this usage is obsolescent. * doc/lispref/files.texi (File Attributes): * doc/lispref/hash.texi (Defining Hash): * doc/lispref/nonascii.texi (Character Sets): * doc/lispref/os.texi (User Identification): * doc/lispref/processes.texi (System Processes): * etc/NEWS: Document changes. * src/bignum.c (mpz_set_uintmax, make_biguint) (mpz_set_uintmax_slow, bignum_to_intmax, bignum_to_uintmax): New functions. (mpz_set_intmax_slow): Implement via mpz_limbs_write, to avoid the need for an extra pass through a negative number. * src/charset.c (Fencode_char): * src/composite.h (LGLYPH_SET_CODE): * src/dired.c (file_attributes): * src/dosfns.c, src/w32.c (list_system_processes) (system_process_attributes): * src/editfns.c (init_editfns, Fuser_uid, Fuser_real_uid) (Fgroup_gid, Fgroup_real_gid, Femacs_pid): * src/emacs-module.c (check_vec_index): * src/fns.c (Fsafe_length): * src/process.c (record_deleted_pid, Fprocess_id): * src/sysdep.c (list_system_processes, system_process_attributes): * src/xselect.c (x_own_selection, selection_data_to_lisp_data): * src/xterm.c (set_wm_state): * src/inotify.c (inotifyevent_to_event, add_watch) (inotify_callback): If an integer is out of fixnum range, use a bignum instead of converting it to a float or a cons of integers. * src/coding.c (Fdefine_coding_system_internal): * src/frame.c (frame_windows_min_size) (x_set_frame_parameters): * src/fringe.c (Fdefine_fringe_bitmap): * src/nsterm.m (mouseDown:): * src/syntax.c (find_defun_start): * src/w32fns.c (x_set_undecorated, w32_createwindow) (w32_wnd_proc, Fx_create_frame, Fx_show_tip) (w32_console_toggle_lock_key): * src/w32inevt.c (key_event): * src/w32proc.c (Fw32_get_locale_info): Do not mishandle floats by treating their addresses as their values. * src/data.c (store_symval_forwarding): * src/gnutls.c (Fgnutls_error_fatalp, Fgnutls_error_string): * src/keyboard.c (command_loop_1, make_lispy_event): * src/lread.c (read_filtered_event, read1) (substitute_object_recurse): * src/window.c (Fcoordinates_in_window_p, Fwindow_at) (window_resize_apply, Fset_window_vscroll): * src/xdisp.c (handle_single_display_spec, try_scrolling) (redisplay_window, calc_pixel_width_or_height) (calc_line_height_property, on_hot_spot_p): * src/xfaces.c (check_lface_attrs): * src/xselect.c (x_get_local_selection, cons_to_x_long) (lisp_data_to_selection_data, clean_local_selection_data) (x_check_property_data, x_fill_property_data): (x_send_client_event): Do not reject bignums. * src/data.c (INTBIG_TO_LISP, intbig_to_lisp) (uintbig_to_lisp): Remove. All uses removed. * src/data.c (cons_to_unsigned, cons_to_signed): * src/dbusbind.c (xd_signature, xd_extract_signed) (xd_extract_unsigned): * src/dispnew.c (sit_for): * src/dosfns.c, src/w32.c (system_process_attributes): * src/editfns.c (Fuser_full_name): * src/fileio.c (file_offset): * src/fileio.c (write_region): * src/font.c (font_unparse_xlfd, font_open_for_lface, Fopen_font): * src/frame.c (x_set_screen_gamma): * src/frame.h (NUMVAL, FRAME_PIXEL_X_FROM_CANON_X) (FRAME_PIXEL_Y_FROM_CANON_Y): * src/image.c (parse_image_spec, x_edge_detection) (compute_image_size): * src/json.c (json_to_lisp): * src/lcms.c (PARSE_LAB_LIST_FIELD, Flcms_cie_de2000) (PARSE_XYZ_LIST_FIELD, PARSE_JCH_LIST_FIELD) (PARSE_JAB_LIST_FIELD, PARSE_VIEW_CONDITION_FLOAT) (Flcms_temp_to_white_point): * src/nsimage.m (ns_load_image, setSizeFromSpec): * src/process.c (Fsignal_process, handle_child_signal): * src/sysdep.c (system_process_attributes): * src/xdisp.c (calc_line_height_property): Handle bignums. * src/data.c (Fnumber_to_string): Use proper predicate name in signal if the argument is not a number. * src/lisp.h (make_uint): New function. (INT_TO_INTEGER): New macro. (FIXED_OR_FLOATP, CHECK_FIXNUM_OR_FLOAT) (CHECK_FIXNUM_OR_FLOAT_COERCE_MARKER, INTEGER_TO_CONS) (make_fixnum_or_float): Remove; no longer used. * src/nsfns.m, src/w32fns.c, src/xfns.c (Fx_create_frame): Reject floating-point min-width or min-height. * src/process.c (handle_child_signal): Do not worry about floating-point pids, as they are no longer generated.
* Modularize bignums betterPaul Eggert2018-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/bignum.c, src/bignum.h: New files. Only modules that need to know how bignums are implemented should include bignum.h. Currently these are alloc.c, bignum.c (of course), data.c, emacs.c, emacs-module.c, floatfns.c, fns.c, print.c. * src/Makefile.in (base_obj): Add bignum.o. * src/alloc.c (make_bignum_str): Move to bignum.c. (make_number): Remove; replaced by bignum.c’s make_integer. All callers changed. * src/conf_post.h (ARG_NONNULL): New macro. * src/json.c (json_to_lisp): Use it. * src/data.c (Fnatnump): Move NATNUMP’s implementation here from lisp.h. * src/data.c (Fnumber_to_string): * src/editfns.c (styled_format): Move conversion of string to bignum to bignum_to_string, and call it here. * src/emacs-module.c (module_make_integer): * src/floatfns.c (Fabs): Simplify by using make_int. * src/emacs.c: Include bignum.h, to expand its inline fns. * src/floatfns.c (Ffloat): Simplify by using XFLOATINT. (rounding_driver): Simplify by using double_to_bignum. (rounddiv_q): Clarify use of temporaries. * src/lisp.h: Move decls that need to know bignum internals to bignum.h. Do not include gmp.h or mini-gmp.h; that is now bignum.h’s job. (GMP_NUM_BITS, struct Lisp_Bignum, XBIGNUM, mpz_set_intmax): Move to bignum.h. (make_int): New function. (NATNUMP): Remove; all callers changed to use Fnatnump. (XFLOATINT): If arg is a bignum, use bignum_to_double, so that bignum internals are not exposed here. * src/print.c (print_vectorlike): Use SAFE_ALLOCA to avoid the need for a record_unwind_protect_ptr.
* Define get_proc_addr in Cygwin-w32 buildAndy Moreton2018-08-201-0/+1
| | | | | | | | | | | | | * src/w32common.h (get_proc_addr, DEF_DLL_FN, LOAD_DLL_FN): Move definitions here from src/w32.h. * src/decompress.c [WINDOWSNT]: * src/gnutls.c [WINDOWSNT]: * src/image.c [WINDOWSNT]: * src/json.c [WINDOWSNT]: * src/lcms.c [WINDOWSNT]: * src/w32font.c [WINDOWSNT]: * src/w32uniscribe.c: * src/xml.c [WINDOWSNT]: Include w32common.h.
* Merge remote-tracking branch 'origin/master' into feature/bignumTom Tromey2018-08-091-3/+8
|\
| * Avoid segfaults in jason-serialize on MS-WindowsEli Zaretskii2018-08-071-2/+7
| | | | | | | | | | | | * src/json.c (Fjson_serialize): Free the string with 'json_free', not 'free', since it was allocated with 'json_malloc'. (Bug#32381)
| * ; * src/json.c: Fix typo in license statementPhilipp Stephani2018-07-301-1/+1
| |
* | More macro renamings for bignumTom Tromey2018-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/alloc.c, src/bidi.c, src/buffer.c, src/buffer.h, src/bytecode.c, src/callint.c, src/callproc.c, src/casefiddle.c, src/casetab.c, src/category.c, src/ccl.c, src/character.c, src/character.h, src/charset.c, src/charset.h, src/chartab.c, src/cmds.c, src/coding.c, src/composite.c, src/composite.h, src/data.c, src/dbusbind.c, src/decompress.c, src/dired.c, src/dispextern.h, src/dispnew.c, src/disptab.h, src/doc.c, src/dosfns.c, src/editfns.c, src/emacs-module.c, src/emacs.c, src/eval.c, src/fileio.c, src/floatfns.c, src/fns.c, src/font.c, src/font.h, src/fontset.c, src/frame.c, src/frame.h, src/fringe.c, src/ftcrfont.c, src/ftfont.c, src/gfilenotify.c, src/gnutls.c, src/gtkutil.c, src/image.c, src/indent.c, src/insdel.c, src/intervals.c, src/json.c, src/keyboard.c, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/syntax.h, src/sysdep.c, src/term.c, src/termhooks.h, src/textprop.c, src/undo.c, src/w32.c, src/w32console.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32term.h, src/w32uniscribe.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xml.c, src/xrdb.c, src/xselect.c, src/xsettings.c, src/xterm.c, src/xwidget.c Rename XINT->XFIXNUM, XFASTINT->XFIXNAT, XUINT->XUFIXNUM.
* | Rename integerp->fixnum, etc, in preparation for bignumsTom Tromey2018-07-121-5/+5
|/ | | | | | | | | | | | | | | | | * src/json.c, src/keyboard.c, src/keyboard.h, src/keymap.c, src/kqueue.c, src/lcms.c, src/lisp.h, src/lread.c, src/macros.c, src/marker.c, src/menu.c, src/minibuf.c, src/msdos.c, src/print.c, src/process.c, src/profiler.c, src/search.c, src/sound.c, src/syntax.c, src/sysdep.c, src/term.c, src/terminal.c, src/textprop.c, src/undo.c, src/w16select.c, src/w32.c, src/w32console.c, src/w32cygwinx.c, src/w32fns.c, src/w32font.c, src/w32inevt.c, src/w32proc.c, src/w32select.c, src/w32term.c, src/w32uniscribe.c, src/widget.c, src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xfont.c, src/xftfont.c, src/xmenu.c, src/xrdb.c, src/xselect.c, src/xterm.c, src/xwidget.c: Rename INTEGERP->FIXNUM, make_number->make_fixnum, CHECK_NUMBER->CHECK_FIXNUM, make_natnum->make_fixed_natum, NUMBERP->FIXED_OR_FLOATP, NATNUMP->FIXNATP, CHECK_NATNUM->CHECK_FIXNAT.
* Minor doc string fixes in json.cEli Zaretskii2018-06-161-2/+3
| | | | * src/json.c (Fjson_serialize, Fjson_insert): Fix 'usage'.
* Also allow custom false and null when serializing to JSONJoão Távora2018-06-151-82/+113
| | | | | | | | | | | | | | | | | * doc/lispref/text.texi (Parsing JSON): Describe new arguments of json-serialize and json-insert. * src/json.c (enum json_object_type, struct json_configuration): Move up in file before first usage. (lisp_to_json_toplevel, lisp_to_json_toplevel_1, lisp_to_json): Accept a struct json_configuration*. (Fjson_serialize, Fjson_insert): Accept multiple args. (json_parse_args): Accept new boolean configure_object_type. * test/src/json-tests.el (json-serialize, json-insert): Update forward decls. (json-parse-with-custom-null-and-false-objects): Add assertions for json-serialize.
* Support custom null and false objects when parsing JSONJoão Távora2018-06-151-54/+82
| | | | | | | | | | | | | | | | | | * doc/lispref/text.texi (Parsing JSON): Describe new :null-object and :false-object kwargs to json-parse-string and json-parse-buffer. * src/json.c (struct json_configuration): New type. (json_to_lisp): Accept a struct json_configuration* param. (json_parse_args): Rename from json_parse_object_type. (Fjson_parse_string): Rework docstring. (Fjson_parse_string, Fjson_parse_buffer): Update call to json_to_lisp. (syms_of_json): Two new syms, QCnull_object and QCfalse_object. * test/src/json-tests.el (json-parse-with-custom-null-and-false-objects): New test.
* Fix pointer misuse in JSON parserPaul Eggert2018-06-091-32/+28
| | | | | | | | | * src/json.c (lisp_to_json_toplevel_1): Fix pointer misuse not caught by C type checking (json_t ** converted to void * where the program expected json_t *). Bug caught on Fedora 28 x86-64 via './configure CFLAGS="-g3 -O2 -fsanitize=address" CANNOT_DUMP=yes'. Avoid similar problems in the future by rewriting to use json_t * instead of json_t **.
* Accept plists when serializing and parsing JSONJoão Távora2018-06-071-24/+73
| | | | | | | | | | | | | | | | * doc/lispref/text.texi (Parsing JSON): Mention plist support. * src/json.c (lisp_to_json_toplevel_1): Serialize plists to json. (Fjson_serialize): Mention plists in docstring. (enum json_object_type): Add json_object_plist. (json_to_lisp): Parse JSON into plists. (json_parse_object_type): Consider plists. (Fjson_parse_string): Mention plists in docstring. (syms_of_json): New Qplist sym_of_json. (lisp_to_json): Update comment. * test/src/json-tests.el (json-serialize/object) (json-parse-string/object): New plist tests.
* ; Fix arglist doc of json parse functionsBasil L. Contovounesios2018-02-031-2/+2
| | | | | * src/json.c (Fjson_parse_string, Fjson_parse_buffer): Fix "usage:" arglist doc.
* Update copyright year to 2018Paul Eggert2018-01-011-1/+1
| | | | Run admin/update-copyright.
* Improve error reporting when serializing non-Unicode strings to JSONPhilipp Stephani2017-12-301-8/+25
| | | | | | | | | | | | | * src/coding.c (utf8_string_p): New helper function. (syms_of_coding) <utf-8-unix>: Move from json.c. * src/json.c (json_check_utf8): New helper function. (lisp_to_json_toplevel_1, lisp_to_json): Use it. To save a bit of time, check for invalid UTF-8 strings only after encountering an error, since Jansson already rejects them. * test/src/json-tests.el (json-serialize/invalid-unicode): Adapt expected error symbol.
* Fix MS-Windows build broken by recent changes in json.cChris Zheng2017-12-251-0/+3
| | | | | | | | * src/json.c [WINDOWSNT] (fn_json_object_get): Define. (init_json_functions) [WINDOWSNT]: Load json_object_get from DLL. (Bug#29848) Copyright-paperwork-exempt: yes
* Accept alists when serializing JSONPhilipp Stephani2017-12-241-10/+47
| | | | | | | | | | | | | * src/json.c (lisp_to_json_toplevel_1): Also accept alists representing objects. * src/json.c (Fjson_serialize): Update docstring. * test/src/json-tests.el (json-serialize/object): Add unit tests for serializing alists. * doc/lispref/text.texi (Parsing JSON): Document that serialization functions accept alists.
* JSON serialization: reject duplicate keys in hashtablesPhilipp Stephani2017-12-241-1/+6
| | | | | | | | * src/json.c (lisp_to_json_toplevel_1): Reject duplicate keys in hashtables. * test/src/json-tests.el (json-serialize/object-with-duplicate-keys): Add unit tests.
* JSON: improve some commentsPhilipp Stephani2017-12-221-5/+8
| | | | | * src/json.c (json_make_string, json_build_string): Document why these functions are OK as-is.
* Define helper functions only if neededPhilipp Stephani2017-12-201-1/+7
| | | | | | * src/json.c (JSON_HAS_ERROR_CODE): New define. (json_parse_error): Use it. (json_has_prefix, json_has_suffix): Define only if needed.
* * src/json.c (json_parse_error): Fix embarrassing bug.Philipp Stephani2017-12-201-0/+3
|
* Use Jansson's error code support if availablePhilipp Stephani2017-12-191-3/+12
| | | | | * src/json.c (json_parse_error): Use Jansson's error code support if available.
* Allow JSON parser functions to return alistsPhilipp Stephani2017-12-191-30/+99
| | | | | | | | | | | | | * src/json.c (Fjson_parse_string, Fjson_parse_buffer): Give these functions a keyword argument to specify the return type for JSON objects. (json_to_lisp): Convert objects to alists if requested. (json_parse_object_type): New helper function to parse keyword arguments. * test/src/json-tests.el (json-parse-string/object): Add a unit test. * doc/lispref/text.texi (Parsing JSON): Document new functionality.
* ; Add a couple of encoding-related FIXMEs to json.cPhilipp Stephani2017-12-191-0/+8
| | | | | | * src/json.c (json_make_string, json_build_string, json_encode) (lisp_to_json_toplevel_1, lisp_to_json): Add FIXMEs for problematic string error reporting.
* ; * src/json.c (lisp_to_json): Inline an unnecessary variable.Philipp Stephani2017-12-191-2/+1
|
* ; Add comments about potential future Jansson flagsPhilipp Stephani2017-12-191-0/+4
| | | | | * src/json.c (Fjson_serialize, Fjson_insert): Add comments about flags that we might potentially add in the future.
* ; * src/json.c: Convert non-ASCII quotes to ASCII characters.Eli Zaretskii2017-12-141-6/+6
|
* Support dynamic loading of libjansson on MS-WindowsEli Zaretskii2017-12-101-0/+181
| | | | | | | | | | | | | | | | | | | | | * src/json.c [WINDOWSNT]: Define fn_* function pointers to jansson functions. (json_delete) [WINDOWSNT]: A wrapper around fn_json_delete, needed by json_decref. (init_json_functions) [WINDOWSNT]: New function. (Fjson_serialize, Fjson_insert, Fjson_parse_string) (Fjson_parse_buffer) [WINDOWSNT]: Call init_json_functions if needed, and record JSON in Vlibrary_cache. * src/emacs.c (main): Don't call init_json on WINDOWSNT. * src/w32fns.c (syms_of_w32fns): DEFSYM "json". * lisp/term/w32-win.el (dynamic-library-alist): Add JSON DLL to the list. * configure.ac (HAVE_JSON): Empty JSON_LIBS for MinGW. * nt/INSTALL.W64: * nt/INSTALL: Add information about libjansson.
* Implement native JSON support using JanssonPhilipp Stephani2017-12-101-0/+576
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: New option --with-json. * src/json.c (Fjson_serialize, Fjson_insert, Fjson_parse_string) (Fjson_parse_buffer): New defuns. (json_malloc, json_free, json_has_prefix, json_has_suffix) (json_make_string, json_build_string, json_encode) (json_out_of_memory, json_parse_error) (json_release_object, check_string_without_embedded_nulls, json_check) (lisp_to_json, lisp_to_json_toplevel, lisp_to_json_toplevel_1) (json_insert, json_insert_callback, json_to_lisp) (json_read_buffer_callback, Fjson_parse_buffer, define_error): New helper functions. (init_json, syms_of_json): New file. * src/lisp.h: Declaration for init_json and syms_of_json. * src/emacs.c (main): Enable JSON functions. * src/eval.c (internal_catch_all, internal_catch_all_1): New helper functions to catch all signals. (syms_of_eval): Add uninterned symbol to signify out of memory. * src/Makefile.in (JSON_LIBS, JSON_CFLAGS, JSON_OBJ, EMACS_CFLAGS) (base_obj, LIBES): Compile json.c if --with-json is enabled. * test/src/json-tests.el (json-serialize/roundtrip) (json-serialize/object, json-parse-string/object) (json-parse-string/string, json-serialize/string) (json-parse-string/incomplete, json-parse-string/trailing) (json-parse-buffer/incomplete, json-parse-buffer/trailing): New unit tests. * doc/lispref/text.texi (Parsing JSON): New manual section.
* Revert "Implement native JSON support using Jansson"Philipp Stephani2017-09-181-469/+0
| | | | This reverts commit cb99cf5a99680af7dc2c49fdf5b840d1ff4dd928.
* Implement native JSON support using JanssonPhilipp Stephani2017-09-181-0/+469
* configure.ac: New option --with-json. * src/json.c (Fjson_serialize, Fjson_insert, Fjson_parse_string) (Fjson_parse_buffer): New defuns. (json_out_of_memory, json_parse_error, json_release_object) (check_string_without_embedded_nulls, json_check, lisp_to_json) (json_insert, json_insert_callback, json_to_lisp) (json_read_buffer_callback, Fjson_parse_buffer, define_error): New helper function. (syms_of_json): New file. * src/lisp.h: Declaration for syms_of_json. * src/emacs.c (main): Enable JSON functions. * src/Makefile.in (JSON_LIBS, JSON_CFLAGS, JSON_OBJ, EMACS_CFLAGS) (base_obj, LIBES): Compile json.c if --with-json is enabled. * test/src/json-tests.el (json-serialize/roundtrip) (json-serialize/object, json-parse-string/object): New unit tests.