commit 72f2ca43c420c1b33b67e7bc5451defa440da41e
parent 9e8f1afac3d9e6120f59ce07e4853224f950efc1
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Wed, 11 Jan 2023 17:44:35 +0100
Add man pages section 1, improve help, small changes in command line arguments
Diffstat:
9 files changed, 544 insertions(+), 50 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -19,6 +19,52 @@ enable_testing()
set(CG2_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src)
option(NO_TEST "Disable the test" OFF)
+option(STL_OUTPUT_DEFAULT_IS_BINARY
+ "Default is to use binary format for output STL files" ON)
+
+if(CMAKE_HOST_UNIX)
+ set(CG2_DOC "TROFF" CACHE STRING
+ "Type of documentation to generate and install.")
+else()
+ set(CG2_DOC "HTML" CACHE STRING
+ "Type of documentation to generate and install.")
+endif()
+
+set_property(CACHE CG2_DOC PROPERTY STRINGS
+ "HTML"
+ "TROFF"
+ "TROFF & HTML"
+ "NONE")
+
+###############################################################################
+# Generate files
+###############################################################################
+if(STL_OUTPUT_DEFAULT_IS_BINARY)
+ set(CG2_ARGS_BINARY_STL_DEFAULT "1")
+ set(CG2_ARGS_STL_DEFAULT_STR "binary")
+ set(CG2_ARGS_STL_NON_DEFAULT_STR "ascii")
+ set(CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION "a")
+else()
+ set(CG2_ARGS_BINARY_STL_DEFAULT "0")
+ set(CG2_ARGS_STL_DEFAULT_STR "ascii")
+ set(CG2_ARGS_STL_NON_DEFAULT_STR "binary")
+ set(CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION "b")
+endif()
+set(CG2_ARGS_DEFAULT_VERBOSITY_LEVEL "1")
+
+configure_file(${CG2_SOURCE_DIR}/../doc/city_generator2.1.txt.in
+ ${CMAKE_CURRENT_BINARY_DIR}/doc/city_generator2.1.txt @ONLY)
+
+configure_file(${CG2_SOURCE_DIR}/cg_default.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cg_default.h @ONLY)
+
+set(CG2_VERSION_MAJOR 0)
+set(CG2_VERSION_MINOR 1)
+set(CG2_VERSION_PATCH 0)
+
+set(CG2_VERSION ${CG2_VERSION_MAJOR}.${CG2_VERSION_MINOR}.${CG2_VERSION_PATCH})
+configure_file(${CG2_SOURCE_DIR}/cg_version.h.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cg_version.h @ONLY)
################################################################################
# Check dependencies
@@ -44,14 +90,16 @@ if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
endif()
+###############################################################################
+# Build subprojects
+###############################################################################
+if(NOT CG2_DOC STREQUAL "NONE")
+ add_subdirectory(doc)
+endif()
+
################################################################################
# Configure and define targets
################################################################################
-set(CG2_VERSION_MAJOR 0)
-set(CG2_VERSION_MINOR 1)
-set(CG2_VERSION_PATCH 0)
-set(CG2_VERSION ${CG2_VERSION_MAJOR}.${CG2_VERSION_MINOR}.${CG2_VERSION_PATCH})
-
set(CG2_FILES_SRC
cg_args.c
cg_catalog.c
@@ -81,15 +129,6 @@ set(CG2_FILES_INC
cg_ground.h
cg_version.h.in)
-set(CG2_ARGS_DEFAULT_VERBOSE_LEVEL "1")
-set(CG2_BINARY_EXPORT_DEFAULT "1")
-
-configure_file(${CG2_SOURCE_DIR}/cg_default.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/cg_default.h @ONLY)
-
-configure_file(${CG2_SOURCE_DIR}/cg_version.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/cg_version.h @ONLY)
-
set(CG2_FILES_DOC COPYING README.md)
# Prepend each file in the `CG2_FILES_<SRC|INC>' list by `CG2_SOURCE_DIR'
diff --git a/cmake/doc/CMakeLists.txt b/cmake/doc/CMakeLists.txt
@@ -0,0 +1,149 @@
+# Copyright (C) 2018-2021 |Meso|Star> (contact@meso-star.com)
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+cmake_minimum_required(VERSION 3.0)
+
+string(REGEX MATCH ".*HTML.*" _html ${CG2_DOC})
+string(REGEX MATCH ".*ROFF.*" _roff ${CG2_DOC})
+
+set(CG2_DOC_DIR ${PROJECT_SOURCE_DIR}/../doc)
+
+################################################################################
+# Look for asciidoc and a2x programs
+################################################################################
+if(_html)
+ find_program(ASCIIDOC NAMES asciidoc asciidoc.py)
+ if(NOT ASCIIDOC)
+ unset(_html)
+ message(WARNING
+ "The `asciidoc' program is missing. "
+ "The city_generator2 HTML documentation cannot be generated.")
+ endif()
+endif()
+
+if(_roff)
+ find_program(A2X NAMES a2x a2x.py)
+ if(NOT A2X)
+ unset(_roff)
+ message(WARNING
+ "The `a2x' program is missing. "
+ "The city_generator2 man pages cannot be generated.")
+ endif()
+endif()
+
+################################################################################
+# Copy doc files
+################################################################################
+set(MAN_NAMES
+ city_generator2-input.5
+ city_generator2-output.5)
+
+if(_roff OR _html)
+ set(MAN_FILES)
+ foreach(_name IN LISTS MAN_NAMES)
+ set(_src ${CG2_DOC_DIR}/${_name}.txt)
+ set(_dst ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt)
+ add_custom_command(
+ OUTPUT ${_dst}
+ COMMAND ${CMAKE_COMMAND} -E copy ${_src} ${_dst}
+ DEPENDS ${_src}
+ COMMENT "Copy the asciidoc ${_src}"
+ VERBATIM)
+ list(APPEND MAN_FILES ${_dst})
+ endforeach()
+ add_custom_target(man-copy ALL DEPENDS ${MAN_FILES})
+endif()
+
+list(APPEND MAN_NAMES city_generator2.1)
+
+################################################################################
+# ROFF man pages
+################################################################################
+if(_roff)
+ set(A2X_OPTS -dmanpage -fmanpage)
+ set(MAN_FILES)
+ set(MAN5_FILES)
+ set(MAN1_FILES)
+ foreach(_name IN LISTS MAN_NAMES)
+ set(_man ${CMAKE_CURRENT_BINARY_DIR}/${_name})
+ set(_txt ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt)
+
+ add_custom_command(
+ OUTPUT ${_man}
+ COMMAND ${A2X} ${A2X_OPTS} ${_txt}
+ DEPENDS man-copy ${_txt}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Build ROFF man page ${_man}"
+ VERBATIM)
+ list(APPEND MAN_FILES ${_man})
+
+ string(REGEX MATCH "^.*.5$" _man5 ${_man})
+ string(REGEX MATCH "^.*.1$" _man1 ${_man})
+ if(_man1)
+ list(APPEND MAN1_FILES ${_man1})
+ elseif(_man5)
+ list(APPEND MAN5_FILES ${_man5})
+ else()
+ message(FATAL_ERROR "Unexpected man type")
+ endif()
+ endforeach()
+ add_custom_target(man-roff ALL DEPENDS ${MAN_FILES})
+
+ install(FILES ${MAN1_FILES} DESTINATION share/man/man1)
+ install(FILES ${MAN5_FILES} DESTINATION share/man/man5)
+endif()
+
+################################################################################
+# HTML documentation
+################################################################################
+if(_html)
+ set(ASCIIDOC_OPTS
+ -bxhtml11
+ -dmanpage
+ --attribute themedir=${CG2_DOC_DIR}
+ --theme=city_generator2-man)
+
+ set(MAN_FILES)
+ set(MAN5_FILES)
+ set(MAN1_FILES)
+ foreach(_name IN LISTS MAN_NAMES)
+ set(_man ${CMAKE_CURRENT_BINARY_DIR}/${_name}.html)
+ set(_txt ${CMAKE_CURRENT_BINARY_DIR}/${_name}.txt)
+
+ add_custom_command(
+ OUTPUT ${_man}
+ COMMAND ${ASCIIDOC} ${ASCIIDOC_OPTS} ${_txt}
+ DEPENDS man-copy ${_txt} ${CG2_DOC_DIR}/city_generator2-man.css
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Build HTML man page ${_man}"
+ VERBATIM)
+ list(APPEND MAN_FILES ${_man})
+
+ string(REGEX MATCH "^.*.5.html$" _man5 ${_man})
+ string(REGEX MATCH "^.*.1.html$" _man1 ${_man})
+ if(_man1)
+ list(APPEND MAN1_FILES ${_man1})
+ elseif(_man5)
+ list(APPEND MAN5_FILES ${_man5})
+ else()
+ message(FATAL_ERROR "Unexpected man type")
+ endif()
+ endforeach()
+ add_custom_target(man-html ALL DEPENDS ${MAN_FILES})
+
+ install(FILES ${MAN1_FILES} DESTINATION share/doc/city_generator2/html)
+ install(FILES ${MAN5_FILES} DESTINATION share/doc/city_generator2/html)
+endif()
+
diff --git a/doc/city_generator2-input.5.txt b/doc/city_generator2-input.5.txt
@@ -0,0 +1,38 @@
+// Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA
+// Copyright (C) 2022-2023 CNRS
+// Copyright (C) 2022-2023 Sorbonne Université
+// Copyright (C) 2022-2023 Université Paul Sabatier
+// Copyright (C) 2022-2023 |Meso|Star>.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+:sharp: #
+
+:toc:
+
+city_generator2-input(5)
+========================
+
+NAME
+----
+city_generator2-input - city description for city_generator2(1)
+
+DESCRIPTION
+-----------
+*city_generator2-input* is the format used by the *city_generator2*(1) program
+to describe a city. It relies on the yaml 1.1 syntax.
+
+SEE ALSO
+--------
+*city_generator2*(1)
diff --git a/doc/city_generator2-man.css b/doc/city_generator2-man.css
@@ -0,0 +1,96 @@
+/* Copyright (C) 2016-2018 CNRS
+ *
+ * This is free style sheet: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This CSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/. */
+
+body.manpage {
+ font-family:"Liberation Sans",sans-serif;
+ font-size:10pt;
+ text-align: justify;
+ max-width: 55em;
+ margin: 1em;
+ background: #ffffff
+}
+
+body.manpage .monospaced, .literalblock {
+ margin: 2em;
+ color: #636261
+}
+
+body.manpage em {
+ color: #660000
+}
+
+body.manpage div.verseblock > pre.content {
+ font-family: "Liberation Mono",monospace;
+}
+
+body.manpage h1 {
+ padding-bottom: 0.5em;
+}
+body.manpage h2 {
+ border-style: none;
+}
+body.manpage div.sectionbody {
+ margin-left: 3em;
+}
+
+body.manpage code {
+ font-family: "Liberation Mono",monospace;
+}
+
+body.manpage #footer { display: none; }
+
+body.manpage div#toctitle { display: none; }
+
+body.manpage div#toc {
+ display: block;
+ position:fixed;
+ top:0;
+ left:60em;
+ height:100%;
+ width: 100%;
+ padding:3em 0 0 0;
+ border-left:1px solid #dbdbdb;
+ background: #eeeeee
+}
+
+body.manpage a {
+ font-weight: bold;
+ color: #225588;
+}
+
+body.manpage div#toc a, div#toc a:link, div#toc a:visited {
+ margin:0;
+ padding-left: 2em;
+ color:#999999;
+ text-decoration:none;
+ font-weight: normal;
+}
+
+body.manpage div.toclevel1 {
+ line-height: 1.5em;
+}
+
+body.manpage div.toclevel2 {
+ margin-left: 2em;
+}
+
+body.manpage div#toc a:hover {
+ color:#666666;
+}
+
+@media print {
+ body.manpage div#toc { display: none; }
+}
+
diff --git a/doc/city_generator2-output.5.txt b/doc/city_generator2-output.5.txt
@@ -0,0 +1,40 @@
+// Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA
+// Copyright (C) 2022-2023 CNRS
+// Copyright (C) 2022-2023 Sorbonne Université
+// Copyright (C) 2022-2023 Université Paul Sabatier
+// Copyright (C) 2018-2022 |Meso|Star>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+:toc:
+
+= city_generator2-output(5)
+
+== NAME
+
+city_generator2-output - naming-scheme of city_generator2(1) generated files.
+
+== DESCRIPTION
+
+Blah.
+
+== NOTES
+
+1. YAML syntax -
+ <https://yaml.org/>
+
+== SEE ALSO
+
+*city_generator2*(1),
+rcity_generator2-input*(5),
diff --git a/doc/city_generator2.1.txt.in b/doc/city_generator2.1.txt.in
@@ -0,0 +1,126 @@
+// Copyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA
+// Copyright (C) 2022-2023 CNRS
+// Copyright (C) 2022-2023 Sorbonne Université
+// Copyright (C) 2022-2023 Université Paul Sabatier
+// Copyright (C) 2022-2023 |Meso|Star>.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+:toc:
+
+city_generator2(1)
+==================
+
+NAME
+----
+city_generator2 - generation of conformal 3D meshes of a city from a simple
+ascii description.
+
+SYNOPSIS
+--------
+[verse]
+*city_generator2* *-h* [_option_]
+*city_generator2* *-m* <__file__> {*-c* <__file__>}+ [_option_]
+
+DESCRIPTION
+-----------
+*city_generator2* generates a city as 3D conformal meshes from an ascii
+description. The description includes the city map (a description of the ground
+and buildings in a yaml file), and at least one catalog file (a description of
+a set of datasets grouped by constructive modes). The provided description must
+comply with the *city_generator2-input*(5) format.
+
+The output of *city_generator2* is a set of *STL* files, either in ascii or in
+binary format, that contain the various meshes of the ground layers and
+building parts, along with all their boundaries. As expected for use by most
+solvers, including *stardis*(1), the output meshes are conformal.
+The various output files are named after the name of the building they are part
+of, as well as the name of the part they mesh.
+Please refer to *city_generator2-output*(5) for the complete description of
+this naming scheme.
+
+The internals of *city_generator2* rely on the star-cad library[1] which itself
+relies on the gmsh library[2].
+
+[1] https://gitlab.com/meso-star/star-cad/
+
+[2] C. Geuzaine and J.-F. Remacle. Gmsh: a three-dimensional finite element
+mesh generator with built-in pre- and post-processing facilities.
+International Journal for Numerical Methods in Engineering 79(11),
+pp. 1309-1331, 2009.
+
+MANDATORY OPTIONS
+-----------------
+*-m* _file_::
+ Read a city map file which is a text file in yaml 1.1 format containing the
+ description of the ground and a list of buildings. The description of an
+ individual building include its footprint and constructive mode among other
+ things.
+ Please refer to *city_generator2-input*(5) for more information on formats.
+
+*-c* _file_::
+ Read a catalog file which is a text file in yaml 1.1 format containing datasets
+ for a given constructive mode. All the datasets in a given file share the
+ same constructive mode. If the city map uses more than one constructive mode,
+ the different datasets must be provided in (at least) as many catalog files
+ as there are constructive modes involved.
+ Please refer to *city_generator2-input*(5) for more information on formats.
+
+OTHER OPTIONS
+-------------
+*-@CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION@*::
+ Change the output format of the generated *STL* files to
+ @CG2_ARGS_STL_NON_DEFAULT_STR@ (default @CG2_ARGS_STL_DEFAULT_STR@).
+
+*-h*::
+ Output short help and exit.
+
+*-s*::
+ Force single threaded execution. By default use as many threads as available.
++
+Note however that only some parts of the processing is parallelized.
+Therefore, poor speedup is not a bug and can even be expected.
+
+*-v*::
+ Output version information and exit.
+
+*-V* _level_::
+ Set the verbosity level. Possible values are *0* (no message), *1* (error
+ messages only), *2* (error and warning messages), and *3* (error, warning
+ and informative messages). All the messages are written to _standard error_.
+ Default verbosity *level* is @CG2_ARGS_DEFAULT_VERBOSITY_LEVEL@.
+
+EXAMPLES
+--------
+Generates the city described in the *city.yaml* file, looking for the needed
+datasets in the *catalog0.yaml* and *catalog1.yaml* datafile:
+
+ $ city_generator2 -m city.yaml -c catalog0.yaml -c catalog1.yaml
+
+COPYRIGHT
+---------
+Copyright © 2022-2023 Université de Pau et des Pays de l'Adour UPPA,
+ CNRS,
+ Sorbonne Université,
+ Université Paul Sabatier,
+ |Meso|Star>.
+
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
+This is free software. You are free to change and redistribute it. There is NO
+WARRANTY, to the extent permitted by law.
+
+SEE ALSO
+--------
+*city_generator2-input*(5),
+*city_generator2-output*(5)
diff --git a/src/cg_args.c b/src/cg_args.c
@@ -19,6 +19,7 @@
#include "cg_args.h"
#include "cg_catalog_parsing.h"
+#include "cg_default.h"
#include "cg_version.h"
#include "cg_default.h"
#include "cg.h"
@@ -42,38 +43,41 @@ short_help(void)
{
print_version();
printf("\nUsage:\n"
- "city_generator2 -m <FILENAME> -c <FILENAME> [-V verbosity]\n"
+ "city_generator2 -m <FILENAME> { -c <FILENAME> }+ -[%c] [-s] [-V verbosity]\n"
"city_generator2 [-h]\n"
- "city_generator2 [-v]\n"
+ "city_generator2 [-v]\n",
+ CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION
);
printf(
"\nMandatory options\n"
"-----------------\n"
+ "-m <city_map_filename>\n"
+ " Read a yaml file that describes the city map.\n"
"-c <filename>\n"
- " Read a yaml text file containing datasets for a given constructive mode.\n"
+ " Read a yaml file containing datasets for a given constructive mode.\n"
" Can be used more than once.\n"
- "-m <city_map_filename>\n"
- " Read a yaml text file that describes the city map.\n"
"\nOther options\n"
"-------------\n"
"-h\n"
" Print this help and exit.\n"
- "-f <TYPE>\n"
- " Set the output format to ASCII or BINARY (default %s).\n"
- " Use TYPE=a for ASCII, or TYPE=b for BINARY.\n"
+ "-%c\n"
+ " Set the format of output files to "STR(CG2_ARGS_STL_NON_DEFAULT_STR)
+ " (default "STR(CG2_ARGS_STL_DEFAULT_STR)").\n"
+ "-s\n"
+ " Force single threaded execution. By default use as many threads as available.\n"
"-v\n"
" Print the software version and exit.\n"
"-V <LEVEL>\n"
" Set the verbosity level (default %i)\n",
- (CG2_BINARY_EXPORT_DEFAULT ? "BINARY" : "ASCII"),
- CG2_DEFAULT_VERBOSE_LEVEL
+ CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION,
+ CG2_ARGS_DEFAULT_VERBOSITY_LEVEL
);
printf(
- "\nCopyright (C) 2022 Université de Pau et des Pays de l'Adour UPPA.\n"
- "Copyright (C) 2022 CNRS.\n"
- "Copyright (C) 2022 Sorbonne Université.\n"
- "Copyright (C) 2022 Université Paul Sabatier.\n"
- "Copyright (C) 2022 |Meso|Star> (contact@meso-star.com).\n"
+ "\nCopyright (C) 2022-2023 Université de Pau et des Pays de l'Adour UPPA.\n"
+ "Copyright (C) 2022-2023 CNRS.\n"
+ "Copyright (C) 2022-2023 Sorbonne Université.\n"
+ "Copyright (C) 2022-2023 Université Paul Sabatier.\n"
+ "Copyright (C) 2022-2023 |Meso|Star> (contact@meso-star.com).\n"
"city_generator2 is free software released under the GNU GPL license,\n"
"version 3 or later.\n"
"You are free to change or redistribute it under certain conditions\n"
@@ -92,10 +96,13 @@ parse_args
int opt;
int info_provided = 0, c_provided = 0, m_provided = 0;
struct args* args;
- const char option_list[] = "c:m:f:hvV:";
+ char option_list[] = "?c:m:hvV:";
ASSERT(allocator && logger && argv && out_args);
+ /* Patch option_list[] according to stl format default */
+ option_list[0] = CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION;
+
args = MEM_ALLOC(allocator, sizeof(*args));
if(!args) {
res = RES_MEM_ERR;
@@ -107,8 +114,9 @@ parse_args
/* Set default values */
args->city_filename = NULL;
darray_catalog_filenames_init(allocator, &args->catalog_filenames);
- args->binary_export = CG2_BINARY_EXPORT_DEFAULT;
- args->verbosity_level = CG2_DEFAULT_VERBOSE_LEVEL;
+ args->binary_export = CG2_ARGS_BINARY_STL_DEFAULT;
+ args->verbosity_level = CG2_ARGS_DEFAULT_VERBOSITY_LEVEL;
+ args->single_thread = 0;
args->print_help = 0;
args->print_version = 0;
@@ -146,25 +154,20 @@ parse_args
m_provided = 1;
break;
- case 'f':
- if(0 == strcmp(optarg, "A") || 0 == strcmp(optarg, "a"))
- args->binary_export = 0;
- else if(0 == strcmp(optarg, "B") || 0 == strcmp(optarg, "b"))
- args->binary_export = 1;
- else {
- logger_print(logger, LOG_ERROR,
- "Invalid argument for option -%c: %s\n",
- opt, optarg);
- res = RES_BAD_ARG;
- goto error;
- }
- break;
+ case CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION:
+ args->binary_export = !CG2_ARGS_BINARY_STL_DEFAULT;
+ break;
case 'h':
info_provided = 1;
args->print_help = 1;
break;
+ case 's':
+ info_provided = 1;
+ args->single_thread = 1;
+ break;
+
case 'v':
info_provided = 1;
args->print_version = 1;
@@ -205,7 +208,7 @@ parse_args
if(!m_provided && !info_provided) {
ERR(logger_print(logger, LOG_ERROR,
- "Missing mandatory argument: -c <city_filename>\n"));
+ "Missing mandatory argument: -m <city_filename>\n"));
res = RES_BAD_ARG;
goto error;
}
diff --git a/src/cg_args.h b/src/cg_args.h
@@ -38,6 +38,7 @@ struct args {
int verbosity_level;
int print_help;
int print_version;
+ int single_thread;
};
res_T
diff --git a/src/cg_default.h.in b/src/cg_default.h.in
@@ -16,8 +16,10 @@
#ifndef CG2_DEFAULT_H
#define CG2_DEFAULT_H
-#define CG2_DEFAULT_VERBOSE_LEVEL @CG2_ARGS_DEFAULT_VERBOSE_LEVEL@
-#define CG2_BINARY_EXPORT_DEFAULT @CG2_BINARY_EXPORT_DEFAULT@
-
-#endif /* CG2_DEFAULT_H */
+#define CG2_ARGS_DEFAULT_VERBOSITY_LEVEL @CG2_ARGS_DEFAULT_VERBOSITY_LEVEL@
+#define CG2_ARGS_BINARY_STL_DEFAULT @CG2_ARGS_BINARY_STL_DEFAULT@
+#define CG2_ARGS_STL_DEFAULT_STR @CG2_ARGS_STL_DEFAULT_STR@
+#define CG2_ARGS_STL_NON_DEFAULT_STR @CG2_ARGS_STL_NON_DEFAULT_STR@
+#define CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION '@CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION@'
+#endif