From 086a2ac9abc9f55314027b39a2d4523922a99bd0 Mon Sep 17 00:00:00 2001 From: carl Date: Sun, 24 Mar 2019 17:09:12 +0800 Subject: [PATCH] Add additional defines for compilation. --- util/led/error.h | 19 +++++++++++++++++++ util/led/extract.h | 23 +++++++++++++++++++++++ util/led/finish.h | 14 ++++++++++++++ util/led/output.h | 27 +++++++++++++++++++++++++++ util/led/relocate.h | 21 +++++++++++++++++++++ util/led/save.h | 14 ++++++++++++++ util/led/write.h | 21 +++++++++++++++++++++ 7 files changed, 139 insertions(+) create mode 100644 util/led/error.h create mode 100644 util/led/extract.h create mode 100644 util/led/finish.h create mode 100644 util/led/output.h create mode 100644 util/led/relocate.h create mode 100644 util/led/save.h create mode 100644 util/led/write.h diff --git a/util/led/error.h b/util/led/error.h new file mode 100644 index 000000000..8071a9f06 --- /dev/null +++ b/util/led/error.h @@ -0,0 +1,19 @@ +/* + * error.h + * + * Created on: 2018-11-17 + * Author: carl + */ + + +#ifndef __ERROR_H_INCLUDED__ +#define __ERROR_H_INCLUDED__ + +void stop(void); +void fatal(char *format, ...); +void warning(char *format, ...); +void error(char *format, ...); +int do_verbose(char *format, ...); + + +#endif /* __ERROR_H_INCLUDED__ */ diff --git a/util/led/extract.h b/util/led/extract.h new file mode 100644 index 000000000..48c817190 --- /dev/null +++ b/util/led/extract.h @@ -0,0 +1,23 @@ +/* + * extract.h + * + * Created on: 2018-11-17 + * Author: carl + */ + +#ifndef __EXTRACT_H_INCLUDED__ +#define __EXTRACT_H_INCLUDED__ + +#include "out.h" + +void extract(void); +/* + * Add relocation constant for names in user defined sections. + * The value of a common name indicates a size instead of an offset, + * and hence shouldn't be relocated. + * Otherwise we just add the accumulated size of all normal parts in preceding + * sections with the same size. + */ +void namerelocate(register struct outname *name); + +#endif /* __EXTRACT_H_INCLUDED___ */ diff --git a/util/led/finish.h b/util/led/finish.h new file mode 100644 index 000000000..51159fabd --- /dev/null +++ b/util/led/finish.h @@ -0,0 +1,14 @@ +/* + * finish.h + * + * Created on: 2018-11-17 + * Author: Carl Eric Codere + */ + +#ifndef __FINISH_H_INCLUDED__ +#define __FINISH_H_INCLUDED__ + +void finish(void); +void do_crs(struct outname *base, unsigned int count); + +#endif /* __FINISH_H_INCLUDED__ */ diff --git a/util/led/output.h b/util/led/output.h new file mode 100644 index 000000000..19c9a1b3a --- /dev/null +++ b/util/led/output.h @@ -0,0 +1,27 @@ +/* + * output.h + * + * Created on: 2018-11-18 + * Author: carl + */ + +#ifndef __OUTPUT_H_INCLUDED__ +#define __OUTPUT_H_INCLUDED__ + +/* + * We have counted all relocation structs but we know only now if + * these must be emitted.We add all names here,unless the -s(trip) + * flag was given. + * If this flag is given we don't need the string table either. + */ +void beginoutput(void); + +/* + * If we didn't keep the whole output file in core, most of it has been + * written out, and we just finish that. + * If we did, we write out our pieces of core. + */ +void endoutput(void); + + +#endif /* __OUTPUT_H_INCLUDED__ */ diff --git a/util/led/relocate.h b/util/led/relocate.h new file mode 100644 index 000000000..0c76729ac --- /dev/null +++ b/util/led/relocate.h @@ -0,0 +1,21 @@ +/* + * relocate.h + * + * Created on: 2018-11-18 + * Author: carl + */ + +#ifndef __RELOCATE_H_INCLUDED__ +#define __RELOCATE_H_INCLUDED__ + +#include "out.h" + +/* + * This routine relocates a value in a section pointed to by `emit', of + * which the header is pointed to by `head'. Relocation is relative to the + * names in `names'; `relo' tells how to relocate. + */ +void relocate(struct outhead *head, char* emit, struct outname names[], struct outrelo *relo, long off); + + +#endif /* __RELOCATE_H_INCLUDED__ */ diff --git a/util/led/save.h b/util/led/save.h new file mode 100644 index 000000000..54a51715e --- /dev/null +++ b/util/led/save.h @@ -0,0 +1,14 @@ +#ifndef __SAVE_H_INCLUDED__ +#define __SAVE_H_INCLUDED__ + +#include "memory.h" + +struct ar_hdr; +struct outname; + +void savemagic(void); +void savehdr(struct ar_hdr *hdr); +ind_t savechar(int piece, ind_t off); +void savelocal(struct outname *name); + +#endif /* __SAVE_H_INCLUDED__ */ diff --git a/util/led/write.h b/util/led/write.h new file mode 100644 index 000000000..07b337ae6 --- /dev/null +++ b/util/led/write.h @@ -0,0 +1,21 @@ +/* + * write.h + * + * Created on: 2018-11-17 + * Author: carl + */ + +#ifndef __WRITE_H_INCLUDED__ +#define __WRITE_H_INCLUDED__ + +#include "out.h" + +void wr_fatal(void); +void begin_write(void); +void end_write(void); +void wrt_emit(char *emit, int sectindex, long cnt); +void wrt_nulls(int sectindex, long cnt); +void wrt_name(struct outname *name, int writename); + + +#endif /* __WRITE_H_INCLUDED__ */