pcs 97/09/12 00:28:52
Modified: src/os/unix Makefile.tmpl os.c os.h
Added: src/os/unix os-inline.c
Log:
Add capability to OS abstract on Unix systems, with either functions,
inlines or macros. All code in os.c, os.h and os-inline.c is available
to all Apache source files. Only GCC is known to support inline at this
stage.
Revision Changes Path
1.5 +4 -4 apachen/src/os/unix/Makefile.tmpl
Index: Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/os/unix/Makefile.tmpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.tmpl 1997/09/10 20:05:39 1.4
+++ Makefile.tmpl 1997/09/12 07:28:49 1.5
@@ -4,11 +4,13 @@
LFLAGS=$(LFLAGS1) $(EXTRA_LFLAGS)
INCDIR=../../main
-OBJS= os.o
+OBJS= os.o os-inline.o
LIB= libos.a
-all: $(LIB)
+all: $(LIB)
+ cp os.h ../../main
+ cp os-inline.c ../../main
$(LIB): $(OBJS)
rm -f $@
@@ -20,8 +22,6 @@
clean:
rm -f $(OBJS)
-
-$(OBJS): Makefile
# DO NOT REMOVE
os.o: os.c
1.3 +6 -1 apachen/src/os/unix/os.c
Index: os.c
===================================================================
RCS file: /export/home/cvs/apachen/src/os/unix/os.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- os.c 1997/09/03 16:11:33 1.2
+++ os.c 1997/09/12 07:28:50 1.3
@@ -1 +1,6 @@
-char AP_OPERATING_SYSTEM[] = "UNIX";
+/*
+ * This file will include OS specific functions which are not inlineable.
+ * Any inlineable functions should be defined in os-inline.c instead.
+ */
+
+#include "os.h"
1.2 +20 -0 apachen/src/os/unix/os.h
Index: os.h
===================================================================
RCS file: /export/home/cvs/apachen/src/os/unix/os.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- os.h 1997/08/10 13:33:19 1.1
+++ os.h 1997/09/12 07:28:50 1.2
@@ -0,0 +1,20 @@
+/*
+ * This file in included in all Apache source code. It contains definitions
+ * of facilities available on _this_ operating system (HAVE_* macros),
+ * and prototypes of OS specific functions defined in os.c or os-inline.c
+ */
+
+#if defined(__GNUC__) && !defined(INLINE)
+/* Compiler supports inline, so include the inlineable functions as
+ * part of the header
+ */
+#define INLINE extern inline
+#include "os-inline.c"
+#endif
+
+#ifndef INLINE
+/* Compiler does not support inline, so prototype the inlineable functions
+ * as normal
+ */
+extern int os_is_path_absolute(char *f);
+#endif
1.1 apachen/src/os/unix/os-inline.c
Index: os-inline.c
===================================================================
/*
* This file contains functions which can be inlined if the compiler
* has an "inline" modifier. Because of this, this file is both a
* header file and a compilable module.
*
* Only inlineable functions should be defined in here. They must all
* include the INLINE modifier.
*
* If the compiler supports inline, this file will be #included as a
* header file from os.h to create all the inline function
* definitions. INLINE will be defined to whatever is required on
* function definitions to make them inline declarations.
*
* If the compiler does not support inline, this file will be compiled
* as a normal C file into libos.a (along with os.c). In this case
* INLINE will _not_ be set so we can use this to test if we are
* compiling this source file.
*/
#ifndef INLINE
#define INLINE
/* Anything required only when compiling */
#endif
INLINE int os_is_path_absolute(char *file)
{
return (file && file[0] == '/' ? 1 : 0);
}