+2003-02-08 NIIBE Yutaka <gniibe@m17n.org>
+
+ * util/resolve.c (pupa_util_resolve_dependencies): BUG
+ FIX. Reverse the path_list.
+
+ * include/pupa/normal.h: Export pupa_register_command and
+ pupa_unregister_command.
+
+ * hello/hello.c (pupa_cmd_hello): New module.
+ * conf/i386-pc.rmk: Added hello.mod.
+
2003-01-31 Yoshinori K. Okuji <okuji@enbug.org>
* kern/i386/pc/lzo1x.S: New file.
genmoddep_SOURCES = util/genmoddep.c
# Modules.
-pkgdata_MODULES = _chain.mod _linux.mod fat.mod normal.mod
+pkgdata_MODULES = _chain.mod _linux.mod fat.mod normal.mod hello.mod
# For _chain.mod.
_chain_mod_SOURCES = loader/i386/pc/chainloader.c
normal/menu.c normal/i386/setjmp.S
normal_mod_CFLAGS = $(COMMON_CFLAGS)
normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
+
+# For hello.mod.
+hello_mod_SOURCES = hello/hello.c
+hello_mod_CFLAGS = $(COMMON_CFLAGS)
--- /dev/null
+/* hello.c - test module for dynamic loading */
+/*
+ * PUPA -- Preliminary Universal Programming Architecture for GRUB
+ * Copyright (C) 2003 NIIBE Yutaka <gniibe@m17n.org>
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <pupa/types.h>
+#include <pupa/misc.h>
+#include <pupa/mm.h>
+#include <pupa/err.h>
+#include <pupa/dl.h>
+#include <pupa/normal.h>
+
+static int
+pupa_cmd_hello (int argc, char *argv[])
+{
+ (void)argc; (void)argv; /* To stop warning. */
+ pupa_printf ("Hello World\n");
+ return 0;
+}
+
+PUPA_MOD_INIT
+{
+ (void)mod; /* To stop warning. */
+ pupa_register_command ("hello", pupa_cmd_hello, PUPA_COMMAND_FLAG_BOTH,
+ "hello", "Say hello");
+}
+
+PUPA_MOD_FINI
+{
+ pupa_unregister_command ("hello");
+}
#define PUPA_NORMAL_HEADER 1
#include <pupa/setjmp.h>
+#include <pupa/symbol.h>
/* The maximum size of a command-line. */
#define PUPA_MAX_CMDLINE 1600
void pupa_cmdline_run (int nested);
int pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
int echo_char, int readline);
-void pupa_register_command (const char *name,
+void EXPORT_FUNC(pupa_register_command) (const char *name,
int (*func) (int argc, char *argv[]),
unsigned flags,
const char *summary,
const char *description);
-void pupa_unregister_command (const char *name);
+void EXPORT_FUNC(pupa_unregister_command) (const char *name);
pupa_command_t pupa_command_find (char *cmdline);
int pupa_command_execute (char *cmdline);
void pupa_command_init (void);
struct dep_list *dep_list;
struct mod_list *mod_list = 0;
struct pupa_util_path_list *path_list = 0;
-
+
path = pupa_util_get_path (prefix, dep_list_file);
fp = fopen (path, "r");
if (! fp)
free_dep_list (dep_list);
free_mod_list (mod_list);
- return path_list;
+ { /* Reverse the path_list */
+ struct pupa_util_path_list *p, *prev, *next;
+
+ for (p = path_list, prev = NULL; p; p = next)
+ {
+ next = p->next;
+ p->next = prev;
+ prev = p;
+ }
+
+ return prev;
+ }
}