[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] viewman and hyper on Mac OS X
From: |
Waldek Hebisch |
Subject: |
Re: [Axiom-developer] viewman and hyper on Mac OS X |
Date: |
Sat, 4 Nov 2006 21:02:22 +0100 (CET) |
Humberto Ortiz-Zuazaga wrote:
> and viewman now compiles. Next problem is hyper, the Mac doesn't have
> regexp.h:
>
> Hyper still fails to build:
>
> 13 making /Users/humberto/src/axiom-darcs/src/hyper
> gcc -O2 -fno-strength-reduce -Wall -D_GNU_SOURCE -DMACOSXplatform
> -I/usr/include -I/usr/include/sys
> -I/Users/humberto/src/axiom-darcs/src/include -I. -I/usr/X11R6/include
> -c -o hthits.o hthits.c
> hthits.c: In function 'main':
> hthits.c:121: warning: implicit declaration of function 'compile'
The patch below converts hthits to use 'regexp.h'. The <sys/types.h>
include is correct on Linux, but may need adjustment on Mac.
diff -u build-improvements.pp/src/hyper/hthits.pamphlet
build-improvements/src/hyper/hthits.pamphlet
--- build-improvements.pp/src/hyper/hthits.pamphlet 2006-11-02
18:27:40.000000000 +0100
+++ build-improvements/src/hyper/hthits.pamphlet 2006-11-04
21:44:43.926067992 +0100
@@ -53,25 +53,8 @@
#include "hthits.H1"
-
-
-/*
- * Things for the regular expression scanning.
- */
-char expbuf[MAX_COMP_REGEX];
-
-#define INIT register char *sp = instring;
-#define GETC() (*sp++)
-#define PEEKC() (*sp)
-#define UNGETC(c) (--sp)
-#define RETURN(c) return(c);
-#define ERROR(c) regerr(c);
-
-#if defined(RIOSplatform) && !defined(_AIX41) && defined(_XOPEN_SOURCE)
-/* AIX3 regexp.h includes NLregexp which we don't want */
-#undef _XOPEN_SOURCE
-#endif
-# include <regexp.h>
+#include <sys/types.h>
+#include <regex.h>
/*
* Global variables set according to the command line.
@@ -81,6 +64,7 @@
char *pattern;
char *htdbFName;
int gverifydates=0;
+regex_t reg_pattern;
int
#ifdef _NO_PROTO
@@ -93,7 +77,7 @@
{
cmdline(argc, argv);
- compile(pattern, expbuf, expbuf + MAX_COMP_REGEX, '\0');
+ regcomp(®_pattern, pattern, REG_NEWLINE);
handleHtdb();
return(0);
@@ -335,13 +319,17 @@
#endif
{
char *bodyrest;
+ regmatch_t match_pos;
int nhits = 0;
- if (step(pgtitle, expbuf))
+ if (!regexec(®_pattern, pgtitle, 1, &match_pos, 0))
nhits++;
- for (bodyrest = pgbody; step(bodyrest, expbuf); bodyrest = loc2)
+ for (bodyrest = pgbody;
+ !regexec(®_pattern, bodyrest, 1, &match_pos, 0);) {
nhits++;
+ bodyrest += match_pos.rm_eo;
+ }
if (nhits) {
printf("\\newsearchresultentry{%d}{%s}",nhits, pgtitle);
squirt(pgname, strlen(pgname));
--
Waldek Hebisch
address@hidden