Index: branches/xZenu/src/modules/MakeInc.dir =================================================================== --- branches/xZenu/src/modules/MakeInc.dir (revision 1307) +++ branches/xZenu/src/modules/MakeInc.dir (revision 1308) @@ -97,8 +97,8 @@ dylib_LINKER: ${OBJROOT} ${MODULE_OBJECTS} $(SYMROOT)/boot_modules.c $(SYMROOT)/boot_modules.h $(SYMROOT)/$(MODULE_NAME).${ARCH}.linker.dylib dylib: ${OBJROOT} ${MODULE_OBJECTS} $(SYMROOT)/$(MODULE_NAME).${ARCH}.dylib +#todo use -dot to generate symbol deps graph - ###### Build module into the code binary ###### $(SYMROOT)/$(MODULE_NAME).${ARCH}.linker.dylib: $(MODULE_DEPENDENCIES) ${MODULE_OBJECTS} $(OBJROOT)/$(MODULE_NAME).desc $(OBJROOT)/$(MODULE_NAME).author Makefile @echo "\t[LD:${ARCH}] (LINKER) $(MODULE_NAME).${ARCH}dylib" @@ -106,7 +106,7 @@ -alias _$(MODULE_START) start \ -dylib -read_only_relocs suppress \ -S -x -Z -dead_strip_dylibs \ - -no_uuid \ + -no_uuid -no_eh_labels \ -current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \ -final_output $(MODULE_NAME) \ $(filter %.${ARCH}o,$^) \ @@ -126,7 +126,7 @@ -alias _$(MODULE_START) start \ -dylib -read_only_relocs suppress \ -S -x -Z -dead_strip_dylibs \ - -no_uuid \ + -no_uuid -no_eh_labels \ -current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \ -final_output $(MODULE_NAME) \ $(filter %.${ARCH}o,$^) \ Index: branches/xZenu/src/modules/klibc/Makefile =================================================================== --- branches/xZenu/src/modules/klibc/Makefile (revision 1307) +++ branches/xZenu/src/modules/klibc/Makefile (revision 1308) @@ -24,6 +24,7 @@ strcmp strncmp strcpy strncpy strlcpy strstr strncat strcat strdup strncasecmp strchr strlen strtoul strtol \ qsort sha1hash onexit atexit exit \ snprintf vsnprintf sscanf vsscanf sprintf \ - fwrite fprintf vfprintf printf + fwrite fprintf vfprintf printf\ + fread2 fputc fputs fopen fread include ../MakeInc.dir Index: branches/xZenu/src/modules/klibc/fopen.c =================================================================== --- branches/xZenu/src/modules/klibc/fopen.c (revision 0) +++ branches/xZenu/src/modules/klibc/fopen.c (revision 1308) @@ -0,0 +1,43 @@ +/* + * fopen.c + */ + +#include +#include +//#include + +/* This depends on O_RDONLY == 0, O_WRONLY == 1, O_RDWR == 2 */ + +FILE *fopen(const char *file, const char *mode) +{ + printf("WARNING: fopen unimplimented.\n"); + return NULL; +#if 0 + int flags = O_RDONLY; + int plus = 0; + + while (*mode) { + switch (*mode++) { + case 'r': + flags = O_RDONLY; + break; + case 'w': + flags = O_WRONLY | O_CREAT | O_TRUNC; + break; + case 'a': + flags = O_WRONLY | O_CREAT | O_APPEND; + break; + case '+': + plus = 1; + break; + } + } + + if (plus) { + flags = (flags & ~(O_RDONLY | O_WRONLY)) | O_RDWR; + } + + /* Note: __create_file(-1) == NULL, so this is safe */ + return __create_file(open(file, flags, 0666)); +#endif +} Index: branches/xZenu/src/modules/klibc/fputc.c =================================================================== --- branches/xZenu/src/modules/klibc/fputc.c (revision 0) +++ branches/xZenu/src/modules/klibc/fputc.c (revision 1308) @@ -0,0 +1,14 @@ +/* + * fputc.c + * + * gcc "printf decompilation" expects this to exist... + */ + +#include +extern size_t _fwrite(const void *buf, size_t count, FILE *f); +int fputc(int c, FILE *f) +{ + unsigned char ch = c; + + return _fwrite(&ch, 1, f) == 1 ? ch : EOF; +} Index: branches/xZenu/src/modules/klibc/fputs.c =================================================================== --- branches/xZenu/src/modules/klibc/fputs.c (revision 0) +++ branches/xZenu/src/modules/klibc/fputs.c (revision 1308) @@ -0,0 +1,16 @@ +/* + * fputs.c + * + * This isn't quite fputs() in the stdio sense, since we don't + * have stdio, but it takes a file descriptor argument instead + * of the FILE *. + */ + +#include +#include + +extern size_t _fwrite(const void *buf, size_t count, FILE *f); +int fputs(const char *s, FILE *file) +{ + return _fwrite(s, strlen(s), file); +} Index: branches/xZenu/src/modules/klibc/fwrite.c =================================================================== --- branches/xZenu/src/modules/klibc/fwrite.c (revision 1307) +++ branches/xZenu/src/modules/klibc/fwrite.c (revision 1308) @@ -13,6 +13,7 @@ while (count) { rv = 1; + // TODO: use FILE* putchar(*p); p += rv; Index: branches/xZenu/src/modules/klibc/fread2.c =================================================================== --- branches/xZenu/src/modules/klibc/fread2.c (revision 0) +++ branches/xZenu/src/modules/klibc/fread2.c (revision 1308) @@ -0,0 +1,13 @@ +/* + * fread2.c + * + * The actual fread() function as a non-inline + */ + +#define __NO_FREAD_FWRITE_INLINES +#include +extern size_t _fread(void *buf, size_t count, FILE *f); +size_t fread(void *ptr, size_t size, size_t nmemb, FILE * f) +{ + return _fread(ptr, size * nmemb, f) / size; +} Index: branches/xZenu/src/modules/klibc/fread.c =================================================================== --- branches/xZenu/src/modules/klibc/fread.c (revision 0) +++ branches/xZenu/src/modules/klibc/fread.c (revision 1308) @@ -0,0 +1,37 @@ +/* + * fread.c + */ + +#include +#include +#include + +size_t _fread(void *buf, size_t count, FILE *f) +{ + printf("WARNING: fread not implimented.\n"); + return 0; +#if 0 + size_t bytes = 0; + ssize_t rv; + char *p = buf; + + while (count) { + rv = read(fileno(f), p, count); + if (rv == -1) { + if (errno == EINTR) { + errno = 0; + continue; + } else + break; + } else if (rv == 0) { + break; + } + + p += rv; + bytes += rv; + count -= rv; + } + + return bytes; +#endif +} Index: branches/xZenu/src/modules/Cconfig =================================================================== --- branches/xZenu/src/modules/Cconfig (revision 1307) +++ branches/xZenu/src/modules/Cconfig (revision 1308) @@ -27,5 +27,8 @@ source "modules/Disk/Cconfig" source "modules/FileSystem/Cconfig" +source "modules/TinyXML/Cconfig" + + source "modules/HelloWorld/Cconfig" endmenu \ No newline at end of file Index: branches/xZenu/src/modules/Makefile =================================================================== --- branches/xZenu/src/modules/Makefile (revision 1307) +++ branches/xZenu/src/modules/Makefile (revision 1308) @@ -9,7 +9,7 @@ include ${ROOT}/Make.rules # The order of building is important. -SUBDIRS = klibc uClibcxx ModuleSystem Disk FileSystem +SUBDIRS = klibc uClibcxx ModuleSystem Disk FileSystem TinyXML # ModuleSystem CFLAGS= -O3 $(MORECPP) -g -static