Make possible to #include <object.h>.

This header declares functions in libobject.  Our programs never
included object.h, but called functions in libobject without declaring
them.  So, our build system never put object.h in the include path;
any #include <object.h> would fail to find the header.

With this commit, a program may #include <object.h> if it has
modules/src/object+lib in its deps.

Declare structs in object.h so we can use them in prototypes without
gcc warning, "'struct whatever' declared inside parameter list".

Remove inclusion of ansi.h from object.h.  Programs would need to
depend on modules+headers to get ansi.h in the include path.
This commit is contained in:
George Koehler 2016-11-22 11:13:14 -05:00
parent 88c2ea63aa
commit 19310d2521
2 changed files with 39 additions and 34 deletions

View file

@ -1,6 +1,7 @@
clibrary {
name = "lib",
srcs = { "./*.c" },
hdrs = { "./object.h" },
deps = {
"modules+headers",
"h+local",

View file

@ -4,42 +4,46 @@
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#include <ansi.h>
#ifndef __OBJECT_INCLUDED__
#define __OBJECT_INCLUDED__
_PROTOTYPE(int wr_open, (char *f));
_PROTOTYPE(void wr_close, (void));
_PROTOTYPE(void wr_ohead, (struct outhead *h));
_PROTOTYPE(void wr_sect, (struct outsect *s, unsigned int c));
_PROTOTYPE(void wr_outsect, (int sectno));
_PROTOTYPE(void wr_emit, (char *b, long c));
_PROTOTYPE(void wr_putc, (int c));
_PROTOTYPE(void wr_relo, (struct outrelo *r, unsigned int c));
_PROTOTYPE(void wr_name, (struct outname *n, unsigned int c));
_PROTOTYPE(void wr_string, (char *s, long c));
_PROTOTYPE(void wr_arhdr, (int fd, struct ar_hdr *a));
_PROTOTYPE(void wr_ranlib, (int fd, struct ranlib *r, long cnt));
_PROTOTYPE(void wr_int2, (int fd, int i));
_PROTOTYPE(void wr_long, (int fd, long l));
_PROTOTYPE(void wr_bytes, (int fd, char *buf, long l));
_PROTOTYPE(int rd_open, (char *f));
_PROTOTYPE(int rd_fdopen, (int f));
_PROTOTYPE(void rd_close, (void));
_PROTOTYPE(void rd_ohead, (struct outhead *h));
_PROTOTYPE(void rd_sect, (struct outsect *s, unsigned int c));
_PROTOTYPE(void rd_outsect, (int sectno));
_PROTOTYPE(void rd_emit, (char *b, long c));
_PROTOTYPE(void rd_relo, (struct outrelo *r, unsigned int c));
_PROTOTYPE(void rd_rew_relo, (struct outhead *head));
_PROTOTYPE(void rd_name, (struct outname *n, unsigned int c));
_PROTOTYPE(void rd_string, (char *s, long c));
_PROTOTYPE(int rd_arhdr, (int fd, struct ar_hdr *a));
_PROTOTYPE(void rd_ranlib, (int fd, struct ranlib *r, long cnt));
_PROTOTYPE(int rd_int2, (int fd));
_PROTOTYPE(long rd_long, (int fd));
_PROTOTYPE(void rd_bytes, (int fd, char *buf, long l));
_PROTOTYPE(int rd_fd, (void));
struct ar_hdr;
struct outhead;
struct outrelo;
struct outsect;
struct ranlib;
int wr_open(char *f);
void wr_close(void);
void wr_ohead(struct outhead *h);
void wr_sect(struct outsect *s, unsigned int c);
void wr_outsect(int sectno);
void wr_emit(char *b, long c);
void wr_putc(int c);
void wr_relo(struct outrelo *r, unsigned int c);
void wr_name(struct outname *n, unsigned int c);
void wr_string(char *s, long c);
void wr_arhdr(int fd, struct ar_hdr *a);
void wr_ranlib(int fd, struct ranlib *r, long cnt);
void wr_int2(int fd, int i);
void wr_long(int fd, long l);
void wr_bytes(int fd, char *buf, long l);
int rd_open(char *f);
int rd_fdopen(int f);
void rd_close(void);
void rd_ohead(struct outhead *h);
void rd_sect(struct outsect *s, unsigned int c);
void rd_outsect(int sectno);
void rd_emit(char *b, long c);
void rd_relo(struct outrelo *r, unsigned int c);
void rd_rew_relo(struct outhead *head);
void rd_name(struct outname *n, unsigned int c);
void rd_string(char *s, long c);
int rd_arhdr(int fd, struct ar_hdr *a);
void rd_ranlib(int fd, struct ranlib *r, long cnt);
int rd_int2(int fd);
long rd_long(int fd);
void rd_bytes(int fd, char *buf, long l);
int rd_fd(void);
#endif /* __OBJECT_INCLUDED__ */