diff -Nrub clearsilver-0.10.1/aclocal.m4 clearsilver-0.10.2/aclocal.m4 --- clearsilver-0.10.1/aclocal.m4 1969-12-31 16:00:00.000000000 -0800 +++ clearsilver-0.10.2/aclocal.m4 2005-12-14 16:26:05.000000000 -0800 @@ -0,0 +1,111 @@ +# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +dnl @synopsis AC_JNI_INCLUDE_DIR +dnl +dnl AC_JNI_INCLUDE_DIR finds include directories needed +dnl for compiling programs using the JNI interface. +dnl +dnl JNI include directories are usually in the java distribution +dnl This is deduced from the value of JAVAC. When this macro +dnl completes, a list of directories is left in the variable +dnl JNI_INCLUDE_DIRS. +dnl +dnl Example usage follows: +dnl +dnl AC_JNI_INCLUDE_DIR +dnl +dnl for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS +dnl do +dnl CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" +dnl done +dnl +dnl If you want to force a specific compiler: +dnl +dnl - at the configure.in level, set JAVAC=yourcompiler before calling +dnl AC_JNI_INCLUDE_DIR +dnl +dnl - at the configure level, setenv JAVAC +dnl +dnl Note: This macro can work with the autoconf M4 macros for Java programs. +dnl This particular macro is not part of the original set of macros. +dnl +dnl @author Don Anderson +dnl @version $Id: ac_jni_include_dirs.m4,v 1.3 2004/12/24 01:16:37 guidod Exp $ +dnl +AC_DEFUN([AC_JNI_INCLUDE_DIR],[ + +JNI_INCLUDE_DIRS="" + +test "x$JAVAC" = x && AC_MSG_ERROR(['$JAVAC' undefined]) +AC_PATH_PROG(_ACJNI_JAVAC, $JAVAC, no) +test "x$_ACJNI_JAVAC" = xno && AC_MSG_ERROR([$JAVAC could not be found in path]) + +_ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") +_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` +case "$host_os" in + darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + _JINC="$_JTOPDIR/Headers";; + *) _JINC="$_JTOPDIR/include";; +esac +if test -f "$_JINC/jni.h"; then + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC" +else + _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + if test -f "$_JTOPDIR/include/jni.h"; then + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include" + else + AC_MSG_ERROR([cannot find java include files]) + fi +fi + +# get the likely subdirectories for system specific java includes +case "$host_os" in +bsdi*) _JNI_INC_SUBDIRS="bsdos";; +linux*) _JNI_INC_SUBDIRS="linux genunix";; +osf*) _JNI_INC_SUBDIRS="alpha";; +solaris*) _JNI_INC_SUBDIRS="solaris";; +mingw*) _JNI_INC_SUBDIRS="win32";; +cygwin*) _JNI_INC_SUBDIRS="win32";; +*) _JNI_INC_SUBDIRS="genunix";; +esac + +# add any subdirectories that are present +for JINCSUBDIR in $_JNI_INC_SUBDIRS +do + if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" + fi +done +]) + +# _ACJNI_FOLLOW_SYMLINKS +# Follows symbolic links on , +# finally setting variable _ACJNI_FOLLOWED +# -------------------- +AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[ +# find the include directory relative to the javac executable +_cur="$1" +while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do + AC_MSG_CHECKING(symlink for $_cur) + _slink=`ls -ld "$_cur" | sed 's/.* -> //'` + case "$_slink" in + /*) _cur="$_slink";; + # 'X' avoids triggering unwanted echo options. + *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; + esac + AC_MSG_RESULT($_cur) +done +_ACJNI_FOLLOWED="$_cur" +])# _ACJNI + diff -Nrub clearsilver-0.10.1/autogen.sh clearsilver-0.10.2/autogen.sh --- clearsilver-0.10.1/autogen.sh 2005-06-30 11:51:48.000000000 -0700 +++ clearsilver-0.10.2/autogen.sh 2005-11-16 19:54:43.000000000 -0800 @@ -5,7 +5,7 @@ test -z "$srcdir" && srcdir=. -# aclocal -I /usr/share/glade/gnome +aclocal -I m4 autoheader autoconf ./configure $* diff -Nrub clearsilver-0.10.1/cgi/cgi.c clearsilver-0.10.2/cgi/cgi.c --- clearsilver-0.10.1/cgi/cgi.c 2005-06-30 18:14:36.000000000 -0700 +++ clearsilver-0.10.2/cgi/cgi.c 2005-12-02 01:34:04.000000000 -0800 @@ -234,11 +234,12 @@ return STATUS_OK; } -unsigned char *cgi_url_unescape (unsigned char *s) +char *cgi_url_unescape (char *value) { int i = 0, o = 0; + unsigned char *s = (unsigned char *)value; - if (s == NULL) return s; + if (s == NULL) return value; while (s[i]) { if (s[i] == '+') @@ -260,13 +261,14 @@ } } if (i && o) s[o] = '\0'; - return s; + return (char *)s; } -NEOERR *cgi_js_escape (const unsigned char *buf, unsigned char **esc) +NEOERR *cgi_js_escape (const char *in, char **esc) { int nl = 0; int l = 0; + unsigned char *buf = (unsigned char *)in; unsigned char *s; while (buf[l]) @@ -280,7 +282,7 @@ l++; } - s = (char *) malloc (sizeof(char) * (nl + 1)); + s = (unsigned char *) malloc (sizeof(unsigned char) * (nl + 1)); if (s == NULL) return nerr_raise (NERR_NOMEM, "Unable to allocate memory to escape %s", buf); @@ -304,34 +306,55 @@ } s[nl] = '\0'; - *esc = s; + *esc = (char *)s; return STATUS_OK; } -NEOERR *cgi_url_escape_more (const unsigned char *buf, unsigned char **esc, - const unsigned char *other) +// List of all characters that must be escaped +// List based on http://www.blooberry.com/indexdot/html/topics/urlencoding.htm +static char EscapedChars[] = "$&+,/:;=?@ \"<>#%{}|\\^~[]`"; + +// Check if a single character needs to be escaped +static BOOL is_reserved_char(char c) +{ + int i = 0; + + if (c < 32 || c > 122) { + return TRUE; + } else { + while (EscapedChars[i]) { + if (c == EscapedChars[i]) { + return TRUE; + } + ++i; + } + } + return FALSE; +} + +NEOERR *cgi_url_escape_more (const char *in, char **esc, + const char *other) { int nl = 0; int l = 0; int x = 0; + unsigned char *buf = (unsigned char *)in; + unsigned char *uother = (unsigned char *)other; unsigned char *s; int match = 0; while (buf[l]) { - if (buf[l] == '/' || buf[l] == '+' || buf[l] == '=' || buf[l] == '&' || - buf[l] == '"' || buf[l] == '%' || buf[l] == '?' || buf[l] == '#' || - buf[l] == '<' || buf[l] == '>' || buf[l] == '\'' || - buf[l] < 32 || buf[l] > 122) + if (is_reserved_char(buf[l])) { nl += 2; } - else if (other) + else if (uother) { x = 0; - while (other[x]) + while (uother[x]) { - if (other[x] == buf[l]) + if (uother[x] == buf[l]) { nl +=2; break; @@ -359,19 +382,16 @@ } else { - if (buf[l] == '/' || buf[l] == '+' || buf[l] == '=' || buf[l] == '&' || - buf[l] == '"' || buf[l] == '%' || buf[l] == '?' || buf[l] == '#' || - buf[l] == '<' || buf[l] == '>' || buf[l] == '\'' || - buf[l] < 32 || buf[l] > 122) + if (is_reserved_char(buf[l])) { match = 1; } - else if (other) + else if (uother) { x = 0; - while (other[x]) + while (uother[x]) { - if (other[x] == buf[l]) + if (uother[x] == buf[l]) { match = 1; break; @@ -394,11 +414,11 @@ } s[nl] = '\0'; - *esc = s; + *esc = (char *)s; return STATUS_OK; } -NEOERR *cgi_url_escape (const unsigned char *buf, unsigned char **esc) +NEOERR *cgi_url_escape (const char *buf, char **esc) { return nerr_pass(cgi_url_escape_more(buf, esc, NULL)); } @@ -999,7 +1019,7 @@ stream.next_in = (Bytef*)str->buf; stream.avail_in = (uInt)str->len; - stream.next_out = obuf; + stream.next_out = (Bytef*)obuf; stream.avail_out = (uInt)*olen; if ((uLong)stream.avail_out != *olen) return nerr_raise(NERR_NOMEM, "Destination too big: %ld", *olen); @@ -1057,7 +1077,7 @@ int ws = 0; int seen_nonws = level > 1; int i, o, l; - unsigned char *ch; + char *ch; i = o = 0; if (str->len) { @@ -1309,7 +1329,7 @@ if (use_gzip) { crc = crc32(0L, Z_NULL, 0); - crc = crc32(crc, str->buf, str->len); + crc = crc32(crc, (const Bytef *)(str->buf), str->len); } len2 = str->len * 2; dest = (char *) malloc (sizeof(char) * len2); @@ -1372,17 +1392,17 @@ return nerr_pass(err); } -NEOERR *cgi_html_escape_strfunc(const unsigned char *str, unsigned char **ret) +NEOERR *cgi_html_escape_strfunc(const char *str, char **ret) { return nerr_pass(html_escape_alloc(str, strlen(str), ret)); } -NEOERR *cgi_html_strip_strfunc(const unsigned char *str, unsigned char **ret) +NEOERR *cgi_html_strip_strfunc(const char *str, char **ret) { return nerr_pass(html_strip_alloc(str, strlen(str), ret)); } -NEOERR *cgi_text_html_strfunc(const unsigned char *str, unsigned char **ret) +NEOERR *cgi_text_html_strfunc(const char *str, char **ret) { return nerr_pass(convert_text_html_alloc(str, strlen(str), ret)); } diff -Nrub clearsilver-0.10.1/cgi/cgi.h clearsilver-0.10.2/cgi/cgi.h --- clearsilver-0.10.1/cgi/cgi.h 2005-06-30 18:11:42.000000000 -0700 +++ clearsilver-0.10.2/cgi/cgi.h 2005-11-30 19:57:32.000000000 -0800 @@ -311,7 +311,7 @@ * Output: esc - a newly allocated string * Return: NERR_NOMEM - no memory available to allocate the escaped string */ -NEOERR *cgi_url_escape (const unsigned char *buf, unsigned char **esc); +NEOERR *cgi_url_escape (const char *buf, char **esc); /* * Function: cgi_url_escape_more - url escape a string @@ -325,8 +325,7 @@ * Output: esc - a newly allocated string * Return: NERR_NOMEM - no memory available to allocate the escaped string */ -NEOERR *cgi_url_escape_more (const unsigned char *buf, unsigned char **esc, - const unsigned char *other); +NEOERR *cgi_url_escape_more (const char *buf, char **esc, const char *other); /* * Function: cgi_url_unescape - unescape an url encoded string @@ -337,7 +336,7 @@ * Input: buf - a 0 terminated string * Return: pointer to same buf */ -unsigned char *cgi_url_unescape (unsigned char *buf); +char *cgi_url_unescape (char *buf); /* * Function: cgi_redirect - send an HTTP 302 redirect response @@ -452,10 +451,10 @@ const char *path); /* not documented *yet* */ -NEOERR *cgi_text_html_strfunc(const unsigned char *str, unsigned char **ret); -NEOERR *cgi_html_strip_strfunc(const unsigned char *str, unsigned char **ret); -NEOERR *cgi_html_escape_strfunc(const unsigned char *str, unsigned char **ret); -NEOERR *cgi_js_escape (const unsigned char *buf, unsigned char **esc); +NEOERR *cgi_text_html_strfunc(const char *str, char **ret); +NEOERR *cgi_html_strip_strfunc(const char *str, char **ret); +NEOERR *cgi_html_escape_strfunc(const char *str, char **ret); +NEOERR *cgi_js_escape (const char *buf, char **esc); void cgi_html_ws_strip(STRING *str, int level); NEOERR *cgi_register_strfuncs(CSPARSE *cs); diff -Nrub clearsilver-0.10.1/cgi/html.c clearsilver-0.10.2/cgi/html.c --- clearsilver-0.10.1/cgi/html.c 2005-06-30 18:18:13.000000000 -0700 +++ clearsilver-0.10.2/cgi/html.c 2005-11-30 20:03:09.000000000 -0800 @@ -22,7 +22,7 @@ #include "html.h" #include "cgi.h" -static int has_space_formatting(const unsigned char *src, int slen) +static int has_space_formatting(const char *src, int slen) { int spaces = 0; int returns = 0; @@ -100,7 +100,7 @@ static char *EmailRe = "[^][@:;<>\\\"()[:space:][:cntrl:]]+@[-+a-zA-Z0-9]+\\.[-+a-zA-Z0-9\\.]+[-+a-zA-Z0-9]"; static char *URLRe = "((http|https|ftp|mailto):(//)?[^[:space:]>\"\t]*|www\\.[-a-z0-9\\.]+)[^[:space:];\t\">]*"; -static NEOERR *split_and_convert (const unsigned char *src, int slen, +static NEOERR *split_and_convert (const char *src, int slen, STRING *out, HTML_CONVERT_OPTS *opts) { NEOERR *err = STATUS_OK; @@ -108,7 +108,8 @@ static regex_t email_re, url_re; regmatch_t email_match, url_match; int errcode; - unsigned char buf[256], *ptr, *esc; + char *ptr, *esc; + char errbuf[256]; struct _parts *parts; int part_count; int part; @@ -119,13 +120,13 @@ { if ((errcode = regcomp (&email_re, EmailRe, REG_ICASE | REG_EXTENDED))) { - regerror (errcode, &email_re, buf, sizeof(buf)); - return nerr_raise (NERR_PARSE, "Unable to compile EmailRE: %s", buf); + regerror (errcode, &email_re, errbuf, sizeof(errbuf)); + return nerr_raise (NERR_PARSE, "Unable to compile EmailRE: %s", errbuf); } if ((errcode = regcomp (&url_re, URLRe, REG_ICASE | REG_EXTENDED))) { - regerror (errcode, &url_re, buf, sizeof(buf)); - return nerr_raise (NERR_PARSE, "Unable to compile URLRe: %s", buf); + regerror (errcode, &url_re, errbuf, sizeof(errbuf)); + return nerr_raise (NERR_PARSE, "Unable to compile URLRe: %s", errbuf); } compiled = 1; } @@ -360,7 +361,7 @@ spaces = 0; if (parts[i].type == SC_TYPE_URL) { - unsigned char last_char = src[parts[i].end-1]; + char last_char = src[parts[i].end-1]; int suffix=0; if (last_char == '.' || last_char == ',') { suffix=1; } err = string_append (out, " bounce_url) { - unsigned char *url, *esc_url, *new_url; + char *url, *esc_url, *new_url; int url_len; if (!strncasecmp(src + x, "www.", 4)) { @@ -438,10 +439,10 @@ err = string_append (out, "\">"); if (err != STATUS_OK) break; if (opts->link_name) { - err = html_escape_alloc(opts->link_name, strlen(opts->link_name), - &esc); + err = html_escape_alloc((opts->link_name), + strlen(opts->link_name), &esc); } else { - err = html_escape_alloc(src + x, parts[i].end - x - suffix, &esc); + err = html_escape_alloc((src + x), parts[i].end - x - suffix, &esc); } if (err != STATUS_OK) break; err = string_append (out, esc); @@ -488,7 +489,7 @@ { int x = 0; int ol = str->len; - unsigned char *ptr; + char *ptr; int i; while (x < str->len) @@ -508,7 +509,7 @@ } else { - x = i = ptr - (unsigned char *) str->buf; + x = i = ptr - str->buf; if (x) { x--; @@ -524,14 +525,14 @@ } } -NEOERR *convert_text_html_alloc (const unsigned char *src, int slen, - unsigned char **out) +NEOERR *convert_text_html_alloc (const char *src, int slen, + char **out) { return nerr_pass(convert_text_html_alloc_options(src, slen, out, NULL)); } -NEOERR *convert_text_html_alloc_options (const unsigned char *src, int slen, - unsigned char **out, +NEOERR *convert_text_html_alloc_options (const char *src, int slen, + char **out, HTML_CONVERT_OPTS *opts) { NEOERR *err; @@ -598,13 +599,13 @@ return STATUS_OK; } -NEOERR *html_escape_alloc (const unsigned char *src, int slen, - unsigned char **out) +NEOERR *html_escape_alloc (const char *src, int slen, + char **out) { NEOERR *err = STATUS_OK; STRING out_s; int x; - unsigned char *ptr; + char *ptr; string_init(&out_s); err = string_append (&out_s, ""); @@ -649,15 +650,15 @@ } /* Replace ampersand with iso-8859-1 character code */ -static unsigned char _expand_amp_8859_1_char (const unsigned char *s) +static unsigned char _expand_amp_8859_1_char (const char *s) { if (s[0] == '\0') return 0; switch (s[0]) { case '#': - if (s[1] == 'x') return strtol (&s[2], NULL, 16); - return strtol (&s[1], NULL, 10); + if (s[1] == 'x') return strtol (s+2, NULL, 16); + return strtol (s+1, NULL, 10); case 'a': if (!strcmp(s, "agrave")) return 0xe0; /* à */ if (!strcmp(s, "aacute")) return 0xe1; /* á */ @@ -724,8 +725,8 @@ return 0; } -unsigned char *html_expand_amp_8859_1(const unsigned char *amp, - unsigned char *buf) +char *html_expand_amp_8859_1(const char *amp, + char *buf) { unsigned char ch; @@ -736,23 +737,23 @@ return ""; } else { - buf[0] = ch; + buf[0] = (char)ch; buf[1] = '\0'; return buf; } } -NEOERR *html_strip_alloc(const unsigned char *src, int slen, - unsigned char **out) +NEOERR *html_strip_alloc(const char *src, int slen, + char **out) { NEOERR *err = STATUS_OK; STRING out_s; int x = 0; int strip_match = -1; int state = 0; - unsigned char amp[10]; + char amp[10]; int amp_start = 0; - unsigned char buf[10]; + char buf[10]; int ampl = 0; string_init(&out_s); diff -Nrub clearsilver-0.10.1/cgi/html.h clearsilver-0.10.2/cgi/html.h --- clearsilver-0.10.1/cgi/html.h 2005-06-30 18:16:42.000000000 -0700 +++ clearsilver-0.10.2/cgi/html.h 2005-12-01 17:13:25.000000000 -0800 @@ -19,27 +19,24 @@ __BEGIN_DECLS typedef struct _text_html_opts { - char *bounce_url; - char *url_class; - char *url_target; - char *mailto_class; + const char *bounce_url; + const char *url_class; + const char *url_target; + const char *mailto_class; int long_lines; int space_convert; int newlines_convert; int longline_width; int check_ascii_art; - char *link_name; + const char *link_name; } HTML_CONVERT_OPTS; -NEOERR *convert_text_html_alloc (const unsigned char *src, int slen, - unsigned char **out); -NEOERR *convert_text_html_alloc_options (const unsigned char *src, int slen, - unsigned char **out, +NEOERR *convert_text_html_alloc (const char *src, int slen, char **out); +NEOERR *convert_text_html_alloc_options (const char *src, int slen, + char **out, HTML_CONVERT_OPTS *opts); -NEOERR *html_escape_alloc (const unsigned char *src, int slen, - unsigned char **out); -NEOERR *html_strip_alloc(const unsigned char *src, int slen, - unsigned char **out); +NEOERR *html_escape_alloc (const char *src, int slen, char **out); +NEOERR *html_strip_alloc(const char *src, int slen, char **out); __END_DECLS diff -Nrub clearsilver-0.10.1/cgi/Makefile clearsilver-0.10.2/cgi/Makefile --- clearsilver-0.10.1/cgi/Makefile 2005-06-30 11:51:48.000000000 -0700 +++ clearsilver-0.10.2/cgi/Makefile 2005-12-02 02:34:24.000000000 -0800 @@ -1,10 +1,10 @@ ifeq ($(NEOTONIC_ROOT),) -NEOTONIC_ROOT = ../ +NEOTONIC_ROOT = .. endif -include $(NEOTONIC_ROOT)rules.mk +include $(NEOTONIC_ROOT)/rules.mk CGI_LIB = $(LIB_DIR)libneo_cgi.a CGI_SRC = cgiwrap.c cgi.c html.c date.c rfc2388.c @@ -32,7 +32,7 @@ $(LDSHARED) -o $@ $(STATIC_OBJ) -L$(LIB_DIR) $(DLIBS) $(LIBS) install: all - $(NEOTONIC_ROOT)mkinstalldirs $(DESTDIR)$(cs_includedir)/cgi + $(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(cs_includedir)/cgi $(INSTALL) -m 644 cgi.h $(DESTDIR)$(cs_includedir)/cgi $(INSTALL) -m 644 cgiwrap.h $(DESTDIR)$(cs_includedir)/cgi $(INSTALL) -m 644 date.h $(DESTDIR)$(cs_includedir)/cgi diff -Nrub clearsilver-0.10.1/cgi/static.c clearsilver-0.10.2/cgi/static.c --- clearsilver-0.10.1/cgi/static.c 2005-06-30 11:51:48.000000000 -0700 +++ clearsilver-0.10.2/cgi/static.c 2005-10-18 15:27:59.000000000 -0700 @@ -9,6 +9,11 @@ * */ +/* static.cgi + * This is a really simple example of how you can map URL requests to a set of + * hdf and cs files. + */ + #include "ClearSilver.h" #include @@ -17,7 +22,7 @@ #include #include -int main (int argc, char **argv, char **envp) +int main(int argc, char **argv, char **envp) { NEOERR *err; CGI *cgi; @@ -25,28 +30,51 @@ char hdf_file[_POSIX_PATH_MAX]; char *p; - cgi_debug_init (argc,argv); - cgiwrap_init_std (argc, argv, envp); + /* CGI works by passing information from the server to the CGI program via + * environment variables and stdin. cgi_debug_init looks for a file as the + * first argument, and loads it. That file contains key=value pairs which + * cgi_debug_init will load into the environment, allowing you to test your + * program via the command line. */ + cgi_debug_init(argc, argv); + + /* The ClearSilver cgi toolkit accesses the CGI environment through a + * wrapper. This allows the program to be used in other environments and + * fake the CGI environment, such as FastCGI, mod_python, PyApache, or even + * just from Python to access the python objects instead of the libc API. + * cgiwrap_init_std just sets up for the default CGI environment using the + * libc api. */ + cgiwrap_init_std(argc, argv, envp); + /* cgi_init creates a CGI struct, and parses the CGI environment variables. + * It creates an HDF structure as well. */ err = cgi_init(&cgi, NULL); if (err != STATUS_OK) { + /* cgi_neo_error renders a NEOERR as an error CGI result */ cgi_neo_error(cgi, err); + /* nerr_log_error logs the error to stderr and cleans up */ nerr_log_error(err); return -1; } - cs_file = hdf_get_value (cgi->hdf, "CGI.PathTranslated", NULL); + /* CGI.PathTranslated is a CGI env var which maps the URL with the + * DocumentRoot to give you the location of the referenced file on disk */ + cs_file = hdf_get_value(cgi->hdf, "CGI.PathTranslated", NULL); if (cs_file == NULL) { - cgi_error (cgi, "No PATH_TRANSLATED var"); + /* cgi_error returns a simple error page */ + cgi_error(cgi, "No PATH_TRANSLATED var"); return -1; } + + /* The hdf.loadpaths variables specify where HDF and ClearSilver look for + * files on the file system. We start setting that up here based on + * the directory of the file referenced */ p = strrchr (cs_file, '/'); if (p) { *p = '\0'; - err = hdf_set_value (cgi->hdf, "hdf.loadpaths.0", cs_file); + err = hdf_set_value(cgi->hdf, "hdf.loadpaths.0", cs_file); chdir(cs_file); *p = '/'; if (err) @@ -56,13 +84,18 @@ return -1; } } - err = hdf_read_file (cgi->hdf, "common.hdf"); + /* Next, we look for a shared HDF static dataset in common.hdf */ + err = hdf_read_file(cgi->hdf, "common.hdf"); if (err && !nerr_handle(&err, NERR_NOT_FOUND)) { cgi_neo_error(cgi, err); nerr_log_error(err); return -1; } + /* Next, we look for an HDF file for this specific page. We first look + * for passedfile.html.hdf, then we check for a file by removing an extension + * from the file, so something like passedfile.html we'll look for + * passedfile.hdf */ snprintf (hdf_file, sizeof(hdf_file), "%s.hdf", cs_file); err = hdf_read_file (cgi->hdf, hdf_file); if (err && !nerr_handle(&err, NERR_NOT_FOUND)) @@ -85,6 +118,9 @@ return -1; } } + /* Lastly, we need to render a template. The template is either the + * file that was passed to us, or its specificed by CGI.StaticContent + * in one of the HDF files we loaded above. */ cs_file = hdf_get_value (cgi->hdf, "CGI.StaticContent", cs_file); err = cgi_display (cgi, cs_file); if (err != STATUS_OK) diff -Nrub clearsilver-0.10.1/config.guess clearsilver-0.10.2/config.guess --- clearsilver-0.10.1/config.guess 2005-06-30 11:51:48.000000000 -0700 +++ clearsilver-0.10.2/config.guess 2005-10-21 15:44:35.000000000 -0700 @@ -1,7 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. -# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-04' + # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -22,22 +25,95 @@ # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# Please send patches to the Autoconf mailing list . +# Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) +# (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi @@ -47,12 +123,55 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -62,55 +181,72 @@ # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text .globl main + .align 4 .ent main main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit .end main EOF - ${CC-cc} $dummy.s -o $dummy 2>/dev/null + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; - 15) + 1-0) UNAME_MACHINE="alphaev5" ;; - 14) + 1-1) UNAME_MACHINE="alphaev56" ;; - 10) + 1-101) UNAME_MACHINE="alphapca56" ;; - 16) + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; esac fi rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-cbm-sysv4 + echo m68k-unknown-sysv4 exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -135,16 +271,16 @@ wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; - Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 @@ -197,21 +333,41 @@ aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} + sparc*:NetBSD:*) + echo `uname -p`-unknown-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -224,9 +380,6 @@ powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${UNAME_RELEASE} - exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; @@ -236,12 +389,14 @@ VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; - 2020:CLIX:*:*) + 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus +#include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { @@ -260,12 +415,15 @@ exit (-1); } EOF - ${CC-cc} $dummy.c -o $dummy \ + $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm $dummy.c $dummy && exit 0 + && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; @@ -281,14 +439,17 @@ AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi - else echo i586-dg-dgux${UNAME_RELEASE} + else + echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) @@ -310,11 +471,20 @@ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i?86:AIX:*:*) + i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include @@ -326,7 +496,7 @@ exit(0); } EOF - ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then @@ -335,9 +505,9 @@ echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) + *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -345,7 +515,7 @@ if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -355,7 +525,7 @@ ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) @@ -371,11 +541,32 @@ echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 ) + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE #include #include @@ -406,13 +597,19 @@ exit (0); } EOF - (${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) + eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int @@ -438,7 +635,7 @@ exit (0); } EOF - ${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; @@ -448,10 +645,7 @@ 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; - *9??*:MPE*:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - *9??*:MPE*:*:*) + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) @@ -460,7 +654,7 @@ hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; - i?86:OSF1:*:*) + i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else @@ -470,6 +664,9 @@ parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; @@ -492,57 +689,50 @@ echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) - echo t3e-cray-unicosmk${UNAME_RELEASE} + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; - F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - if test -x /usr/bin/objformat; then - if test "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 - fi - fi echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; @@ -552,6 +742,18 @@ i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; @@ -561,120 +763,99 @@ *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; - *:Linux:*:*) -# # uname on the ARM produces all sorts of strangeness, and we need to -# # filter it out. -# case "$UNAME_MACHINE" in -# armv*) UNAME_MACHINE=$UNAME_MACHINE ;; -# arm* | sa110*) UNAME_MACHINE="arm" ;; -# esac - + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | sed -ne '/supported emulations:/!d + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g - s/.*supported emulations: *// + s/.*supported targets: *// s/ .*// p'` - case "$ld_supported_emulations" in - i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32arm) echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 ;; - elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <$dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - ${CC-cc} $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - esac - - objdump --private-headers $dummy | \ - grep ld.so.1 > /dev/null - if test "$?" = 0 ; then - LIBC="libc1" - fi - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - else - # Either a pre-BFD a.out linker (linux-gnuoldld) - # or one that does not give us useful --help. - # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. - # If ld does not provide *any* "supported emulations:" - # that means it is gnuoldld. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 - - case "${UNAME_MACHINE}" in - i?86) - VENDOR=pc; - ;; - *) - VENDOR=unknown; + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; esac # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build cat >$dummy.c < #ifdef __cplusplus +#include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { @@ -682,28 +863,30 @@ #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 - printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); + printf ("%s-pc-linux-gnu\n", argv[1]); # else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); + printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else - printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); + printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else - printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); + printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF - ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i?86:DYNIX/ptx:4*:*) + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; - i?86:UNIX_SV:4.2MP:2.*) + i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, @@ -711,14 +894,23 @@ # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; - i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; - i?86:*:3.2:*) + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; - i?86:UnixWare:*:*) - if /bin/uname -X 2>/dev/null >/dev/null ; then - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - fi - echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) + # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp @@ -763,7 +956,7 @@ exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -774,21 +967,24 @@ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:*) + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; - i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; @@ -806,7 +1002,7 @@ echo ns32k-sni-sysv fi exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; @@ -819,13 +1015,17 @@ # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; - news*:NEWS-OS:*:6*) + news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else @@ -853,11 +1053,76 @@ *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 +eval $set_cc_for_build cat >$dummy.c < @@ -944,11 +1209,24 @@ #endif #if defined (vax) -#if !defined (ultrix) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else printf ("vax-dec-bsd\n"); exit (0); -#else +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else printf ("vax-dec-ultrix\n"); exit (0); -#endif +# endif #endif #if defined (alliant) && defined (i860) @@ -959,7 +1237,7 @@ } EOF -${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. @@ -992,6 +1270,48 @@ esac fi -#echo '(Unable to guess system type)' 1>&2 +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nrub clearsilver-0.10.1/config.sub clearsilver-0.10.2/config.sub --- clearsilver-0.10.1/config.sub 2005-06-30 11:51:48.000000000 -0700 +++ clearsilver-0.10.2/config.sub 2005-10-21 15:44:36.000000000 -0700 @@ -1,6 +1,10 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-09-07' + # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. @@ -25,6 +29,8 @@ # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. +# Please send patches to . +# # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. @@ -45,30 +51,73 @@ # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; -# First pass through any local machine types. -case $1 in *local*) + # First pass through any local machine types. echo $1 - exit 0 - ;; - *) - ;; + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - linux-gnu*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -94,15 +143,33 @@ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple) + -apple | -axis) os= basic_machine=$1 ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; -sco5) - os=sco3.2v5 + os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) @@ -121,6 +188,9 @@ os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -143,27 +213,60 @@ -psos*) os=-psos ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ - | hppa2.0w \ - | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ - | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ - | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ - | mipstx39 | mipstx39el | armv[34][lb] \ - | sparc | sparclet | sparclite | sparc64 | v850) + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | s390 | s390x \ + | sh | sh[34] | sh[34]eb | shbe | shle \ + | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ + | stormy16 | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 \ + | we32k \ + | x86 | xscale \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. - i[34567]86) + i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. @@ -172,28 +275,64 @@ exit 1 ;; # Recognize the basic CPU types with company name. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ - | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ - | hppa2.0w-* \ - | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ - | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | mips64-* | mipsel-* | armv[34][lb]-*\ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mipstx39-* | mipstx39el-* \ - | f301-* | armv*-*) + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alphapca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cray2-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | s390-* | s390x-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ + | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ + | ymp-* \ + | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; alliant | fx80) basic_machine=fx80-alliant ;; @@ -209,20 +348,24 @@ os=-sysv ;; amiga | amiga-*) - basic_machine=m68k-cbm + basic_machine=m68k-unknown ;; amigaos | amigados) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) - basic_machine=m68k-cbm + basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; aux) basic_machine=m68k-apple os=-aux @@ -259,13 +402,16 @@ basic_machine=cray2-cray os=-unicos ;; - [ctj]90-cray) - basic_machine=c90-cray + [cjt]90) + basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -299,6 +445,10 @@ encore | umax | mmax) basic_machine=ns32k-encore ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; fx2800) basic_machine=i860-alliant ;; @@ -309,6 +459,10 @@ basic_machine=tron-gmicro os=-sysv ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -317,6 +471,14 @@ basic_machine=h8300-hitachi os=-hms ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; harris) basic_machine=m88k-harris os=-sysv3 @@ -332,13 +494,30 @@ basic_machine=m68k-hp os=-hpux ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; - hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) @@ -347,35 +526,42 @@ hppa-next) os=-nextstep3 ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - os=-mpeix + hppaosf) + basic_machine=hppa1.1-hp + os=-osf ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - os=-mpeix + hppro) + basic_machine=hppa1.1-hp + os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm - os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) + i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; - i[34567]86v4*) + i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; - i[34567]86v) + i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; - i[34567]86sol2) + i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -401,9 +587,17 @@ basic_machine=ns32k-utek os=-sysv ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; miniframe) basic_machine=m68000-convergent ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu @@ -418,12 +612,32 @@ mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; netwinder) - basic_machine=armv4l-corel + basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) @@ -438,6 +652,10 @@ basic_machine=mips-sony os=-newsos ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; next | m*-next ) basic_machine=m68k-next case $os in @@ -463,9 +681,32 @@ basic_machine=i960-intel os=-nindy ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; np1) basic_machine=np1-gould ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -483,28 +724,28 @@ pc532 | pc532-*) basic_machine=ns32k-pc532 ;; - pentium | p5 | k5 | nexen) + pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; - pentiumpro | p6 | k6 | 6x86) + pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) - basic_machine=i786-pc + basic_machine=i686-pc ;; - pentium-* | p5-* | k5-* | nexen-*) + pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumpro-* | p6-* | k6-* | 6x86-*) + pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; - power) basic_machine=rs6000-ibm + power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; @@ -516,15 +757,37 @@ ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ps2) basic_machine=i386-ibm ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; sequent) basic_machine=i386-sequent ;; @@ -532,6 +795,10 @@ basic_machine=sh-hitachi os=-hms ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; sps7) basic_machine=m68k-bull os=-sysv2 @@ -539,6 +806,13 @@ spur) basic_machine=spur-unknown ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; sun2) basic_machine=m68000-sun ;; @@ -579,10 +853,22 @@ sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; symmetry) basic_machine=i386-sequent os=-dynix ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; tx39) basic_machine=mipstx39-unknown ;; @@ -600,6 +886,10 @@ basic_machine=a29k-nyu os=-sym1 ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; vaxv) basic_machine=vax-dec os=-sysv @@ -623,6 +913,18 @@ basic_machine=a29k-wrs os=-vxworks ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; xmp) basic_machine=xmp-cray os=-unicos @@ -630,6 +932,10 @@ xps | xps100) basic_machine=xps100-honeywell ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -637,6 +943,15 @@ # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown @@ -653,13 +968,20 @@ vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; - sparc) + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -671,6 +993,19 @@ orion105) basic_machine=clipper-highlevel ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 @@ -724,14 +1059,37 @@ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \ - | -openstep* | -mpeix* | -oskit*) + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -741,6 +1099,12 @@ -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; -osfrose*) os=-osfrose ;; @@ -756,12 +1120,18 @@ -acis*) os=-aos ;; + -386bsd) + os=-bsd + ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; + -nsk*) + os=-nsk + ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` @@ -787,9 +1157,18 @@ # This must come after -sysvr4. -sysv*) ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; -xenix) os=-xenix ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; -none) ;; *) @@ -815,12 +1194,15 @@ *-acorn) os=-riscix1.2 ;; - arm*-corel) + arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; + pdp10-*) + os=-tops20 + ;; pdp11-*) os=-none ;; @@ -839,6 +1221,15 @@ # default. # os=-sunos4 ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; @@ -851,6 +1242,15 @@ *-ibm) os=-aix ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; *-hp) os=-hpux ;; @@ -911,9 +1311,21 @@ *-masscomp) os=-rtu ;; - f301-fujitsu) + f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; *) os=-none ;; @@ -935,10 +1347,10 @@ -aix*) vendor=ibm ;; - -hpux*) - vendor=hp + -beos*) + vendor=be ;; - -mpeix*) + -hpux*) vendor=hp ;; -mpeix*) @@ -959,7 +1371,7 @@ -genix*) vendor=ns ;; - -mvs*) + -mvs* | -opened*) vendor=ibm ;; -ptx*) @@ -971,9 +1383,29 @@ -aux*) vendor=apple ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nrub clearsilver-0.10.1/configure clearsilver-0.10.2/configure --- clearsilver-0.10.1/configure 2005-07-27 19:38:05.000000000 -0700 +++ clearsilver-0.10.2/configure 2005-12-14 16:26:08.000000000 -0800 @@ -308,7 +308,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP LN_S AR RANLIB ac_ct_RANLIB SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os USE_MINGW32 APXS_PATH PERL RUBY BUILD_WRAPPERS JAVA_PATH PYTHON PYTHON_INC PYTHON_LIB PYTHON_SITE EXTRA_UTL_SRC EXTRA_UTL_OBJS CSHARP_PATH LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP LN_S AR RANLIB ac_ct_RANLIB SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA EGREP build build_cpu build_vendor build_os host host_cpu host_vendor host_os _ACJNI_JAVAC USE_MINGW32 APXS_PATH PERL RUBY BUILD_WRAPPERS JAVA_PATH JAVA_INCLUDE_PATH PYTHON PYTHON_INC PYTHON_LIB PYTHON_SITE EXTRA_UTL_SRC EXTRA_UTL_OBJS CSHARP_PATH LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -5039,7 +5039,7 @@ * ) MINGW32=no;; esac -if test "x$ac_cv_mingw32" = "xyes"; then +if test "x$MINGW32" = "xyes"; then CPPFLAGS="$CPPFLAGS -D__WINDOWS_GCC__" USE_MINGW32="USE_MINGW32 = 1" else @@ -6003,13 +6003,14 @@ echo $ECHO_N "checking for python includes... $ECHO_C" >&6 python_inc=no python_search_path="/neo/opt /usr/local /usr /c" - python_versions="2.3 2.2 2.1 2.0 1.5 22 21 20 15" + python_versions="2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15" if test $cs_cv_python_path != "no" -a -x $cs_cv_python_path; then python_bin=$cs_cv_python_path vers=`$python_bin -c "import sys; print sys.version[:3]"` py_inst_dir=`$python_bin -c "import sys; print sys.exec_prefix"` python_inc=$py_inst_dir/include/python$vers python_lib="-L$py_inst_dir/lib/python$vers/config -lpython$vers" + python_site=$py_inst_dir/lib/python$vers/site-packages else for vers in $python_versions; do for path in $python_search_path; do @@ -6019,11 +6020,13 @@ if test -f $path/include/python$vers/Python.h; then python_inc=$path/include/python$vers python_lib="-L$path/lib/python$vers/config -lpython$vers" + python_site=$path/lib/python$vers/site-packages break 2 fi if test -f $path/python$vers/include/Python.h; then python_inc=$path/python$vers/include python_lib="-L$path/python$vers/libs -lpython$vers" + python_site=$path/python$vers/Lib/site-packages break 2 fi done @@ -6042,7 +6045,9 @@ PYTHON=$python_bin PYTHON_INC="-I$python_inc" PYTHON_LIB=$python_lib - PYTHON_SITE=`$python_bin -c "import site; print site.sitedirs[0]"` + if test ! $?PYTHON_SITE; then + PYTHON_SITE=$python_site + fi BUILD_WRAPPERS="$BUILD_WRAPPERS python" fi fi @@ -6198,10 +6203,123 @@ echo "$as_me:$LINENO: result: not found" >&5 echo "${ECHO_T}not found" >&6 JAVA_PATH= + JAVA_INCLUDE_PATH= else echo "$as_me:$LINENO: result: found $java_path" >&5 echo "${ECHO_T}found $java_path" >&6 JAVA_PATH="$java_path" + JAVAC="$java_path/bin/javac" + _ACJNI_JAVAC=$JAVAC + + +JNI_INCLUDE_DIRS="" + +test "x$JAVAC" = x && { { echo "$as_me:$LINENO: error: '$JAVAC' undefined" >&5 +echo "$as_me: error: '$JAVAC' undefined" >&2;} + { (exit 1); exit 1; }; } +# Extract the first word of "$JAVAC", so it can be a program name with args. +set dummy $JAVAC; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path__ACJNI_JAVAC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $_ACJNI_JAVAC in + [\\/]* | ?:[\\/]*) + ac_cv_path__ACJNI_JAVAC="$_ACJNI_JAVAC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path__ACJNI_JAVAC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path__ACJNI_JAVAC" && ac_cv_path__ACJNI_JAVAC="no" + ;; +esac +fi +_ACJNI_JAVAC=$ac_cv_path__ACJNI_JAVAC + +if test -n "$_ACJNI_JAVAC"; then + echo "$as_me:$LINENO: result: $_ACJNI_JAVAC" >&5 +echo "${ECHO_T}$_ACJNI_JAVAC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +test "x$_ACJNI_JAVAC" = xno && { { echo "$as_me:$LINENO: error: $JAVAC could not be found in path" >&5 +echo "$as_me: error: $JAVAC could not be found in path" >&2;} + { (exit 1); exit 1; }; } + + +# find the include directory relative to the javac executable +_cur=""$_ACJNI_JAVAC"" +while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do + echo "$as_me:$LINENO: checking symlink for $_cur" >&5 +echo $ECHO_N "checking symlink for $_cur... $ECHO_C" >&6 + _slink=`ls -ld "$_cur" | sed 's/.* -> //'` + case "$_slink" in + /*) _cur="$_slink";; + # 'X' avoids triggering unwanted echo options. + *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[^/]*$::'`"$_slink";; + esac + echo "$as_me:$LINENO: result: $_cur" >&5 +echo "${ECHO_T}$_cur" >&6 +done +_ACJNI_FOLLOWED="$_cur" + +_JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[^/]*$::'` +case "$host_os" in + darwin*) _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'` + _JINC="$_JTOPDIR/Headers";; + *) _JINC="$_JTOPDIR/include";; +esac +if test -f "$_JINC/jni.h"; then + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC" +else + _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[^/]*$::'` + if test -f "$_JTOPDIR/include/jni.h"; then + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include" + else + { { echo "$as_me:$LINENO: error: cannot find java include files" >&5 +echo "$as_me: error: cannot find java include files" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +# get the likely subdirectories for system specific java includes +case "$host_os" in +bsdi*) _JNI_INC_SUBDIRS="bsdos";; +linux*) _JNI_INC_SUBDIRS="linux genunix";; +osf*) _JNI_INC_SUBDIRS="alpha";; +solaris*) _JNI_INC_SUBDIRS="solaris";; +mingw*) _JNI_INC_SUBDIRS="win32";; +cygwin*) _JNI_INC_SUBDIRS="win32";; +*) _JNI_INC_SUBDIRS="genunix";; +esac + +# add any subdirectories that are present +for JINCSUBDIR in $_JNI_INC_SUBDIRS +do + if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" + fi +done + + for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS + do + JAVA_INCLUDE_PATH="$JAVA_INCLUDE_PATH -I$JNI_INCLUDE_DIR" + done BUILD_WRAPPERS="$BUILD_WRAPPERS java-jni" fi fi @@ -6498,6 +6616,7 @@ + ac_config_files="$ac_config_files rules.mk" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -7134,12 +7253,14 @@ s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t +s,@_ACJNI_JAVAC@,$_ACJNI_JAVAC,;t t s,@USE_MINGW32@,$USE_MINGW32,;t t s,@APXS_PATH@,$APXS_PATH,;t t s,@PERL@,$PERL,;t t s,@RUBY@,$RUBY,;t t s,@BUILD_WRAPPERS@,$BUILD_WRAPPERS,;t t s,@JAVA_PATH@,$JAVA_PATH,;t t +s,@JAVA_INCLUDE_PATH@,$JAVA_INCLUDE_PATH,;t t s,@PYTHON@,$PYTHON,;t t s,@PYTHON_INC@,$PYTHON_INC,;t t s,@PYTHON_LIB@,$PYTHON_LIB,;t t diff -Nrub clearsilver-0.10.1/configure.in clearsilver-0.10.2/configure.in --- clearsilver-0.10.1/configure.in 2005-06-30 18:49:06.000000000 -0700 +++ clearsilver-0.10.2/configure.in 2005-12-02 03:03:35.000000000 -0800 @@ -75,7 +75,7 @@ ]) AC_MINGW32() -if test "x$ac_cv_mingw32" = "xyes"; then +if test "x$MINGW32" = "xyes"; then CPPFLAGS="$CPPFLAGS -D__WINDOWS_GCC__" USE_MINGW32="USE_MINGW32 = 1" else @@ -246,13 +246,14 @@ AC_MSG_CHECKING(for python includes) python_inc=no python_search_path="/neo/opt /usr/local /usr /c" - python_versions="2.3 2.2 2.1 2.0 1.5 22 21 20 15" + python_versions="2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15" if test $cs_cv_python_path != "no" -a -x $cs_cv_python_path; then python_bin=$cs_cv_python_path vers=`$python_bin -c "import sys; print sys.version[[:3]]"` py_inst_dir=`$python_bin -c "import sys; print sys.exec_prefix"` python_inc=$py_inst_dir/include/python$vers python_lib="-L$py_inst_dir/lib/python$vers/config -lpython$vers" + python_site=$py_inst_dir/lib/python$vers/site-packages else for vers in $python_versions; do for path in $python_search_path; do @@ -262,6 +263,7 @@ if test -f $path/include/python$vers/Python.h; then python_inc=$path/include/python$vers python_lib="-L$path/lib/python$vers/config -lpython$vers" + python_site=$path/lib/python$vers/site-packages break 2 fi dnl This is currently special cased mostly for Windows @@ -269,6 +271,7 @@ if test -f $path/python$vers/include/Python.h; then python_inc=$path/python$vers/include python_lib="-L$path/python$vers/libs -lpython$vers" + python_site=$path/python$vers/Lib/site-packages break 2 fi done @@ -285,7 +288,9 @@ PYTHON=$python_bin PYTHON_INC="-I$python_inc" PYTHON_LIB=$python_lib - PYTHON_SITE=`$python_bin -c "import site; print site.sitedirs[[0]]"` + if test ! $?PYTHON_SITE; then + PYTHON_SITE=$python_site + fi BUILD_WRAPPERS="$BUILD_WRAPPERS python" fi fi @@ -403,9 +408,17 @@ if test "x$java_path" = "xno"; then AC_MSG_RESULT(not found) JAVA_PATH= + JAVA_INCLUDE_PATH= else AC_MSG_RESULT(found $java_path) JAVA_PATH="$java_path" + JAVAC="$java_path/bin/javac" + _ACJNI_JAVAC=$JAVAC + AC_JNI_INCLUDE_DIR + for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS + do + JAVA_INCLUDE_PATH="$JAVA_INCLUDE_PATH -I$JNI_INCLUDE_DIR" + done BUILD_WRAPPERS="$BUILD_WRAPPERS java-jni" fi fi @@ -466,6 +479,7 @@ AC_SUBST(RUBY) AC_SUBST(BUILD_WRAPPERS) AC_SUBST(JAVA_PATH) +AC_SUBST(JAVA_INCLUDE_PATH) AC_SUBST(PYTHON) AC_SUBST(PYTHON_INC) AC_SUBST(PYTHON_LIB) diff -Nrub clearsilver-0.10.1/cs/cs.h clearsilver-0.10.2/cs/cs.h --- clearsilver-0.10.1/cs/cs.h 2005-06-30 18:14:21.000000000 -0700 +++ clearsilver-0.10.2/cs/cs.h 2005-11-30 19:58:44.000000000 -0800 @@ -105,7 +105,7 @@ typedef struct _arg { CSTOKEN_TYPE op_type; - unsigned char *s; + char *s; long int n; int alloc; struct _funct *function; @@ -145,6 +145,9 @@ char *s; long int n; HDF *h; + int first; /* This local is the "first" item in an each/loop */ + int last; /* This local is the "last" item in an loop, each is calculated + explicitly based on hdf_obj_next() in _builtin_last() */ struct _local_map *next; } CS_LOCAL_MAP; @@ -159,8 +162,9 @@ struct _macro *next; } CS_MACRO; -typedef NEOERR* (*CSFUNCTION)(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, CSARG *result); -typedef NEOERR* (*CSSTRFUNC)(const unsigned char *str, unsigned char **ret); +typedef NEOERR* (*CSFUNCTION)(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, + CSARG *result); +typedef NEOERR* (*CSSTRFUNC)(const char *str, char **ret); struct _funct { @@ -185,13 +189,18 @@ int taglen; ULIST *stack; - ULIST *alloc; + ULIST *alloc; /* list of strings owned by CSPARSE and free'd when + its destroyed */ CSTREE *tree; CSTREE *current; CSTREE **next; HDF *hdf; + struct _parse *parent; /* set on internally created parse instances to point + at the parent. This can be used for hierarchical + scope in the future. */ + CS_LOCAL_MAP *locals; CS_MACRO *macros; CS_FUNCTION *functions; @@ -200,6 +209,9 @@ void *output_ctx; CSOUTFUNC output_cb; + /* Global hdf struct */ + /* smarti: Added for support for global hdf under local hdf */ + HDF *global_hdf; }; /* diff -Nrub clearsilver-0.10.1/cs/csparse.c clearsilver-0.10.2/cs/csparse.c --- clearsilver-0.10.1/cs/csparse.c 2005-06-30 18:04:34.000000000 -0700 +++ clearsilver-0.10.2/cs/csparse.c 2005-12-02 03:04:37.000000000 -0800 @@ -105,7 +105,7 @@ static NEOERR *alt_eval (CSPARSE *parse, CSTREE *node, CSTREE **next); static NEOERR *render_node (CSPARSE *parse, CSTREE *node); -static NEOERR *cs_init_internal (CSPARSE **parse, HDF *hdf, BOOL init_funcs); +static NEOERR *cs_init_internal (CSPARSE **parse, HDF *hdf, CSPARSE *parent); static int rearrange_for_call(CSARG **args); typedef struct _cmds @@ -192,6 +192,7 @@ return STATUS_OK; } +/* TODO: make these deallocations linear and not recursive */ static void dealloc_arg (CSARG **arg) { CSARG *p; @@ -579,6 +580,7 @@ { CS_LOCAL_MAP *map; char *c; + HDF *ret_hdf; map = lookup_map (parse, name, &c); if (map && map->type == CS_TYPE_VAR) @@ -592,7 +594,13 @@ return hdf_get_obj (map->h, c+1); } } - return hdf_get_obj (parse->hdf, name); + /* smarti: Added support for global hdf under local hdf */ + /* return hdf_get_obj (parse->hdf, name); */ + ret_hdf = hdf_get_obj (parse->hdf, name); + if (ret_hdf == NULL && parse->global_hdf != NULL) { + ret_hdf = hdf_get_obj (parse->global_hdf, name); + } + return ret_hdf; } /* Ugh, I have to write the same walking code because I can't grab the @@ -657,6 +665,7 @@ { CS_LOCAL_MAP *map; char *c; + char* retval; map = lookup_map (parse, name, &c); if (map) @@ -691,7 +700,13 @@ return map->s; } } - return hdf_get_value (parse->hdf, name, NULL); + /* smarti: Added support for global hdf under local hdf */ + /* return hdf_get_value (parse->hdf, name, NULL); */ + retval = hdf_get_value (parse->hdf, name, NULL); + if (retval == NULL && parse->global_hdf != NULL) { + retval = hdf_get_value (parse->global_hdf, name, NULL); + } + return retval; } long int var_int_lookup (CSPARSE *parse, char *name) @@ -2099,7 +2114,7 @@ /* Ok, we need our own copy of the string to pass to * cs_parse_string... */ - if (val.alloc) { + if (val.alloc && (val.op_type & CS_TYPE_STRING)) { val.alloc = 0; } else @@ -2112,15 +2127,13 @@ } do { - err = cs_init_internal(&cs, parse->hdf, FALSE); + err = cs_init_internal(&cs, parse->hdf, parse); if (err) break; - cs->functions = parse->functions; err = cs_parse_string(cs, s, strlen(s)); if (err) break; err = cs_render(cs, parse->output_ctx, parse->output_cb); if (err) break; } while (0); - cs->functions = NULL; cs_destroy(&cs); } } @@ -2154,9 +2167,8 @@ { CSPARSE *cs = NULL; do { - err = cs_init_internal(&cs, parse->hdf, FALSE); + err = cs_init_internal(&cs, parse->hdf, parse); if (err) break; - cs->functions = parse->functions; err = cs_parse_file(cs, s); if (!(node->flags & CSF_REQUIRED)) { @@ -2166,7 +2178,6 @@ err = cs_render(cs, parse->output_ctx, parse->output_cb); if (err) break; } while (0); - cs->functions = NULL; cs_destroy(&cs); } } @@ -2381,6 +2392,8 @@ each_map.type = CS_TYPE_VAR; each_map.name = node->arg1.s; each_map.next = parse->locals; + each_map.first = 1; + each_map.last = 0; parse->locals = &each_map; do @@ -2388,12 +2401,16 @@ child = hdf_obj_child (var); while (child != NULL) { + /* We don't explicitly set each_map.last here since checking + * requires a function call, so we move the check to _builtin_last + * so it only makes the call if last() is being used */ each_map.h = child; err = render_node (parse, node->case_0); if (each_map.map_alloc) { free(each_map.s); each_map.s = NULL; } + if (each_map.first) each_map.first = 0; if (err != STATUS_OK) break; child = hdf_obj_next (child); } @@ -2748,7 +2765,7 @@ { err = nerr_raise (NERR_PARSE, "%s Incorrect number of arguments, expected %d, got %d in call to macro %s: %s", - find_context(parse, -1, tmp, sizeof(tmp)), macro->n_args, x, + find_context(parse, -1, tmp, sizeof(tmp)), macro->n_args, nargs, macro->name, arg); } if (err) @@ -2774,11 +2791,18 @@ int x; macro = node->arg1.macro; + if (macro->n_args) + { call_map = (CS_LOCAL_MAP *) calloc (macro->n_args, sizeof(CS_LOCAL_MAP)); if (call_map == NULL) return nerr_raise (NERR_NOMEM, "Unable to allocate memory for call_map in call_eval of %s", macro->name); + } + else + { + call_map = NULL; + } darg = macro->args; carg = node->vargs; @@ -2853,7 +2877,7 @@ { if (call_map[x].map_alloc) free(call_map[x].s); } - free (call_map); + if (call_map) free (call_map); *next = node->next; return nerr_pass(err); @@ -3116,17 +3140,20 @@ each_map.type = CS_TYPE_NUM; each_map.name = node->arg1.s; each_map.next = parse->locals; + each_map.first = 1; parse->locals = &each_map; var = start; for (x = 0, var = start; x < iter; x++, var += step) { + if (x == iter - 1) each_map.last = 1; each_map.n = var; err = render_node (parse, node->case_0); if (each_map.map_alloc) { free(each_map.s); each_map.s = NULL; } + if (each_map.first) each_map.first = 0; if (err != STATUS_OK) break; } @@ -3172,7 +3199,8 @@ /* **** Functions ******************************************** */ -static NEOERR *_register_function(CSPARSE *parse, char *funcname, int n_args, CSFUNCTION function) +static NEOERR *_register_function(CSPARSE *parse, const char *funcname, + int n_args, CSFUNCTION function) { CS_FUNCTION *csf; @@ -3207,11 +3235,75 @@ return STATUS_OK; } +/* This is similar to python's PyArg_ParseTuple, : + * s - string (allocated) + * i - int + * A - arg ptr (maybe later) + */ +static NEOERR * cs_arg_parsev(CSPARSE *parse, CSARG *args, char *fmt, + va_list ap) +{ + NEOERR *err = STATUS_OK; + char **s; + long int *i; + CSARG val; + + while (*fmt || args || err) + { + memset(&val, 0, sizeof(val)); + err = eval_expr(parse, args, &val); + if (err) return nerr_pass(err); + + switch (*fmt) + { + case 's': + s = va_arg(ap, char **); + if (s == NULL) + { + err = nerr_raise(NERR_ASSERT, + "Invalid number of arguments in call to cs_arg_parse"); + break; + } + *s = arg_eval_str_alloc(parse, &val); + break; + case 'i': + i = va_arg(ap, long int *); + if (i == NULL) + { + err = nerr_raise(NERR_ASSERT, + "Invalid number of arguments in call to cs_arg_parse"); + break; + } + *i = arg_eval_num(parse, &val); + break; + default: + break; + } + fmt++; + args = args->next; + if (val.alloc) free(val.s); + } + if (err) return nerr_pass(err); + return STATUS_OK; +} + +static NEOERR * cs_arg_parse(CSPARSE *parse, CSARG *args, char *fmt, ...) +{ + NEOERR *err; + va_list ap; + + va_start(ap, fmt); + err = cs_arg_parsev(parse, args, fmt, ap); + va_end(ap); + return nerr_pass(err); +} + static NEOERR * _builtin_subcount(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, CSARG *result) { HDF *obj; int count = 0; + /* default for non-vars is 0 children */ result->op_type = CS_TYPE_NUM; result->n = 0; @@ -3229,11 +3321,6 @@ } result->n = count; } - else - { - // everything else has zero children - result->n = 0; - } return STATUS_OK; } @@ -3242,6 +3329,7 @@ { HDF *obj; + /* non var/string objects have 0 length */ result->op_type = CS_TYPE_NUM; result->n = 0; @@ -3291,67 +3379,105 @@ return STATUS_OK; } -/* This is similar to python's PyArg_ParseTuple, : - * s - string (allocated) - * i - int - * A - arg ptr (maybe later) - */ -static NEOERR * cs_arg_parsev(CSPARSE *parse, CSARG *args, char *fmt, - va_list ap) +/* Check to see if a local variable is the first in an each/loop sequence */ +static NEOERR * _builtin_first(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, + CSARG *result) { - NEOERR *err = STATUS_OK; - char **s; - long int *i; - CSARG val; + CS_LOCAL_MAP *map; + char *c; - while (*fmt || args || err) - { - memset(&val, 0, sizeof(val)); - err = eval_expr(parse, args, &val); - if (err) return nerr_pass(err); + /* default is "not first" */ + result->op_type = CS_TYPE_NUM; + result->n = 0; - switch (*fmt) - { - case 's': - s = va_arg(ap, char **); - if (s == NULL) + /* Only applies to possible local vars */ + if ((args->op_type & CS_TYPE_VAR) && !strchr(args->s, '.')) { - err = nerr_raise(NERR_ASSERT, - "Invalid number of arguments in call to cs_arg_parse"); - break; + map = lookup_map (parse, args->s, &c); + if (map && map->first) + result->n = 1; } - *s = arg_eval_str_alloc(parse, &val); - break; - case 'i': - i = va_arg(ap, long int *); - if (i == NULL) + return STATUS_OK; +} + +/* Check to see if a local variable is the last in an each/loop sequence */ +/* TODO: consider making this work on regular HDF vars */ +static NEOERR * _builtin_last(CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, + CSARG *result) +{ + CS_LOCAL_MAP *map; + char *c; + + /* default is "not last" */ + result->op_type = CS_TYPE_NUM; + result->n = 0; + + /* Only applies to possible local vars */ + if ((args->op_type & CS_TYPE_VAR) && !strchr(args->s, '.')) { - err = nerr_raise(NERR_ASSERT, - "Invalid number of arguments in call to cs_arg_parse"); - break; + map = lookup_map (parse, args->s, &c); + if (map) { + if (map->last) { + result->n = 1; + } else if (map->type == CS_TYPE_VAR) { + if (hdf_obj_next(map->h) == NULL) { + result->n = 1; } - *i = arg_eval_num(parse, &val); - break; - default: - break; } - fmt++; - args = args->next; - if (val.alloc) free(val.s); } + } + return STATUS_OK; +} + +/* returns the absolute value (ie, positive) of a number */ +static NEOERR * _builtin_abs (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, + CSARG *result) +{ + int n1 = 0; + + result->op_type = CS_TYPE_NUM; + result->n = 0; + + n1 = arg_eval_num(parse, args); + result->n = abs(n1); + + return STATUS_OK; +} + +/* returns the larger or two integers */ +static NEOERR * _builtin_max (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, + CSARG *result) +{ + NEOERR *err; + long int n1 = 0; + long int n2 = 0; + + result->op_type = CS_TYPE_NUM; + result->n = 0; + + err = cs_arg_parse(parse, args, "ii", &n1, &n2); if (err) return nerr_pass(err); + result->n = (n1 > n2) ? n1 : n2; + return STATUS_OK; } -static NEOERR * cs_arg_parse(CSPARSE *parse, CSARG *args, char *fmt, ...) +/* returns the smaller or two integers */ +static NEOERR * _builtin_min (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, + CSARG *result) { NEOERR *err; - va_list ap; + long int n1 = 0; + long int n2 = 0; - va_start(ap, fmt); - err = cs_arg_parsev(parse, args, fmt, ap); - va_end(ap); - return nerr_pass(err); + result->op_type = CS_TYPE_NUM; + result->n = 0; + + err = cs_arg_parse(parse, args, "ii", &n1, &n2); + if (err) return nerr_pass(err); + result->n = (n1 < n2) ? n1 : n2; + + return STATUS_OK; } static NEOERR * _builtin_str_slice (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, CSARG *result) @@ -3359,9 +3485,9 @@ NEOERR *err; char *s = NULL; char *slice; - int b = 0; - int e = 0; - int len; + long int b = 0; + long int e = 0; + size_t len; result->op_type = CS_TYPE_STRING; result->s = ""; @@ -3475,10 +3601,10 @@ /* **** CS Initialize/Destroy ************************************ */ NEOERR *cs_init (CSPARSE **parse, HDF *hdf) { - return nerr_pass(cs_init_internal(parse, hdf, TRUE)); + return nerr_pass(cs_init_internal(parse, hdf, NULL)); } -static NEOERR *cs_init_internal (CSPARSE **parse, HDF *hdf, BOOL init_funcs) +static NEOERR *cs_init_internal (CSPARSE **parse, HDF *hdf, CSPARSE *parent) { NEOERR *err = STATUS_OK; CSPARSE *my_parse; @@ -3528,52 +3654,60 @@ cs_destroy(&my_parse); return nerr_pass(err); } - if (init_funcs) - { - err = _register_function(my_parse, "len", 1, _builtin_subcount); - if (err) - { - cs_destroy(&my_parse); - return nerr_pass(err); - } - err = _register_function(my_parse, "subcount", 1, _builtin_subcount); - if (err) - { - cs_destroy(&my_parse); - return nerr_pass(err); - } - err = _register_function(my_parse, "name", 1, _builtin_name); - if (err) + my_parse->tag = hdf_get_value(hdf, "Config.TagStart", "cs"); + my_parse->taglen = strlen(my_parse->tag); + my_parse->hdf = hdf; + + if (parent == NULL) { - cs_destroy(&my_parse); - return nerr_pass(err); - } - err = _register_function(my_parse, "string.slice", 3, _builtin_str_slice); + static struct _builtin_functions { + const char *name; + int nargs; + CSFUNCTION function; + } Builtins[] = { + { "len", 1, _builtin_subcount }, + { "subcount", 1, _builtin_subcount }, + { "name", 1, _builtin_name }, + { "first", 1, _builtin_first }, + { "last", 1, _builtin_last }, + { "abs", 1, _builtin_abs }, + { "max", 2, _builtin_max }, + { "min", 2, _builtin_min }, + { "string.slice", 3, _builtin_str_slice }, + { "string.length", 1, _builtin_str_length }, +#ifdef ENABLE_GETTEXT + { "_", 1, _builtin_gettext }, +#endif + { NULL, 0, NULL }, + }; + int x = 0; + while (Builtins[x].name != NULL) { + err = _register_function(my_parse, Builtins[x].name, Builtins[x].nargs, + Builtins[x].function); if (err) { cs_destroy(&my_parse); return nerr_pass(err); } - err = _register_function(my_parse, "string.length", 1, _builtin_str_length); - if (err) - { - cs_destroy(&my_parse); - return nerr_pass(err); + x++; } - - + /* Set global_hdf to be null */ + my_parse->global_hdf = NULL; + my_parse->parent = NULL; } -#ifdef ENABLE_GETTEXT - err = _register_function(my_parse, "_", 1, _builtin_gettext); - if (err) + else { - cs_destroy(&my_parse); - return nerr_pass(err); + /* TODO: macros and functions should actually not be duplicated, they + * should just be modified in lookup to walk the CS struct hierarchy we're + * creating here */ + /* BUG: We currently can't copy the macros because they reference the parse + * tree, so if this sub-parse tree adds a macro, the macro reference will + * persist, but the parse tree it points to will be gone when the sub-parse + * is gone. */ + my_parse->functions = parent->functions; + my_parse->global_hdf = parent->global_hdf; + my_parse->parent = parent; } -#endif - my_parse->tag = hdf_get_value(hdf, "Config.TagStart", "cs"); - my_parse->taglen = strlen(my_parse->tag); - my_parse->hdf = hdf; *parse = my_parse; return STATUS_OK; @@ -3591,7 +3725,9 @@ dealloc_macro(&my_parse->macros); dealloc_node(&(my_parse->tree)); + if (my_parse->parent == NULL) { dealloc_function(&(my_parse->functions)); + } free(my_parse); *parse = NULL; @@ -3806,4 +3942,3 @@ return nerr_pass (err); } #endif - diff -Nrub clearsilver-0.10.1/cs/Makefile clearsilver-0.10.2/cs/Makefile --- clearsilver-0.10.1/cs/Makefile 2005-06-30 11:51:49.000000000 -0700 +++ clearsilver-0.10.2/cs/Makefile 2005-12-02 02:34:47.000000000 -0800 @@ -1,10 +1,10 @@ ifeq ($(NEOTONIC_ROOT),) -NEOTONIC_ROOT = ../ +NEOTONIC_ROOT = .. endif -include $(NEOTONIC_ROOT)rules.mk +include $(NEOTONIC_ROOT)/rules.mk CS_LIB = $(LIB_DIR)libneo_cs.a CS_SRC = csparse.c @@ -22,7 +22,6 @@ CSDUMP_SRC = csdump.c CSDUMP_OBJ = $(CSDUMP_SRC:%.c=%.o) -CFLAGS += -I$(NEOTONIC_ROOT) LIBS += -L$(LIB_DIR) -lneo_cs -lneo_utl # -lefence TARGETS = $(CS_LIB) $(CSTEST_EXE) $(CSR_EXE) test @@ -32,7 +31,7 @@ test14.cs test15.cs test16.cs test17.cs test18.cs test_var.cs \ test_paren.cs test_chuck.cs test_trak1.cs test_iter.cs \ test_each_array.cs test_name.cs test_with.cs test_numbers.cs \ - test_splice.cs test_joo.cs + test_splice.cs test_joo.cs test_first_last.cs test_abs_max_min.cs all: $(TARGETS) @@ -64,7 +63,7 @@ for test in $(CS_TESTS); do \ rm -f $$test.out; \ ./cstest test.hdf $$test > $$test.out 2>&1; \ - diff --brief $$test.out $$test.gold 2>&1 > /dev/null; \ + diff $$test.out $$test.gold 2>&1 > /dev/null; \ return_code=$$?; \ if [ $$return_code -ne 0 ]; then \ diff $$test.gold $$test.out > $$test.err; \ @@ -75,7 +74,7 @@ done; \ rm -f test_tag.cs.out; \ ./cstest test_tag.hdf test_tag.cs> test_tag.cs.out 2>&1; \ - diff --brief test_tag.cs.out test_tag.cs.gold; \ + diff test_tag.cs.out test_tag.cs.gold; \ return_code=$$?; \ if [ $$return_code -ne 0 ]; then \ echo "Failed Regression Test: test_tag.cs"; \ @@ -88,7 +87,7 @@ @echo "Passed" install: all - $(NEOTONIC_ROOT)mkinstalldirs $(DESTDIR)$(cs_includedir)/cs + $(NEOTONIC_ROOT)/mkinstalldirs $(DESTDIR)$(cs_includedir)/cs $(INSTALL) -m 644 cs.h $(DESTDIR)$(cs_includedir)/cs $(INSTALL) -m 644 $(CS_LIB) $(DESTDIR)$(libdir) $(INSTALL) $(CSTEST_EXE) $(DESTDIR)$(bindir) diff -Nrub clearsilver-0.10.1/cs/test_abs_max_min.cs clearsilver-0.10.2/cs/test_abs_max_min.cs --- clearsilver-0.10.1/cs/test_abs_max_min.cs 1969-12-31 16:00:00.000000000 -0800 +++ clearsilver-0.10.2/cs/test_abs_max_min.cs 2005-09-01 12:09:48.000000000 -0700 @@ -0,0 +1,28 @@ + +abs(-10) = +abs("-10") = +abs("10") = +abs("0") = + + + abs() = + + +min(5,10) = +min(-5,10) = +min(-5,-10) = +min(5,-10) = + +max(5,10) = +max(-5,10) = +max(-5,-10) = +max(5,-10) = + + + + max(, ) = + max(, ) = + min(, ) = + min(, ) = + + diff -Nrub clearsilver-0.10.1/cs/test_abs_max_min.cs.gold clearsilver-0.10.2/cs/test_abs_max_min.cs.gold --- clearsilver-0.10.1/cs/test_abs_max_min.cs.gold 1969-12-31 16:00:00.000000000 -0800 +++ clearsilver-0.10.2/cs/test_abs_max_min.cs.gold 2005-09-07 14:57:26.000000000 -0700 @@ -0,0 +1,1239 @@ +Parsing test_abs_max_min.cs + +abs(-10) = 10 +abs("-10") = 10 +abs("10") = 10 +abs("0") = 0 + + + abs(-5) = 5 + + abs(-4) = 4 + + abs(-3) = 3 + + abs(-2) = 2 + + abs(-1) = 1 + + abs(0) = 0 + + abs(1) = 1 + + abs(2) = 2 + + abs(3) = 3 + + abs(4) = 4 + + abs(5) = 5 + + +min(5,10) = 5 +min(-5,10) = -5 +min(-5,-10) = -10 +min(5,-10) = -10 + +max(5,10) = 10 +max(-5,10) = 10 +max(-5,-10) = -5 +max(5,-10) = 5 + + + + max(-10, -10) = -10 + max(-10, -10) = -10 + min(-10, -10) = -10 + min(-10, -10) = -10 + + max(-10, -8) = -8 + max(-8, -10) = -8 + min(-10, -8) = -10 + min(-8, -10) = -10 + + max(-10, -6) = -6 + max(-6, -10) = -6 + min(-10, -6) = -10 + min(-6, -10) = -10 + + max(-10, -4) = -4 + max(-4, -10) = -4 + min(-10, -4) = -10 + min(-4, -10) = -10 + + max(-10, -2) = -2 + max(-2, -10) = -2 + min(-10, -2) = -10 + min(-2, -10) = -10 + + max(-10, 0) = 0 + max(0, -10) = 0 + min(-10, 0) = -10 + min(0, -10) = -10 + + max(-10, 2) = 2 + max(2, -10) = 2 + min(-10, 2) = -10 + min(2, -10) = -10 + + max(-10, 4) = 4 + max(4, -10) = 4 + min(-10, 4) = -10 + min(4, -10) = -10 + + max(-10, 6) = 6 + max(6, -10) = 6 + min(-10, 6) = -10 + min(6, -10) = -10 + + max(-10, 8) = 8 + max(8, -10) = 8 + min(-10, 8) = -10 + min(8, -10) = -10 + + max(-10, 10) = 10 + max(10, -10) = 10 + min(-10, 10) = -10 + min(10, -10) = -10 + + + + max(-9, -10) = -9 + max(-10, -9) = -9 + min(-9, -10) = -10 + min(-10, -9) = -10 + + max(-9, -8) = -8 + max(-8, -9) = -8 + min(-9, -8) = -9 + min(-8, -9) = -9 + + max(-9, -6) = -6 + max(-6, -9) = -6 + min(-9, -6) = -9 + min(-6, -9) = -9 + + max(-9, -4) = -4 + max(-4, -9) = -4 + min(-9, -4) = -9 + min(-4, -9) = -9 + + max(-9, -2) = -2 + max(-2, -9) = -2 + min(-9, -2) = -9 + min(-2, -9) = -9 + + max(-9, 0) = 0 + max(0, -9) = 0 + min(-9, 0) = -9 + min(0, -9) = -9 + + max(-9, 2) = 2 + max(2, -9) = 2 + min(-9, 2) = -9 + min(2, -9) = -9 + + max(-9, 4) = 4 + max(4, -9) = 4 + min(-9, 4) = -9 + min(4, -9) = -9 + + max(-9, 6) = 6 + max(6, -9) = 6 + min(-9, 6) = -9 + min(6, -9) = -9 + + max(-9, 8) = 8 + max(8, -9) = 8 + min(-9, 8) = -9 + min(8, -9) = -9 + + max(-9, 10) = 10 + max(10, -9) = 10 + min(-9, 10) = -9 + min(10, -9) = -9 + + + + max(-8, -10) = -8 + max(-10, -8) = -8 + min(-8, -10) = -10 + min(-10, -8) = -10 + + max(-8, -8) = -8 + max(-8, -8) = -8 + min(-8, -8) = -8 + min(-8, -8) = -8 + + max(-8, -6) = -6 + max(-6, -8) = -6 + min(-8, -6) = -8 + min(-6, -8) = -8 + + max(-8, -4) = -4 + max(-4, -8) = -4 + min(-8, -4) = -8 + min(-4, -8) = -8 + + max(-8, -2) = -2 + max(-2, -8) = -2 + min(-8, -2) = -8 + min(-2, -8) = -8 + + max(-8, 0) = 0 + max(0, -8) = 0 + min(-8, 0) = -8 + min(0, -8) = -8 + + max(-8, 2) = 2 + max(2, -8) = 2 + min(-8, 2) = -8 + min(2, -8) = -8 + + max(-8, 4) = 4 + max(4, -8) = 4 + min(-8, 4) = -8 + min(4, -8) = -8 + + max(-8, 6) = 6 + max(6, -8) = 6 + min(-8, 6) = -8 + min(6, -8) = -8 + + max(-8, 8) = 8 + max(8, -8) = 8 + min(-8, 8) = -8 + min(8, -8) = -8 + + max(-8, 10) = 10 + max(10, -8) = 10 + min(-8, 10) = -8 + min(10, -8) = -8 + + + + max(-7, -10) = -7 + max(-10, -7) = -7 + min(-7, -10) = -10 + min(-10, -7) = -10 + + max(-7, -8) = -7 + max(-8, -7) = -7 + min(-7, -8) = -8 + min(-8, -7) = -8 + + max(-7, -6) = -6 + max(-6, -7) = -6 + min(-7, -6) = -7 + min(-6, -7) = -7 + + max(-7, -4) = -4 + max(-4, -7) = -4 + min(-7, -4) = -7 + min(-4, -7) = -7 + + max(-7, -2) = -2 + max(-2, -7) = -2 + min(-7, -2) = -7 + min(-2, -7) = -7 + + max(-7, 0) = 0 + max(0, -7) = 0 + min(-7, 0) = -7 + min(0, -7) = -7 + + max(-7, 2) = 2 + max(2, -7) = 2 + min(-7, 2) = -7 + min(2, -7) = -7 + + max(-7, 4) = 4 + max(4, -7) = 4 + min(-7, 4) = -7 + min(4, -7) = -7 + + max(-7, 6) = 6 + max(6, -7) = 6 + min(-7, 6) = -7 + min(6, -7) = -7 + + max(-7, 8) = 8 + max(8, -7) = 8 + min(-7, 8) = -7 + min(8, -7) = -7 + + max(-7, 10) = 10 + max(10, -7) = 10 + min(-7, 10) = -7 + min(10, -7) = -7 + + + + max(-6, -10) = -6 + max(-10, -6) = -6 + min(-6, -10) = -10 + min(-10, -6) = -10 + + max(-6, -8) = -6 + max(-8, -6) = -6 + min(-6, -8) = -8 + min(-8, -6) = -8 + + max(-6, -6) = -6 + max(-6, -6) = -6 + min(-6, -6) = -6 + min(-6, -6) = -6 + + max(-6, -4) = -4 + max(-4, -6) = -4 + min(-6, -4) = -6 + min(-4, -6) = -6 + + max(-6, -2) = -2 + max(-2, -6) = -2 + min(-6, -2) = -6 + min(-2, -6) = -6 + + max(-6, 0) = 0 + max(0, -6) = 0 + min(-6, 0) = -6 + min(0, -6) = -6 + + max(-6, 2) = 2 + max(2, -6) = 2 + min(-6, 2) = -6 + min(2, -6) = -6 + + max(-6, 4) = 4 + max(4, -6) = 4 + min(-6, 4) = -6 + min(4, -6) = -6 + + max(-6, 6) = 6 + max(6, -6) = 6 + min(-6, 6) = -6 + min(6, -6) = -6 + + max(-6, 8) = 8 + max(8, -6) = 8 + min(-6, 8) = -6 + min(8, -6) = -6 + + max(-6, 10) = 10 + max(10, -6) = 10 + min(-6, 10) = -6 + min(10, -6) = -6 + + + + max(-5, -10) = -5 + max(-10, -5) = -5 + min(-5, -10) = -10 + min(-10, -5) = -10 + + max(-5, -8) = -5 + max(-8, -5) = -5 + min(-5, -8) = -8 + min(-8, -5) = -8 + + max(-5, -6) = -5 + max(-6, -5) = -5 + min(-5, -6) = -6 + min(-6, -5) = -6 + + max(-5, -4) = -4 + max(-4, -5) = -4 + min(-5, -4) = -5 + min(-4, -5) = -5 + + max(-5, -2) = -2 + max(-2, -5) = -2 + min(-5, -2) = -5 + min(-2, -5) = -5 + + max(-5, 0) = 0 + max(0, -5) = 0 + min(-5, 0) = -5 + min(0, -5) = -5 + + max(-5, 2) = 2 + max(2, -5) = 2 + min(-5, 2) = -5 + min(2, -5) = -5 + + max(-5, 4) = 4 + max(4, -5) = 4 + min(-5, 4) = -5 + min(4, -5) = -5 + + max(-5, 6) = 6 + max(6, -5) = 6 + min(-5, 6) = -5 + min(6, -5) = -5 + + max(-5, 8) = 8 + max(8, -5) = 8 + min(-5, 8) = -5 + min(8, -5) = -5 + + max(-5, 10) = 10 + max(10, -5) = 10 + min(-5, 10) = -5 + min(10, -5) = -5 + + + + max(-4, -10) = -4 + max(-10, -4) = -4 + min(-4, -10) = -10 + min(-10, -4) = -10 + + max(-4, -8) = -4 + max(-8, -4) = -4 + min(-4, -8) = -8 + min(-8, -4) = -8 + + max(-4, -6) = -4 + max(-6, -4) = -4 + min(-4, -6) = -6 + min(-6, -4) = -6 + + max(-4, -4) = -4 + max(-4, -4) = -4 + min(-4, -4) = -4 + min(-4, -4) = -4 + + max(-4, -2) = -2 + max(-2, -4) = -2 + min(-4, -2) = -4 + min(-2, -4) = -4 + + max(-4, 0) = 0 + max(0, -4) = 0 + min(-4, 0) = -4 + min(0, -4) = -4 + + max(-4, 2) = 2 + max(2, -4) = 2 + min(-4, 2) = -4 + min(2, -4) = -4 + + max(-4, 4) = 4 + max(4, -4) = 4 + min(-4, 4) = -4 + min(4, -4) = -4 + + max(-4, 6) = 6 + max(6, -4) = 6 + min(-4, 6) = -4 + min(6, -4) = -4 + + max(-4, 8) = 8 + max(8, -4) = 8 + min(-4, 8) = -4 + min(8, -4) = -4 + + max(-4, 10) = 10 + max(10, -4) = 10 + min(-4, 10) = -4 + min(10, -4) = -4 + + + + max(-3, -10) = -3 + max(-10, -3) = -3 + min(-3, -10) = -10 + min(-10, -3) = -10 + + max(-3, -8) = -3 + max(-8, -3) = -3 + min(-3, -8) = -8 + min(-8, -3) = -8 + + max(-3, -6) = -3 + max(-6, -3) = -3 + min(-3, -6) = -6 + min(-6, -3) = -6 + + max(-3, -4) = -3 + max(-4, -3) = -3 + min(-3, -4) = -4 + min(-4, -3) = -4 + + max(-3, -2) = -2 + max(-2, -3) = -2 + min(-3, -2) = -3 + min(-2, -3) = -3 + + max(-3, 0) = 0 + max(0, -3) = 0 + min(-3, 0) = -3 + min(0, -3) = -3 + + max(-3, 2) = 2 + max(2, -3) = 2 + min(-3, 2) = -3 + min(2, -3) = -3 + + max(-3, 4) = 4 + max(4, -3) = 4 + min(-3, 4) = -3 + min(4, -3) = -3 + + max(-3, 6) = 6 + max(6, -3) = 6 + min(-3, 6) = -3 + min(6, -3) = -3 + + max(-3, 8) = 8 + max(8, -3) = 8 + min(-3, 8) = -3 + min(8, -3) = -3 + + max(-3, 10) = 10 + max(10, -3) = 10 + min(-3, 10) = -3 + min(10, -3) = -3 + + + + max(-2, -10) = -2 + max(-10, -2) = -2 + min(-2, -10) = -10 + min(-10, -2) = -10 + + max(-2, -8) = -2 + max(-8, -2) = -2 + min(-2, -8) = -8 + min(-8, -2) = -8 + + max(-2, -6) = -2 + max(-6, -2) = -2 + min(-2, -6) = -6 + min(-6, -2) = -6 + + max(-2, -4) = -2 + max(-4, -2) = -2 + min(-2, -4) = -4 + min(-4, -2) = -4 + + max(-2, -2) = -2 + max(-2, -2) = -2 + min(-2, -2) = -2 + min(-2, -2) = -2 + + max(-2, 0) = 0 + max(0, -2) = 0 + min(-2, 0) = -2 + min(0, -2) = -2 + + max(-2, 2) = 2 + max(2, -2) = 2 + min(-2, 2) = -2 + min(2, -2) = -2 + + max(-2, 4) = 4 + max(4, -2) = 4 + min(-2, 4) = -2 + min(4, -2) = -2 + + max(-2, 6) = 6 + max(6, -2) = 6 + min(-2, 6) = -2 + min(6, -2) = -2 + + max(-2, 8) = 8 + max(8, -2) = 8 + min(-2, 8) = -2 + min(8, -2) = -2 + + max(-2, 10) = 10 + max(10, -2) = 10 + min(-2, 10) = -2 + min(10, -2) = -2 + + + + max(-1, -10) = -1 + max(-10, -1) = -1 + min(-1, -10) = -10 + min(-10, -1) = -10 + + max(-1, -8) = -1 + max(-8, -1) = -1 + min(-1, -8) = -8 + min(-8, -1) = -8 + + max(-1, -6) = -1 + max(-6, -1) = -1 + min(-1, -6) = -6 + min(-6, -1) = -6 + + max(-1, -4) = -1 + max(-4, -1) = -1 + min(-1, -4) = -4 + min(-4, -1) = -4 + + max(-1, -2) = -1 + max(-2, -1) = -1 + min(-1, -2) = -2 + min(-2, -1) = -2 + + max(-1, 0) = 0 + max(0, -1) = 0 + min(-1, 0) = -1 + min(0, -1) = -1 + + max(-1, 2) = 2 + max(2, -1) = 2 + min(-1, 2) = -1 + min(2, -1) = -1 + + max(-1, 4) = 4 + max(4, -1) = 4 + min(-1, 4) = -1 + min(4, -1) = -1 + + max(-1, 6) = 6 + max(6, -1) = 6 + min(-1, 6) = -1 + min(6, -1) = -1 + + max(-1, 8) = 8 + max(8, -1) = 8 + min(-1, 8) = -1 + min(8, -1) = -1 + + max(-1, 10) = 10 + max(10, -1) = 10 + min(-1, 10) = -1 + min(10, -1) = -1 + + + + max(0, -10) = 0 + max(-10, 0) = 0 + min(0, -10) = -10 + min(-10, 0) = -10 + + max(0, -8) = 0 + max(-8, 0) = 0 + min(0, -8) = -8 + min(-8, 0) = -8 + + max(0, -6) = 0 + max(-6, 0) = 0 + min(0, -6) = -6 + min(-6, 0) = -6 + + max(0, -4) = 0 + max(-4, 0) = 0 + min(0, -4) = -4 + min(-4, 0) = -4 + + max(0, -2) = 0 + max(-2, 0) = 0 + min(0, -2) = -2 + min(-2, 0) = -2 + + max(0, 0) = 0 + max(0, 0) = 0 + min(0, 0) = 0 + min(0, 0) = 0 + + max(0, 2) = 2 + max(2, 0) = 2 + min(0, 2) = 0 + min(2, 0) = 0 + + max(0, 4) = 4 + max(4, 0) = 4 + min(0, 4) = 0 + min(4, 0) = 0 + + max(0, 6) = 6 + max(6, 0) = 6 + min(0, 6) = 0 + min(6, 0) = 0 + + max(0, 8) = 8 + max(8, 0) = 8 + min(0, 8) = 0 + min(8, 0) = 0 + + max(0, 10) = 10 + max(10, 0) = 10 + min(0, 10) = 0 + min(10, 0) = 0 + + + + max(1, -10) = 1 + max(-10, 1) = 1 + min(1, -10) = -10 + min(-10, 1) = -10 + + max(1, -8) = 1 + max(-8, 1) = 1 + min(1, -8) = -8 + min(-8, 1) = -8 + + max(1, -6) = 1 + max(-6, 1) = 1 + min(1, -6) = -6 + min(-6, 1) = -6 + + max(1, -4) = 1 + max(-4, 1) = 1 + min(1, -4) = -4 + min(-4, 1) = -4 + + max(1, -2) = 1 + max(-2, 1) = 1 + min(1, -2) = -2 + min(-2, 1) = -2 + + max(1, 0) = 1 + max(0, 1) = 1 + min(1, 0) = 0 + min(0, 1) = 0 + + max(1, 2) = 2 + max(2, 1) = 2 + min(1, 2) = 1 + min(2, 1) = 1 + + max(1, 4) = 4 + max(4, 1) = 4 + min(1, 4) = 1 + min(4, 1) = 1 + + max(1, 6) = 6 + max(6, 1) = 6 + min(1, 6) = 1 + min(6, 1) = 1 + + max(1, 8) = 8 + max(8, 1) = 8 + min(1, 8) = 1 + min(8, 1) = 1 + + max(1, 10) = 10 + max(10, 1) = 10 + min(1, 10) = 1 + min(10, 1) = 1 + + + + max(2, -10) = 2 + max(-10, 2) = 2 + min(2, -10) = -10 + min(-10, 2) = -10 + + max(2, -8) = 2 + max(-8, 2) = 2 + min(2, -8) = -8 + min(-8, 2) = -8 + + max(2, -6) = 2 + max(-6, 2) = 2 + min(2, -6) = -6 + min(-6, 2) = -6 + + max(2, -4) = 2 + max(-4, 2) = 2 + min(2, -4) = -4 + min(-4, 2) = -4 + + max(2, -2) = 2 + max(-2, 2) = 2 + min(2, -2) = -2 + min(-2, 2) = -2 + + max(2, 0) = 2 + max(0, 2) = 2 + min(2, 0) = 0 + min(0, 2) = 0 + + max(2, 2) = 2 + max(2, 2) = 2 + min(2, 2) = 2 + min(2, 2) = 2 + + max(2, 4) = 4 + max(4, 2) = 4 + min(2, 4) = 2 + min(4, 2) = 2 + + max(2, 6) = 6 + max(6, 2) = 6 + min(2, 6) = 2 + min(6, 2) = 2 + + max(2, 8) = 8 + max(8, 2) = 8 + min(2, 8) = 2 + min(8, 2) = 2 + + max(2, 10) = 10 + max(10, 2) = 10 + min(2, 10) = 2 + min(10, 2) = 2 + + + + max(3, -10) = 3 + max(-10, 3) = 3 + min(3, -10) = -10 + min(-10, 3) = -10 + + max(3, -8) = 3 + max(-8, 3) = 3 + min(3, -8) = -8 + min(-8, 3) = -8 + + max(3, -6) = 3 + max(-6, 3) = 3 + min(3, -6) = -6 + min(-6, 3) = -6 + + max(3, -4) = 3 + max(-4, 3) = 3 + min(3, -4) = -4 + min(-4, 3) = -4 + + max(3, -2) = 3 + max(-2, 3) = 3 + min(3, -2) = -2 + min(-2, 3) = -2 + + max(3, 0) = 3 + max(0, 3) = 3 + min(3, 0) = 0 + min(0, 3) = 0 + + max(3, 2) = 3 + max(2, 3) = 3 + min(3, 2) = 2 + min(2, 3) = 2 + + max(3, 4) = 4 + max(4, 3) = 4 + min(3, 4) = 3 + min(4, 3) = 3 + + max(3, 6) = 6 + max(6, 3) = 6 + min(3, 6) = 3 + min(6, 3) = 3 + + max(3, 8) = 8 + max(8, 3) = 8 + min(3, 8) = 3 + min(8, 3) = 3 + + max(3, 10) = 10 + max(10, 3) = 10 + min(3, 10) = 3 + min(10, 3) = 3 + + + + max(4, -10) = 4 + max(-10, 4) = 4 + min(4, -10) = -10 + min(-10, 4) = -10 + + max(4, -8) = 4 + max(-8, 4) = 4 + min(4, -8) = -8 + min(-8, 4) = -8 + + max(4, -6) = 4 + max(-6, 4) = 4 + min(4, -6) = -6 + min(-6, 4) = -6 + + max(4, -4) = 4 + max(-4, 4) = 4 + min(4, -4) = -4 + min(-4, 4) = -4 + + max(4, -2) = 4 + max(-2, 4) = 4 + min(4, -2) = -2 + min(-2, 4) = -2 + + max(4, 0) = 4 +