Skip to content

Commit 9742397

Browse files
committed
---
yaml --- r: 83430 b: refs/heads/try c: 6aba140 h: refs/heads/master v: v3
1 parent 76c0c1e commit 9742397

30 files changed

+5487
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 24d46a0f45b4a0d6198b9d23dad2f7faa5a05d92
5+
refs/heads/try: 6aba140fa738acea9d06e29e95abbfcc9d1cba5d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ do
684684
isaac linenoise sync test \
685685
arch/i386 arch/x86_64 arch/arm arch/mips \
686686
libuv libuv/src/ares libuv/src/eio libuv/src/ev \
687-
jemalloc
687+
jemalloc sundown/src sundown/html
688688
do
689689
make_dir $t/rt/stage$s/$i
690690
done

branches/try/mk/rt.mk

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,16 @@ RUNTIME_CXXS_$(1)_$(2) := \
8282
rt/rust_android_dummy.cpp \
8383
rt/rust_test_helpers.cpp
8484

85-
RUNTIME_CS_$(1)_$(2) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
85+
RUNTIME_CS_$(1)_$(2) := rt/linenoise/linenoise.c \
86+
rt/linenoise/utf8.c \
87+
rt/sundown/src/autolink.c \
88+
rt/sundown/src/buffer.c \
89+
rt/sundown/src/stack.c \
90+
rt/sundown/src/markdown.c \
91+
rt/sundown/html/houdini_href_e.c \
92+
rt/sundown/html/houdini_html_e.c \
93+
rt/sundown/html/html_smartypants.c \
94+
rt/sundown/html/html.c
8695

8796
RUNTIME_S_$(1)_$(2) := rt/arch/$$(HOST_$(1))/_context.S \
8897
rt/arch/$$(HOST_$(1))/ccall.S \
@@ -117,6 +126,8 @@ RUNTIME_DEF_$(1)_$(2) := $$(RT_OUTPUT_DIR_$(1))/rustrt$$(CFG_DEF_SUFFIX_$(1))
117126
RUNTIME_INCS_$(1)_$(2) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \
118127
-I $$(S)src/rt/arch/$$(HOST_$(1)) \
119128
-I $$(S)src/rt/linenoise \
129+
-I $$(S)src/rt/sundown/src \
130+
-I $$(S)src/rt/sundown/html \
120131
-I $$(S)src/libuv/include
121132
RUNTIME_OBJS_$(1)_$(2) := $$(RUNTIME_CXXS_$(1)_$(2):rt/%.cpp=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \
122133
$$(RUNTIME_CS_$(1)_$(2):rt/%.c=$$(RT_BUILD_DIR_$(1)_$(2))/%.o) \

branches/try/mk/tests.mk

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ ALL_CS := $(wildcard $(S)src/rt/*.cpp \
227227
$(S)src/rt/*/*/*.cpp \
228228
$(S)src/rustllvm/*.cpp)
229229
ALL_CS := $(filter-out $(S)src/rt/miniz.cpp \
230-
$(S)src/rt/linenoise/linenoise.c \
231-
$(S)src/rt/linenoise/utf8.c \
230+
$(wildcard $(S)src/rt/linenoise/*.c) \
231+
$(wildcard $(S)src/rt/sundown/src/*.c) \
232+
$(wildcard $(S)src/rt/sundown/html/*.c) \
232233
,$(ALL_CS))
233234
ALL_HS := $(wildcard $(S)src/rt/*.h \
234235
$(S)src/rt/*/*.h \
@@ -241,6 +242,8 @@ ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
241242
$(S)src/rt/msvc/inttypes.h \
242243
$(S)src/rt/linenoise/linenoise.h \
243244
$(S)src/rt/linenoise/utf8.h \
245+
$(wildcard $(S)src/rt/sundown/src/*.h) \
246+
$(wildcard $(S)src/rt/sundown/html/*.h) \
244247
,$(ALL_HS))
245248

246249
# Run the tidy script in multiple parts to avoid huge 'echo' commands

branches/try/src/libextra/crypto/cryptoutil.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ mod test {
352352

353353
use cryptoutil::{add_bytes_to_bits, add_bytes_to_bits_tuple};
354354
use digest::Digest;
355-
use hex::FromHex;
356355

357356
/// Feed 1,000,000 'a's into the digest with varying input sizes and check that the result is
358357
/// correct.
@@ -373,10 +372,8 @@ mod test {
373372
}
374373

375374
let result_str = digest.result_str();
376-
let result_bytes = digest.result_bytes();
377375

378-
assert_eq!(expected, result_str.as_slice());
379-
assert_eq!(expected.from_hex().unwrap(), result_bytes);
376+
assert!(expected == result_str);
380377
}
381378

382379
// A normal addition - no overflow occurs

branches/try/src/libextra/crypto/digest.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
use std::vec;
1212

13-
use hex::ToHex;
14-
1513

1614
/**
1715
* The Digest trait specifies an interface common to digest functions, such as SHA-1 and the SHA-2
@@ -60,20 +58,23 @@ pub trait Digest {
6058

6159
/**
6260
* Convenience function that retrieves the result of a digest as a
63-
* newly allocated vec of bytes.
61+
* ~str in hexadecimal format.
6462
*/
65-
fn result_bytes(&mut self) -> ~[u8] {
63+
fn result_str(&mut self) -> ~str {
6664
let mut buf = vec::from_elem((self.output_bits()+7)/8, 0u8);
6765
self.result(buf);
68-
buf
66+
return to_hex(buf);
6967
}
68+
}
7069

71-
/**
72-
* Convenience function that retrieves the result of a digest as a
73-
* ~str in hexadecimal format.
74-
*/
75-
fn result_str(&mut self) -> ~str {
76-
self.result_bytes().to_hex()
70+
fn to_hex(rr: &[u8]) -> ~str {
71+
let mut s = ~"";
72+
for b in rr.iter() {
73+
let hex = (*b as uint).to_str_radix(16u);
74+
if hex.len() == 1 {
75+
s.push_char('0');
76+
}
77+
s.push_str(hex);
7778
}
79+
return s;
7880
}
79-

branches/try/src/rt/rustrt.def.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,9 @@ rust_set_stdio_container_fd
200200
rust_set_stdio_container_stream
201201
rust_uv_process_pid
202202
rust_uv_pipe_init
203+
sdhtml_renderer
204+
sd_markdown_new
205+
sd_markdown_render
206+
sd_markdown_free
207+
bufrelease
208+
bufnew
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.o
2+
libsundown.so*
3+
sundown
4+
smartypants
5+
*.exe
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Contributing to Sundown
2+
=======================
3+
4+
Do not.
5+
6+
Unfortunately, Sundown is currently frozen as we're working with the Reddit, StackOverflow and Meteor developers to design a formal Markdown standard and parser that will supersede Sundown in all these websites (and in GitHub, of course). Our goal is to deprecate Sundown altogether before the end of the year.
7+
8+
The new parser will be smaller, faster, safer and most importantly, more consistent.
9+
10+
Please stay tuned.

branches/try/src/rt/sundown/Makefile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Makefile
2+
3+
# Copyright (c) 2009, Natacha Porté
4+
#
5+
# Permission to use, copy, modify, and distribute this software for any
6+
# purpose with or without fee is hereby granted, provided that the above
7+
# copyright notice and this permission notice appear in all copies.
8+
#
9+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16+
17+
DEPDIR=depends
18+
19+
# "Machine-dependant" options
20+
#MFLAGS=-fPIC
21+
22+
CFLAGS=-c -g -O3 -fPIC -Wall -Werror -Wsign-compare -Isrc -Ihtml
23+
LDFLAGS=-g -O3 -Wall -Werror
24+
CC=gcc
25+
26+
27+
SUNDOWN_SRC=\
28+
src/markdown.o \
29+
src/stack.o \
30+
src/buffer.o \
31+
src/autolink.o \
32+
html/html.o \
33+
html/html_smartypants.o \
34+
html/houdini_html_e.o \
35+
html/houdini_href_e.o
36+
37+
all: libsundown.so sundown smartypants html_blocks
38+
39+
.PHONY: all clean
40+
41+
# libraries
42+
43+
libsundown.so: libsundown.so.1
44+
ln -f -s $^ $@
45+
46+
libsundown.so.1: $(SUNDOWN_SRC)
47+
$(CC) $(LDFLAGS) -shared -Wl $^ -o $@
48+
49+
# executables
50+
51+
sundown: examples/sundown.o $(SUNDOWN_SRC)
52+
$(CC) $(LDFLAGS) $^ -o $@
53+
54+
smartypants: examples/smartypants.o $(SUNDOWN_SRC)
55+
$(CC) $(LDFLAGS) $^ -o $@
56+
57+
# perfect hashing
58+
html_blocks: src/html_blocks.h
59+
60+
src/html_blocks.h: html_block_names.txt
61+
gperf -N find_block_tag -H hash_block_tag -C -c -E --ignore-case $^ > $@
62+
63+
64+
# housekeeping
65+
clean:
66+
rm -f src/*.o html/*.o examples/*.o
67+
rm -f libsundown.so libsundown.so.1 sundown smartypants
68+
rm -f sundown.exe smartypants.exe
69+
rm -rf $(DEPDIR)
70+
71+
72+
# dependencies
73+
74+
include $(wildcard $(DEPDIR)/*.d)
75+
76+
77+
# generic object compilations
78+
79+
%.o: src/%.c examples/%.c html/%.c
80+
@mkdir -p $(DEPDIR)
81+
@$(CC) -MM $< > $(DEPDIR)/$*.d
82+
$(CC) $(CFLAGS) -o $@ $<
83+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
CFLAGS=/O2 /EHsc /I"src/" /I"examples"/ /I"html"/
3+
CC=cl
4+
5+
SUNDOWN_SRC=\
6+
src\markdown.obj \
7+
src\stack.obj \
8+
src\buffer.obj \
9+
src\autolink.obj \
10+
html\html.obj \
11+
html\html_smartypants.obj \
12+
html\houdini_html_e.obj \
13+
html\houdini_href_e.obj
14+
15+
all: sundown.dll sundown.exe
16+
17+
sundown.dll: $(SUNDOWN_SRC) sundown.def
18+
$(CC) $(SUNDOWN_SRC) sundown.def /link /DLL $(LDFLAGS) /out:$@
19+
20+
sundown.exe: examples\sundown.obj $(SUNDOWN_SRC)
21+
$(CC) examples\sundown.obj $(SUNDOWN_SRC) /link $(LDFLAGS) /out:$@
22+
23+
# housekeeping
24+
clean:
25+
del $(SUNDOWN_SRC)
26+
del sundown.dll sundown.exe
27+
del sundown.exp sundown.lib
28+
29+
# generic object compilations
30+
31+
.c.obj:
32+
$(CC) $(CFLAGS) /c $< /Fo$@
33+

0 commit comments

Comments
 (0)