From dda1e8a9ee1427b5513c4b0f6791245f67ae8a20 Mon Sep 17 00:00:00 2001 From: schodet Date: Mon, 19 Sep 2005 20:22:53 +0000 Subject: Ajout du module host. --- n/avr/modules/host/Makefile.module | 1 + n/avr/modules/host/README | 25 +++++++++++++ n/avr/modules/host/host.c | 72 ++++++++++++++++++++++++++++++++++++++ n/avr/modules/host/host.h | 63 +++++++++++++++++++++++++++++++++ 4 files changed, 161 insertions(+) create mode 100644 n/avr/modules/host/Makefile.module create mode 100644 n/avr/modules/host/README create mode 100644 n/avr/modules/host/host.c create mode 100644 n/avr/modules/host/host.h diff --git a/n/avr/modules/host/Makefile.module b/n/avr/modules/host/Makefile.module new file mode 100644 index 0000000..6ce2645 --- /dev/null +++ b/n/avr/modules/host/Makefile.module @@ -0,0 +1 @@ +host_SOURCES = host.c diff --git a/n/avr/modules/host/README b/n/avr/modules/host/README new file mode 100644 index 0000000..7b9e507 --- /dev/null +++ b/n/avr/modules/host/README @@ -0,0 +1,25 @@ +avr.host - Host fonctions modules. + +Host and simulation functions. See modules README for more details about AVR +modules. + + +Copyright (C) 2005 Nicolas Schodet + +Robot APB Team/Efrei 2006. + Web: http://assos.efrei.fr/robot/ + Email: robot AT efrei DOT fr + +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. diff --git a/n/avr/modules/host/host.c b/n/avr/modules/host/host.c new file mode 100644 index 0000000..f4d76e9 --- /dev/null +++ b/n/avr/modules/host/host.c @@ -0,0 +1,72 @@ +/* host.c */ +/* avr.host - Host fonctions modules. {{{ + * + * Copyright (C) 2005 Nicolas Schodet + * + * Robot APB Team/Efrei 2006. + * Web: http://assos.efrei.fr/robot/ + * Email: robot AT efrei DOT fr + * + * 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. + * + * }}} */ +#include "host.h" + +/** Global integer variables list. */ + +/** Global string variables list. */ + +/** Initialise host modules. */ +void +host_init (int argc, char **argv) +{ +} + +/** Register a host integer. */ +void +host_register_integer (const char *name, int val) +{ +} + +/** Register a host string. */ +void +host_register_string (const char *name, const char *val) +{ +} + +/** Fetch a host integer, return -1 if non existant. */ +int +host_fetch_integer (const char *name) +{ + return -1; +} + +/** Fetch a host string, return 0 if non existant. */ +const char * +host_fetch_string (const char *name) +{ + return 0; +} + +/** Reset the program. */ +void +host_reset (void) +{ + execlp (program_invocation_name, program_invocation_name, 0); + assert_perror (errno); + abort (); +} + +#endif /* host_h */ diff --git a/n/avr/modules/host/host.h b/n/avr/modules/host/host.h new file mode 100644 index 0000000..7dd901f --- /dev/null +++ b/n/avr/modules/host/host.h @@ -0,0 +1,63 @@ +#ifndef host_h +#define host_h +/* host.h */ +/* avr.host - Host fonctions modules. {{{ + * + * Copyright (C) 2005 Nicolas Schodet + * + * Robot APB Team/Efrei 2006. + * Web: http://assos.efrei.fr/robot/ + * Email: robot AT efrei DOT fr + * + * 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. + * + * }}} */ + +/* Discourage use of this header in non HOST compilation. */ +#ifndef HOST +# error Use this header only for HOST only files ! +#endif + +/** Initialise host modules. */ +void +host_init (int argc, char **argv); + +/** Host variables are usefull on reset. They are passed on the command + * line. This is not optimised for performance. */ + +/** Register a host integer. */ +void +host_register_integer (const char *name, int val); + +/** Register a host string. */ +void +host_register_string (const char *name, const char *val); + +/** Fetch a host integer, return -1 if non existant. */ +int +host_fetch_integer (const char *name); + +/** Fetch a host string, return 0 if non existant. */ +const char * +host_fetch_string (const char *name); + +void +host_reset (void) __attribute__ ((noreturn)); + +/** Reset the program. */ +void +host_reset (void); + +#endif /* host_h */ -- cgit v1.2.3