diff options
author | dos-reis <gdr@axiomatics.org> | 2008-05-23 01:04:38 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-05-23 01:04:38 +0000 |
commit | 7d85189b98ae004c095f4c1b58804f021f67880a (patch) | |
tree | c1726cb97778147af789898521f060d15eb8afa4 /src | |
parent | 66bf12078133726c7b95d9708472f2032ba458db (diff) | |
download | open-axiom-7d85189b98ae004c095f4c1b58804f021f67880a.tar.gz |
Port htadd to win32
Diffstat (limited to 'src')
-rw-r--r-- | src/hyper/Makefile.in | 23 | ||||
-rw-r--r-- | src/hyper/ex2ht.c | 11 | ||||
-rw-r--r-- | src/hyper/htadd.c | 46 | ||||
-rw-r--r-- | src/hyper/node.h | 6 | ||||
-rw-r--r-- | src/include/open-axiom.h | 13 | ||||
-rw-r--r-- | src/lib/Makefile.in | 11 | ||||
-rw-r--r-- | src/lib/cfuns-c.c | 30 | ||||
-rw-r--r-- | src/lib/sockio-c.c | 29 |
8 files changed, 65 insertions, 104 deletions
diff --git a/src/hyper/Makefile.in b/src/hyper/Makefile.in index 474951eb..1e9d22b1 100644 --- a/src/hyper/Makefile.in +++ b/src/hyper/Makefile.in @@ -73,27 +73,27 @@ hypertex_SOURCES = addfile.c cond.c dialog.c display.c event.c extent1.c \ libspad_la = -L$(build_libdir) -lspad -hypertex_objects = $(hypertex_SOURCES:.c=.lo) +hypertex_objects = $(hypertex_SOURCES:.c=.$(OBJEXT)) hypertex_LDADD = $(libspad_la) -L$(build_libdir) -lopen-axiom-core hypertex_DEPENDENCIES = htadd_SOURCES = addfile.c htadd.c lex.c -htadd_objects = $(htadd_SOURCES:.c=.lo) +htadd_objects = $(htadd_SOURCES:.c=.$(OBJEXT)) htadd_LDADD = $(libspad_la) -L$(build_libdir) -lopen-axiom-core htadd_DEPENDENCIES = spadbuf_SOURCES = spadbuf.c -spadbuf_objects = $(spadbuf_SOURCES:.c=.lo) +spadbuf_objects = $(spadbuf_SOURCES:.c=.$(OBJEXT)) spadbuf_LDADD = $(libspad_la) -L$(build_libdir) -lopen-axiom-core spadbuf_DEPENDENCIES = hthits_SOURCES = hthits.c -hthits_objects = $(hthits_SOURCES:.c=.lo) +hthits_objects = $(hthits_SOURCES:.c=.$(OBJEXT)) hthits_LDADD = $(libspad_la) -L$(build_libdir) -lopen-axiom-core hthits_DEPENDENCIES = ex2ht_SOURCES = ex2ht.c -ex2ht_objects = $(ex2ht_SOURCES:.c=.lo) +ex2ht_objects = $(ex2ht_SOURCES:.c=.$(OBJEXT)) ex2ht_LDADD = $(libspad_la) -L$(build_libdir) -lopen-axiom-core ex2ht_DEPENDENCIES = @@ -101,7 +101,7 @@ subdir = src/hyper/ .PHONY: all all-hyper .SUFFIXES: -.SUFFIXES: .c .o .h +.SUFFIXES: .c .$(OBJEXT) .h all: all-ax @@ -126,7 +126,7 @@ distclean-local: clean-local .PRECIOUS: %.lo %.$(OBJEXT) -%.lo: %.c $(HEADERS) +%.$(OBJEXT) %.lo: %.c $(HEADERS) $(COMPILE) -o $@ $(CFLAGS) ${CCF} $(axiom_includes) $(AXIOM_X11_CFLAGS) -I. $< ${HYPER}/pages/ht.db: $(HTADD) $(srcdir)/pages/*.ht $(srcdir)/pages/*.pht @@ -139,7 +139,7 @@ ${HYPER}/pages/ht.db: $(HTADD) $(srcdir)/pages/*.ht $(srcdir)/pages/*.pht done @ rm -f ${HYPER}/pages/ht.db ; \ rm -f ${HYPER}/pages/*~ ; AXIOM=$(AXIOM) \ - ${HTADD} -s ${HYPER}/pages/*.ht ${HYPER}/pages/*.pht + ${HTADD} -s ${HYPER}/pages/*.ht ${HYPER}/pages/*.pht || exit 1 @ cp -pr $(srcdir)/bitmaps ${HYPER} @ cp -pr $(srcdir)/viewports $(axiom_target_datadir) @@ -151,13 +151,14 @@ ${OUTLIB}/presea: presea $(INSTALL_PROGRAM) $< $@ ${OUTLIB}/ex2ht$(EXEEXT): $(ex2ht_objects) $(ex2ht_DEPENDENCIES) - ${LINK} -o $@ $(ex2ht_objects) $(ex2ht_LDADD) $(AXIOM_X11_LDFLAGS) -lm + ${LINK} -o $@ $(ex2ht_objects) $(ex2ht_LDADD) -lm $(OUTLIB)/htadd$(EXEEXT): $(htadd_objects) $(htadd_DEPENDENCIES) - ${LINK} -o $@ $(htadd_objects) $(htadd_LDADD) $(AXIOM_X11_LDFLAGS) -lm + ${LINK} -o $@ $(htadd_objects) $(htadd_LDADD) \ + @axiom_c_runtime_extra@ -lm ${OUTLIB}/hthits$(EXEEXT): $(hthits_objects) $(hthits_DEPENDENCIES) - ${LINK} -o $@ $(hthits_objects) $(hthits_LDADD) $(AXIOM_X11_LDFLAGS) -lm + ${LINK} -o $@ $(hthits_objects) $(hthits_LDADD) -lm $(OUTLIB)/hypertex$(EXEEXT): $(hypertex_objects) $(hypertex_DEPENDENCIES) diff --git a/src/hyper/ex2ht.c b/src/hyper/ex2ht.c index 994ad277..b88d42ec 100644 --- a/src/hyper/ex2ht.c +++ b/src/hyper/ex2ht.c @@ -49,13 +49,6 @@ #include "cfuns.h" - -#if defined(SUN4OS5platform)||defined(SGIplatform) -/* can't find a prototype anywhere */ -extern int utimes(const char *, const struct timeval [2]); -#endif - - #define MaxLineLength 512 #define MaxFiles 100 @@ -94,9 +87,7 @@ static void closeCoverFile(void) { fclose(coverFile); -#ifdef HP9platform - times("coverex.ht",latest_date); -#else +#ifndef __MINGW32__ /* FIXME! */ utimes("coverex.ht",latest_date); #endif } diff --git a/src/hyper/htadd.c b/src/hyper/htadd.c index eb6103bb..c08ced6f 100644 --- a/src/hyper/htadd.c +++ b/src/hyper/htadd.c @@ -42,9 +42,7 @@ #include <errno.h> #include <setjmp.h> #include <stdlib.h> -#ifndef __MINGW32__ -# include <sys/stat.h> -#endif +#include <sys/stat.h> #include "cfuns.h" #include "hash.h" @@ -62,7 +60,6 @@ static int delete_file(char*, char*); static void get_filename(void); static void parse_args(char**, char*, char**, short*); static void update_db(FILE*, FILE*, FILE*, char*, char*, int); -static int writable(struct stat); @@ -171,27 +168,6 @@ parse_args(char **argv, char *db_dir, char **filenames, short *fl) -static int -writable(struct stat buff) -{ -#ifdef DEBUG - unsigned short uid = geteuid(), gid = getegid(); - - fprintf(stderr, "Uid = %d and Gid = %d\n", uid, gid); -#endif - - /* - * Checks the status structure sent against the user id, and goup id - */ - if ((buff.st_uid == geteuid()) && (buff.st_mode & S_IWUSR)) - return 1; - else if ((buff.st_gid == getegid()) && (buff.st_mode & S_IWGRP)) - return 1; - else if ((buff.st_mode & S_IWOTH)) - return 1; - return 0; -} - /* check to see if the user has permission */ /* @@ -204,7 +180,6 @@ static int build_db_filename(short flag, char *db_dir, char *dbfilename) { int ret_status; - struct stat buff; char *SPAD; char path[256]; @@ -229,22 +204,13 @@ build_db_filename(short flag, char *db_dir, char *dbfilename) } /* fprintf(stderr,"htadd:build_db_filename:dbfilename=%s\n",dbfilename);*/ /* Now see if I can write to the file */ - ret_status = stat(dbfilename, &buff); + ret_status = writeablep (dbfilename); if (ret_status == -1) { - if (errno == ENOENT) { - /* If the file does not exist, then check it's path */ - ret_status = stat(path, &buff); - } - if (ret_status == -1) { - perror("build_db_file"); - exit(-1); - } + perror("build_db_file"); + exit(-1); } - - /* check the status */ - - if (writable(buff)) - return 1; + else if (ret_status > 0) + return 1; fprintf(stderr, "build_db_filename: Database file name is not writable\n"); exit(-1); diff --git a/src/hyper/node.h b/src/hyper/node.h index 7cd6b31e..730ea30f 100644 --- a/src/hyper/node.h +++ b/src/hyper/node.h @@ -47,6 +47,7 @@ typedef Window openaxiom_window; typedef Pixmap openaxiom_pixmap; typedef XImage openaxiom_image; typedef GC openaxiom_graphic_context; +typedef XFontStruct openaxiom_font; typedef Cursor openaxiom_cursor; #else /* X_DISPLAY_MISSING */ typedef HANDLE openaxiom_window; @@ -54,6 +55,7 @@ typedef HANDLE openaxiom_pixmap; typedef HANDLE openaxiom_image; typedef HANDLE openaxiom_graphic_context; typedef HANDLE openaxiom_cursor; +typedef HANDLE openaxiom_font; #endif /* X_DISPLAY_MISSING */ /* Struct forward declarations */ @@ -353,7 +355,7 @@ typedef struct LinkHashID { typedef struct GroupItem { int cur_color; - XFontStruct *cur_font; + openaxiom_font *cur_font; int center; struct GroupItem *next; } GroupItem; @@ -433,7 +435,7 @@ typedef struct parameter_list_type { #define need_help_button (gWindow->page->helppage != NULL) -#define max(x,y) ((x) > (y) ? (x) : (y)) +#define openaxiom_max(x,y) ((x) > (y) ? (x) : (y)) #define pick_box(box) fill_box(box->win, box->selected) diff --git a/src/include/open-axiom.h b/src/include/open-axiom.h index 2c0335f0..e2c545a7 100644 --- a/src/include/open-axiom.h +++ b/src/include/open-axiom.h @@ -36,14 +36,15 @@ /* Cope with MS-platform oddities. */ #ifdef __MINGW32__ -# ifdef OPENAXIOM_BUILD_DLL +# ifdef DLL_EXPORT # define OPENAXIOM_EXPORT __declspec(dllexport) -# else +# elif defined(OPENAXIOM_DLL_IMPORT) # define OPENAXIOM_EXPORT __declspec(dllimport) -# endif /* OPENAXIOM_BUILD_DLL */ -#else -# define OPENAXIOM_EXPORT /* nothing */ -#endif /* __MINGW32__ */ +# endif /* DLL_EXPORT */ +#endif /* __MINGW32__ */ +#ifndef OPENAXIOM_EXPORT +# define OPENAXIOM_EXPORT /* nothing */ +#endif /* OPENAXIOM_EXPORT */ #if defined(HAVE_STDINT_H) # include <stdint.h> diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 3ac1a3f1..233bf6cf 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -36,8 +36,6 @@ core_SOURCES = bsdsignal.c cfuns-c.c sockio-c.c terminal_io_SOURCES = cursor.c edin.c fnct_key.c openpty.c prt.c wct.c graphics_SOURCES = \ - halloc.c \ - hash.c \ pixmap.c \ spadcolors.c \ util.c \ @@ -47,7 +45,8 @@ graphics_SOURCES = \ libspad_SOURCES = $(foreach comp, \ $(addsuffix _SOURCES, @axiom_c_runtime@), \ - $($(comp))) + $($(comp))) \ + halloc.c hash.c unused_SOURCES = emupty.c @@ -81,16 +80,16 @@ $(axiom_target_libdir)/libopen-axiom-core$(SHREXT): \ @axiom_c_runtime_extra@ -lm libopen-axiom-core.$(LIBEXT): $(libopen_axiom_core_SOURCES:.c=.lo) - $(LIBTOOL) --mode=link $(CC) -o $@ \ + $(LIBTOOL) --mode=link $(CC) -static -o $@ \ $(libopen_axiom_core_SOURCES:.c=.lo) libspad.$(LIBEXT): $(libspad_objects) - $(LIBTOOL) --mode=link $(CC) -o $@ $(libspad_objects) + $(LIBTOOL) --mode=link $(CC) -static -o $@ $(libspad_objects) .PRECIOUS: %.$(OBJEXT) %.$(OBJEXT) %.lo: %.c $(axiom_c_macros_h) - $(COMPILE) $(oa_shrobj_flags) -o $@ $(CCF) -DOPENAXIOM_BUILD_DLL \ + $(COMPILE) $(oa_shrobj_flags) -no-suppress -o $@ $(CCF) \ $(axiom_includes) $(AXIOM_X11_CFLAGS) $< # This is a support library, so it does not change often and diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c index 2620be00..fe5380e8 100644 --- a/src/lib/cfuns-c.c +++ b/src/lib/cfuns-c.c @@ -540,3 +540,33 @@ oa_get_tmpdir(void) return "/tmp"; #endif } + + + +OPENAXIOM_EXPORT double +plus_infinity(void ) +{ +#ifdef INFINITY + return INFINITY; +#else + /* This must be a curious platform. */ + volatile double zero = 0.0; + return 1.0 / zero; /* If it traps, well, it traps. */ +#endif +} + +OPENAXIOM_EXPORT double +minus_infinity(void) +{ + return -plus_infinity(); +} + +OPENAXIOM_EXPORT double +NANQ(void) +{ +#ifdef NAN + return NAN; +#else + return sqrt(-1.0); /* Juts pick one. */ +#endif +} diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c index baab6445..d1df2bea 100644 --- a/src/lib/sockio-c.c +++ b/src/lib/sockio-c.c @@ -1174,32 +1174,3 @@ print_line(const char* s) { printf("%s\n", s); } - - -OPENAXIOM_EXPORT double -plus_infinity(void ) -{ -#ifdef INFINITY - return INFINITY; -#else - /* This must be a curious platform. */ - volatile double zero = 0.0; - return 1.0 / zero; /* If it traps, well, it traps. */ -#endif -} - -OPENAXIOM_EXPORT double -minus_infinity(void) -{ - return -plus_infinity(); -} - -OPENAXIOM_EXPORT double -NANQ(void) -{ -#ifdef NAN - return NAN; -#else - return sqrt(-1.0); /* Juts pick one. */ -#endif -} |