From: Philipp Hachtmann Date: Tue, 17 May 2016 11:50:02 +0000 (+0200) Subject: ldc: Small fixes (includes, less warnings etc.) X-Git-Url: http://gitweb.hachti.de/?a=commitdiff_plain;h=d34afc1e025c289b7454d33504b116a74eb20498;p=h316.git ldc: Small fixes (includes, less warnings etc.) Signed-off-by: Philipp Hachtmann --- diff --git a/pc-tools/ldc/Makefile b/pc-tools/ldc/Makefile index df7c0f3..9902505 100644 --- a/pc-tools/ldc/Makefile +++ b/pc-tools/ldc/Makefile @@ -1,9 +1,11 @@ default: ldc +CFLAGS=-Wall + %.o: %.c *.h @echo -n Baue: $@ @echo - @gcc -c -Wunknown-pragmas -o$@ $< + @gcc ${CFLAGS} -c -Wunknown-pragmas -o$@ $< ldc: ldc.o process.o hw_helpers.o tape.o split.o diff --git a/pc-tools/ldc/hw_types.h b/pc-tools/ldc/hw_types.h index cb79661..e567115 100644 --- a/pc-tools/ldc/hw_types.h +++ b/pc-tools/ldc/hw_types.h @@ -32,9 +32,9 @@ struct hw16_tape { }; struct hw16_bytes { - unsigned char low __attribute__ ((packed)); - unsigned char high __attribute__ ((packed)); -}; + unsigned char low; + unsigned char high; +} __attribute__((packed)) w; struct hw16_otype { unsigned int space1:6 __attribute__ ((packed)); @@ -149,12 +149,12 @@ typedef union{ typedef union { - struct hw16_bits bits __attribute__ ((packed)); - struct hw16_bytes bytes __attribute__ ((packed)); - struct hw16_tape tape __attribute__ ((packed)); - struct hw16_otype blocktype __attribute__ ((packed)); - unsigned short value __attribute__ ((packed)); -} hw16; + struct hw16_bits bits; + struct hw16_bytes bytes; + struct hw16_tape tape; + struct hw16_otype blocktype; + unsigned short value; +} __attribute__ ((packed)) hw16; enum {BT_DATA,BT_STOP}; diff --git a/pc-tools/ldc/ldc.c b/pc-tools/ldc/ldc.c index 6a20558..26a469e 100644 --- a/pc-tools/ldc/ldc.c +++ b/pc-tools/ldc/ldc.c @@ -6,6 +6,10 @@ #include #include "hw_types.h" #include "hw_helpers.h" +#include "tape.h" +#include "process.h" +#include "split.h" + #define XON 0x11 #define XOFF 0x13 #define CHAR_START 0x81 diff --git a/pc-tools/ldc/ldc.h b/pc-tools/ldc/ldc.h new file mode 100644 index 0000000..8a5b157 --- /dev/null +++ b/pc-tools/ldc/ldc.h @@ -0,0 +1,6 @@ +#ifndef LDC_H +#define LDC_H + +void errf (char *format, ...); + +#endif diff --git a/pc-tools/ldc/process.c b/pc-tools/ldc/process.c index 9dd71be..a21ac7e 100644 --- a/pc-tools/ldc/process.c +++ b/pc-tools/ldc/process.c @@ -3,7 +3,7 @@ #include "hw_helpers.h" #include "process.h" - +#include "ldc.h" //#define DEBUG_DATA /**********************************************************************/ @@ -41,7 +41,7 @@ void block_dispose(datablock * victim){ char ** extract_labels0(datablock * blockp){ char ** result=(char **) malloc (sizeof(char **)); - result[0]==NULL; + result[0] = NULL; if (get_blocktype(blockp)!=0) return NULL; datablock block; @@ -65,7 +65,6 @@ char ** extract_labels0(datablock * blockp){ strncpy (aktres,akt+dd,strlen(akt+dd)); result=(char **)realloc(result, (c+1)* sizeof(char**)); result[c]=aktres; -// printf("akt: %s\n",result[c]); } result=(char **)realloc(result, (c+1)* sizeof(char**)); result[c]=NULL; @@ -75,7 +74,6 @@ char ** extract_labels0(datablock * blockp){ } void dispose_labels(char ** labels){ - char * akt; if (labels==NULL) return; int c=0; do { diff --git a/pc-tools/ldc/process.h b/pc-tools/ldc/process.h index 825003f..87dedcc 100644 --- a/pc-tools/ldc/process.h +++ b/pc-tools/ldc/process.h @@ -4,7 +4,7 @@ void process_block (datablock * block); int get_blocktype (datablock * block); -int get_subblocktype (datablock * block); +int get_blocksubtype(datablock * block); void block_copy(datablock * dest, datablock* src); datablock * block_clone(datablock * original); void block_dispose(datablock * victim); diff --git a/pc-tools/ldc/split.c b/pc-tools/ldc/split.c index ad305a5..e28f862 100644 --- a/pc-tools/ldc/split.c +++ b/pc-tools/ldc/split.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "hw_types.h" #include "hw_helpers.h" diff --git a/pc-tools/ldc/tape.c b/pc-tools/ldc/tape.c index 6225ca1..472b73c 100644 --- a/pc-tools/ldc/tape.c +++ b/pc-tools/ldc/tape.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "tape.h" diff --git a/pc-tools/ldc/tape.h b/pc-tools/ldc/tape.h index 15c8f79..7b1bdc7 100644 --- a/pc-tools/ldc/tape.h +++ b/pc-tools/ldc/tape.h @@ -1,4 +1,4 @@ void tapeinit(int fg); -void tapeclose(); -void tapestart(); -void tapestop(); +void tapeclose(void); +void tapestart(void); +void tapestop(void);