From 1a0954abb80f92cd9940a21f11dd8f3a84518579 Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 4 Jan 2005 21:18:08 +0000 Subject: autolib --- include/bin.h | 2 ++ include/bio.h | 2 ++ include/complete.h | 12 ++++++++++++ include/disk.h | 17 +++++++++++++++-- include/draw.h | 4 +++- include/flate.h | 2 ++ include/frame.h | 2 ++ include/fs.h | 42 ------------------------------------------ include/html.h | 1 + include/httpd.h | 2 ++ include/ip.h | 1 + include/libString.h | 11 +++++++++++ include/libsec.h | 2 ++ include/mach.h | 16 +++++++++++++--- include/mp.h | 2 ++ include/mux.h | 12 ++++++++++++ include/regexp9.h | 2 ++ include/thread.h | 5 ++++- include/u.h | 5 +++++ include/venti.h | 3 +++ 20 files changed, 96 insertions(+), 49 deletions(-) delete mode 100644 include/fs.h diff --git a/include/bin.h b/include/bin.h index dc738f14..139e6bf5 100644 --- a/include/bin.h +++ b/include/bin.h @@ -4,6 +4,8 @@ extern "C" { #endif +AUTOLIB(bin) + /* #pragma lib "libbin.a" #pragma src "/sys/src/libbin" diff --git a/include/bio.h b/include/bio.h index bd529011..2c2b9566 100644 --- a/include/bio.h +++ b/include/bio.h @@ -4,6 +4,8 @@ extern "C" { #endif +AUTOLIB(bio) + #include /* for off_t */ #include /* for O_RDONLY, O_WRONLY */ diff --git a/include/complete.h b/include/complete.h index ae8003d7..92ed1477 100644 --- a/include/complete.h +++ b/include/complete.h @@ -1,3 +1,10 @@ +#ifndef _COMPLETE_H_ +#define _COMPLETE_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + +AUTOLIB(complete) /* #pragma lib "libcomplete.a" #pragma src "/sys/src/libcomplete" @@ -16,3 +23,8 @@ struct Completion{ Completion* complete(char *dir, char *s); void freecompletion(Completion*); + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/include/disk.h b/include/disk.h index a887866e..7e1d35a2 100644 --- a/include/disk.h +++ b/include/disk.h @@ -1,6 +1,13 @@ -#pragma src "/sys/src/libdisk" -#pragma lib "libdisk.a" +#ifndef _DISK_H_ +#define _DISK_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + +AUTOLIB(disk) + +#if 0 /* SCSI interface */ typedef struct Scsi Scsi; struct Scsi { @@ -58,8 +65,14 @@ enum { Gdisk, Gguess, }; +#endif /* proto file parsing */ typedef void Protoenum(char *new, char *old, Dir *d, void *a); typedef void Protowarn(char *msg, void *a); int rdproto(char*, char*, Protoenum*, Protowarn*, void*); + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/include/draw.h b/include/draw.h index 4898e314..af58b31c 100644 --- a/include/draw.h +++ b/include/draw.h @@ -4,6 +4,8 @@ extern "C" { #endif +AUTOLIB(draw) + typedef struct Cachefont Cachefont; typedef struct Cacheinfo Cacheinfo; typedef struct Cachesubf Cachesubf; @@ -338,7 +340,7 @@ extern int writeimage(int, Image*, int); extern Image* namedimage(Display*, char*); extern int nameimage(Image*, char*, int); extern Image* allocimagemix(Display*, u32int, u32int); -extern int drawsetlabel(Display*, char*); +extern int drawsetlabel(char*); /* * Colors diff --git a/include/flate.h b/include/flate.h index bbd0b3d7..8fcc173c 100644 --- a/include/flate.h +++ b/include/flate.h @@ -3,6 +3,8 @@ #if defined(__cplusplus) extern "C" { #endif + +AUTOLIB(flate) /* #pragma lib "libflate.a" #pragma src "/sys/src/libflate" diff --git a/include/frame.h b/include/frame.h index 47d808ca..a3291a70 100644 --- a/include/frame.h +++ b/include/frame.h @@ -4,6 +4,8 @@ extern "C" { #endif +AUTOLIB(frame) + typedef struct Frbox Frbox; typedef struct Frame Frame; diff --git a/include/fs.h b/include/fs.h deleted file mode 100644 index 38442709..00000000 --- a/include/fs.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _FS_H_ -#define _FS_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Simple user-level 9P client. - */ - -typedef struct Fsys Fsys; -typedef struct Fid Fid; - -Fsys *fsinit(int); -Fsys *fsmount(int, char*); - -int fsversion(Fsys*, int, char*, int); -Fid *fsauth(Fsys*, char*); -Fid *fsattach(Fsys*, Fid*, char*, char*); -Fid *fsopen(Fsys*, char*, int); -int fsopenfd(Fsys*, char*, int); -long fsread(Fid*, void*, long); -long fsreadn(Fid*, void*, long); -long fswrite(Fid*, void*, long); -void fsclose(Fid*); -void fsunmount(Fsys*); -int fsrpc(Fsys*, Fcall*, Fcall*, void**); -Fid *fswalk(Fid*, char*); -struct Dir; /* in case there's no lib9.h */ -long fsdirread(Fid*, struct Dir**); -long fsdirreadall(Fid*, struct Dir**); -struct Dir *fsdirstat(Fsys*, char*); -struct Dir *fsdirfstat(Fid*); -int fsdirwstat(Fsys*, char*, struct Dir*); -int fsdirfwstat(Fid*, struct Dir*); -Fid *fsroot(Fsys*); -Fsys *nsmount(char*, char*); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/include/html.h b/include/html.h index 0bcf3b5c..1d5dd6b2 100644 --- a/include/html.h +++ b/include/html.h @@ -4,6 +4,7 @@ extern "C" { #endif +AUTOLIB(html) /* #pragma lib "libhtml.a" #pragma src "/sys/src/libhtml" diff --git a/include/httpd.h b/include/httpd.h index 7f332519..e968d5e2 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -3,6 +3,8 @@ #if defined(__cplusplus) extern "C" { #endif + +AUTOLIB(httpd) /* #pragma lib "libhttpd.a" #pragma src "/sys/src/libhttpd" diff --git a/include/ip.h b/include/ip.h index 36b36351..b6843e70 100644 --- a/include/ip.h +++ b/include/ip.h @@ -4,6 +4,7 @@ extern "C" { #endif +AUTOLIB(ip) /* #pragma src "/sys/src/libip" #pragma lib "libip.a" diff --git a/include/libString.h b/include/libString.h index 1a560b6f..ad782b44 100644 --- a/include/libString.h +++ b/include/libString.h @@ -1,7 +1,14 @@ +#ifndef _LIBSTRING_H_ +#define _LIBSTRING_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + /* #pragma src "/sys/src/libString" #pragma lib "libString.a" */ +AUTOLIB(String) /* extensible Strings */ typedef struct String { @@ -44,3 +51,7 @@ extern char *s_rdinstack(Sinstack*, String*); extern Sinstack *s_allocinstack(char*); extern void s_freeinstack(Sinstack*); #endif /* BGETC */ +#if defined(__cplusplus) +} +#endif +#endif diff --git a/include/libsec.h b/include/libsec.h index e598a780..008a283d 100644 --- a/include/libsec.h +++ b/include/libsec.h @@ -8,6 +8,8 @@ extern "C" { #pragma src "/sys/src/libsec" */ +AUTOLIB(sec) + #ifndef _MPINT typedef struct mpint mpint; #endif diff --git a/include/mach.h b/include/mach.h index 23089e44..0f1a5ae5 100644 --- a/include/mach.h +++ b/include/mach.h @@ -1,3 +1,11 @@ +#ifndef _MACH_H_ +#define _MACH_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + +AUTOLIB(mach) + /* * Architecture-dependent application data. * @@ -351,8 +359,6 @@ struct Regdesc uint format; /* print format: 'x', 'X', 'f', 'z', 'Z' */ }; -Regdesc* regdesc(char*); - enum { /* machine types */ @@ -498,7 +504,7 @@ Fhdr* findhdr(char*); Symbol* flookupsym(Fhdr*, char*); Symbol* ffindsym(Fhdr*, Loc, uint); -Symbol* addsym(Fhdr*, Symbol*); +Symbol* _addsym(Fhdr*, Symbol*); /* * Stack frame walking. @@ -525,3 +531,7 @@ struct ps_prochandle }; extern int machdebug; +#if defined(__cplusplus) +} +#endif +#endif diff --git a/include/mp.h b/include/mp.h index 427544df..153fd03b 100644 --- a/include/mp.h +++ b/include/mp.h @@ -4,6 +4,8 @@ extern "C" { #endif +AUTOLIB(mp) + /* #pragma src "/sys/src/libmp" #pragma lib "libmp.a" diff --git a/include/mux.h b/include/mux.h index b8d242c8..01d1779c 100644 --- a/include/mux.h +++ b/include/mux.h @@ -1,3 +1,11 @@ +#ifndef _MUX_H_ +#define _MUX_H_ 1 +#if defined(__cplusplus) +extern "C" { +#endif + +AUTOLIB(mux) + typedef struct Mux Mux; typedef struct Muxrpc Muxrpc; typedef struct Muxqueue Muxqueue; @@ -52,3 +60,7 @@ void *_muxqrecv(Muxqueue*); void _muxqhangup(Muxqueue*); void *_muxnbqrecv(Muxqueue*); +#if defined(__cplusplus) +} +#endif +#endif diff --git a/include/regexp9.h b/include/regexp9.h index b241712b..9e1c01b1 100644 --- a/include/regexp9.h +++ b/include/regexp9.h @@ -4,6 +4,8 @@ extern "C" { #endif +AUTOLIB(regexp9) + #include typedef struct Resub Resub; diff --git a/include/thread.h b/include/thread.h index bbcbba54..23c4a529 100644 --- a/include/thread.h +++ b/include/thread.h @@ -4,6 +4,8 @@ extern "C" { #endif +AUTOLIB(thread) + /* * basic procs and threads */ @@ -23,8 +25,9 @@ _Thread *_threadwakeup(Rendez*); /* * daemonize - */ + * void threaddaemonize(void); + */ /* * clumsy linker hack diff --git a/include/u.h b/include/u.h index ba936960..d062a9db 100644 --- a/include/u.h +++ b/include/u.h @@ -111,6 +111,11 @@ typedef short s16int; #undef _NEEDUINT #undef _NEEDULONG +/* + * Funny-named symbols to tip off 9l to autolink. + */ +#define AUTOLIB(x) static int __p9l_autolib_ ## x = 1; + #if defined(__cplusplus) } #endif diff --git a/include/venti.h b/include/venti.h index 889f86d3..7b14c1ae 100644 --- a/include/venti.h +++ b/include/venti.h @@ -3,6 +3,9 @@ #ifdef __cplusplus extern "C" { #endif + +AUTOLIB(venti) + /* XXX should be own library? */ /* * Packets -- cgit v1.2.3