Mercurial > hg-old > index.cgi
changeset 115:776d8bea5b46
implement reading files
author | lost |
---|---|
date | Sun, 18 Jan 2009 04:53:57 +0000 |
parents | c65fcec346cd |
children | 817ab0e124fa |
files | lwlink/trunk/src/Makefile.am lwlink/trunk/src/lwlink.c lwlink/trunk/src/lwlink.h lwlink/trunk/src/main.c |
diffstat | 4 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lwlink/trunk/src/Makefile.am Sat Jan 17 20:54:58 2009 +0000 +++ b/lwlink/trunk/src/Makefile.am Sun Jan 18 04:53:57 2009 +0000 @@ -1,3 +1,3 @@ bin_PROGRAMS = lwlink -lwlink_SOURCES = main.c lwlink.c util.c +lwlink_SOURCES = main.c lwlink.c util.c readfiles.c EXTRA_DIST = lwlink.h util.h
--- a/lwlink/trunk/src/lwlink.c Sat Jan 17 20:54:58 2009 +0000 +++ b/lwlink/trunk/src/lwlink.c Sun Jan 18 04:53:57 2009 +0000 @@ -39,12 +39,13 @@ int outformat = OUTPUT_DECB; char *outfile = NULL; -char **inputfiles = NULL; +fileinfo_t **inputfiles = NULL; int ninputfiles = 0; void add_input_file(char *fn) { - inputfiles = lw_realloc(inputfiles, sizeof(char *) * (ninputfiles + 1)); - inputfiles[ninputfiles++] = lw_strdup(fn); + inputfiles = lw_realloc(inputfiles, sizeof(fileinfo_t *) * (ninputfiles + 1)); + inputfiles[ninputfiles] = lw_malloc(sizeof(fileinfo_t)); + inputfiles[ninputfiles++] -> filename = lw_strdup(fn); }
--- a/lwlink/trunk/src/lwlink.h Sat Jan 17 20:54:58 2009 +0000 +++ b/lwlink/trunk/src/lwlink.h Sun Jan 18 04:53:57 2009 +0000 @@ -27,13 +27,21 @@ #define OUTPUT_DECB 0 // DECB multirecord format #define OUTPUT_RAW 1 // raw sequence of bytes + +typedef struct +{ + char *filename; + unsigned char *filedata; + long filesize; +} fileinfo_t; + #ifndef __lwlink_c_seen__ extern int debug_level; extern int outformat; extern char *outfile; extern int ninputfiles; -extern char **inputfiles; +extern fileinfo_t **inputfiles; #define __lwlink_E__ extern #else
--- a/lwlink/trunk/src/main.c Sat Jan 17 20:54:58 2009 +0000 +++ b/lwlink/trunk/src/main.c Sun Jan 18 04:53:57 2009 +0000 @@ -112,6 +112,8 @@ "LWLINK, a HD6309 and MC6809 cross-linker" }; +extern void read_files(void); + // main function; parse command line, set up assembler state, and run the // assembler on the first file int main(int argc, char **argv) @@ -122,6 +124,9 @@ fprintf(stderr, "No input files\n"); exit(1); } + + // read the input files + read_files(); exit(0); }