+Thu Apr 27 10:43:24 1995 Keith Vetter (keithv@fusion.com)
+
+ * Makefile.in: made to work on the PC.
+ * profile.hin, prof_int.h: use _MSDOS instead of _WINDOWS
+ so we can compile DOS test programs.
+ * *.c: Don't need to include file unistd.h.
+ * test_*.c: Made to work under DOS--used stubs for the com_err stuff.
+ * prof_parse.c: Turned a 2k automatic array into a malloc'ed block
+ because windows dll's shouldn't use up a lot of stack space.
+
Wed Apr 26 09:54:18 1995 Ezra Peisach <epeisach@kangaroo.mit.edu>
* profile.hin: Only define PROTOTYPE if it is undefined.
CFLAGS = $(CCOPTS) $(DEFS) $(LOCALINCLUDE)
+##DOSBUILDTOP = ..\..
+##DOSLIBNAME=profile.lib
+##DOS!include $(BUILDTOP)\config\windows.in
+
LOCALINCLUDE=-I. -I$(srcdir)/../et
-OBJS = prof_tree.o \
- prof_file.o \
- prof_parse.o \
- prof_err.o \
- prof_init.o
+OBJS = prof_tree.$(OBJEXT) \
+ prof_file.$(OBJEXT) \
+ prof_parse.$(OBJEXT) \
+ prof_err.$(OBJEXT) \
+ prof_init.$(OBJEXT)
SRCS = $(srcdir)/prof_tree.c \
$(srcdir)/prof_file.c \
prof_err.c \
$(srcdir)/prof_init.c
-LIBS = ../et/libcom_err.a
+LIBS = ../et/libcom_err.$(LIBEXT)
+
+all:: all-$(WHAT)
+
+all-max:: all-unix
+all-unix:: includes libprofile.a test_parse test_profile
-all:: includes libprofile.a test_parse test_profile
+all-windows: $(OBJS)
+
+awk-windows:
+ $(AWK) -f $(BUILDTOP)/util/et/et_h.awk outfile=prof_err.h prof_err.et
+ $(AWK) -f $(BUILDTOP)/util/et/et_c.awk outfile=prof_err.c prof_err.et
+ if exist prof_err.h copy profile.hin+prof_err.h profile.h
+ if exist profile.h copy profile.h $(BUILDTOP)\include\profile.h
libprofile.a: $(OBJS)
- $(ARADD) $@ $(OBJS)
+ $(ARCHIVE) $@ $(OBJS)
$(RANLIB) $@
-test_parse: test_parse.o $(OBJS) $(LIBS)
- $(CC) -o test_parse test_parse.o $(OBJS) $(LIBS)
+test_parse: test_parse.$(OBJEXT) $(OBJS) $(LIBS)
+ $(CC) -o test_parse test_parse.$(OBJEXT) $(OBJS) $(LIBS)
+
+test_profile: test_profile.$(OBJEXT) $(OBJS) $(LIBS)
+ $(CC) -o test_profile test_profile.$(OBJEXT) $(OBJS) $(LIBS)
-test_profile: test_profile.o $(OBJS) $(LIBS)
- $(CC) -o test_profile test_profile.o $(OBJS) $(LIBS)
+test_parse.exe:
+ $(CC) $(CFLAGS2) -o test_parse.exe test_parse.c \
+ prof_parse.c prof_tree.c /link /stack:16384
+
+test_profile.exe:
+ $(CC) $(CFLAGS2) -o test_profile.exe test_profile.c prof_init.c \
+ prof_file.c prof_parse.c prof_tree.c /link /stack:16384
profile.h: prof_err.h profile.hin
cat $(srcdir)/profile.hin prof_err.h > $@
prof_err.c: $(srcdir)/prof_err.et
-clean::
+clean:: clean-$(WHAT)
+
+clean-mac:: clean-unix
+clean-unix::
rm -f $(PROGS) *.o *~ test_parse core libprofile.a prof_err.h \
prof_err.c
+clean-windows::
+ $(RM) profile.lib profile.bak test_parse.exe test_profile.exe
+
+check:: check-$(WHAT)
+
+check-mac::
+check-unix::
+check-windows:: test_profile.exe test_parse.exe
+ $(RM) *.obj
+ test_parse test.ini
# +++ Dependency line eater +++
#
*/
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "prof_int.h"
+#ifdef _WINDOWS
+#define stat _stat
+#endif
+
errcode_t profile_open_file(filename, ret_prof)
const char *filename;
prf_file_t *ret_prof;
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
init_list(&values);
- if (profile == 0) {
- *ret_values = 0;
- return 0;
- }
-
file = profile->first_file;
retval = profile_update_file(file);
if (retval)
#include <time.h>
#include "prof_err.h"
-#if defined(__STDC__) || defined(_WINDOWS)
+#if defined(__STDC__) || defined(_MSDOS)
#define PROTOTYPE(x) x
#else
#define PROTOTYPE(x) ()
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
FILE *f;
struct profile_node **root;
{
- char buf[2048];
- int retval;
+#define BUF_SIZE 2048
+ char *bptr;
+ errcode_t retval;
struct parse_state state;
+ bptr = malloc (BUF_SIZE);
+ if (!bptr)
+ return ENOMEM;
+
retval = parse_init_state(&state);
- if (retval)
+ if (retval) {
+ free (bptr);
return retval;
+ }
while (!feof(f)) {
- if (fgets(buf, sizeof(buf), f) == NULL)
+ if (fgets(bptr, BUF_SIZE, f) == NULL)
break;
- retval = parse_line(buf, &state);
- if (retval)
+ retval = parse_line(bptr, &state);
+ if (retval) {
+ free (bptr);
return retval;
+ }
}
*root = state.root_section;
+
+ free (bptr);
return 0;
}
+#ifndef _WINDOWS
+
void dump_profile(root, level)
struct profile_node *root;
int level;
dump_profile(p, level+1);
} while (iter != 0);
}
-
+#endif /* ! _WINDOWS */
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#include <stdlib.h>
#include "prof_int.h"
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
typedef struct _profile_t *profile_t;
#if !defined(PROTOTYPE)
-#if defined(__STDC__) || defined(_WINDOWS)
+#if defined(__STDC__) || defined(_MSDOS)
#define PROTOTYPE(x) x
#else
#define PROTOTYPE(x) ()
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include "profile.h"
+
+#ifndef _MSDOS
#include "com_err.h"
+#else
+
+#include "prof_int.h"
+#define initialize_prof_error_table()
+char *error_message (long err) {
+ static char buf[50];
+
+ sprintf (buf, " 0x%lX (%ld)", err, err);
+ return buf;
+}
+#endif
int main(argc, argv)
int argc;
char **argv;
{
- struct profile_relation *root;
+ struct profile_node *root;
unsigned long retval;
FILE *f;
+ void dump_profile(struct profile_node *root, int level);
initialize_prof_error_table();
if (argc != 2) {
*/
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
#include "profile.h"
+#ifndef _MSDOS
#include "com_err.h"
+#else
+
+/* Stubs for the error handling routines */
+#include "prof_int.h"
+void initialize_prof_error_table() {}
+void com_err (char *fmt, long err, char *msg) {
+ printf (fmt, err, msg);
+}
+#endif
int main(argc, argv)
int argc;
}
free(values);
profile_release(profile);
- exit(0);
+
+ return 0;
+
}