summaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-12-01 19:52:00 -0800
committerZachary T Welch <zw@superlucidity.net>2009-12-02 13:26:26 -0800
commiteaf10f69de969652d03742809b9c970158b90719 (patch)
treebb382e74018d2352a0ee05912d53c34b28ad6113 /src/helper
parent34654359a918edae10ca7dd7ebc0a487fdf609a4 (diff)
downloadopenocd+libswd-eaf10f69de969652d03742809b9c970158b90719.tar.gz
openocd+libswd-eaf10f69de969652d03742809b9c970158b90719.tar.bz2
openocd+libswd-eaf10f69de969652d03742809b9c970158b90719.tar.xz
openocd+libswd-eaf10f69de969652d03742809b9c970158b90719.zip
remove BUILD_IOUTIL symbol
Add ioutil_stubs.c to provide an empty ioutil_init() routine. Add ioutil.h to prevent applications from needing to declare it. Allows unconditionally calling that function during startup, and the resulting libocdhelper library API is now more stable. Prints a DEBUG message when the stub implementation is included.
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/Makefile.am3
-rw-r--r--src/helper/ioutil.h27
-rw-r--r--src/helper/ioutil_stubs.c29
3 files changed, 59 insertions, 0 deletions
diff --git a/src/helper/Makefile.am b/src/helper/Makefile.am
index 22b3c330..01e805eb 100644
--- a/src/helper/Makefile.am
+++ b/src/helper/Makefile.am
@@ -27,6 +27,8 @@ libhelper_la_SOURCES = \
if IOUTIL
libhelper_la_SOURCES += ioutil.c
+else
+libhelper_la_SOURCES += ioutil_stubs.c
endif
libhelper_la_CFLAGS =
@@ -38,6 +40,7 @@ endif
noinst_HEADERS = \
binarybuffer.h \
configuration.h \
+ ioutil.h \
types.h \
log.h \
command.h \
diff --git a/src/helper/ioutil.h b/src/helper/ioutil.h
new file mode 100644
index 00000000..855ae550
--- /dev/null
+++ b/src/helper/ioutil.h
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
+ * *
+ * 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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef HELPER_IOUTILS_H
+#define HELPER_IOUTILS_H
+
+struct command_context;
+
+int ioutil_init(struct command_context *cmd_ctx);
+
+#endif // HELPER_IOUTILS_H
diff --git a/src/helper/ioutil_stubs.c b/src/helper/ioutil_stubs.c
new file mode 100644
index 00000000..1171a6f1
--- /dev/null
+++ b/src/helper/ioutil_stubs.c
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
+ * *
+ * 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 2 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, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "ioutil.h"
+
+int ioutil_init(struct command_context *cmd_ctx)
+{
+ LOG_DEBUG("libocdhelper was built without I/O utility support");
+ return ERROR_OK;
+}