aboutsummaryrefslogtreecommitdiff
path: root/src/hyper
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-05-23 01:04:38 +0000
committerdos-reis <gdr@axiomatics.org>2008-05-23 01:04:38 +0000
commit7d85189b98ae004c095f4c1b58804f021f67880a (patch)
treec1726cb97778147af789898521f060d15eb8afa4 /src/hyper
parent66bf12078133726c7b95d9708472f2032ba458db (diff)
downloadopen-axiom-7d85189b98ae004c095f4c1b58804f021f67880a.tar.gz
Port htadd to win32
Diffstat (limited to 'src/hyper')
-rw-r--r--src/hyper/Makefile.in23
-rw-r--r--src/hyper/ex2ht.c11
-rw-r--r--src/hyper/htadd.c46
-rw-r--r--src/hyper/node.h6
4 files changed, 23 insertions, 63 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)