[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/aptel/dynamic-modules-rc3 4000103 20/35: yaml modu
From: |
Noah Friedman |
Subject: |
[Emacs-diffs] feature/aptel/dynamic-modules-rc3 4000103 20/35: yaml module: add `yaml-parse-string'. |
Date: |
Mon, 8 May 2017 19:46:29 -0400 (EDT) |
branch: feature/aptel/dynamic-modules-rc3
commit 40001035c6c9c597cda9507450ac7ae5cce44372
Author: Aurélien Aptel <address@hidden>
Commit: Aurélien Aptel <address@hidden>
yaml module: add `yaml-parse-string'.
---
modules/yaml/yaml.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/modules/yaml/yaml.c b/modules/yaml/yaml.c
index 4096205..6d2647f 100644
--- a/modules/yaml/yaml.c
+++ b/modules/yaml/yaml.c
@@ -56,7 +56,7 @@ parse_element (struct context *ctx)
case YAML_SCALAR_EVENT:
res = parse_scalar (ctx, &e);
if (s)
- Fputhash (make_string (s, strlen (s)), res, ctx->anchors);
+ Fputhash (make_string (s, strlen (s)), res, ctx->anchors);
break;
case YAML_SEQUENCE_START_EVENT:
@@ -143,6 +143,25 @@ context_init (struct context *ctx)
ctx->anchors = Fmake_hash_table (2, args);
}
+EXFUN (Fyaml_parse_string, 1);
+DEFUN ("yaml-parse-string", Fyaml_parse_string, Syaml_parse_string, 1, 1, 0,
+ doc: "Parse STRING as yaml.")
+ (Lisp_Object string)
+{
+ struct context ctx;
+ Lisp_Object res = Qnil;
+
+ context_init (&ctx);
+
+ yaml_parser_initialize (&ctx.p);
+ yaml_parser_set_input_string (&ctx.p, SDATA (string), SBYTES (string));
+ res = parse_element (&ctx);
+ yaml_parser_delete (&ctx.p);
+
+ return res;
+}
+
+
EXFUN (Fyaml_parse, 0);
DEFUN ("yaml-parse", Fyaml_parse, Syaml_parse, 0, 0, 0,
doc: "Parse current buffer as yaml.")
@@ -206,6 +225,7 @@ void init ()
DEFSYM (Qyaml, "yaml");
defsubr (&Syaml_parse_file);
+ defsubr (&Syaml_parse_string);
defsubr (&Syaml_parse);
Fprovide (Qyaml, Qnil);
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 19705b8 06/35: alloc.c: protect doc field from GC., (continued)
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 19705b8 06/35: alloc.c: protect doc field from GC., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 1b98be3 09/35: move fmod module in modules/fmod/., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 772cb16 01/35: add libltdl configure option/dependency., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 6478a32 03/35: intern literal strings as regular string., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 b8286d2 08/35: doc.c: don't prefix doc path by ../etc/ for modules, Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 89c8287 11/35: opaque: add comments., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 79e2c28 05/35: change Subr doc field from char* to Lisp_Object., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 8254721 16/35: make `load' look for and handle dynamic modules., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 092a6d2 22/35: configure.ac: dynamic modules off by default., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 0cfb066 07/35: doc.c: use DOC format sanity checks instead of bytecompiled checks on module doc files., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 4000103 20/35: yaml module: add `yaml-parse-string'.,
Noah Friedman <=
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 4e1ad37 19/35: new yaml parsing module using libyaml, Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 8147699 15/35: fix docstring., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 bfe16af 10/35: new module: opaque, Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 582704c 14/35: curl: use url arg., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 9330ca6 12/35: new module: elisp, Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 9da7346 13/35: new module: curl. basic URL fetcher working., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 c7248ea 21/35: yaml module: rename `yaml-parse' to `yaml-parse-buffer'., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 a95e032 17/35: update modules examples with `provide' call., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 1959b65 18/35: use `load-module-suffixes' as a source of module suffixes., Noah Friedman, 2017/05/08
- [Emacs-diffs] feature/aptel/dynamic-modules-rc3 1da9b91 24/35: opaque module: rename Qc variable to Qc_ due to macro collision, Noah Friedman, 2017/05/08