An incomplete attempt at rationalising the non-Posix/ANSI header files, required by a fresh Zlib and Libpng implementation Notes: Wed Apr 26 10:17:51 EDT 2006 rsc Not sure I would call that a rationalization, but I certainly understand the need for it. Thanks. Reference: /n/sources/patch/applied/ape_hdrs Date: Sun Apr 23 17:06:28 CES 2006 Signed-off-by: lucio@proxima.alt.za Reviewed-by: rsc --- /sys/include/ape/fmt.h Sun Apr 23 16:44:49 2006 +++ /sys/include/ape/fmt.h Sun Apr 23 16:44:34 2006 @@ -1,11 +1,13 @@ -#ifndef _FMT_H_ -#define _FMT_H_ 1 -#pragma lib "/$M/lib/ape/libfmt.a" +#ifndef _RESEARCH_SOURCE + This header file is an extension to ANSI/POSIX +#endif + +#ifndef __FMT_H_ +#define __FMT_H_ #pragma src "/sys/src/ape/lib/fmt" +#pragma lib "/$M/lib/ape/libfmt.a" -#if defined(__cplusplus) -extern "C" { -#endif +#include /* * The authors of this software are Rob Pike and Ken Thompson. @@ -59,6 +61,10 @@ FmtFlag = FmtLDouble << 1 }; +#ifdef __cplusplus +extern "C" { +#endif + extern int print(char*, ...); extern char* seprint(char*, char*, char*, ...); extern char* vseprint(char*, char*, char*, va_list); @@ -101,7 +107,8 @@ extern void werrstr(const char*, ...); -#if defined(__cplusplus) +#ifdef __cplusplus } #endif + #endif --- /sys/include/ape/event.h Sun Apr 23 16:45:47 2006 +++ /sys/include/ape/event.h Sun Apr 23 16:45:37 2006 @@ -1,6 +1,10 @@ #ifndef _RESEARCH_SOURCE - This header file is not defined in ANSI or POSIX + This header file is an extension to ANSI/POSIX #endif +#ifndef __EVENT_H_ +#define __EVENT_H_ #include "/sys/include/event.h" + +#endif --- /sys/include/ape/qlock.h Sun Apr 23 16:46:57 2006 +++ /sys/include/ape/qlock.h Sun Apr 23 16:46:46 2006 @@ -1,10 +1,14 @@ -#ifndef __QLOCK_H_ -#define __QLOCK_H -#ifndef _QLOCK_EXTENSION +#ifndef _RESEARCH_SOURCE This header file is an extension to ANSI/POSIX #endif + +#ifndef __QLOCK_H_ +#define __QLOCK_H #pragma lib "/$M/lib/ape/lib9.a" +#include +#include + typedef struct QLp QLp; struct QLp { @@ -29,6 +33,7 @@ extern void qlock(QLock*); extern void qunlock(QLock*); extern int canqlock(QLock*); + #ifdef __cplusplus } #endif --- /sys/include/ape/lock.h Sun Apr 23 16:48:18 2006 +++ /sys/include/ape/lock.h Sun Apr 23 16:48:07 2006 @@ -1,9 +1,12 @@ +#ifndef _RESEARCH_SOURCE + This header file is an extension of ANSI/POSIX +#endif + #ifndef __LOCK_H #define __LOCK_H -#ifndef _LOCK_EXTENSION - This header file is not defined in ANSI/POSIX -#endif #pragma lib "/$M/lib/ape/libap.a" + +#include typedef struct { --- /sys/include/ape/u.h Sun Apr 23 16:49:50 2006 +++ /sys/include/ape/u.h Sun Apr 23 16:49:40 2006 @@ -1,5 +1,7 @@ +#ifndef __U_H +#define __U_H #ifndef _RESEARCH_SOURCE - This header file is not defined in ANSI or POSIX + This header file is an extension to ANSI/POSIX #endif #define nil ((void*)0) @@ -13,3 +15,5 @@ typedef ushort Rune; typedef union FPdbleword FPdbleword; typedef char* p9va_list; + +#endif --- /sys/include/ape/draw.h Sun Apr 23 16:52:05 2006 +++ /sys/include/ape/draw.h Sun Apr 23 16:51:30 2006 @@ -1,10 +1,16 @@ #ifndef _RESEARCH_SOURCE - This header file is not defined in ANSI or POSIX + This header file is an extension to ANSI/POSIX #endif +#ifndef __DRAW_H_ +#define __DRAW_H_ #pragma src "/sys/src/ape/lib/draw" #pragma lib "/$M/lib/ape/libdraw.a" +#include +#include +#include + typedef struct Cachefont Cachefont; typedef struct Cacheinfo Cacheinfo; typedef struct Cachesubf Cachesubf; @@ -142,7 +148,10 @@ RGB24 = CHAN3(CRed, 8, CGreen, 8, CBlue, 8), RGBA32 = CHAN4(CRed, 8, CGreen, 8, CBlue, 8, CAlpha, 8), ARGB32 = CHAN4(CAlpha, 8, CRed, 8, CGreen, 8, CBlue, 8), /* stupid VGAs */ - XRGB32 = CHAN4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8), + XRGB32 = CHAN4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8), + BGR24 = CHAN3(CBlue, 8, CGreen, 8, CRed, 8), + ABGR32 = CHAN4(CAlpha, 8, CBlue, 8, CGreen, 8, CRed, 8), + XBGR32 = CHAN4(CIgnore, 8, CBlue, 8, CGreen, 8, CRed, 8), }; extern char* chantostr(char*, ulong); @@ -316,6 +325,10 @@ #define Dx(r) ((r).max.x-(r).min.x) #define Dy(r) ((r).max.y-(r).min.y) +#ifdef __cplusplus +extern "C" { +#endif + /* * Image management */ @@ -519,3 +532,9 @@ extern int log2[]; extern ulong drawld2chan[]; extern void drawsetdebug(int); + +#ifdef __cplusplus +} +#endif + +#endif --- /sys/include/ape/cursor.h Sun Apr 23 16:54:20 2006 +++ /sys/include/ape/cursor.h Sun Apr 23 16:54:10 2006 @@ -1,6 +1,10 @@ #ifndef _RESEARCH_SOURCE - This header file is not defined in ANSI or POSIX + This header file is an extension to ANSI/POSIX #endif +#ifndef __CURSOR_H_ +#define __CURSOR_H_ #include "/sys/include/cursor.h" + +#endif --- /sys/include/ape/string.h Sun Apr 23 16:56:25 2006 +++ /sys/include/ape/string.h Sun Apr 23 16:56:14 2006 @@ -1,5 +1,5 @@ -#ifndef __STRING -#define __STRING +#ifndef __STRING_H_ +#define __STRING_H_ #pragma lib "/$M/lib/ape/libap.a" #include @@ -39,4 +39,4 @@ } #endif -#endif /* __STRING */ +#endif --- /sys/include/ape/bsd.h Sun Apr 23 16:58:42 2006 +++ /sys/include/ape/bsd.h Sun Apr 23 16:58:31 2006 @@ -1,11 +1,13 @@ -#ifndef __BSD_H__ -#define __BSD_H__ - #ifndef _BSD_EXTENSION This header file is an extension to ANSI/POSIX #endif -#if defined(_INC_PREREQS) && !defined(__TYPES_H) +#ifndef __BSD_H_ +#define __BSD_H_ +#pragma src "/sys/src/ape/lib/bsd" +#pragma lib "/$M/lib/ape/libbsd.a" + +#ifndef __TYPES_H #include #endif @@ -13,8 +15,6 @@ extern "C" { #endif -#pragma lib "/$M/lib/ape/libbsd.a" - #ifndef _SIZE_T #define _SIZE_T typedef unsigned long size_t; @@ -49,9 +49,8 @@ extern char *sys_errlist[]; extern int sys_nerr; - #ifdef __cplusplus } #endif -#endif /* !__BSD_H__ */ +#endif --- /sys/include/ape/mouse.h Sun Apr 23 17:01:08 2006 +++ /sys/include/ape/mouse.h Sun Apr 23 17:00:58 2006 @@ -1,5 +1,5 @@ #ifndef _RESEARCH_SOURCE - This header file is not defined in ANSI or POSIX + This header file is an extension to ANSI/POSIX #endif #include "/sys/include/mouse.h" --- /sys/include/ape/keyboard.h Sun Apr 23 17:03:49 2006 +++ /sys/include/ape/keyboard.h Sun Apr 23 17:03:38 2006 @@ -1,5 +1,5 @@ #ifndef _RESEARCH_SOURCE - This header file is not defined in ANSI or POSIX + This header file is an extension to ANSI/POSIX #endif #include "/sys/include/keyboard.h"