Permalink
Browse files

Merge emscripten, native, and swig into one branch.

  • Loading branch information...
bootstraponline committed Jul 7, 2012
1 parent acebc18 commit f39d26eca3adb06d8187fc408c24c74c06691e81
Showing with 2,385 additions and 145 deletions.
  1. +2 −14 Makefile
  2. +73 −0 Makefile.native
  3. +73 −0 Makefile.swig
  4. +3 −131 README.markdown
  5. +1,959 −0 src/jni.h
  6. +42 −0 src/jni_md.h
  7. 0 {examples → src}/sundown.c
  8. +14 −0 src/sundown.h
  9. +219 −0 src/sundown_wrap.c
View
@@ -34,26 +34,14 @@ SUNDOWN_SRC=\
html/houdini_html_e.o \
html/houdini_href_e.o
-all: libsundown.so sundown smartypants html_blocks
+all: libsundown.so html_blocks
.PHONY: all clean
# libraries
-
-libsundown.so: libsundown.so.1
- ln -f -s $^ $@
-
-libsundown.so.1: $(SUNDOWN_SRC)
+libsundown.so: $(SUNDOWN_SRC)
$(CC) $(LDFLAGS) -shared -Wl $^ -o $@
-# executables
-
-sundown: examples/sundown.o $(SUNDOWN_SRC)
- $(CC) $(LDFLAGS) $^ -o $@
-
-smartypants: examples/smartypants.o $(SUNDOWN_SRC)
- $(CC) $(LDFLAGS) $^ -o $@
-
# perfect hashing
html_blocks: src/html_blocks.h
View
@@ -0,0 +1,73 @@
+# Makefile
+
+# Copyright (c) 2009, Natacha Porté
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+DEPDIR=depends
+
+# "Machine-dependant" options
+#MFLAGS=-fPIC
+
+CFLAGS=-c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml
+LDFLAGS=-g -O3 -Wall -Werror
+CC=gcc
+
+
+SUNDOWN_SRC=\
+ src/sundown_wrap.o \
+ src/sundown.o \
+ src/markdown.o \
+ src/stack.o \
+ src/buffer.o \
+ src/autolink.o \
+ html/html.o \
+ html/html_smartypants.o \
+ html/houdini_html_e.o \
+ html/houdini_href_e.o
+
+all: libsundown.so html_blocks
+
+.PHONY: all clean
+
+# libraries
+libsundown.so: $(SUNDOWN_SRC)
+ $(CC) $(LDFLAGS) -shared -Wl $^ -o $@
+
+# perfect hashing
+html_blocks: src/html_blocks.h
+
+src/html_blocks.h: html_block_names.txt
+ gperf -N find_block_tag -H hash_block_tag -C -c -E --ignore-case $^ > $@
+
+
+# housekeeping
+clean:
+ rm -f src/*.o html/*.o examples/*.o
+ rm -f libsundown.so sundown smartypants
+ rm -f sundown.exe smartypants.exe
+ rm -rf $(DEPDIR)
+
+
+# dependencies
+
+include $(wildcard $(DEPDIR)/*.d)
+
+
+# generic object compilations
+
+%.o: src/%.c examples/%.c html/%.c
+ @mkdir -p $(DEPDIR)
+ @$(CC) -MM $< > $(DEPDIR)/$*.d
+ $(CC) $(CFLAGS) -o $@ $<
+
View
@@ -0,0 +1,73 @@
+# Makefile
+
+# Copyright (c) 2009, Natacha Porté
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+DEPDIR=depends
+
+# "Machine-dependant" options
+#MFLAGS=-fPIC
+
+CFLAGS=-c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml
+LDFLAGS=-g -O3 -Wall -Werror
+CC=gcc
+
+
+SUNDOWN_SRC=\
+ src/sundown_wrap.o \
+ src/sundown.o \
+ src/markdown.o \
+ src/stack.o \
+ src/buffer.o \
+ src/autolink.o \
+ html/html.o \
+ html/html_smartypants.o \
+ html/houdini_html_e.o \
+ html/houdini_href_e.o
+
+all: libsundown.so html_blocks
+
+.PHONY: all clean
+
+# libraries
+libsundown.so: $(SUNDOWN_SRC)
+ $(CC) $(LDFLAGS) -shared -Wl $^ -o $@
+
+# perfect hashing
+html_blocks: src/html_blocks.h
+
+src/html_blocks.h: html_block_names.txt
+ gperf -N find_block_tag -H hash_block_tag -C -c -E --ignore-case $^ > $@
+
+
+# housekeeping
+clean:
+ rm -f src/*.o html/*.o examples/*.o
+ rm -f libsundown.so sundown smartypants
+ rm -f sundown.exe smartypants.exe
+ rm -rf $(DEPDIR)
+
+
+# dependencies
+
+include $(wildcard $(DEPDIR)/*.d)
+
+
+# generic object compilations
+
+%.o: src/%.c examples/%.c html/%.c
+ @mkdir -p $(DEPDIR)
+ @$(CC) -MM $< > $(DEPDIR)/$*.d
+ $(CC) $(CFLAGS) -o $@ $<
+
View
@@ -1,131 +1,3 @@
-Sundown
-=======
-
-`Sundown` is a Markdown parser based on the original code of the
-[Upskirt library](http://fossil.instinctive.eu/libupskirt/index) by Natacha Porté.
-
-Features
---------
-
-* **Fully standards compliant**
-
- `Sundown` passes out of the box the official Markdown v1.0.0 and v1.0.3
- test suites, and has been extensively tested with additional corner cases
- to make sure its output is as sane as possible at all times.
-
-* **Massive extension support**
-
- `Sundown` has optional support for several (unofficial) Markdown extensions,
- such as non-strict emphasis, fenced code blocks, tables, autolinks,
- strikethrough and more.
-
-* **UTF-8 aware**
-
- `Sundown` is fully UTF-8 aware, both when parsing the source document and when
- generating the resulting (X)HTML code.
-
-* **Tested & Ready to be used on production**
-
- `Sundown` has been extensively security audited, and includes protection against
- all possible DOS attacks (stack overflows, out of memory situations, malformed
- Markdown syntax...) and against client attacks through malicious embedded HTML.
-
- We've worked very hard to make `Sundown` never crash or run out of memory
- under *any* input. `Sundown` renders all the Markdown content in GitHub and so
- far hasn't crashed a single time.
-
-* **Customizable renderers**
-
- `Sundown` is not stuck with XHTML output: the Markdown parser of the library
- is decoupled from the renderer, so it's trivial to extend the library with
- custom renderers. A fully functional (X)HTML renderer is included.
-
-* **Optimized for speed**
-
- `Sundown` is written in C, with a special emphasis on performance. When wrapped
- on a dynamic language such as Python or Ruby, it has shown to be up to 40
- times faster than other native alternatives.
-
-* **Zero-dependency**
-
- `Sundown` is a zero-dependency library composed of 3 `.c` files and their headers.
- No dependencies, no bullshit. Only standard C99 that builds everywhere.
-
-Credits
--------
-
-`Sundown` is based on the original Upskirt parser by Natacha Porté, with many additions
-by Vicent Marti (@tanoku) and contributions from the following authors:
-
- Ben Noordhuis, Bruno Michel, Joseph Koshy, Krzysztof Kowalczyk, Samuel Bronson,
- Shuhei Tanuma
-
-Bindings
---------
-
-`Sundown` is available from other programming languages thanks to these bindings developed
-by our awesome contributors.
-
-- [Redcarpet](https://github.com/tanoku/redcarpet) (Ruby)
-- [RobotSkirt](https://github.com/benmills/robotskirt) (Node.js)
-- [Misaka](https://github.com/FSX/misaka) (Python)
-- [ffi-sundown](https://github.com/postmodern/ffi-sundown) (Ruby FFI)
-- [Sundown HS](https://github.com/bitonic/sundown) (Haskell)
-- [Goskirt](https://github.com/madari/goskirt) (Go)
-- [Upskirt.go](https://github.com/buu700/upskirt.go) (Go)
-- [MoonShine](https://github.com/brandonc/moonshine) (.NET)
-- [PHP-Sundown](https://github.com/chobie/php-sundown) (PHP)
-- [Sundown.net](https://github.com/txdv/sundown.net) (.NET)
-
-Help us
--------
-
-`Sundown` is all about security. If you find a (potential) security vulnerability in the
-library, or a way to make it crash through malicious input, please report it to us,
-either directly via email or by opening an Issue on GitHub, and help make the web safer
-for everybody.
-
-Unicode character handling
---------------------------
-
-Given that the Markdown spec makes no provision for Unicode character handling, `Sundown`
-takes a conservative approach towards deciding which extended characters trigger Markdown
-features:
-
-* Punctuation characters outside of the U+007F codepoint are not handled as punctuation.
- They are considered as normal, in-word characters for word-boundary checks.
-
-* Whitespace characters outside of the U+007F codepoint are not considered as
- whitespace. They are considered as normal, in-word characters for word-boundary checks.
-
-Install
--------
-
-There is nothing to install. `Sundown` is composed of 3 `.c` files (`markdown.c`,
-`buffer.c` and `array.c`), so just throw them in your project. Zero-dependency means
-zero-dependency. You might want to include `render/html.c` if you want to use the
-included XHTML renderer, or write your own renderer. Either way, it's all fun and joy.
-
-If you are hardcore, you can use the included `Makefile` to build `Sundown` into a dynamic
-library, or to build the sample `sundown` executable, which is just a commandline
-Markdown to XHTML parser. (If gcc gives you grief about `-fPIC`, e.g. with MinGW, try
-`make MFLAGS=` instead of just `make`.)
-
-License
--------
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-<!-- Local Variables: -->
-<!-- fill-column: 89 -->
-<!-- End: -->
+Makefile - sundown for emscripten
+Makefile.native - sundown for BridJ, mostly unmodified upstream makefile
+Makefile.swig - sundown for SWIG
Oops, something went wrong.

0 comments on commit f39d26e

Please sign in to comment.