Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
aclocal.m4
autom4te.cache
configure
libtool
*.la
*.lo
*.o
*.pc
.deps
.hg
.libs
CMakeCache.txt
CMakeFiles/
Makefile
Makefile.in
stamp-h1
TAGS
aclocal.m4
autom4te.cache
cmake_install.cmake
config
config.h
config.h.in
config.log
config.status
configure
example-deconstructor
example-deconstructor-alt
example-reformatter
example-reformatter-alt
libtool
libyaml.a
run-dumper
run-emitter
run-loader
run-parser
run-scanner
.deps
.libs
*.o
*.lo
*.la
*.pc
stamp-h1
tests/test-reader
tests/test-reader.log
tests/test-reader.trs
tests/test-suite.log
tests/test-version
tests/test-version.log
tests/test-version.trs
44 changes: 44 additions & 0 deletions .hgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax: glob
aclocal.m4
autom4te.cache
configure
libtool
Makefile
Makefile.in
stamp-h1
config
config.h
config.h.in
config.log
config.status
example-deconstructor
example-deconstructor-alt
example-reformatter
example-reformatter-alt
run-dumper
run-emitter
run-loader
run-parser
run-scanner
.deps
.libs
*.o
*.lo
*.la
*.pc

.git
.gitignore
TAGS

CMakeCache.txt
CMakeFiles/
cmake_install.cmake
libyaml.a
tests/test-reader
tests/test-reader.log
tests/test-reader.trs
tests/test-suite.log
tests/test-version
tests/test-version.log
tests/test-version.trs
10 changes: 10 additions & 0 deletions .hgtags
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
24a3166c80398babe9e92378ca933912b7c63565 0.1.1
70885badb940fdc774fc2179afbf4a4a16106a49 0.0.1
754e22e32e2bfe8524633d5241940b903a401441 0.1.3
754e22e32e2bfe8524633d5241940b903a401441 0.1.4
d19de7b14cd02c4861e3ed5503c06a48c4ab2e5b 0.1.2
754e22e32e2bfe8524633d5241940b903a401441 0.1.4
3e6507fa0c26d20c09f8f468f2bd04aa2fd1b5b5 0.1.4
a5142b24428b1458513eff73591976eefca1a669 0.1.5
bce8b60f0b9af69fa9fab3093d0a41ba243de048 0.1.6
88bd944837cd71cdb55458dad8f43465495455b2 0.1.7
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ compiler:
- clang
- gcc

script:
- ./bootstrap
- ./configure
- make test
script: ./bootstrap && ./configure && make && make check
5 changes: 5 additions & 0 deletions bootstrap-perl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

exec autoreconf -fvi
# perl adds a lot of warnings
export CFLAGS='-Wall -Wunused-parameter -Wc++-compat'
36 changes: 36 additions & 0 deletions development/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
= libyaml Development

Welcome!

The directory contains extra content for development of libyaml. It should only
exist on branches and should not be merged to master.

All libyaml development should be done on branches. GitHub commit/push will be
granted liberally. Stop by #yaml on irc.freenode.net.

== Quick start

$ git clone https://github.com/yaml/libyaml.git
$ cd libyaml
$ ./developent/test

== Testing

Testing libyaml requires the pyyaml repository. The tests are all in the
pyyamlrepository.

The following script will make sure that everything is set up correctly and run
the tests for you:

$ ./developent/test

== PyYAML

Note that changes to libyaml should be replicated in ../pyyaml/lib and
../pyyaml/lib3 for Python and Python3 respectively.

== NOTE

There is an unsolved problem where the build system will pick up a system
libyaml instead of the development one. For now make sure there is no system
libyaml. Patches (very much) welcome.
2 changes: 2 additions & 0 deletions development/ToDo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- When there is a system libyaml available, pyyaml will link to that even
though we tell it to use the local version. I don't understand why.
12 changes: 12 additions & 0 deletions development/clean
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -ex

git clean -dxf
(
cd ../pyyaml
git checkout setup.cfg
rm -fr build
rm -f ext/_yaml.c
rm -f tests/lib/*.pyc
)
5 changes: 5 additions & 0 deletions development/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DO NOT COMMIT
# Test setup.cfg from libyaml for libyaml testing.
[build_ext]
include_dirs=../libyaml/include
library_dirs=../libyaml/src/.libs
58 changes: 58 additions & 0 deletions development/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -ex

test_branch=yaml-1.2
pyyaml=../pyyaml
[ -n "$LIBYAML_REPO_NAME" ] || LIBYAML_REPO_NAME=libyaml

if [[ $(basename $PWD) != $LIBYAML_REPO_NAME ]]; then
echo "This does not appear to be the libyaml repository"
echo "If it is, set LIBYAML_REPO_NAME"
exit 1
fi

if [ ! -d .git ]; then
echo "Run this script from the top level directory of the libyaml repo"
exit 1
fi

if [ -z "$(which cython)" ]; then
echo "You need to install cython"
exit 1
fi

libyaml_branch=$(git rev-parse --abbrev-ref HEAD)
if [ $libyaml_branch != $test_branch ]; then
echo "git branch must be set to '$test_branch'"
exit 1
fi

if [ -e $pyyaml ]; then
if [ ! -d $pyyaml/.git ]; then
echo "$pyyaml must be a Git repository"
exit 1
fi
else
git clone git://github.com/yaml/pyyaml.git $pyyaml
(cd $pyyaml; git branch $pyyaml)
fi

pyyaml_branch=$(cd $pyyaml; git rev-parse --abbrev-ref HEAD)
if [ $pyyaml_branch != $test_branch ]; then
echo "$pyyaml must be on branch '$test_branch'"
exit 1
fi

[ ! -e ./configure ] && ./bootstrap
[ ! -e ./Makefile ] && ./configure

make

cp development/setup.cfg $pyyaml/
(
cd $pyyaml
rm -fr build
python setup.py build test
)

29 changes: 20 additions & 9 deletions include/yaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ typedef struct yaml_tag_directive_s {

/** The stream encoding. */
typedef enum yaml_encoding_e {
/** Let the parser choose the encoding. */
/** Let the parser choose the encoding. The initial state, invalid at runtime. */
YAML_ANY_ENCODING,
/** The default UTF-8 encoding. */
YAML_UTF8_ENCODING,
Expand Down Expand Up @@ -1296,6 +1296,10 @@ typedef struct yaml_parser_s {
/** The currently parsed document. */
yaml_document_t *document;

/** Optionally forgive some reader errors.
* Make them non-fatal. */
int problem_nonstrict;

/**
* @}
*/
Expand Down Expand Up @@ -1515,6 +1519,18 @@ typedef enum yaml_emitter_state_e {
YAML_EMIT_END_STATE
} yaml_emitter_state_t;


/* This is needed for C++ */

typedef struct yaml_anchors_s {
/** The number of references. */
int references;
/** The anchor id. */
int anchor;
/** If the node has been emitted? */
int serialized;
} yaml_anchors_t;

/**
* The emitter structure.
*
Expand Down Expand Up @@ -1682,6 +1698,8 @@ typedef struct yaml_emitter_s {
int indention;
/** If an explicit document end is required? */
int open_ended;
/** If a map requires a new indent (backcompat, unreadable by YAML.pm) */
int indentless_map;

/** Anchor analysis. */
struct {
Expand Down Expand Up @@ -1740,14 +1758,7 @@ typedef struct yaml_emitter_s {
int closed;

/** The information associated with the document nodes. */
struct {
/** The number of references. */
int references;
/** The anchor id. */
int anchor;
/** If the node has been emitted? */
int serialized;
} *anchors;
yaml_anchors_t *anchors;

/** The last assigned anchor id. */
int last_anchor_id;
Expand Down
Loading