Permalink
Browse files

Initial BypassParser API

  • Loading branch information...
Damian Carrillo
Damian Carrillo committed Feb 21, 2013
1 parent 4895c0f commit ce04c0a211b209c0a0001529978a1ccc0a354e2a
Showing with 111 additions and 80 deletions.
  1. +11 −6 Makefile
  2. 0 {deps → dep}/Makefile
  3. 0 {deps → dep}/libsoldout
  4. 0 {deps → dep}/libsoldout-1.3/BSDmakefile
  5. 0 {deps → dep}/libsoldout-1.3/CHANGES
  6. 0 {deps → dep}/libsoldout-1.3/GNUmakefile
  7. 0 {deps → dep}/libsoldout-1.3/LICENSE
  8. 0 {deps → dep}/libsoldout-1.3/README
  9. 0 {deps → dep}/libsoldout-1.3/array.c
  10. 0 {deps → dep}/libsoldout-1.3/array.h
  11. 0 {deps → dep}/libsoldout-1.3/benchmark.c
  12. 0 {deps → dep}/libsoldout-1.3/buffer.c
  13. 0 {deps → dep}/libsoldout-1.3/buffer.h
  14. +1 −0 dep/libsoldout-1.3/depends/array.d
  15. +1 −0 dep/libsoldout-1.3/depends/buffer.d
  16. +1 −0 dep/libsoldout-1.3/depends/markdown.d
  17. +1 −0 dep/libsoldout-1.3/depends/mkd2html.d
  18. +1 −0 dep/libsoldout-1.3/depends/mkd2latex.d
  19. +1 −0 dep/libsoldout-1.3/depends/mkd2man.d
  20. +1 −0 dep/libsoldout-1.3/depends/renderers.d
  21. 0 {deps → dep}/libsoldout-1.3/expanded_markdown.sh
  22. 0 {deps → dep}/libsoldout-1.3/markdown.c
  23. 0 {deps → dep}/libsoldout-1.3/markdown.h
  24. BIN dep/libsoldout-1.3/mkd2html
  25. 0 {deps → dep}/libsoldout-1.3/mkd2html.c
  26. BIN dep/libsoldout-1.3/mkd2latex
  27. 0 {deps → dep}/libsoldout-1.3/mkd2latex.c
  28. BIN dep/libsoldout-1.3/mkd2man
  29. 0 {deps → dep}/libsoldout-1.3/mkd2man.c
  30. 0 {deps → dep}/libsoldout-1.3/renderers.c
  31. 0 {deps → dep}/libsoldout-1.3/renderers.h
  32. +1 −1 platform/android/jni/Android.mk
  33. +12 −5 src/{bypass.cpp → BypassParser.cpp}
  34. +20 −0 src/BypassParser.h
  35. +11 −0 src/MOMTree.cpp
  36. +15 −0 src/MOMTree.h
  37. +1 −1 src/Makefile
  38. +0 −18 src/bypass.h
  39. +12 −0 test/BypassParserTests.cpp
  40. +20 −0 test/BypassParserTests_cpp_tests.dSYM/Contents/Info.plist
  41. BIN test/BypassParserTests_cpp_tests.dSYM/Contents/Resources/DWARF/BypassParserTests_cpp_tests
  42. +1 −1 test/Makefile
  43. +0 −24 test/main.cpp
  44. +0 −24 test/main2.cpp
View
@@ -1,16 +1,21 @@
-SRC_DIR = src
-TEST_DIR = test
+SRC_DIR = src
+TEST_DIR = test
+DEP_DIR = dep
-.PHONY: all test lib clean
+.PHONY: all dep lib check clean
all: check
-check: lib
- $(MAKE) -C $(TEST_DIR)
+dep:
+ $(MAKE) -C $(DEP_DIR)
-lib:
+lib: dep
$(MAKE) -C $(SRC_DIR)
+check: lib
+ $(MAKE) -C $(TEST_DIR)
+
clean:
$(MAKE) -C $(TEST_DIR) clean
$(MAKE) -C $(SRC_DIR) clean
+ $(MAKE) -C $(DEP_DIR) clean
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
+array.o: array.c array.h
@@ -0,0 +1 @@
+buffer.o: buffer.c buffer.h
@@ -0,0 +1 @@
+markdown.o: markdown.c markdown.h buffer.h array.h
@@ -0,0 +1 @@
+mkd2html.o: mkd2html.c markdown.h buffer.h renderers.h
@@ -0,0 +1 @@
+mkd2latex.o: mkd2latex.c markdown.h buffer.h
@@ -0,0 +1 @@
+mkd2man.o: mkd2man.c markdown.h buffer.h
@@ -0,0 +1 @@
+renderers.o: renderers.c renderers.h markdown.h buffer.h
File renamed without changes.
File renamed without changes.
View
Binary file not shown.
File renamed without changes.
Binary file not shown.
File renamed without changes.
View
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -3,7 +3,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := bypass
-LOCAL_SRC_FILES := ../../../src/bypass.cpp ../../../deps/libsoldout/markdown.c ../../../deps/libsoldout/buffer.c ../../../deps/libsoldout/array.c
+LOCAL_SRC_FILES := ../../../src/BypassParser.cpp ../../../deps/libsoldout/markdown.c ../../../deps/libsoldout/buffer.c ../../../deps/libsoldout/array.c
LOCAL_C_INCLUDES:= ../../deps/libsoldout
include $(BUILD_SHARED_LIBRARY)
@@ -4,7 +4,7 @@ extern "C" {
#include "markdown.h"
}
-#include "bypass.h"
+#include "BypassParser.h"
using namespace std;
@@ -18,16 +18,23 @@ BypassParser::~BypassParser()
}
-void
-BypassParser::parse(const string &markdown)
+MOMTree
+BypassParser::parse(const char *markdown)
{
+ if (!markdown)
+ {
+ return BypassParser::parse(string());
+ }
+ return BypassParser::parse(string(markdown));
}
-void
-BypassParser::parse(const char *markdown)
+MOMTree
+BypassParser::parse(const string &markdown)
{
+ MOMTree mom;
+ return mom;
}
struct mkd_renderer to_spannable = {
View
@@ -0,0 +1,20 @@
+#ifndef _BYPASS_PARSER_H_
+#define _BYPASS_PARSER_H_
+
+#include "MOMTree.h"
+
+class BypassParser
+{
+private:
+
+public:
+
+ BypassParser();
+ ~BypassParser();
+
+ MOMTree parse(const char *markdown);
+ MOMTree parse(const std::string &markdown);
+
+};
+
+#endif // _BYPASS_PARSER_H_
View
@@ -0,0 +1,11 @@
+#include "MOMTree.h"
+
+MOMTree::MOMTree()
+{
+
+}
+
+MOMTree::~MOMTree()
+{
+
+}
View
@@ -0,0 +1,15 @@
+#ifndef _MOM_TREE_H_
+#define _MOM_TREE_H_
+
+class MOMTree
+{
+private:
+
+public:
+
+ MOMTree();
+ ~MOMTree();
+
+};
+
+#endif // _MOM_TREE_H_
View
@@ -1,6 +1,6 @@
LIBSRC = $(wildcard *.cpp)
LIBOBJ = $(LIBSRC:.cpp=.o)
-CXXFLAGS = -I../deps/libsoldout -std=c++0x -fcolor-diagnostics -g -O3 -Wno-unknown-pragmas
+CXXFLAGS = -I../dep/libsoldout -std=c++0x -fcolor-diagnostics -g -O3 -Wno-unknown-pragmas
CPPFLAGS = -Wall
LDLIBS = -lc
LDFLAGS = -shared -Wl,-install_name,@rpath/libbypass.so
View
@@ -1,18 +0,0 @@
-#ifndef _BYPASS_H_
-#define _BYPASS_H_
-
-class BypassParser
-{
-private:
-
-public:
-
- BypassParser();
- ~BypassParser();
-
- void parse(const char *markdown);
- void parse(const std::string &markdown);
-
-};
-
-#endif
View
@@ -0,0 +1,12 @@
+#define BOOST_TEST_MODULE MyTest
+
+#include <boost/test/included/unit_test.hpp>
+#include <BypassParser.h>
+
+BOOST_AUTO_TEST_CASE( parse_with_null_input )
+{
+ BypassParser parser;
+
+ const char *markdown = NULL;
+ MOMTree momTree = parser.parse(markdown);
+}
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.BypassParserTests_cpp_tests</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ </dict>
+</plist>
View
@@ -1,7 +1,7 @@
SRC = $(wildcard *.cpp)
TESTS = $(SRC:.cpp=_test)
CPPFLAGS = -Wall
-CXXFLAGS = -isystem $(BOOST_HOME)
+CXXFLAGS = -isystem $(BOOST_HOME) -I../src -std=c++0x -fcolor-diagnostics -g -O3 -Wno-unknown-pragmas
LDFLAGS = -L../src -Wl,-rpath,../src
LDLIBS = -lbypass
View
@@ -1,24 +0,0 @@
-#define BOOST_TEST_MODULE MyTest
-
-#include <boost/test/included/unit_test.hpp>
-
-int add( int i, int j ) { return i + j; }
-
-BOOST_AUTO_TEST_CASE( my_test )
-{
- BOOST_CHECK( add( 2,2 ) == 4 );
-
- BOOST_REQUIRE( add( 2,2 ) == 4 );
-
- if( add( 2,2 ) != 4 )
- BOOST_ERROR( "Ouch..." );
-
- if( add( 2,2 ) != 4 )
- BOOST_FAIL( "Ouch..." );
-
- if( add( 2,2 ) != 4 ) throw "Ouch...";
-
- BOOST_CHECK_MESSAGE( add( 2,2 ) == 4, "add(..) result: " << add( 2,2 ) );
-
- BOOST_CHECK_EQUAL( add( 2,2 ), 4 );
-}
View
@@ -1,24 +0,0 @@
-#define BOOST_TEST_MODULE MyTest
-
-#include <boost/test/included/unit_test.hpp>
-
-int add( int i, int j ) { return i + j; }
-
-BOOST_AUTO_TEST_CASE( my_test )
-{
- BOOST_CHECK( add( 2,2 ) == 4 );
-
- BOOST_REQUIRE( add( 2,2 ) == 4 );
-
- if( add( 2,2 ) != 4 )
- BOOST_ERROR( "Ouch..." );
-
- if( add( 2,2 ) != 4 )
- BOOST_FAIL( "Ouch..." );
-
- if( add( 2,2 ) != 4 ) throw "Ouch...";
-
- BOOST_CHECK_MESSAGE( add( 2,2 ) == 4, "add(..) result: " << add( 2,2 ) );
-
- BOOST_CHECK_EQUAL( add( 2,2 ), 4 );
-}

0 comments on commit ce04c0a

Please sign in to comment.