From: Ebersold Date: Sun, 26 Dec 2021 13:09:39 +0000 (+0100) Subject: Initial import from SVN X-Git-Url: https://git.ebersold.fr/?a=commitdiff_plain;h=9e9b4fd737654a0c6b05857d5373e62ab0b0491a;p=smartasn1.git Initial import from SVN --- 9e9b4fd737654a0c6b05857d5373e62ab0b0491a diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..09258a7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,21 @@ +[submodule "utils"] + path = utils + url = https://git.ebersold.fr/repos/aebutils.git +[submodule "rules"] + path = rules + url = https://git.ebersold.fr/repos/rules.git +[submodule "xml-transform"] + path = xml-transform + url = https://git.ebersold.fr/repos/xml-transform.git +[submodule "asn1"] + path = asn1 + url = https://git.ebersold.fr/repos/parser/asn1.git +[submodule "common"] + path = common + url = https://git.ebersold.fr/repos/parser/common.git +[submodule "gsp"] + path = gsp + url = https://git.ebersold.fr/repos/parser/gsp.git +[submodule "gdmo"] + path = gdmo + url = https://git.ebersold.fr/repos/parser/gdmo.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..472da72 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,65 @@ +PROJECT(smartasn1) +cmake_minimum_required(VERSION 2.8) +LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/rules") +SET(SMASN1_VERSION_MAJOR 1) +SET(SMASN1_VERSION_MINOR 0) +SET(SMASN1_VERSION_PATCH 2) +SET(SMASN1_VERSION "${SMASN1_VERSION_MAJOR}.${SMASN1_VERSION_MINOR}.${SMASN1_VERSION_PATCH}") + +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckIncludeFile) +INCLUDE(CheckTypeSize) +INCLUDE(CheckFunctionExists) +INCLUDE(CheckLibraryExists) +INCLUDE(CheckSymbolExists) + +CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H) +CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILE(syslog.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILE(errno.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILE(libgen.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H) +CHECK_INCLUDE_FILE(direct.h HAVE_DIRECT_H) +CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) + + +CHECK_FUNCTION_EXISTS(closedir HAVE_CLOSEDIR) +CHECK_FUNCTION_EXISTS(opendir HAVE_OPENDIR) +CHECK_FUNCTION_EXISTS(basename HAVE_BASENAME) +CHECK_FUNCTION_EXISTS(getcwd HAVE_GETCWD) +CHECK_FUNCTION_EXISTS(mkdir HAVE_GETCWD) + + + +INCLUDE(bootstrap) +SUBDIRS(data-models rules utils asn1 xml-transform libCodeGen gdmo gsp) + +# +# Stuff for ftplib and optarg +# +IF(UNIX) + SET(EXT_SRC ${FTPDIR}/ftplib.c) + CONFIGURE_FILE(CPackSmartasn1Rpm.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/CPackSmartasn1Rpm.cmake) + CONFIGURE_FILE(CPackSmartasn1Deb.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/CPackSmartasn1Deb.cmake) +ELSE(UNIX) + +ENDIF(UNIX) + +# Configuration stuff +# For install and so one. +IF(APPLE) + CONFIGURE_FILE(CPackSmartasn1Mac.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/CPackSmartasn1Mac.cmake + ) +ENDIF(APPLE) + +IF(WINDOWS) + CONFIGURE_FILE(CPackSmartasn1Nsis.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/CpackSmartasn1Nsis.cmake + ) +ENDIF(WINDOWS) + + + diff --git a/CPackSmartasn1Deb.cmake.in b/CPackSmartasn1Deb.cmake.in new file mode 100644 index 0000000..109a2bb --- /dev/null +++ b/CPackSmartasn1Deb.cmake.in @@ -0,0 +1,42 @@ +SET(CPACK_BINARY_BUNDLE "OFF") +SET(CPACK_BINARY_CYGWIN "") +SET(CPACK_BINARY_DEB "ON") +SET(CPACK_BINARY_DRAGNDROP "") +SET(CPACK_BINARY_NSIS "OFF") +SET(CPACK_BINARY_OSXX11 "") +SET(CPACK_BINARY_PACKAGEMAKER "") +SET(CPACK_BINARY_RPM "OFF") +SET(CPACK_BINARY_STGZ "OFF") +SET(CPACK_BINARY_TBZ2 "OFF") +SET(CPACK_BINARY_TGZ "OFF") +SET(CPACK_BINARY_TZ "OFF") +SET(CPACK_BINARY_ZIP "") +SET(CPACK_CMAKE_GENERATOR "Unix Makefiles") +SET(CPACK_GENERATOR "DEB") + +SET(CPACK_PACKAGE_EXECUTABLES asn1p;Smartasn1) +SET(CPACK_INSTALL_CMAKE_PROJECTS "asn1") +SET(CPACK_MODULE_PATH "@CMAKE_CURRENT_SOURCE_DIR@/rules/") +SET(CPACK_OUTPUT_CONFIG_FILE "@CMAKE_CURRENT_BINARY_DIR@/CPackSmartasn1Deb.cmake") +SET(CPACK_PACKAGE_DEFAULT_LOCATION "c:\\Program Files\\Smartasn1") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "@CMAKE_ROOT@/Templates/CPack.GenericDescription.txt") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Smartasn1 software") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "") +SET(CPACK_PACKAGE_RELOCATABLE "true") +SET(CPACK_PACKAGE_VENDOR "Ebersold Andre") +SET(CPACK_PACKAGE_VERSION "@PROJECT_VERSION@") +SET(CPACK_PACKAGE_VERSION_MAJOR "@ASN1_VERSION_MAJOR@") +SET(CPACK_PACKAGE_VERSION_MINOR "@ASN1_VERSION_MINOR@") +SET(CPACK_PACKAGE_VERSION_PATCH "@ASN1_VERSION_PATCH@") +SET(CPACK_PACKAGE_NAME "smartasn1") +SET(CPACK_PACKAGE_FILE_NAME "Smartasn1-@PROJECT_VERSION@") +SET(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_ROOT@/Templates/CPack.GenericLicense.txt") +SET(CPACK_RESOURCE_FILE_README "@CMAKE_ROOT@/Templates/CPack.GenericDescription.txt") +SET(CPACK_RESOURCE_FILE_WELCOME "@CMAKE_ROOT@/Templates/CPack.GenericWelcome.txt") +SET(CPACK_SET_DESTDIR "OFF") +SET(CPACK_INSTALL_PREFIX "") +SET(CPACK_SYSTEM_NAME "Linux") + + +SET(CMAKE_INSTALL_DEBUG_LIBRARIES ON) +SET(CMAKE_INSTALL_PREFIX .) diff --git a/CPackSmartasn1Mac.cmake.in b/CPackSmartasn1Mac.cmake.in new file mode 100644 index 0000000..4cdae17 --- /dev/null +++ b/CPackSmartasn1Mac.cmake.in @@ -0,0 +1,59 @@ +SET(CPACK_BINARY_BUNDLE "ON") +SET(CPACK_BINARY_CYGWIN "") +SET(CPACK_BINARY_DEB "OFF") +SET(CPACK_BINARY_DRAGNDROP "") +SET(CPACK_BINARY_NSIS "OFF") +SET(CPACK_BINARY_OSXX11 "") +SET(CPACK_BINARY_PACKAGEMAKER "") +SET(CPACK_BINARY_RPM "OFF") +SET(CPACK_BINARY_STGZ "OFF") +SET(CPACK_BINARY_TBZ2 "OFF") +SET(CPACK_BINARY_TGZ "ON") +SET(CPACK_BINARY_TZ "OFF") +SET(CPACK_BINARY_ZIP "") +SET(CPACK_CMAKE_GENERATOR "Unix Makefiles") +SET(CPACK_Bundle_COMPONENT_INSTALL 0) +SET(CPACK_COMPONENTS_ALL "Runtime") +SET(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE") +SET(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE") +#SET(CPACK_GENERATOR "Bundle") +SET(CPACK_GENERATOR "DragNDrop") + +SET(CPACK_PACKAGE_EXECUTABLES "asn1p" "Smartasn1 application") +#SET(CPACK_INSTALL_CMAKE_PROJECTS "@CMAKE_CURRENT_BINARY_DIR@/asn1;asn1;All;/") +SET(CPACK_INSTALL_CMAKE_PROJECTS "@CMAKE_CURRENT_BINARY_DIR@/asn1;asn1;Asn1;/" + "@CMAKE_CURRENT_BINARY_DIR@/asn1/asn1;asn1;RuntimeLibraries;/" + "@CMAKE_CURRENT_BINARY_DIR@/asn1/asn1;asn1;Asn1Headers;/" + ) +SET(CPACK_MODULE_PATH "@CMAKE_CURRENT_SOURCE_DIR@/rules/") +SET(CPACK_OUTPUT_CONFIG_FILE "@CMAKE_CURRENT_BINARY_DIR@/CPackSmartasn1Mac.cmake") +SET(CPACK_PACKAGE_DEFAULT_LOCATION "/Application") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "@CMAKE_ROOT@/Templates/CPack.GenericDescription.txt") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Smartasn1 software. Asn1 c++ compiler and runtime library") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "l") +SET(CPACK_PACKAGE_NAME "Smartasn1") +SET(CPACK_PACKAGE_RELOCATABLE "true") +SET(CPACK_PACKAGE_VENDOR "Andre EBERSOLD (andre.ebersold@free.fr)") +SET(CPACK_PACKAGE_VERSION "@PROJECT_VERSION@") +SET(CPACK_PACKAGE_VERSION_MAJOR "1") +SET(CPACK_PACKAGE_VERSION_MINOR "0") +SET(CPACK_PACKAGE_VERSION_PATCH "0") + +SET(CPACK_PACKAGE_FILE_NAME "Smartasn1") +SET(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_ROOT@/Templates/CPack.GenericLicense.txt") +SET(CPACK_RESOURCE_FILE_README "@CMAKE_ROOT@/Templates/CPack.GenericDescription.txt") +SET(CPACK_RESOURCE_FILE_WELCOME "@CMAKE_ROOT@/Templates/CPack.GenericWelcome.txt") +SET(CPACK_SET_DESTDIR "ON") +SET(CPACK_INSTALL_PREFIX "") +SET(CPACK_SYSTEM_NAME "MacOSX") +SET(CPACK_TOPLEVEL_TAG "MacOS") + +SET(CPACK_BUNDLE_NAME "Smartasn1") +SET(CPACK_BUNDLE_STARTUP_COMMAND "@CMAKE_CURRENT_SOURCE_DIR@/smartasn1.sh") +SET(CPACK_BUNDLE_PLIST "@CMAKE_CURRENT_BINARY_DIR@/Smartasn1.app/Contents/Info.plist") +SET(CPACK_BUNDLE_ICON "@CMAKE_CURRENT_SOURCE_DIR@/Resources/cstainsight.icns") +SET(CPACK_PACKAGE_ICON "@CMAKE_CURRENT_SOURCE_DIR@/Resources/squarelogo.jpg") + +SET(CPACK_DMG_BACKGROUND_IMAGE "@CMAKE_CURRENT_SOURCE_DIR@/Resources/background.png") +SET(CPACK_DMG_DS_STORE "@CMAKE_CURRENT_SOURCE_DIR@/Resources/DS_Store") +SET(CMAKE_INSTALL_PREFIX /) diff --git a/CPackSmartasn1Nsis.cmake.in b/CPackSmartasn1Nsis.cmake.in new file mode 100644 index 0000000..1639532 --- /dev/null +++ b/CPackSmartasn1Nsis.cmake.in @@ -0,0 +1,47 @@ +SET(CPACK_BINARY_BUNDLE "OFF") +SET(CPACK_BINARY_CYGWIN "") +SET(CPACK_BINARY_DEB "OFF") +SET(CPACK_BINARY_DRAGNDROP "") +SET(CPACK_BINARY_NSIS "ON") +SET(CPACK_BINARY_OSXX11 "") +SET(CPACK_BINARY_PACKAGEMAKER "") +SET(CPACK_BINARY_RPM "OFF") +SET(CPACK_BINARY_STGZ "OFF") +SET(CPACK_BINARY_TBZ2 "OFF") +SET(CPACK_BINARY_TGZ "OFF") +SET(CPACK_BINARY_TZ "OFF") +SET(CPACK_BINARY_ZIP "") +SET(CPACK_CMAKE_GENERATOR "NMake Makefiles") +SET(CPACK_GENERATOR "NSIS") + +SET(CPACK_PACKAGE_EXECUTABLES asn1p;Smartasn1) +SET(CPACK_INSTALL_CMAKE_PROJECTS "asn1") +SET(CPACK_MODULE_PATH "@CMAKE_CURRENT_SOURCE_DIR@/rules/") +SET(CPACK_OUTPUT_CONFIG_FILE "@CMAKE_CURRENT_BINARY_DIR@/CPackSmartasn1Nsis.cmake") +SET(CPACK_PACKAGE_DEFAULT_LOCATION "c:\\Program Files\\Smartasn1") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "@CMAKE_ROOT@/Templates/CPack.GenericDescription.txt") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Smartasn1 software") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "") +SET(CPACK_PACKAGE_RELOCATABLE "true") +SET(CPACK_PACKAGE_VENDOR "Ebersold Andre") +SET(CPACK_PACKAGE_VERSION "@PROJECT_VERSION@") +SET(CPACK_PACKAGE_VERSION_MAJOR "1") +SET(CPACK_PACKAGE_VERSION_MINOR "0") +SET(CPACK_PACKAGE_VERSION_PATCH "0") +SET(CPACK_PACKAGE_NAME "Smartasn1") +SET(CPACK_PACKAGE_FILE_NAME "Smartasn1-@PROJECT_VERSION@") +SET(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_ROOT@/Templates/CPack.GenericLicense.txt") +SET(CPACK_RESOURCE_FILE_README "@CMAKE_ROOT@/Templates/CPack.GenericDescription.txt") +SET(CPACK_RESOURCE_FILE_WELCOME "@CMAKE_ROOT@/Templates/CPack.GenericWelcome.txt") +SET(CPACK_SET_DESTDIR "OFF") +SET(CPACK_INSTALL_PREFIX "") +SET(CPACK_SYSTEM_NAME "Windows") + +SET(CPACK_NSIS_INSTALL_ROOT "c:\\Program Files\\Smartasn1") +SET(CPACK_NSIS_DISPLAY_NAME "Smartasn1") +SET(CPACK_NSIS_EXECUTABLES_DIRECTORY bin) + +SET(CPACK_BUNDLE_ICON "@CMAKE_CURRENT_SOURCE_DIR@/Resources/betfan.icns") +SET(CPACK_PACKAGE_ICON "@CMAKE_CURRENT_SOURCE_DIR@\\Resources\\squarelogo.jpg") +SET(CMAKE_INSTALL_DEBUG_LIBRARIES ON) +SET(CMAKE_INSTALL_PREFIX .) diff --git a/CPackSmartasn1Rpm.cmake.in b/CPackSmartasn1Rpm.cmake.in new file mode 100644 index 0000000..4219228 --- /dev/null +++ b/CPackSmartasn1Rpm.cmake.in @@ -0,0 +1,48 @@ +SET(CPACK_BINARY_BUNDLE "OFF") +SET(CPACK_BINARY_CYGWIN "") +SET(CPACK_BINARY_DEB "OFF") +SET(CPACK_BINARY_DRAGNDROP "") +SET(CPACK_BINARY_NSIS "OFF") +SET(CPACK_BINARY_OSXX11 "") +SET(CPACK_BINARY_PACKAGEMAKER "") +SET(CPACK_BINARY_RPM "ON") +SET(CPACK_BINARY_STGZ "OFF") +SET(CPACK_BINARY_TBZ2 "OFF") +SET(CPACK_BINARY_TGZ "OFF") +SET(CPACK_BINARY_TZ "OFF") +SET(CPACK_BINARY_ZIP "") +SET(CPACK_CMAKE_GENERATOR "Unix Makefiles") +SET(CPACK_GENERATOR "RPM") + +SET(CPACK_PACKAGE_EXECUTABLES asn1p;Smartasn1) +# TODO replace ALL by appropriate components +SET(CPACK_INSTALL_CMAKE_PROJECTS + "${PROJECT_BINARY_DIR};asn1;Asn1;/" + "${PROJECT_BINARY_DIR};asn1;Asn1Headers;/" + "${PROJECT_BINARY_DIR};asn1;RuntimeLibraries;/" +) +#SET(CPACK_INSTALL_CMAKE_PROJECTS "asn1") +SET(CPACK_MODULE_PATH "@CMAKE_CURRENT_SOURCE_DIR@/rules/") +SET(CPACK_OUTPUT_CONFIG_FILE "@CMAKE_CURRENT_BINARY_DIR@/CPackSmartasn1Rpm.cmake") +SET(CPACK_PACKAGE_DEFAULT_LOCATION "c:\\Program Files\\Smartasn1") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "@CMAKE_ROOT@/Templates/CPack.GenericDescription.txt") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Smartasn1 software") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "") +SET(CPACK_PACKAGE_RELOCATABLE "true") +SET(CPACK_PACKAGE_VENDOR "Ebersold Andre") +SET(CPACK_PACKAGE_VERSION "@SMASN1_VERSION@") +SET(CPACK_RPM_PACKAGE_VERSION "@SMASN1_VERSION@") +SET(CPACK_PACKAGE_VERSION_MAJOR "@SMASN1_VERSION_MAJOR@") +SET(CPACK_PACKAGE_VERSION_MINOR "@SMASN1_VERSION_MINOR@") +SET(CPACK_PACKAGE_VERSION_PATCH "@SMASN1_VERSION_PATCH@") +SET(CPACK_PACKAGE_NAME "Smartasn1") +SET(CPACK_PACKAGE_FILE_NAME "Smartasn1-@SMASN1_VERSION@") +SET(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_ROOT@/Templates/CPack.GenericLicense.txt") +SET(CPACK_RESOURCE_FILE_README "@CMAKE_ROOT@/Templates/CPack.GenericDescription.txt") +SET(CPACK_RESOURCE_FILE_WELCOME "@CMAKE_ROOT@/Templates/CPack.GenericWelcome.txt") +SET(CPACK_SET_DESTDIR "OFF") +SET(CPACK_INSTALL_PREFIX "") +SET(CPACK_SYSTEM_NAME "Linux") + +SET(CMAKE_INSTALL_DEBUG_LIBRARIES ON) +SET(CMAKE_INSTALL_PREFIX .) diff --git a/Resources/DS_Store b/Resources/DS_Store new file mode 100644 index 0000000..bf5f678 Binary files /dev/null and b/Resources/DS_Store differ diff --git a/Resources/background.png b/Resources/background.png new file mode 100644 index 0000000..a5aef23 Binary files /dev/null and b/Resources/background.png differ diff --git a/Resources/cstainsight.icns b/Resources/cstainsight.icns new file mode 100644 index 0000000..bbab504 Binary files /dev/null and b/Resources/cstainsight.icns differ diff --git a/Resources/squarelogo.jpg b/Resources/squarelogo.jpg new file mode 100644 index 0000000..6e79d90 Binary files /dev/null and b/Resources/squarelogo.jpg differ diff --git a/asn1 b/asn1 new file mode 160000 index 0000000..606f37b --- /dev/null +++ b/asn1 @@ -0,0 +1 @@ +Subproject commit 606f37be8dbd1dff3d135e3bdafd245c84d67860 diff --git a/common b/common new file mode 160000 index 0000000..09c4610 --- /dev/null +++ b/common @@ -0,0 +1 @@ +Subproject commit 09c461092c6c4e7cc01da9fea83146bab8ead9c2 diff --git a/gdmo b/gdmo new file mode 160000 index 0000000..0e47c66 --- /dev/null +++ b/gdmo @@ -0,0 +1 @@ +Subproject commit 0e47c66125c03dd6118a9db58f093d8d9804cd40 diff --git a/gsp b/gsp new file mode 160000 index 0000000..70fec5d --- /dev/null +++ b/gsp @@ -0,0 +1 @@ +Subproject commit 70fec5d1a2b248cb4d2cf3a6a470e0b31ad66b29 diff --git a/libCodeGen/CMakeLists.txt b/libCodeGen/CMakeLists.txt new file mode 100644 index 0000000..d592571 --- /dev/null +++ b/libCodeGen/CMakeLists.txt @@ -0,0 +1,2 @@ +PROJECT(libCodeGen) +SUBDIRS(xml) diff --git a/libCodeGen/xml/CMakeLists.txt b/libCodeGen/xml/CMakeLists.txt new file mode 100644 index 0000000..00fdb37 --- /dev/null +++ b/libCodeGen/xml/CMakeLists.txt @@ -0,0 +1,16 @@ +PROJECT(gencodexml) +IF(NOT DEFINED xsd_SOURCE_DIR) + MESSAGE("gencodexml xsd SOURCE_DIR not defined ${xsd_SOURCE_DIR}") +ENDIF(NOT DEFINED xsd_SOURCE_DIR) +MESSAGE("gencodexml xsd SOURCE_DIR is: ${xsd_SOURCE_DIR}") + +INCLUDE_DIRECTORIES(${gencodexml_BINARY_DIR}) +INCLUDE_DIRECTORIES(${xsd_SOURCE_DIR}/include) +FIND_PACKAGE(EXPAT REQUIRED) +FIND_LIBRARY(EXPAT_LIB expat "/usr/lib:/usr/local/lib") + +INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) + +MESSAGE("Expat Librarie : ${EXPAT_LIB}") +ADD_EXECUTABLE(test main.cxx) +TARGET_LINK_LIBRARIES(test ${EXPAT_LIB}) diff --git a/libCodeGen/xml/element.h b/libCodeGen/xml/element.h new file mode 100644 index 0000000..430756c --- /dev/null +++ b/libCodeGen/xml/element.h @@ -0,0 +1,192 @@ +#ifndef ELEMENT_H +#define ELEMENT_H + +namespace xml { + + + +/** + * class context + * + * \brief + * \author + */ +class context { + public: + // + context() {}; + // + context(const context &o) {}; + // + ~context() {}; + protected: +}; + + +/** + * class node + * + * \brief + * \author + */ +class node { + public: + // + node() {}; + // + node(const node &o) {}; + // + ~node() {}; + protected: +}; + + + +/** + * class element_base + * + * \brief + * \author + */ +template +class element_base { + public: + // + element_base() + { + } ; + // + element_base(const element_base &o) ; + // + ~element_base() ; + + void generate_code(context &ctx,node &n) + { + T *derived = static_cast(this); + derived->generate_code(ctx,n); + } + protected: +}; + + + +/** + * class element + * + * \brief + * \author + */ +class element { + protected: + std::string m_Name; + std::string m_Str; + public: + // + element(const std::string &_n + ,const std::string &_s= "" + , element *_parent=NULL) : m_Next(NULL) , m_Child(NULL) + , m_Parent(_parent) + , m_Name(_n) + , m_Str(_s) + { + }; + // + element(const element &o) ; + // + ~element() ; + + void addChild( element *c) { + c->setParent(this); + if (m_Child == NULL) { + m_Child = c; + } else { + element *e = m_Child; + while (e->m_Next) + e = e->m_Next; + e->m_Next = c; + } + }; + + element *getFirstChild() { return m_Child ; } + element *getNextSibling() { return m_Next ; } + element *getParent() { return m_Parent ; } + void setParent(element *e) { m_Parent = e; }; + + void setAttributes(const char **attrs) + { + for (int i = 0 ; attrs[i] ; i+=2) + { + m_Attributes[attrs[i]] = attrs[i+1]; + } + } + virtual void generate_code(context &ctx,node &_node) {}; + protected: + element *m_Next; + element *m_Child; + element *m_Parent; + std::map m_Attributes; +}; + +#define ELEMENT(NAME,CODE) \ + class NAME : public element \ + { \ + public: \ + NAME(const std::string &_name,const std::string _s = "") : element(_name,_s) {} \ + ~NAME() {} \ + void generate_code(context &ctx, node &n ) { \ + CODE ; \ + }\ + }; + +ELEMENT(elementText, { + std::cout<generate_code(ctx,n); + e = e->getNextSibling(); + } + }) + +ELEMENT(elementStylesheet ,{ + xml::element *e = getFirstChild(); + while (e) { + e->generate_code(ctx,n); + e = e->getNextSibling(); + } + }) + +ELEMENT(elementImport ,{}) +ELEMENT(elementFile ,{}) +ELEMENT(elementApplyTemplates ,{}) +ELEMENT(elementCallTemplate ,{}) +ELEMENT(elementOutput ,{}) +ELEMENT(elementParam ,{}) +ELEMENT(elementWithParam ,{}) +ELEMENT(elementVariable ,{}) +ELEMENT(elementResultDocument ,{}) +ELEMENT(elementChoose , + xml::element *e = getFirstChild(); + while (e) { + e->generate_code(ctx,n); + e = e->getNextSibling(); + } + {}) +ELEMENT(elementWhen ,{ + std::cout<<"When :"< +#include +#include +#include +#include "element.h" +#include + +class MyParser : public xml::sax::parser +{ + protected: + long m_Depth; + std::stack m_Stack; + xml::element *m_CurrentElement; + + public: + MyParser() : m_Depth(0), m_CurrentElement(NULL) { } + + xml::element *get_root() { return m_CurrentElement;}; + void onStartElement(const XML_Char *name,const XML_Char **attr) + { + xml::element *_e = NULL; + std::string local_name,ns; + split_name(name,local_name,ns); + m_Depth++; +#define PELEMENT(NAME,ELT) \ + else if (!local_name.compare(#NAME) ) \ + { \ + _e = new xml::ELT(local_name); \ + if (m_CurrentElement) \ + m_CurrentElement->addChild(_e); \ + } \ + + // std::cout<<" Got Start Element:"<addChild(_e); + } + else if (!local_name.compare("import") ) + { + _e = new xml::elementImport(local_name); + // lookup file, create a new parser and add to current tree + } + PELEMENT(with-param,elementWithParam) + PELEMENT(for-each,elementFor) + PELEMENT(if,elementIf) + PELEMENT(value-of,elementValueOf) + PELEMENT(apply-templates,elementApplyTemplates) + PELEMENT(text,elementText) + PELEMENT(choose,elementChoose) + PELEMENT(when,elementWhen) + PELEMENT(otherwise,elementOtherwise) + else if (!local_name.compare("stylesheet") ) + { + _e = new xml::elementStylesheet(local_name); + } else { + std::cerr<<"Invalid tag " <addChild(_e); + } + + + protected: +}; + +/** + * + * + */ +int main(int argc,char **argv) +{ + std::fstream xml; + MyParser p; + + xml.open("test.xml"); + std::cout<<"Hello Parser"<generate_code(c,n); + } + } +} diff --git a/rules b/rules new file mode 160000 index 0000000..aeca878 --- /dev/null +++ b/rules @@ -0,0 +1 @@ +Subproject commit aeca878a84169490996e427211493ac306f00c7c diff --git a/smartasn1.sh b/smartasn1.sh new file mode 100644 index 0000000..e1f467b --- /dev/null +++ b/smartasn1.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +SMARTASN1_BUNDLE="`echo "$0" | sed -e's/\/Contents\/MacOS\/smartasn1//'`" +export "SMARTASN1_RESOURCES=$SMARTASN1_BUNDLE/Contents/Resources" +export "DYLD_LIBRARY_PATH=$SMARTASN1_BUNDLE/Contents/MacOS:$DYLD_LIBRARY_PATH" +export "PATH=$SMARTASN1_BUNDLE/Contents/MacOS:$PATH" +exec "$SMARTASN1_BUNDLE/Contents/MacOS/smartasn1.bin" diff --git a/utils b/utils new file mode 160000 index 0000000..5f6e913 --- /dev/null +++ b/utils @@ -0,0 +1 @@ +Subproject commit 5f6e9134ab67b61537fc0bf557842221001f76b1 diff --git a/xml-transform b/xml-transform new file mode 160000 index 0000000..9bb0eda --- /dev/null +++ b/xml-transform @@ -0,0 +1 @@ +Subproject commit 9bb0eda673f41d6e5125c1606e69f77ec1198198