Added mxml as subproject. CMake still gives errors.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[submodule "software/mxml"]
|
||||
path = software/mxml
|
||||
url = https://bitbucket.org/tmidas/mxml
|
||||
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.0)
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR})
|
||||
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mxml)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
find_package(libusb-1.0 REQUIRED)
|
||||
|
||||
@@ -11,9 +11,9 @@ set(SRC
|
||||
../src/DRS.cpp
|
||||
../src/averager.cpp
|
||||
../src/musbstd.c
|
||||
../src/mxml.c
|
||||
../src/strlcpy.c)
|
||||
|
||||
../mxml/mxml.cxx
|
||||
../mxml/strlcpy.cxx)
|
||||
|
||||
add_executable(drscl ${SRC} drscl.cpp)
|
||||
add_executable(drs_exam ${SRC} drs_exam.cpp)
|
||||
add_executable(drs_exam_multi ${SRC} drs_exam_multi.cpp)
|
||||
|
||||
@@ -3,7 +3,13 @@ cmake_minimum_required(VERSION 3.0)
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR})
|
||||
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
execute_process(COMMAND wx-config --cxxflags OUTPUT_VARIABLE WX_CXXFLAGS)
|
||||
separate_arguments(WX_CXXFLAGS UNIX_COMMAND ${WX_CXXFLAGS})
|
||||
execute_process(COMMAND wx-config --libs OUTPUT_VARIABLE WX_LIBS)
|
||||
string(STRIP ${WX_LIBS} WX_LIBS)
|
||||
message(STATUS "--cxxflags: " ${WX_CXXFLAGS})
|
||||
message(STATUS "--libs: " ${WX_LIBS})
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
find_package(libusb-1.0 REQUIRED)
|
||||
|
||||
@@ -11,8 +17,8 @@ set(LIBSRC
|
||||
../src/DRS.cpp
|
||||
../src/averager.cpp
|
||||
../src/musbstd.c
|
||||
../src/mxml.c
|
||||
../src/strlcpy.c)
|
||||
../mxml/mxml.cxx
|
||||
../mxml/strlcpy.cxx)
|
||||
|
||||
set(SRC
|
||||
ConfigDialog
|
||||
@@ -26,12 +32,23 @@ set(SRC
|
||||
DisplayDialog
|
||||
InfoDialog
|
||||
AboutDialog
|
||||
TriggerDialog)
|
||||
TriggerDialog
|
||||
rb
|
||||
main)
|
||||
|
||||
add_executable(drsosc ${SRC} ${LIBSRC})
|
||||
|
||||
target_compile_options(drsosc PRIVATE -DOS_LINUX -DHAVE_USB -DHAVE_LIBUSB10)
|
||||
target_include_directories(drsosc PRIVATE ${LIBUSB_1_INCLUDE_DIRS})
|
||||
target_link_libraries(drsosc ${LIBUSB_1_LIBRARIES})
|
||||
target_compile_options(drsosc PRIVATE
|
||||
-Wno-deprecated-declarations
|
||||
-DOS_LINUX -DHAVE_USB -DHAVE_LIBUSB10)
|
||||
target_compile_options(drsosc PRIVATE ${WX_CXXFLAGS})
|
||||
|
||||
target_include_directories(drsosc PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/mxml
|
||||
${LIBUSB_1_INCLUDE_DIRS})
|
||||
target_link_libraries(drsosc ${LIBUSB_1_LIBRARIES} ${WX_LIBS})
|
||||
|
||||
target_link_options(drsosc PRIVATE -L/opt/local/lib)
|
||||
|
||||
install(TARGETS drsosc DESTINATION bin)
|
||||
|
||||
@@ -16,10 +16,10 @@ ifeq ($(HAVE_WX),)
|
||||
$(error Error: wxWidgets required to compile "drsosc")
|
||||
endif
|
||||
|
||||
CFLAGS = -g -O2 -Wall -Wuninitialized -Wno-unused-result -fno-strict-aliasing -DHAVE_USB -DHAVE_LIBUSB10 -DUSE_DRS_MUTEX
|
||||
CFLAGS += -I../include -I../ -I/usr/local/include
|
||||
CFLAGS = -g -O2 -Wall -Wuninitialized -Wno-unused-result -Wno-deprecated-declarations -fno-strict-aliasing -DHAVE_USB -DHAVE_LIBUSB10 -DUSE_DRS_MUTEX
|
||||
CFLAGS += -I../include -I../mxml -I../ -I/usr/local/include -I/usr/local/include/libusb-1.0/
|
||||
WXFLAGS = $(shell wx-config --cxxflags)
|
||||
LIBS = -L/usr/local/lib -lpthread -lutil
|
||||
LIBS = -L/usr/local/lib/ -L/opt/local/lib/ -lpthread -lutil
|
||||
LIBS += $(shell wx-config --libs)
|
||||
|
||||
WX_OBJ = ConfigDialog.o DOFrame.o DOScreen.o DRSOsc.o MeasureDialog.o Measurement.o Osci.o EPThread.o DisplayDialog.o InfoDialog.o AboutDialog.o TriggerDialog.o
|
||||
@@ -58,7 +58,7 @@ DRSOsc.app: drsosc
|
||||
read_binary: read_binary.cpp
|
||||
$(CXX) $(CFLAGS) -o $@ $<
|
||||
|
||||
main.o: %.o: %.cpp ../include/mxml.h ../include/DRS.h
|
||||
main.o: %.o: %.cpp ../mxml/mxml.h ../include/DRS.h
|
||||
$(CXX) $(CFLAGS) $(WXFLAGS) -c $<
|
||||
|
||||
musbstd.o: ../src/musbstd.c ../include/musbstd.h
|
||||
@@ -73,13 +73,13 @@ rb.o: rb.cpp rb.h
|
||||
averager.o: ../src/averager.cpp ../include/averager.h
|
||||
$(CXX) $(CFLAGS) -c $<
|
||||
|
||||
mxml.o: ../src/mxml.c ../include/mxml.h
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
mxml.o: ../mxml/mxml.cxx ../mxml/mxml.h
|
||||
$(CXX) $(CFLAGS) -c $<
|
||||
|
||||
strlcpy.o: ../src/strlcpy.c ../include/strlcpy.h
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
strlcpy.o: ../mxml/strlcpy.cxx ../mxml/strlcpy.h
|
||||
$(CXX) $(CFLAGS) -c $<
|
||||
|
||||
$(WX_OBJ): %.o: %.cpp %.h ../include/mxml.h ../include/DRS.h
|
||||
$(WX_OBJ): %.o: %.cpp %.h ../mxml/mxml.h ../include/DRS.h
|
||||
$(CXX) $(CFLAGS) $(WXFLAGS) -c $<
|
||||
|
||||
clean:
|
||||
|
||||
@@ -8,11 +8,7 @@
|
||||
\********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef OS_DARWIN
|
||||
#include <sys/malloc.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
/********************************************************************\
|
||||
|
||||
Name: mxml.h
|
||||
Created by: Stefan Ritt
|
||||
Copyright 2000 + Stefan Ritt
|
||||
|
||||
Contents: Header file for mxml.c
|
||||
|
||||
This file is part of MIDAS XML Library.
|
||||
|
||||
MIDAS XML Library 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.
|
||||
|
||||
MIDAS XML Library 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 MIDAS XML Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\********************************************************************/
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _MXML_H_
|
||||
#define _MXML_H_
|
||||
|
||||
#define MXML_NAME_LENGTH 64
|
||||
|
||||
#define ELEMENT_NODE 1
|
||||
#define TEXT_NODE 2
|
||||
#define PROCESSING_INSTRUCTION_NODE 3
|
||||
#define COMMENT_NODE 4
|
||||
#define DOCUMENT_NODE 5
|
||||
|
||||
#define INTERNAL_ENTITY 0
|
||||
#define EXTERNAL_ENTITY 1
|
||||
#define MXML_MAX_ENTITY 500
|
||||
|
||||
#define MXML_MAX_CONDITION 10
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#else
|
||||
#define DIR_SEPARATOR '/'
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int fh;
|
||||
char *buffer;
|
||||
int buffer_size;
|
||||
int buffer_len;
|
||||
int level;
|
||||
int element_is_open;
|
||||
int data_was_written;
|
||||
char **stack;
|
||||
int translate;
|
||||
} MXML_WRITER;
|
||||
|
||||
typedef struct mxml_struct *PMXML_NODE;
|
||||
|
||||
typedef struct mxml_struct {
|
||||
char name[MXML_NAME_LENGTH]; // name of element <[name]>[value]</[name]>
|
||||
int node_type; // type of node XXX_NODE
|
||||
char *value; // value of element
|
||||
int n_attributes; // list of attributes
|
||||
char *attribute_name;
|
||||
char **attribute_value;
|
||||
int line_number_start; // first line number in XML file, starting from 1
|
||||
int line_number_end; // last line number in XML file, starting from 1
|
||||
PMXML_NODE parent; // pointer to parent element
|
||||
int n_children; // list of children
|
||||
PMXML_NODE child;
|
||||
} MXML_NODE;
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
/* make functions callable from a C++ program */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef EXPRT
|
||||
#if defined(EXPORT_DLL)
|
||||
#define EXPRT __declspec(dllexport)
|
||||
#else
|
||||
#define EXPRT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void mxml_suppress_date(int suppress);
|
||||
MXML_WRITER *mxml_open_file(const char *file_name);
|
||||
MXML_WRITER *mxml_open_buffer(void);
|
||||
int mxml_set_translate(MXML_WRITER *writer, int flag);
|
||||
int mxml_start_element(MXML_WRITER *writer, const char *name);
|
||||
int mxml_start_element_noindent(MXML_WRITER *writer, const char *name);
|
||||
int mxml_end_element(MXML_WRITER *writer);
|
||||
int mxml_write_comment(MXML_WRITER *writer, const char *string);
|
||||
int mxml_write_element(MXML_WRITER *writer, const char *name, const char *value);
|
||||
int mxml_write_attribute(MXML_WRITER *writer, const char *name, const char *value);
|
||||
int mxml_write_value(MXML_WRITER *writer, const char *value);
|
||||
int mxml_write_empty_line(MXML_WRITER *writer);
|
||||
char *mxml_close_buffer(MXML_WRITER *writer);
|
||||
int mxml_close_file(MXML_WRITER *writer);
|
||||
|
||||
int mxml_get_number_of_children(PMXML_NODE pnode);
|
||||
PMXML_NODE mxml_get_parent(PMXML_NODE pnode);
|
||||
PMXML_NODE mxml_subnode(PMXML_NODE pnode, int idx);
|
||||
PMXML_NODE mxml_find_node(PMXML_NODE tree, const char *xml_path);
|
||||
int mxml_find_nodes(PMXML_NODE tree, const char *xml_path, PMXML_NODE **nodelist);
|
||||
char *mxml_get_name(PMXML_NODE pnode);
|
||||
char *mxml_get_value(PMXML_NODE pnode);
|
||||
int mxml_get_line_number_start(PMXML_NODE pnode);
|
||||
int mxml_get_line_number_end(PMXML_NODE pnode);
|
||||
PMXML_NODE mxml_get_node_at_line(PMXML_NODE tree, int linenumber);
|
||||
char *mxml_get_attribute(PMXML_NODE pnode, const char *name);
|
||||
|
||||
int mxml_add_attribute(PMXML_NODE pnode, const char *attrib_name, const char *attrib_value);
|
||||
PMXML_NODE mxml_add_special_node(PMXML_NODE parent, int node_type, const char *node_name, const char *value);
|
||||
PMXML_NODE mxml_add_special_node_at(PMXML_NODE parent, int node_type, const char *node_name, const char *value, int idx);
|
||||
PMXML_NODE mxml_add_node(PMXML_NODE parent, const char *node_name, const char *value);
|
||||
PMXML_NODE mxml_add_node_at(PMXML_NODE parent, const char *node_name, const char *value, int idx);
|
||||
|
||||
PMXML_NODE mxml_clone_tree(PMXML_NODE tree);
|
||||
int mxml_add_tree(PMXML_NODE parent, PMXML_NODE tree);
|
||||
int mxml_add_tree_at(PMXML_NODE parent, PMXML_NODE tree, int idx);
|
||||
|
||||
int mxml_replace_node_name(PMXML_NODE pnode, const char *new_name);
|
||||
int mxml_replace_node_value(PMXML_NODE pnode, const char *value);
|
||||
int mxml_replace_subvalue(PMXML_NODE pnode, const char *name, const char *value);
|
||||
int mxml_replace_attribute_name(PMXML_NODE pnode, const char *old_name, const char *new_name);
|
||||
int mxml_replace_attribute_value(PMXML_NODE pnode, const char *attrib_name, const char *attrib_value);
|
||||
|
||||
int mxml_delete_node(PMXML_NODE pnode);
|
||||
int mxml_delete_attribute(PMXML_NODE, const char *attrib_name);
|
||||
|
||||
PMXML_NODE mxml_create_root_node(void);
|
||||
PMXML_NODE mxml_parse_file(const char *file_name, char *error, int error_size, int *error_line);
|
||||
PMXML_NODE mxml_parse_buffer(const char *buffer, char *error, int error_size, int *error_line);
|
||||
int mxml_parse_entity(char **buf, const char* file_name, char *error, int error_size, int *error_line);
|
||||
int mxml_write_tree(const char *file_name, PMXML_NODE tree);
|
||||
void mxml_debug_tree(PMXML_NODE tree, int level);
|
||||
void mxml_free_tree(PMXML_NODE tree);
|
||||
|
||||
void mxml_dirname(char* path);
|
||||
void mxml_basename(char *path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MXML_H_ */
|
||||
/*------------------------------------------------------------------*/
|
||||
@@ -1,55 +0,0 @@
|
||||
/********************************************************************\
|
||||
|
||||
Name: strlcpy.h
|
||||
Created by: Stefan Ritt
|
||||
Copyright 2000 + Stefan Ritt
|
||||
|
||||
Contents: Header file for strlcpy.c
|
||||
|
||||
This file is part of MIDAS XML Library.
|
||||
|
||||
MIDAS XML Library 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.
|
||||
|
||||
MIDAS XML Library 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 MIDAS XML Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef _STRLCPY_H_
|
||||
#define _STRLCPY_H_
|
||||
|
||||
// some version of gcc have a built-in strlcpy
|
||||
#ifdef strlcpy
|
||||
#define STRLCPY_DEFINED
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef EXPRT
|
||||
#if defined(EXPORT_DLL)
|
||||
#define EXPRT __declspec(dllexport)
|
||||
#else
|
||||
#define EXPRT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef STRLCPY_DEFINED
|
||||
size_t EXPRT strlcpy(char *dst, const char *src, size_t size);
|
||||
size_t EXPRT strlcat(char *dst, const char *src, size_t size);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*_STRLCPY_H_ */
|
||||
Submodule
+1
Submodule software/mxml added at 2e48b71244
-2366
File diff suppressed because it is too large
Load Diff
@@ -1,101 +0,0 @@
|
||||
/********************************************************************\
|
||||
|
||||
Name: strlcpy.c
|
||||
Created by: Stefan Ritt
|
||||
Copyright 2000 + Stefan Ritt
|
||||
|
||||
Contents: Contains strlcpy and strlcat which are versions of
|
||||
strcpy and strcat, but which avoid buffer overflows
|
||||
|
||||
|
||||
This file is part of MIDAS XML Library.
|
||||
|
||||
MIDAS XML Library 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.
|
||||
|
||||
MIDAS XML Library 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 MIDAS XML Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "strlcpy.h"
|
||||
|
||||
/*
|
||||
* Copy src to string dst of size siz. At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless size == 0).
|
||||
* Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
#ifndef STRLCPY_DEFINED
|
||||
|
||||
size_t strlcpy(char *dst, const char *src, size_t size)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = size;
|
||||
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0 && --n != 0) {
|
||||
do {
|
||||
if ((*d++ = *s++) == 0)
|
||||
break;
|
||||
} while (--n != 0);
|
||||
}
|
||||
|
||||
/* Not enough room in dst, add NUL and traverse rest of src */
|
||||
if (n == 0) {
|
||||
if (size != 0)
|
||||
*d = '\0'; /* NUL-terminate dst */
|
||||
while (*s++);
|
||||
}
|
||||
|
||||
return (s - src - 1); /* count does not include NUL */
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
* full size of dst, not space left). At most siz-1 characters
|
||||
* will be copied. Always NUL terminates (unless size <= strlen(dst)).
|
||||
* Returns strlen(src) + MIN(size, strlen(initial dst)).
|
||||
* If retval >= size, truncation occurred.
|
||||
*/
|
||||
size_t strlcat(char *dst, const char *src, size_t size)
|
||||
{
|
||||
char *d = dst;
|
||||
const char *s = src;
|
||||
size_t n = size;
|
||||
size_t dlen;
|
||||
|
||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||
while (n-- != 0 && *d != '\0')
|
||||
d++;
|
||||
dlen = d - dst;
|
||||
n = size - dlen;
|
||||
|
||||
if (n == 0)
|
||||
return (dlen + strlen(s));
|
||||
while (*s != '\0') {
|
||||
if (n != 1) {
|
||||
*d++ = *s;
|
||||
n--;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
*d = '\0';
|
||||
|
||||
return (dlen + (s - src)); /* count does not include NUL */
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
#endif // STRLCPY_DEFINED
|
||||
Reference in New Issue
Block a user