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.
AC_DEFINE(BUILD_ZY1000, 0, [0 if you don't want ZY1000.])
fi
-if test $build_ioutil = yes; then
- AC_DEFINE(BUILD_IOUTIL, 1, [1 if you want ioutils.])
-else
- AC_DEFINE(BUILD_IOUTIL, 0, [0 if you don't want ioutils.])
-fi
-
if test $build_httpd = yes; then
AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.])
else
#include "types.h"
#include "jtag.h"
+#include "ioutil.h"
#include "configuration.h"
#include "xsvf.h"
#include "svf.h"
return ERROR_OK;
}
-int ioutil_init(struct command_context *cmd_ctx);
-
int main(int argc, char *argv[])
{
/* ramblockdevice will be the same address every time. The deflate app uses a buffer 16mBytes out, so we
command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
command_context_mode(cmd_ctx, COMMAND_CONFIG);
-#if BUILD_IOUTIL
if (ioutil_init(cmd_ctx) != ERROR_OK)
- {
return EXIT_FAILURE;
- }
-#endif
-
#ifdef CYGPKG_PROFILE_GPROF
COMMAND_REGISTER(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command,
if IOUTIL
libhelper_la_SOURCES += ioutil.c
+else
+libhelper_la_SOURCES += ioutil_stubs.c
endif
libhelper_la_CFLAGS =
noinst_HEADERS = \
binarybuffer.h \
configuration.h \
+ ioutil.h \
types.h \
log.h \
command.h \
--- /dev/null
+/***************************************************************************
+ * 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
--- /dev/null
+/***************************************************************************
+ * 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;
+}
#include "openocd.h"
#include "jtag.h"
+#include "ioutil.h"
#include "configuration.h"
#include "xsvf.h"
#include "svf.h"
return ERROR_OK;
}
-int ioutil_init(struct command_context *cmd_ctx);
-
static bool init_at_startup = true;
COMMAND_HANDLER(handle_noinit_command)
cmd_ctx = setup_command_handler(NULL);
-#if BUILD_IOUTIL
if (ioutil_init(cmd_ctx) != ERROR_OK)
- {
return EXIT_FAILURE;
- }
-#endif
LOG_OUTPUT("For bug reports, read\n\t"
"http://openocd.berlios.de/doc/doxygen/bugs.html"