diff --git a/.gitignore b/.gitignore index 0fdd197d..b3c24f65 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,11 @@ DerivedData lemon/build +build +build-test build-xcode +build-xcode-test + build-xcode-debug test/parser_test.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ec73989..a37fb5a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,144 +1,229 @@ -cmake_minimum_required (VERSION 2.6) +# +# Boilerplate CMake configuration for a cross-platform library, +# including configuration for a static framework on Xcode/macOS/iOS +# +# Designed by Fletcher T. Penney +# See the LICENSE file for copyright and licensing information. +# +cmake_minimum_required(VERSION 2.6) -# ================== -# Define Our Project -# ================== -set (My_Project_Title "MultiMarkdown") +# =================== +# Customize This Part +# =================== + +# Project Description + +set (My_Project_Title "libMultiMarkdown") set (My_Project_Description "Lightweight markup processor to produce HTML, LaTeX, and more.") set (My_Project_Author "Fletcher T. Penney") set (My_Project_Revised_Date "2020-10-28") set (My_Project_Version_Major 6) -set (My_Project_Version_Minor 5) -set (My_Project_Version_Patch 3) - -set (My_Project_Version "${My_Project_Version_Major}.${My_Project_Version_Minor}.${My_Project_Version_Patch}") +set (My_Project_Version_Minor 6) +set (My_Project_Version_Patch 0) set (My_Project_Copyright_Date "2016 - 2020") -set (My_Project_Copyright "Copyright © ${My_Project_Copyright_Date} ${My_Project_Author}.") -string(TOUPPER ${My_Project_Title} My_Project_Title_Caps ) -string(REGEX REPLACE " " "_" My_Project_Title_Caps ${My_Project_Title_Caps} ) +set (My_Project_Identifier "net.fletcherpenney.multimarkdown") -project (${My_Project_Title}) +string(TIMESTAMP My_Build_Version "%Y.%m.%d.%H.%M") -# Enable this if you want to be warned about struct alignment -# add_definitions ("-Wpadded") +# Search for included files here +include_directories( ${PROJECT_SOURCE_DIR}/src) -# ========================= -# Build Submodules (if any) -# ========================= +# Source files and headers -# add_subdirectory(submodules/foo) +set(src_files + src/aho-corasick.c + src/beamer.c + src/char.c + src/critic_markup.c + src/d_string.c + src/epub.c + src/file.c + src/html.c + src/itmz.c + src/itmz-lexer.c + src/itmz-parser.c + src/itmz-reader.c + src/latex.c + src/lexer.c + src/memoir.c + src/miniz.c + src/mmd.c + src/object_pool.c + src/opendocument.c + src/opendocument-content.c + src/opml.c + src/opml-lexer.c + src/opml-parser.c + src/opml-reader.c + src/parser.c + src/rng.c + src/scanners.c + src/stack.c + src/textbundle.c + src/token.c + src/token_pairs.c + src/transclude.c + src/uuid.c + src/xml.c + src/writer.c + src/zip.c +) +set(public_headers + src/libMultiMarkdown.h + src/d_string.h + src/token.h +) -# ================= -# Configure Project -# ================= +set(private_headers + src/aho-corasick.h + src/beamer.h + src/char.h + src/critic_markup.h + src/epub.h + src/file.h + src/html.h + src/itmz.h + src/itmz-lexer.h + src/itmz-parser.h + src/itmz-reader.h + src/latex.h + src/lexer.h + src/memoir.h + src/miniz.h + src/mmd.h + src/object_pool.h + src/opendocument.h + src/opendocument-content.h + src/opml.h + src/opml-lexer.h + src/opml-parser.h + src/opml-reader.h + src/scanners.h + src/stack.h + src/textbundle.c + src/token_pairs.h + src/transclude.h + src/uthash.h + src/uuid.h + src/xml.h + src/writer.h + src/zip.h +) -# Search for included files here -include_directories( ${PROJECT_SOURCE_DIR}/Sources/libMultiMarkdown) -include_directories( ${PROJECT_SOURCE_DIR}/Sources/libMultiMarkdown/include) -include_directories( ${PROJECT_SOURCE_DIR}/Sources/multimarkdown) -include_directories( ${PROJECT_SOURCE_DIR}/test ) -include_directories(${PROJECT_BINARY_DIR}) +set(resources +) -if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - # using Clang - # Default is 256 -- needed for localization hash function - add_definitions("-fbracket-depth=264") -endif() +set(main_storyboard +) -set(CMAKE_SUPPRESS_REGENERATION 1) +# Include other CMake projects? +# add_subdirectory(submodules/foo) -# ================= -# Macro Definitions -# ================= +# Libraries for linking +# on macOS can link to frameworks using: "-framework QuartzCore", for example +set(libraries_to_link +) -MACRO(ADD_PUBLIC_HEADER target filename) - # Add filename to public_header_files list, flag it as - # public header for libraries and OS X Frameworks +# This is an ugly hack, but it seems to work. +# When linking to a framework in Xcode, we need to be able to +# search for public headers within that framework +# "$SRCROOT/build-xcode/submodules/libFoo/$/libFoo.framework/.." +# +set(framework_search_paths +) - # This will work for creating one library/framework with public headers - # per project. If you need more than one, you will need to customize - # the workflow as appropriate, since there is only one - # public_header_files list. +# Link to Cocoa Framework? +# set (link_to_cocoa 1) - # This should only be run once per target - # SET_TARGET_PROPERTIES(${target} PROPERTIES PUBLIC_HEADER ${filename}) +# Enable ARC for Obj-C? +# set (enable_arc 1) - LIST(APPEND public_header_files ${filename}) - SET_SOURCE_FILES_PROPERTIES( - ${filename} - PROPERTIES - MACOSX_PACKAGE_LOCATION - include/\${PRODUCT_NAME} - ) +# ======================= +# Leave the rest alone... +# ======================= - # Set Xcode project to configure public header location to allow - # use when this project is used in another workspace. - # NOTE: You must manually add a "Headers" build phase and add - # the desired public headers to that list for Xcode to use them. - # - # TODO: If anyone knows how to automate that in Cmake, I would be very - # grateful!! +# Configuration - SET_TARGET_PROPERTIES(${target} PROPERTIES - XCODE_ATTRIBUTE_PUBLIC_HEADERS_FOLDER_PATH - "include/$(TARGET_NAME)" - ) +set (My_Project_Version "${My_Project_Version_Major}.${My_Project_Version_Minor}.${My_Project_Version_Patch}") +set (My_Project_Copyright "Copyright © ${My_Project_Copyright_Date} ${My_Project_Author}.") - SET_TARGET_PROPERTIES(${target} PROPERTIES - XCODE_ATTRIBUTE_PRIVATE_HEADERS_FOLDER_PATH - "$(PUBLIC_HEADERS_FOLDER_PATH)/Private" - ) - - # Set Xcode target to include settings for OS X and iOS - - SET_TARGET_PROPERTIES(${target} PROPERTIES - XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS - "macosx iphonesimulator iphoneos" - ) +string(TOUPPER ${My_Project_Title} My_Project_Title_Caps ) +string(REGEX REPLACE " " "_" My_Project_Title_Caps ${My_Project_Title_Caps} ) - SET_TARGET_PROPERTIES(${target} PROPERTIES - XCODE_ATTRIBUTE_VALID_ARCHITECTURES - "x86_64 armv6 armv7 armv7s arm64" - ) +if (POLICY CMP0048) + cmake_policy(SET CMP0048 NEW) +endif (POLICY CMP0048) -ENDMACRO(ADD_PUBLIC_HEADER) +project (${My_Project_Title} VERSION "${My_Project_Version}") -# The target should be an OS X Bundle with a PList +# Search source directory +include_directories(${PROJECT_SOURCE_DIR}/src) +include_directories(${PROJECT_SOURCE_DIR}/test) -MACRO(MAKE_TARGET_BUNDLE targetname) - set_target_properties( - ${targetname} - PROPERTIES - MACOSX_BUNDLE_INFO_PLIST - ${PROJECT_SOURCE_DIR}/templates/plist.in - ) +# Search build directory (for version.h) +include_directories(${PROJECT_BINARY_DIR}) -ENDMACRO(MAKE_TARGET_BUNDLE) +# Configure library/framework -MACRO(ADD_LINKED_FRAMEWORK frame) +add_library("${My_Project_Title}" + STATIC + ${src_files} + ${private_headers} + ${public_headers} + ${resources} +) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGES} -framework ${frame}") +string (REPLACE ";" " " framework_search_paths_string "${framework_search_paths}") + +set_target_properties("${My_Project_Title}" + PROPERTIES + PREFIX "" + FRAMEWORK_VERSION A + MACOSX_FRAMEWORK_IDENTIFIER "${My_Project_Identifier}" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${My_Project_Identifier}" + XCODE_ATTRIBUTE_MARKETING_VERSION ${My_Project_Version} + RESOURCE "${resources}" + XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS "${XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS} ${framework_search_paths_string}" + PUBLIC_HEADER "${public_headers}" + ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} +) + +# Link to other libraries +target_link_libraries("${My_Project_Title}" + ${libraries_to_link} +) + +# Link to Apple Cocoa Framework? +if (link_to_cocoa) + target_link_libraries("${My_Project_Title}" "-framework Cocoa") +endif (link_to_cocoa) + +# Enable ARC +if (enable_arc) + set_property (TARGET "${My_Project_Title}" + APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc" + ) +endif (enable_arc) -ENDMACRO(ADD_LINKED_FRAMEWORK) # ====================== # Process Template Files # ====================== -file(READ ${PROJECT_SOURCE_DIR}/LICENSE.txt My_Project_License) +file(READ ${PROJECT_SOURCE_DIR}/LICENSE My_Project_License) string(REGEX REPLACE "\n" "\n\t" My_Project_License_Indented ${My_Project_License}) @@ -169,90 +254,114 @@ configure_file ( ) -# ============ -# Source Files -# ============ +# =================================== +# Documentation Generation by doxygen +# =================================== -# src_files are the primary files, and will be included in doxygen documentation -set(src_files - Sources/libMultiMarkdown/aho-corasick.c - Sources/libMultiMarkdown/beamer.c - Sources/libMultiMarkdown/char.c - Sources/libMultiMarkdown/critic_markup.c - Sources/libMultiMarkdown/d_string.c - Sources/libMultiMarkdown/epub.c - Sources/libMultiMarkdown/file.c - Sources/libMultiMarkdown/html.c - Sources/libMultiMarkdown/itmz.c - Sources/libMultiMarkdown/itmz-lexer.c - Sources/libMultiMarkdown/itmz-parser.c - Sources/libMultiMarkdown/itmz-reader.c - Sources/libMultiMarkdown/latex.c - Sources/libMultiMarkdown/lexer.c - Sources/libMultiMarkdown/memoir.c - Sources/libMultiMarkdown/miniz.c - Sources/libMultiMarkdown/mmd.c - Sources/libMultiMarkdown/object_pool.c - Sources/libMultiMarkdown/opendocument.c - Sources/libMultiMarkdown/opendocument-content.c - Sources/libMultiMarkdown/opml.c - Sources/libMultiMarkdown/opml-lexer.c - Sources/libMultiMarkdown/opml-parser.c - Sources/libMultiMarkdown/opml-reader.c - Sources/libMultiMarkdown/parser.c - Sources/libMultiMarkdown/rng.c - Sources/libMultiMarkdown/scanners.c - Sources/libMultiMarkdown/stack.c - Sources/libMultiMarkdown/textbundle.c - Sources/libMultiMarkdown/token.c - Sources/libMultiMarkdown/token_pairs.c - Sources/libMultiMarkdown/transclude.c - Sources/libMultiMarkdown/uuid.c - Sources/libMultiMarkdown/xml.c - Sources/libMultiMarkdown/writer.c - Sources/libMultiMarkdown/zip.c +# Generate doxygen configuration file +string(REPLACE ";" " " doxygen_src_files "${src_files}" ) +string(REPLACE ";" " " doxygen_header_files "${public_headers} {private_headers}" ) + +configure_file ( + "${PROJECT_SOURCE_DIR}/templates/doxygen.conf.in" + "${PROJECT_BINARY_DIR}/doxygen.conf" +) + + +# =========================================== +# Build Test Suite with CuTest (unit testing) +# =========================================== + +# from http://stackoverflow.com/questions/25199677/how-to-detect-if-current-scope-has-a-parent-in-cmake +get_directory_property(hasParent PARENT_DIRECTORY) + + +set(test_files + test/CuTest.c + test/CuTest.h + ${PROJECT_BINARY_DIR}/AllTests.c ) -# Primary header files, also for doxygen documentation -set(header_files - Sources/libMultiMarkdown/aho-corasick.h - Sources/libMultiMarkdown/beamer.h - Sources/libMultiMarkdown/char.h - Sources/libMultiMarkdown/critic_markup.h - Sources/libMultiMarkdown/include/d_string.h - Sources/libMultiMarkdown/epub.h - Sources/libMultiMarkdown/file.h - Sources/libMultiMarkdown/html.h - Sources/libMultiMarkdown/itmz.h - Sources/libMultiMarkdown/itmz-lexer.h - Sources/libMultiMarkdown/itmz-parser.h - Sources/libMultiMarkdown/itmz-reader.h - Sources/libMultiMarkdown/latex.h - Sources/libMultiMarkdown/lexer.h - Sources/libMultiMarkdown/include/libMultiMarkdown.h - Sources/libMultiMarkdown/memoir.h - Sources/libMultiMarkdown/miniz.h - Sources/libMultiMarkdown/mmd.h - Sources/libMultiMarkdown/object_pool.h - Sources/libMultiMarkdown/opendocument.h - Sources/libMultiMarkdown/opendocument-content.h - Sources/libMultiMarkdown/opml.h - Sources/libMultiMarkdown/opml-lexer.h - Sources/libMultiMarkdown/opml-parser.h - Sources/libMultiMarkdown/opml-reader.h - Sources/libMultiMarkdown/scanners.h - Sources/libMultiMarkdown/stack.h - Sources/libMultiMarkdown/textbundle.c - Sources/libMultiMarkdown/include/token.h - Sources/libMultiMarkdown/token_pairs.h - Sources/libMultiMarkdown/transclude.h - Sources/libMultiMarkdown/uthash.h - Sources/libMultiMarkdown/uuid.h - Sources/libMultiMarkdown/xml.h - Sources/libMultiMarkdown/writer.h - Sources/libMultiMarkdown/zip.h + +# Process source files to look for tests to run +add_custom_command ( + OUTPUT ${PROJECT_BINARY_DIR}/AllTests.c + COMMAND bash ${PROJECT_SOURCE_DIR}/test/make-tests.sh ${PROJECT_SOURCE_DIR}/src/*.c > ${PROJECT_BINARY_DIR}/AllTests.c ) + +if(hasParent) + # Don't create "run_tests" when we're a sub-project for something else +else() + # Only create framework if we are the parent project + set_target_properties("${My_Project_Title}" + PROPERTIES + FRAMEWORK TRUE + ) + + if (DEFINED TEST) + add_definitions(-DTEST) + + add_executable(run_tests + ${src_files} + ${private_headers} + ${public_headers} + ${test_files} + ) + + # Link to other libraries + target_link_libraries(run_tests + ${libraries_to_link} + ) + + # Link to Apple Cocoa Framework? + if (link_to_cocoa) + target_link_libraries(run_tests "-framework Cocoa") + endif (link_to_cocoa) + + # Enable ARC + if (enable_arc) + set_property (TARGET run_tests + APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc" + ) + endif (enable_arc) + + enable_testing() + + add_test( test ${PROJECT_BINARY_DIR}/run_tests) + + # valgrind memory testing + # find_program (MEMORYCHECK_COMMAND valgrind) + # SET (MEMORYCHECK_COMMAND_OPTIONS --leak-check=full --error-exitcode=1) + # + # add_test( memory_test ${MEMORYCHECK_COMMAND} ${MEMORYCHECK_COMMAND_OPTIONS} ${PROJECT_BINARY_DIR}/run_tests) + + endif() +endif() + + +# Build MultiMarkdown app +if (hasParent) +else() + add_executable(multimarkdown + src/d_string.c + + src/main.c + src/argtable3.c + + ${private_headers} + ${public_headers} + ) + + target_link_libraries(multimarkdown "${My_Project_Title}") +endif() + + +# ========================== +# Build Installer with CPack +# ========================== + + if (WIN32) set (scripts scripts/mmd.bat @@ -327,339 +436,147 @@ set (latex texmf/tex/latex/mmd6/tufte-handout/mmd6-tufte-handout-leader.tex ) -# Public headers, will be installed in 'include' -# Do not manually add files here, use the ADD_PUBLIC_HEADER() macro -set(public_header_files -) -# Utility source files will not be included in doxygen -set(src_utility_files -) +set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${My_Project_Description}") +set (CPACK_PACKAGE_VERSION "${My_Project_Version_Major}.${My_Project_Version_Minor}.${My_Project_Version_Patch}") +set (CPACK_PACKAGE_VERSION_MAJOR "${My_Project_Version_Major}") +set (CPACK_PACKAGE_VERSION_MINOR "${My_Project_Version_Minor}") +set (CPACK_PACKAGE_VERSION_PATCH "My_Project_Version_Patch") -set(header_utility_files - ${PROJECT_BINARY_DIR}/version.h +configure_file ( + "${PROJECT_SOURCE_DIR}/LICENSE" + "${PROJECT_BINARY_DIR}/LICENSE.txt" ) - -# Generate doxygen configuration file -string(REPLACE ";" " " doxygen_src_files "${src_files}" ) -string(REPLACE ";" " " doxygen_header_files "${header_files}" ) - configure_file ( - "${PROJECT_SOURCE_DIR}/templates/doxygen.conf.in" - "${PROJECT_BINARY_DIR}/doxygen.conf" + "${PROJECT_SOURCE_DIR}/README.md" + "${PROJECT_BINARY_DIR}/README.txt" ) +set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_BINARY_DIR}/LICENSE.txt") +set (CPACK_RESOURCE_FILE_README "${PROJECT_BINARY_DIR}/README.txt") -# =========================================== -# Build Test Suite with CuTest (unit testing) -# =========================================== - -# from http://stackoverflow.com/questions/25199677/how-to-detect-if-current-scope-has-a-parent-in-cmake -get_directory_property(hasParent PARENT_DIRECTORY) - -set(test_files - test/CuTest.c - test/CuTest.h - ${PROJECT_BINARY_DIR}/AllTests.c -) - -# Process source files to look for tests to run -add_custom_command ( - OUTPUT ${PROJECT_BINARY_DIR}/AllTests.c - COMMAND bash ${PROJECT_SOURCE_DIR}/test/make-tests.sh ${PROJECT_SOURCE_DIR}/Sources/libMultiMarkdown/*.c > ${PROJECT_BINARY_DIR}/AllTests.c -) if(hasParent) - # Don't create "run_tests" when we're a sub-project for something else -else() +else (hasParent) if (DEFINED TEST) - add_definitions(-DTEST) - - add_executable(run_tests - ${test_files} - ${src_files} - ${header_files} - ${src_utility_files} - ${header_utility_files} + # Don't install the test suite + else() + if (APPLE) + # Apple Builds + + if (DEFINED ZIP) + set (CPACK_GENERATOR ZIP) + else (DEFINED ZIP) + set (CPACK_GENERATOR productbuild) + endif (DEFINED ZIP) + else (APPLE) + if (WIN32) + # Windows Builds + + if (DEFINED ZIP) + set (CPACK_GENERATOR ZIP) + else (DEFINED ZIP) + set (CPACK_GENERATOR NSIS) + endif (DEFINED ZIP) + elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") + # Linux + set (CPACK_GENERATOR ZIP) + endif (WIN32) + endif (APPLE) + + # Install Target + install (TARGETS multimarkdown + DESTINATION bin + COMPONENT MAIN ) + set (CPACK_COMPONENT_MAIN_DISPLAY_NAME "MultiMarkdown") + set (CPACK_COMPONENT_MAIN_DESCRIPTION "Install the actual `multimarkdown` program.") + + # Install utility scripts + install (FILES ${scripts} + DESTINATION bin + COMPONENT scripts + PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + set (CPACK_COMPONENT_SCRIPTS_DISPLAY_NAME "Convenience scripts") + set (CPACK_COMPONENT_SCRIPTS_DESCRIPTION "Install convenience scripts for common MultiMarkdown shortcuts, e.g. `mmd`, `mmd2tex`, etc.") + + # Install Shared Library? + if (DEFINED SHAREDBUILD) + install (TARGETS "${My_Project_Title}" + ARCHIVE DESTINATION lib + FRAMEWORK DESTINATION lib + LIBRARY DESTINATION lib + COMPONENT sharedlib + ) + + if (public_headers) + # Install Headers + install(FILES + ${public_headers} + DESTINATION include/${My_Project_Title} + COMPONENT sharedlib + ) + set (CPACK_COMPONENT_SHAREDLIB_DISPLAY_NAME "Shared Library") + set (CPACK_COMPONENT_SHAREDLIB_DESCRIPTION "MultiMarkdown shared library for use with third party software.") + + set (CPACK_COMPONENTS_ALL MAIN scripts sharedlib) + set (CPACK_COMPONENT_SHAREDLIB_GROUP "libMultiMarkdown") + else (public_headers) + set (CPACK_COMPONENTS_ALL Main) + endif (public_headers) + endif (DEFINED SHAREDBUILD) + + # Install Documentation + install(FILES + "${PROJECT_BINARY_DIR}/LICENSE.txt" + "${PROJECT_BINARY_DIR}/README.txt" + COMPONENT Docs + DESTINATION . + ) + set (CPACK_COMPONENT_DOCS_DISPLAY_NAME "Documentation") + set (CPACK_COMPONENT_DOCS_DESCRIPTION "Install README and LICENSE.") + + # Install LaTeX support files + install (FILES ${latex} + DESTINATION share/texmf/tex/latex/mmd6 + COMPONENT latex + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ + ) + set (CPACK_COMPONENT_LATEX_DISPLAY_NAME "LaTeX support files") + set (CPACK_COMPONENT_LATEX_DESCRIPTION "Install configuration files for MultiMarkdown-based LaTex configurations.") + + # Rename package + if (APPLE) + set (CPACK_PACKAGE_FILE_NAME "MultiMarkdown-Mac-${CPACK_PACKAGE_VERSION}") + else (APPLE) + set (CPACK_PACKAGE_FILE_NAME "MultiMarkdown-${CMAKE_SYSTEM_NAME}-${CPACK_PACKAGE_VERSION}") + endif (APPLE) + + # Use default install locations (if appropriate) + # TODO: This may need tweaking + if (WIN32) + set (CPACK_INSTALL_PREFIX "") + set (CPACK_NSIS_MODIFY_PATH ON) + if (ZIP) + set(CPACK_SET_DESTDIR true) + endif (ZIP) + else (WIN32) + set(CPACK_SET_DESTDIR true) + set (CPACK_INSTALL_PREFIX /usr/local) + endif (WIN32) + + set (CPACK_PACKAGE_CONTACT "fletcher@fletcherpenney.net") - enable_testing() - - add_test( test ${PROJECT_BINARY_DIR}/run_tests) - - # valgrind memory testing - # find_program (MEMORYCHECK_COMMAND valgrind) - # SET (MEMORYCHECK_COMMAND_OPTIONS --leak-check=full --error-exitcode=1) - # - # add_test( memory_test ${MEMORYCHECK_COMMAND} ${MEMORYCHECK_COMMAND_OPTIONS} ${PROJECT_BINARY_DIR}/run_tests) - - endif() -endif() - - -# ======================= -# Configure for Target OS -# ======================= - -# OS X Builds -if (APPLE) - - # Configure backwards-compatible support (if your project allows it) - SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE STRING "Deployment target for OSX" FORCE) - - # Compile for x86_64 and i386. ppc no longer supported - if(CMAKE_BUILD_TYPE MATCHES "Release") - SET (CMAKE_OSX_ARCHITECTURES x86_64) - endif(CMAKE_BUILD_TYPE MATCHES "Release") - - # Use PackageMaker for installers? - if (DEFINED ZIP) - set (CPACK_GENERATOR ZIP) - else (DEFINED ZIP) - set (CPACK_GENERATOR productbuild) - endif (DEFINED ZIP) - -endif (APPLE) - -# Windows Builds -if (WIN32) - - # Use NSIS to generate installers? - if (DEFINED ZIP) - set (CPACK_GENERATOR ZIP) - else (DEFINED ZIP) - set (CPACK_GENERATOR NSIS) - endif (DEFINED ZIP) - -# Linux Builds (not cross-compiling for Windows) -elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") - - # Create zip archive - set (CPACK_GENERATOR ZIP) - - # Statically link libraries -- might make the binary slightly more - # compatible across Linux distributions, for example - # - # You may wish to disable this. - # - - # set (CMAKE_FIND_LIBRARY_SUFFIXES ".a") - # set (BUILD_SHARED_LIBRARIES OFF) - # set (CMAKE_EXE_LINKER_FLAGS "-static") - - # Some libraries need to be linked on some Linux builds - if (DEFINED TEST) - # target_link_libraries(run_tests m) endif (DEFINED TEST) +endif (hasParent) -endif (WIN32) - - -# ============== -# Define targets -# ============== - -# Is libcurl available? -if (NOT DEFINED TEST) - find_package(CURL) - if (CURL_FOUND) - add_definitions(-DUSE_CURL) - message (STATUS "libcurl found") - else () - message (STATUS "libcurl not found") - endif (CURL_FOUND) -endif () - -# Create a library? -if (NOT DEFINED TEST) - add_library(libMultiMarkdown STATIC - ${src_files} - ${src_utility_files} - ${header_files} - ${header_utility_files} - ) -else () - add_library(libMultiMarkdown STATIC - ${src_files} - ${src_utility_files} - ${header_files} - ${header_utility_files} - ${test_files} - ) -endif () - -if (CURL_FOUND) - target_link_libraries(libMultiMarkdown curl) -endif (CURL_FOUND) - -# Create a shared library if defined -if (DEFINED SHAREDBUILD) +include(CPack) - add_library(libMultiMarkdownShared SHARED - ${src_files} - ${src_utility_files} - ${header_files} - ${header_utility_files} - ) - - # Shared libraries require position independent code - SET_TARGET_PROPERTIES(libMultiMarkdownShared PROPERTIES POSITION_INDEPENDENT_CODE 1) - - # Remove the extra "lib" from "liblibMultiMarkdown" - SET_TARGET_PROPERTIES(libMultiMarkdownShared PROPERTIES PREFIX "") - - # Remove "Shared" from library name - SET_TARGET_PROPERTIES(libMultiMarkdownShared PROPERTIES OUTPUT_NAME libMultiMarkdown) - - if (CURL_FOUND) - target_link_libraries(libMultiMarkdown ${CURL_LIBRARY}) - endif (CURL_FOUND) - -endif (DEFINED SHAREDBUILD) - -# remove the extra "lib" from "liblibFOO" -SET_TARGET_PROPERTIES(libMultiMarkdown PROPERTIES - PREFIX "" - FRAMEWORK TRUE - FRAMEWORK_VERSION A - MACOSX_FRAMEWORK_IDENTIFIER net.multimarkdown.mmd6 - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "net.multimarkdown.mmd6" - ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} -) - -ADD_PUBLIC_HEADER(libMultiMarkdown Sources/libMultiMarkdown/include/libMultiMarkdown.h) -ADD_PUBLIC_HEADER(libMultiMarkdown Sources/libMultiMarkdown/include/d_string.h) -ADD_PUBLIC_HEADER(libMultiMarkdown Sources/libMultiMarkdown/include/token.h) -ADD_PUBLIC_HEADER(libMultiMarkdown Sources/libMultiMarkdown/include/version.h) - -# Create a command-line app? -if(hasParent) -else() - add_executable(multimarkdown - Sources/libMultiMarkdown/d_string.c - Sources/multimarkdown/main.c - Sources/multimarkdown/argtable3.c - ) -# -# Link the library to the app? - target_link_libraries(multimarkdown libMultiMarkdown) - - set_target_properties(multimarkdown PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH "NO") - set_property(TARGET multimarkdown PROPERTY C_STANDARD 11) - set_property(TARGET multimarkdown PROPERTY C_STANDARD 11) -endif() - -# Xcode settings for fat binaries -set_target_properties(libMultiMarkdown PROPERTIES XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH "NO") - -# Use C11 -set_property(TARGET libMultiMarkdown PROPERTY C_STANDARD 11) - -# ========================== -# Build Installer with CPack -# ========================== - -# You're largely on your own here - -# install (FILES ${CMAKE_CURRENT_LIST_DIR}/README.md ${PROJECT_SOURCE_DIR}/LICENSE.txt -# DESTINATION . -# ) - -# Use something like this to install public header files (after adding them -# with the ADD_PUBLIC_HEADER() macro) - -# install (FILES ${public_header_files} DESTINATION local/include/libFoo) - -# Install MMD binary -if(hasParent) -else() - install (TARGETS multimarkdown - DESTINATION bin - COMPONENT application - ) -endif() -set (CPACK_COMPONENT_APPLICATION_DISPLAY_NAME "MultiMarkdown") -set (CPACK_COMPONENT_APPLICATION_DESCRIPTION "Install the actual `multimarkdown` program.") - - -# Install utility scripts -install (FILES ${scripts} - DESTINATION bin - COMPONENT scripts - PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -) -set (CPACK_COMPONENT_SCRIPTS_DISPLAY_NAME "Convenience scripts") -set (CPACK_COMPONENT_SCRIPTS_DESCRIPTION "Install convenience scripts for common MultiMarkdown shortcuts, e.g. `mmd`, `mmd2tex`, etc.") - -# Install Shared Library? -if (DEFINED SHAREDBUILD) - install (TARGETS libMultiMarkdownShared - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - COMPONENT sharedlib - ) - - install (FILES ${public_header_files} - DESTINATION include/multimarkdown - COMPONENT sharedlib - ) - - set (CPACK_COMPONENT_SHAREDLIB_DISPLAY_NAME "Shared Library") - set (CPACK_COMPONENT_SHAREDLIB_DESCRIPTION "MultiMarkdown shared library for use with third party software.") - - set (CPACK_COMPONENTS_ALL application scripts sharedlib) - - set (CPACK_COMPONENT_SHAREDLIB_GROUP "MultiMarkdown") -endif (DEFINED SHAREDBUILD) - -# Install LaTeX support files -install (FILES ${latex} - DESTINATION share/texmf/tex/latex/mmd6 - COMPONENT latex - PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ -) -set (CPACK_COMPONENT_LATEX_DISPLAY_NAME "LaTeX support files") -set (CPACK_COMPONENT_LATEX_DESCRIPTION "Install configuration files for MultiMarkdown-based LaTex configurations.") - - -# Which groups should be installed? -set (CPACK_COMPONENTS_ALL application scripts latex) - -set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "${My_Project_Description}") -set (CPACK_PACKAGE_VENDOR "fletcherpenney.net") -set (CPACK_PACKAGE_VERSION "${My_Project_Version_Major}.${My_Project_Version_Minor}.${My_Project_Version_Patch}") -set (CPACK_PACKAGE_VERSION_MAJOR "${My_Project_Version_Major}") -set (CPACK_PACKAGE_VERSION_MINOR "${My_Project_Version_Minor}") -set (CPACK_PACKAGE_VERSION_PATCH "My_Project_Version_Patch") - -set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt") - -if (APPLE) - set (CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-Mac-${CPACK_PACKAGE_VERSION}") -else (APPLE) - set (CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CPACK_PACKAGE_VERSION}") -endif (APPLE) - -# Use some default install locations (if appropriate) -set(CPACK_SET_DESTDIR true) -if (WIN32) - set (CPACK_INSTALL_PREFIX "") - set (CPACK_NSIS_MODIFY_PATH ON) -else (WIN32) - set (CPACK_INSTALL_PREFIX /usr/local) -endif (WIN32) - -set (CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT}) - -set (CPACK_PACKAGE_CONTACT "fletcher@fletcherpenney.net") - -include (CPack) - - -# ====================== -# Integration Test Suite -# ====================== +# ===================================== +# MultiMarkdown Integration Test Suite +# ===================================== enable_testing() diff --git a/DevelopmentNotes/DevelopmentNotes.epub b/DevelopmentNotes/DevelopmentNotes.epub index 098a4925..f2356f9a 100644 Binary files a/DevelopmentNotes/DevelopmentNotes.epub and b/DevelopmentNotes/DevelopmentNotes.epub differ diff --git a/DevelopmentNotes/DevelopmentNotes.fodt b/DevelopmentNotes/DevelopmentNotes.fodt index d085b9a7..56a783f6 100644 --- a/DevelopmentNotes/DevelopmentNotes.fodt +++ b/DevelopmentNotes/DevelopmentNotes.fodt @@ -763,6 +763,15 @@ TextBundle/TextPack, OpenDocument, etc. Changelog + +2020–10–28 - v 6.6.0: + + + +UPDATED: Restructure source code organization; Restructure Cmake configuration file; restructure Makefile + + + 2020–10–28 - v 6.5.3: diff --git a/DevelopmentNotes/DevelopmentNotes.html b/DevelopmentNotes/DevelopmentNotes.html index f915f134..f20b42fd 100644 --- a/DevelopmentNotes/DevelopmentNotes.html +++ b/DevelopmentNotes/DevelopmentNotes.html @@ -433,6 +433,11 @@

Dependencies/Libraries

Changelog

    +
  • 2020–10–28 - v 6.6.0:

    + +
      +
    • UPDATED: Restructure source code organization; Restructure Cmake configuration file; restructure Makefile
    • +
  • 2020–10–28 - v 6.5.3:

      diff --git a/DevelopmentNotes/DevelopmentNotes.pdf b/DevelopmentNotes/DevelopmentNotes.pdf index 6fa6a659..f7f19a94 100644 Binary files a/DevelopmentNotes/DevelopmentNotes.pdf and b/DevelopmentNotes/DevelopmentNotes.pdf differ diff --git a/DevelopmentNotes/DevelopmentNotes.txt b/DevelopmentNotes/DevelopmentNotes.txt index ff5f08a1..14c77088 100644 --- a/DevelopmentNotes/DevelopmentNotes.txt +++ b/DevelopmentNotes/DevelopmentNotes.txt @@ -472,6 +472,11 @@ TextBundle/TextPack, OpenDocument, etc. # Changelog # +* 2020-10-28 - v 6.6.0: + + * UPDATED: Restructure source code organization; Restructure Cmake configuration file; restructure Makefile + + * 2020-10-28 - v 6.5.3: * ADDED: Add additional blockquote tests diff --git a/LICENSE.txt b/LICENSE similarity index 100% rename from LICENSE.txt rename to LICENSE diff --git a/Makefile b/Makefile index 8c05b775..8fb302f6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ BUILD_DIR = build -DOC_DIR = documentation +DEBUG_DIR = build-test XCODE_BUILD_DIR = build-xcode -XCODE_DEBUG_BUILD_DIR = build-xcode-debug +XCODE_DEBUG_BUILD_DIR = build-xcode-test +DOC_DIR = documentation + # The release target will perform additional optimization .PHONY : release @@ -9,37 +11,13 @@ release: $(BUILD_DIR) cd $(BUILD_DIR); \ cmake -DCMAKE_BUILD_TYPE=Release .. + # Also build a shared library .PHONY : shared shared: $(BUILD_DIR) cd $(BUILD_DIR); \ cmake -DCMAKE_BUILD_TYPE=Release -DSHAREDBUILD=1 .. -# Build zip file package -.PHONY : zip -zip: $(BUILD_DIR) - cd $(BUILD_DIR); touch README.html; \ - cmake -DCMAKE_BUILD_TYPE=Release -DZIP=1 .. - -# debug target enables CuTest unit testing -.PHONY : debug -debug: $(BUILD_DIR) - cd $(BUILD_DIR); \ - cmake -DTEST=1 DCMAKE_BUILD_TYPE=DEBUG .. - -# analyze target enables use of clang's scan-build (if installed) -# will then need to run 'scan-build make' to compile and analyze -# 'scan-build -V make' will show the results graphically in your -# web browser -.PHONY : analyze -analyze: $(BUILD_DIR) - cd $(BUILD_DIR); \ - scan-build cmake -DTEST=1 DCMAKE_BUILD_TYPE=DEBUG .. - -.PHONY : map -map: - cd $(BUILD_DIR); \ - ../tools/enumsToPerl.pl ../Sources/libMultiMarkdown/include/libMultiMarkdown.h enumMap.txt; # Create xcode project # You can then build within XCode, or using the commands: @@ -50,20 +28,36 @@ xcode: $(XCODE_BUILD_DIR) cd $(XCODE_BUILD_DIR); \ cmake -G Xcode .. -.PHONY : xcode-debug -xcode-debug: $(XCODE_DEBUG_BUILD_DIR) + +# Xcode debug variant +.PHONY : xcode-test +xcode-test: $(XCODE_DEBUG_BUILD_DIR) cd $(XCODE_DEBUG_BUILD_DIR); \ cmake -G Xcode -DTEST=1 .. -# Build Swift debug variant -.PHONY : swift -swift: $(BUILD_DIR) - swift build -c debug --build-path ${BUILD_DIR} -Xcc -fbracket-depth=264 -# Build Swift release variant -.PHONY : swift-release -swift-release: $(BUILD_DIR) - swift build -c release --build-path ${BUILD_DIR} -Xcc -fbracket-depth=264 -Xcc -DNDEBUG=1 +# test target enables CuTest unit testing +.PHONY : test +test: $(DEBUG_DIR) + cd $(DEBUG_DIR); \ + cmake -DTEST=1 -DCMAKE_BUILD_TYPE=Debug .. + + +# Build the documentation using doxygen +.PHONY : documentation +documentation: + -mkdir $(DOC_DIR) 2>/dev/null; \ + cd $(DOC_DIR); \ + cmake -DDOCUMENTATION=1 ..; cd ..; \ + doxygen $(DOC_DIR)/doxygen.conf + + +# Build zip file package +.PHONY : zip +zip: $(BUILD_DIR) + cd $(BUILD_DIR); touch README.html; \ + cmake -DCMAKE_BUILD_TYPE=Release -DZIP=1 .. + # Cross-compile for Windows using MinGW on *nix .PHONY : windows @@ -71,61 +65,71 @@ windows: $(BUILD_DIR) cd $(BUILD_DIR); touch README.html; \ cmake -DCMAKE_TOOLCHAIN_FILE=../tools/Toolchain-MinGW-w64-64bit.cmake -DCMAKE_BUILD_TYPE=Release .. -# Build Windows zip file using MinGW on *nix + +# Cross-compile and build Windows zip file using MinGW on *nix .PHONY : windows-zip windows-zip: $(BUILD_DIR) cd $(BUILD_DIR); touch README.html; \ cmake -DCMAKE_TOOLCHAIN_FILE=../tools/Toolchain-MinGW-w64-64bit.cmake -DCMAKE_BUILD_TYPE=Release -DZIP=1 .. + # Cross-compile for Windows using MinGW on *nix (32-bit) .PHONY : windows-32 windows-32: $(BUILD_DIR) cd $(BUILD_DIR); touch README.html; \ cmake -DCMAKE_TOOLCHAIN_FILE=../tools/Toolchain-MinGW-w64-32bit.cmake -DCMAKE_BUILD_TYPE=Release .. -# Build Windows zip file using MinGW on *nix (32-bit) + +# Cross-compile and build Windows zip file using MinGW on *nix (32-bit) .PHONY : windows-zip-32 windows-zip-32: $(BUILD_DIR) cd $(BUILD_DIR); touch README.html; \ cmake -DCMAKE_TOOLCHAIN_FILE=../tools/Toolchain-MinGW-w64-32bit.cmake -DCMAKE_BUILD_TYPE=Release -DZIP=1 .. -# Build the documentation using doxygen -.PHONY : documentation -documentation: - -mkdir $(DOC_DIR) 2>/dev/null; \ - cd $(DOC_DIR); \ - cmake -DDOCUMENTATION=1 ..; cd ..; \ - doxygen $(DOC_DIR)/doxygen.conf -.PHONY : gh-pages -gh-pages: documentation - cp -r $(BUILD_DIR)/documentation/html/* documentation/ +# Use astyle to format source code +.PHONY : astyle +astyle: + astyle --options=.astylerc -q --recursive "src/*.h" "src/*.c" + + +# Generate a list of changes since last commit to 'master' branch +.PHONY : CHANGELOG +CHANGELOG: + git log master..develop --format="* %s" | sort | uniq > CHANGELOG-UNRELEASED + + +# Generate mapping of various enumeration constants (for debugging purposes) +.PHONY : map +map: + cd $(BUILD_DIR); \ + ../tools/enumsToPerl.pl ../src/libMultiMarkdown.h enumMap.txt; -# Clean out the build directory -.PHONY : clean -clean: - rm -rf $(BUILD_DIR)/* # Create build directory if it doesn't exist $(BUILD_DIR): CHANGELOG -mkdir $(BUILD_DIR) 2>/dev/null -cd $(BUILD_DIR); rm -rf * + +# Create debug directory if it doesn't exist +$(DEBUG_DIR): CHANGELOG + -mkdir $(DEBUG_DIR) 2>/dev/null + -cd $(DEBUG_DIR); rm -rf * + + # Build xcode directories if they don't exist -$(XCODE_BUILD_DIR): +$(XCODE_BUILD_DIR): CHANGELOG -mkdir $(XCODE_BUILD_DIR) 2>/dev/null -cd $(XCODE_BUILD_DIR); rm -rf * -$(XCODE_DEBUG_BUILD_DIR): +$(XCODE_DEBUG_BUILD_DIR): CHANGELOG -mkdir $(XCODE_DEBUG_BUILD_DIR) 2>/dev/null -cd $(XCODE_DEBUG_BUILD_DIR); rm -rf * -# Generate a list of changes since last commit to 'master' branch -.PHONY : CHANGELOG -CHANGELOG: - -git log master..develop --format="* %s" | sort | uniq > CHANGELOG-UNRELEASED -# Use astyle -.PHONY : astyle -astyle: - astyle --options=.astylerc "Sources/libMultiMarkdown/*.c" "Sources/multimarkdown/*.c" "Sources/libMultiMarkdown/*.h" "Sources/libMultiMarkdown/include/*.h" +# Clean out the build directory +.PHONY : clean +clean: + rm -rf $(BUILD_DIR)/*; + diff --git a/Package.swift b/Package.swift deleted file mode 100644 index c042eac5..00000000 --- a/Package.swift +++ /dev/null @@ -1,9 +0,0 @@ -import PackageDescription - -let package = Package( - name: "mmd-swift", - targets: [ - Target(name: "mmd-swift", dependencies: ["libMultiMarkdown"]) - ], - exclude: ["tests", "Tests", "Sources/multimarkdown"] -) diff --git a/README.md b/README.md index 14d9bf61..8104abb0 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ | | | | ---------- | ------------------------- | -| Title: | MultiMarkdown | +| Title: | libMultiMarkdown | | Author: | Fletcher T. Penney | | Date: | 2020-10-28 | | Copyright: | Copyright © 2016 - 2020 Fletcher T. Penney. | -| Version: | 6.5.3 | +| Version: | 6.6.0 | master branch: [![Build Status](https://travis-ci.org/fletcher/MultiMarkdown-6.svg?branch=master)](https://travis-ci.org/fletcher/MultiMarkdown-6) develop branch: [![Build Status](https://travis-ci.org/fletcher/MultiMarkdown-6.svg?branch=develop)](https://travis-ci.org/fletcher/MultiMarkdown-6) diff --git a/Sources/mmd-swift/main.swift b/Sources/mmd-swift/main.swift deleted file mode 100644 index 6c7ff015..00000000 --- a/Sources/mmd-swift/main.swift +++ /dev/null @@ -1,34 +0,0 @@ -/// Trivial example of using libMultiMarkdown within a Swift -/// project. Needs a lot of work to be functional. - - -// libMultiMarkdown is built as shared library -- needs to be static -// libMultiMarkdown is named liblibMultiMarkdown -- need to fix - -// Needs the functionality from main.c in order to become viable -// replacement for the c build. - -// But as a proof of concept, it works. - -import libMultiMarkdown - - -token_pool_init() - - -let text = "This is a *test* string" -let output = d_string_new("") -let format = Int16(FORMAT_HTML.rawValue) - -let e = mmd_engine_create_with_string(text, 0) - - -mmd_engine_parse_string(e) -mmd_engine_export_token_tree(output, e, format) -token_pool_drain() - - -let str = String(cString: output!.pointee.str!) -print(str) - -token_pool_free() diff --git a/Sources/libMultiMarkdown/aho-corasick.c b/src/aho-corasick.c similarity index 100% rename from Sources/libMultiMarkdown/aho-corasick.c rename to src/aho-corasick.c diff --git a/Sources/libMultiMarkdown/aho-corasick.h b/src/aho-corasick.h similarity index 100% rename from Sources/libMultiMarkdown/aho-corasick.h rename to src/aho-corasick.h diff --git a/Sources/multimarkdown/argtable3.c b/src/argtable3.c similarity index 100% rename from Sources/multimarkdown/argtable3.c rename to src/argtable3.c diff --git a/Sources/multimarkdown/argtable3.h b/src/argtable3.h similarity index 100% rename from Sources/multimarkdown/argtable3.h rename to src/argtable3.h diff --git a/Sources/libMultiMarkdown/beamer.c b/src/beamer.c similarity index 100% rename from Sources/libMultiMarkdown/beamer.c rename to src/beamer.c diff --git a/Sources/libMultiMarkdown/beamer.h b/src/beamer.h similarity index 100% rename from Sources/libMultiMarkdown/beamer.h rename to src/beamer.h diff --git a/Sources/libMultiMarkdown/char.c b/src/char.c similarity index 100% rename from Sources/libMultiMarkdown/char.c rename to src/char.c diff --git a/Sources/libMultiMarkdown/char.h b/src/char.h similarity index 100% rename from Sources/libMultiMarkdown/char.h rename to src/char.h diff --git a/Sources/libMultiMarkdown/char_lookup.c b/src/char_lookup.c similarity index 100% rename from Sources/libMultiMarkdown/char_lookup.c rename to src/char_lookup.c diff --git a/Sources/libMultiMarkdown/critic_markup.c b/src/critic_markup.c similarity index 100% rename from Sources/libMultiMarkdown/critic_markup.c rename to src/critic_markup.c diff --git a/Sources/libMultiMarkdown/critic_markup.h b/src/critic_markup.h similarity index 100% rename from Sources/libMultiMarkdown/critic_markup.h rename to src/critic_markup.h diff --git a/Sources/libMultiMarkdown/d_string.c b/src/d_string.c similarity index 100% rename from Sources/libMultiMarkdown/d_string.c rename to src/d_string.c diff --git a/Sources/libMultiMarkdown/include/d_string.h b/src/d_string.h similarity index 100% rename from Sources/libMultiMarkdown/include/d_string.h rename to src/d_string.h diff --git a/Sources/libMultiMarkdown/epub.c b/src/epub.c similarity index 100% rename from Sources/libMultiMarkdown/epub.c rename to src/epub.c diff --git a/Sources/libMultiMarkdown/epub.h b/src/epub.h similarity index 100% rename from Sources/libMultiMarkdown/epub.h rename to src/epub.h diff --git a/Sources/libMultiMarkdown/file.c b/src/file.c similarity index 100% rename from Sources/libMultiMarkdown/file.c rename to src/file.c diff --git a/Sources/libMultiMarkdown/file.h b/src/file.h similarity index 100% rename from Sources/libMultiMarkdown/file.h rename to src/file.h diff --git a/Sources/libMultiMarkdown/html.c b/src/html.c similarity index 100% rename from Sources/libMultiMarkdown/html.c rename to src/html.c diff --git a/Sources/libMultiMarkdown/html.h b/src/html.h similarity index 100% rename from Sources/libMultiMarkdown/html.h rename to src/html.h diff --git a/Sources/libMultiMarkdown/i18n.h b/src/i18n.h similarity index 100% rename from Sources/libMultiMarkdown/i18n.h rename to src/i18n.h diff --git a/Sources/libMultiMarkdown/itmz-lexer.c b/src/itmz-lexer.c similarity index 100% rename from Sources/libMultiMarkdown/itmz-lexer.c rename to src/itmz-lexer.c diff --git a/Sources/libMultiMarkdown/itmz-lexer.h b/src/itmz-lexer.h similarity index 100% rename from Sources/libMultiMarkdown/itmz-lexer.h rename to src/itmz-lexer.h diff --git a/Sources/libMultiMarkdown/itmz-lexer.re b/src/itmz-lexer.re similarity index 100% rename from Sources/libMultiMarkdown/itmz-lexer.re rename to src/itmz-lexer.re diff --git a/Sources/libMultiMarkdown/itmz-parser.c b/src/itmz-parser.c similarity index 100% rename from Sources/libMultiMarkdown/itmz-parser.c rename to src/itmz-parser.c diff --git a/Sources/libMultiMarkdown/itmz-parser.h b/src/itmz-parser.h similarity index 100% rename from Sources/libMultiMarkdown/itmz-parser.h rename to src/itmz-parser.h diff --git a/Sources/libMultiMarkdown/itmz-parser.out b/src/itmz-parser.out similarity index 100% rename from Sources/libMultiMarkdown/itmz-parser.out rename to src/itmz-parser.out diff --git a/Sources/libMultiMarkdown/itmz-parser.y b/src/itmz-parser.y similarity index 100% rename from Sources/libMultiMarkdown/itmz-parser.y rename to src/itmz-parser.y diff --git a/Sources/libMultiMarkdown/itmz-reader.c b/src/itmz-reader.c similarity index 100% rename from Sources/libMultiMarkdown/itmz-reader.c rename to src/itmz-reader.c diff --git a/Sources/libMultiMarkdown/itmz-reader.h b/src/itmz-reader.h similarity index 100% rename from Sources/libMultiMarkdown/itmz-reader.h rename to src/itmz-reader.h diff --git a/Sources/libMultiMarkdown/itmz.c b/src/itmz.c similarity index 100% rename from Sources/libMultiMarkdown/itmz.c rename to src/itmz.c diff --git a/Sources/libMultiMarkdown/itmz.h b/src/itmz.h similarity index 100% rename from Sources/libMultiMarkdown/itmz.h rename to src/itmz.h diff --git a/Sources/libMultiMarkdown/latex.c b/src/latex.c similarity index 100% rename from Sources/libMultiMarkdown/latex.c rename to src/latex.c diff --git a/Sources/libMultiMarkdown/latex.h b/src/latex.h similarity index 100% rename from Sources/libMultiMarkdown/latex.h rename to src/latex.h diff --git a/Sources/libMultiMarkdown/lexer.c b/src/lexer.c similarity index 100% rename from Sources/libMultiMarkdown/lexer.c rename to src/lexer.c diff --git a/Sources/libMultiMarkdown/lexer.h b/src/lexer.h similarity index 100% rename from Sources/libMultiMarkdown/lexer.h rename to src/lexer.h diff --git a/Sources/libMultiMarkdown/lexer.re b/src/lexer.re similarity index 100% rename from Sources/libMultiMarkdown/lexer.re rename to src/lexer.re diff --git a/Sources/libMultiMarkdown/include/libMultiMarkdown.h b/src/libMultiMarkdown.h similarity index 100% rename from Sources/libMultiMarkdown/include/libMultiMarkdown.h rename to src/libMultiMarkdown.h diff --git a/Sources/multimarkdown/main.c b/src/main.c similarity index 98% rename from Sources/multimarkdown/main.c rename to src/main.c index 1c274647..49a84525 100644 --- a/Sources/multimarkdown/main.c +++ b/src/main.c @@ -187,7 +187,7 @@ int main(int argc, char ** argv) { // '--help' takes precedence if (a_help->count > 0) { - printf("\n%s v%s -- %s\n\n", MULTIMARKDOWN_NAME, MULTIMARKDOWN_VERSION, MULTIMARKDOWN_COPYRIGHT); + printf("\n%s v%s -- %s\n\n", LIBMULTIMARKDOWN_NAME, LIBMULTIMARKDOWN_VERSION, LIBMULTIMARKDOWN_COPYRIGHT); printf("\tUsage: %s", binname); arg_print_syntax(stdout, argtable, "\n\n"); printf("Options:\n"); @@ -198,7 +198,7 @@ int main(int argc, char ** argv) { if (nerrors > 0) { // Report errors - arg_print_errors(stdout, a_end, MULTIMARKDOWN_NAME); + arg_print_errors(stdout, a_end, LIBMULTIMARKDOWN_NAME); printf("Try '%s --help' for more information.\n", binname); exitcode = 1; goto exit2; @@ -206,9 +206,9 @@ int main(int argc, char ** argv) { // '--version' also takes precedence if (a_version->count > 0) { - printf("\nMultiMarkdown 6 v%s\n", MULTIMARKDOWN_VERSION); - printf("%s\n\n", MULTIMARKDOWN_COPYRIGHT); - printf("%s\n", MULTIMARKDOWN_LICENSE); + printf("\nMultiMarkdown 6 v%s\n", LIBMULTIMARKDOWN_VERSION); + printf("%s\n\n", LIBMULTIMARKDOWN_COPYRIGHT); + printf("%s\n", LIBMULTIMARKDOWN_LICENSE); printf("\n"); goto exit2; } diff --git a/Sources/libMultiMarkdown/memoir.c b/src/memoir.c similarity index 100% rename from Sources/libMultiMarkdown/memoir.c rename to src/memoir.c diff --git a/Sources/libMultiMarkdown/memoir.h b/src/memoir.h similarity index 100% rename from Sources/libMultiMarkdown/memoir.h rename to src/memoir.h diff --git a/Sources/libMultiMarkdown/miniz.c b/src/miniz.c similarity index 100% rename from Sources/libMultiMarkdown/miniz.c rename to src/miniz.c diff --git a/Sources/libMultiMarkdown/miniz.h b/src/miniz.h similarity index 100% rename from Sources/libMultiMarkdown/miniz.h rename to src/miniz.h diff --git a/Sources/libMultiMarkdown/mmd.c b/src/mmd.c similarity index 99% rename from Sources/libMultiMarkdown/mmd.c rename to src/mmd.c index b8c2865a..05220c2d 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/src/mmd.c @@ -3081,7 +3081,7 @@ DString * mmd_engine_convert_itmz_to_text(mmd_engine * e) { char * mmd_version(void) { char * result = NULL; #ifndef TEST - result = my_strdup(MULTIMARKDOWN_VERSION); + result = my_strdup(LIBMULTIMARKDOWN_VERSION); #endif return result; } diff --git a/Sources/libMultiMarkdown/mmd.h b/src/mmd.h similarity index 100% rename from Sources/libMultiMarkdown/mmd.h rename to src/mmd.h diff --git a/Sources/libMultiMarkdown/object_pool.c b/src/object_pool.c similarity index 100% rename from Sources/libMultiMarkdown/object_pool.c rename to src/object_pool.c diff --git a/Sources/libMultiMarkdown/object_pool.h b/src/object_pool.h similarity index 100% rename from Sources/libMultiMarkdown/object_pool.h rename to src/object_pool.h diff --git a/Sources/libMultiMarkdown/opendocument-content.c b/src/opendocument-content.c similarity index 100% rename from Sources/libMultiMarkdown/opendocument-content.c rename to src/opendocument-content.c diff --git a/Sources/libMultiMarkdown/opendocument-content.h b/src/opendocument-content.h similarity index 100% rename from Sources/libMultiMarkdown/opendocument-content.h rename to src/opendocument-content.h diff --git a/Sources/libMultiMarkdown/opendocument.c b/src/opendocument.c similarity index 100% rename from Sources/libMultiMarkdown/opendocument.c rename to src/opendocument.c diff --git a/Sources/libMultiMarkdown/opendocument.h b/src/opendocument.h similarity index 100% rename from Sources/libMultiMarkdown/opendocument.h rename to src/opendocument.h diff --git a/Sources/libMultiMarkdown/opml-lexer.c b/src/opml-lexer.c similarity index 100% rename from Sources/libMultiMarkdown/opml-lexer.c rename to src/opml-lexer.c diff --git a/Sources/libMultiMarkdown/opml-lexer.h b/src/opml-lexer.h similarity index 100% rename from Sources/libMultiMarkdown/opml-lexer.h rename to src/opml-lexer.h diff --git a/Sources/libMultiMarkdown/opml-lexer.re b/src/opml-lexer.re similarity index 100% rename from Sources/libMultiMarkdown/opml-lexer.re rename to src/opml-lexer.re diff --git a/Sources/libMultiMarkdown/opml-parser.c b/src/opml-parser.c similarity index 100% rename from Sources/libMultiMarkdown/opml-parser.c rename to src/opml-parser.c diff --git a/Sources/libMultiMarkdown/opml-parser.h b/src/opml-parser.h similarity index 100% rename from Sources/libMultiMarkdown/opml-parser.h rename to src/opml-parser.h diff --git a/Sources/libMultiMarkdown/opml-parser.out b/src/opml-parser.out similarity index 100% rename from Sources/libMultiMarkdown/opml-parser.out rename to src/opml-parser.out diff --git a/Sources/libMultiMarkdown/opml-parser.y b/src/opml-parser.y similarity index 100% rename from Sources/libMultiMarkdown/opml-parser.y rename to src/opml-parser.y diff --git a/Sources/libMultiMarkdown/opml-reader.c b/src/opml-reader.c similarity index 100% rename from Sources/libMultiMarkdown/opml-reader.c rename to src/opml-reader.c diff --git a/Sources/libMultiMarkdown/opml-reader.h b/src/opml-reader.h similarity index 100% rename from Sources/libMultiMarkdown/opml-reader.h rename to src/opml-reader.h diff --git a/Sources/libMultiMarkdown/opml.c b/src/opml.c similarity index 100% rename from Sources/libMultiMarkdown/opml.c rename to src/opml.c diff --git a/Sources/libMultiMarkdown/opml.h b/src/opml.h similarity index 100% rename from Sources/libMultiMarkdown/opml.h rename to src/opml.h diff --git a/Sources/libMultiMarkdown/parser.c b/src/parser.c similarity index 100% rename from Sources/libMultiMarkdown/parser.c rename to src/parser.c diff --git a/Sources/libMultiMarkdown/parser.h b/src/parser.h similarity index 100% rename from Sources/libMultiMarkdown/parser.h rename to src/parser.h diff --git a/Sources/libMultiMarkdown/parser.out b/src/parser.out similarity index 100% rename from Sources/libMultiMarkdown/parser.out rename to src/parser.out diff --git a/Sources/libMultiMarkdown/parser.y b/src/parser.y similarity index 100% rename from Sources/libMultiMarkdown/parser.y rename to src/parser.y diff --git a/Sources/libMultiMarkdown/rng.c b/src/rng.c similarity index 100% rename from Sources/libMultiMarkdown/rng.c rename to src/rng.c diff --git a/Sources/libMultiMarkdown/scanners.c b/src/scanners.c similarity index 100% rename from Sources/libMultiMarkdown/scanners.c rename to src/scanners.c diff --git a/Sources/libMultiMarkdown/scanners.h b/src/scanners.h similarity index 100% rename from Sources/libMultiMarkdown/scanners.h rename to src/scanners.h diff --git a/Sources/libMultiMarkdown/scanners.re b/src/scanners.re similarity index 100% rename from Sources/libMultiMarkdown/scanners.re rename to src/scanners.re diff --git a/Sources/libMultiMarkdown/stack.c b/src/stack.c similarity index 100% rename from Sources/libMultiMarkdown/stack.c rename to src/stack.c diff --git a/Sources/libMultiMarkdown/stack.h b/src/stack.h similarity index 100% rename from Sources/libMultiMarkdown/stack.h rename to src/stack.h diff --git a/Sources/libMultiMarkdown/textbundle.c b/src/textbundle.c similarity index 100% rename from Sources/libMultiMarkdown/textbundle.c rename to src/textbundle.c diff --git a/Sources/libMultiMarkdown/textbundle.h b/src/textbundle.h similarity index 100% rename from Sources/libMultiMarkdown/textbundle.h rename to src/textbundle.h diff --git a/Sources/libMultiMarkdown/token.c b/src/token.c similarity index 100% rename from Sources/libMultiMarkdown/token.c rename to src/token.c diff --git a/Sources/libMultiMarkdown/include/token.h b/src/token.h similarity index 98% rename from Sources/libMultiMarkdown/include/token.h rename to src/token.h index 6c00d04c..bd9a9522 100644 --- a/Sources/libMultiMarkdown/include/token.h +++ b/src/token.h @@ -58,7 +58,7 @@ #define TOKEN_PARSER_TEMPLATE_H -#define kUseObjectPool 1 //!< Use an object pool to allocate tokens to improve +#define kUseObjectPool_disabled 1 //!< Use an object pool to allocate tokens to improve //!< performance in memory allocation. Frees all //!< tokens at once, however, at end of parsing. diff --git a/Sources/libMultiMarkdown/token_pairs.c b/src/token_pairs.c similarity index 100% rename from Sources/libMultiMarkdown/token_pairs.c rename to src/token_pairs.c diff --git a/Sources/libMultiMarkdown/token_pairs.h b/src/token_pairs.h similarity index 100% rename from Sources/libMultiMarkdown/token_pairs.h rename to src/token_pairs.h diff --git a/Sources/libMultiMarkdown/transclude.c b/src/transclude.c similarity index 100% rename from Sources/libMultiMarkdown/transclude.c rename to src/transclude.c diff --git a/Sources/libMultiMarkdown/transclude.h b/src/transclude.h similarity index 100% rename from Sources/libMultiMarkdown/transclude.h rename to src/transclude.h diff --git a/Sources/libMultiMarkdown/update b/src/update similarity index 100% rename from Sources/libMultiMarkdown/update rename to src/update diff --git a/Sources/libMultiMarkdown/uthash.h b/src/uthash.h similarity index 100% rename from Sources/libMultiMarkdown/uthash.h rename to src/uthash.h diff --git a/Sources/libMultiMarkdown/uuid.c b/src/uuid.c similarity index 100% rename from Sources/libMultiMarkdown/uuid.c rename to src/uuid.c diff --git a/Sources/libMultiMarkdown/uuid.h b/src/uuid.h similarity index 100% rename from Sources/libMultiMarkdown/uuid.h rename to src/uuid.h diff --git a/Sources/libMultiMarkdown/writer.c b/src/writer.c similarity index 100% rename from Sources/libMultiMarkdown/writer.c rename to src/writer.c diff --git a/Sources/libMultiMarkdown/writer.h b/src/writer.h similarity index 100% rename from Sources/libMultiMarkdown/writer.h rename to src/writer.h diff --git a/Sources/libMultiMarkdown/xml.c b/src/xml.c similarity index 100% rename from Sources/libMultiMarkdown/xml.c rename to src/xml.c diff --git a/Sources/libMultiMarkdown/xml.h b/src/xml.h similarity index 100% rename from Sources/libMultiMarkdown/xml.h rename to src/xml.h diff --git a/Sources/libMultiMarkdown/xml.re b/src/xml.re similarity index 100% rename from Sources/libMultiMarkdown/xml.re rename to src/xml.re diff --git a/Sources/libMultiMarkdown/zip.c b/src/zip.c similarity index 100% rename from Sources/libMultiMarkdown/zip.c rename to src/zip.c diff --git a/Sources/libMultiMarkdown/zip.h b/src/zip.h similarity index 100% rename from Sources/libMultiMarkdown/zip.h rename to src/zip.h diff --git a/templates/doxygen.conf.in b/templates/doxygen.conf.in index 87aa5206..98be4a0d 100644 --- a/templates/doxygen.conf.in +++ b/templates/doxygen.conf.in @@ -790,7 +790,7 @@ USE_MDFILE_AS_MAINPAGE = README.md # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. -SOURCE_BROWSER = YES +SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. @@ -807,13 +807,13 @@ STRIP_CODE_COMMENTS = YES # then for each documented function all documented # functions referencing it will be listed. -REFERENCED_BY_RELATION = NO +REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. -REFERENCES_RELATION = NO +REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from diff --git a/templates/template.c.in b/templates/template.c.in index 45897c4c..8d77496b 100644 --- a/templates/template.c.in +++ b/templates/template.c.in @@ -22,16 +22,19 @@ */ +#include + #include "file.h" -static int void_function(void) { - return 0; -} #ifdef TEST -static void Test_void_function(CuTest* tc) { - int test = void_function(); +#include "CuTest.h" +#endif - CuAssertIntEquals(tc, 0, test); + +#ifdef TEST +// Remove static keyword to enable this test +static void Test_void_function(CuTest* tc) { + CuAssertIntEquals(tc, 0, 0); } #endif diff --git a/templates/template.h.in b/templates/template.h.in index ab64f45a..b3f93ab0 100644 --- a/templates/template.h.in +++ b/templates/template.h.in @@ -25,12 +25,5 @@ #ifndef FILE_@My_Project_Title_Caps@_H #define FILE_@My_Project_Title_Caps@_H -#ifdef TEST -#include "CuTest.h" -#endif - - -/// This is a sample function with a doxygen description. -// void void_f(void); #endif