remove BUILD_IOUTIL symbol
authorZachary T Welch <zw@superlucidity.net>
Wed, 2 Dec 2009 03:52:00 +0000 (19:52 -0800)
committerZachary T Welch <zw@superlucidity.net>
Wed, 2 Dec 2009 21:26:26 +0000 (13:26 -0800)
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.

configure.in
src/ecosboard.c
src/helper/Makefile.am
src/helper/ioutil.h [new file with mode: 0644]
src/helper/ioutil_stubs.c [new file with mode: 0644]
src/openocd.c

index 81e4326278daad9bbbf191923599dd0e27fa9d12..1a4299d30ad788926c02e379c4610950b29673ee 100644 (file)
@@ -614,12 +614,6 @@ else
   AC_DEFINE(BUILD_ZY1000, 0, [0 if you don't want ZY1000.])
 fi
 
   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
 if test $build_httpd = yes; then
   AC_DEFINE(BUILD_HTTPD, 1, [1 if you want httpd.])
 else
index dcd497ce9e943516e825cd6e227a87900ab2638d..cfb57655a47f946891d2e8fbb7649b4a57566f52 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "types.h"
 #include "jtag.h"
 
 #include "types.h"
 #include "jtag.h"
+#include "ioutil.h"
 #include "configuration.h"
 #include "xsvf.h"
 #include "svf.h"
 #include "configuration.h"
 #include "xsvf.h"
 #include "svf.h"
@@ -942,8 +943,6 @@ static int add_default_dirs(void)
        return ERROR_OK;
 }
 
        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
 int main(int argc, char *argv[])
 {
        /* ramblockdevice will be the same address every time. The deflate app uses a buffer 16mBytes out, so we
@@ -1080,13 +1079,8 @@ int main(int argc, char *argv[])
        command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
        command_context_mode(cmd_ctx, COMMAND_CONFIG);
 
        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)
        if (ioutil_init(cmd_ctx) != ERROR_OK)
-       {
                return EXIT_FAILURE;
                return EXIT_FAILURE;
-       }
-#endif
-
 
 #ifdef CYGPKG_PROFILE_GPROF
        COMMAND_REGISTER(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command,
 
 #ifdef CYGPKG_PROFILE_GPROF
        COMMAND_REGISTER(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command,
index 22b3c330e8ce5492ee02e71003691951f94f1822..01e805eb05a21e1950653d32daa0cb517a4903ad 100644 (file)
@@ -27,6 +27,8 @@ libhelper_la_SOURCES = \
 
 if IOUTIL
 libhelper_la_SOURCES += ioutil.c
 
 if IOUTIL
 libhelper_la_SOURCES += ioutil.c
+else
+libhelper_la_SOURCES += ioutil_stubs.c
 endif
 
 libhelper_la_CFLAGS =
 endif
 
 libhelper_la_CFLAGS =
@@ -38,6 +40,7 @@ endif
 noinst_HEADERS = \
        binarybuffer.h \
        configuration.h \
 noinst_HEADERS = \
        binarybuffer.h \
        configuration.h \
+       ioutil.h \
        types.h \
        log.h \
        command.h \
        types.h \
        log.h \
        command.h \
diff --git a/src/helper/ioutil.h b/src/helper/ioutil.h
new file mode 100644 (file)
index 0000000..855ae55
--- /dev/null
@@ -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 (file)
index 0000000..1171a6f
--- /dev/null
@@ -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;
+}
index 2043a92c76a6d3caeaa21b018a46384b205c428a..1f458372708fa62f8d05e7904967b9c88486f9dc 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "openocd.h"
 #include "jtag.h"
 
 #include "openocd.h"
 #include "jtag.h"
+#include "ioutil.h"
 #include "configuration.h"
 #include "xsvf.h"
 #include "svf.h"
 #include "configuration.h"
 #include "xsvf.h"
 #include "svf.h"
@@ -85,8 +86,6 @@ static int log_target_callback_event_handler(struct target *target, enum target_
        return ERROR_OK;
 }
 
        return ERROR_OK;
 }
 
-int ioutil_init(struct command_context *cmd_ctx);
-
 static bool init_at_startup = true;
 
 COMMAND_HANDLER(handle_noinit_command)
 static bool init_at_startup = true;
 
 COMMAND_HANDLER(handle_noinit_command)
@@ -227,12 +226,8 @@ int openocd_main(int argc, char *argv[])
 
        cmd_ctx = setup_command_handler(NULL);
 
 
        cmd_ctx = setup_command_handler(NULL);
 
-#if BUILD_IOUTIL
        if (ioutil_init(cmd_ctx) != ERROR_OK)
        if (ioutil_init(cmd_ctx) != ERROR_OK)
-       {
                return EXIT_FAILURE;
                return EXIT_FAILURE;
-       }
-#endif
 
        LOG_OUTPUT("For bug reports, read\n\t"
                "http://openocd.berlios.de/doc/doxygen/bugs.html"
 
        LOG_OUTPUT("For bug reports, read\n\t"
                "http://openocd.berlios.de/doc/doxygen/bugs.html"

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)