diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1997-04-16 01:40:22 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1997-04-16 01:40:22 -0400 |
commit | e4409c408eedf320b8845cafdd62b664bec1afd8 (patch) | |
tree | ccce96259ffd0a5edf9dc05e49262aaf5854fd99 /WWW/Library | |
parent | 36a66292ee2ec3530d776892d22d6c5ace810ae0 (diff) | |
download | lynx-snapshots-e4409c408eedf320b8845cafdd62b664bec1afd8.tar.gz |
snapshot of project "lynx", label v2-7-1ac_0-6
Diffstat (limited to 'WWW/Library')
39 files changed, 2471 insertions, 247 deletions
diff --git a/WWW/Library/Implementation/BSDI_Makefile b/WWW/Library/Implementation/BSDI_Makefile index 65653ca3..31f5dfef 100644 --- a/WWW/Library/Implementation/BSDI_Makefile +++ b/WWW/Library/Implementation/BSDI_Makefile @@ -1,11 +1,11 @@ -# Make WWW under svr4 +# Make WWW under unix # # For W3 distribution, machine type for subdirectories -WWW_MACH = svr4 +WWW_MACH = unix # The ASIS repository's name for the machine we are on -ASIS_MACH = generic/svr4 +ASIS_MACH = generic/unix CFLAGS = -O -DDEBUG -DUSE_DIRENT -DSVR4 -DNO_FILIO_H diff --git a/WWW/Library/Implementation/CommonMakefile b/WWW/Library/Implementation/CommonMakefile index bd32f131..dea974b0 100644 --- a/WWW/Library/Implementation/CommonMakefile +++ b/WWW/Library/Implementation/CommonMakefile @@ -30,6 +30,8 @@ # If this env var is set to something else Some makes will use that instead SHELL = /bin/sh +RANLIB = ranlib + # .h files are distributed but originally are made from the # self-documenting hypertext files. @@ -60,12 +62,6 @@ LOB = $(WTMP)/Library/$(WWW_MACH) #WAISCFLAGS = -DDIRECT_WAIS # -# This path, if relative, is taken relative to the directory -# in which this makefile is, not the pwd. This screws up the -# recursive invocation -# include $(CMN)Version.make -include $(ABS)$(WWW)/Library/Implementation/Version.make - # XMOsAIC hack is only for server to cope with xmosaic kludge for mmedia # # add -DNEW_GATEWAY here for the new gateway config stuff @@ -142,7 +138,7 @@ SPECIFIC = $(WWW)/All/*/Makefile.include $(WWW)/All/Implementation/Makefile* \ # for that step $(LOB)/libwww.a : $(COMMON) ar r $(LOB)/libwww.a $(COMMON) - -ranlib $(LOB)/libwww.a + -$(RANLIB) $(LOB)/libwww.a # Clean up everything generatable except final products clean : diff --git a/WWW/Library/Implementation/HTAAProt.c b/WWW/Library/Implementation/HTAAProt.c index 751b51fc..91fc81bd 100644 --- a/WWW/Library/Implementation/HTAAProt.c +++ b/WWW/Library/Implementation/HTAAProt.c @@ -21,8 +21,10 @@ #include <string.h> #ifndef VMS +#ifndef NOUSERS #include <pwd.h> /* Unix password file routine: getpwnam() */ #include <grp.h> /* Unix group file routine: getgrnam() */ +#endif /* NOUSERS */ #endif /* not VMS */ #include "HTAAUtil.h" @@ -70,7 +72,7 @@ PRIVATE BOOL isNumber ARGS1(CONST char *, s) } -#ifdef VMS +#if defined (VMS) || defined (NOUSERS) /* PUBLIC HTAA_getUidName() ** GET THE USER ID NAME (VMS ONLY) ** ON ENTRY: diff --git a/WWW/Library/Implementation/HTAccess.h b/WWW/Library/Implementation/HTAccess.h index 78685f8d..d883e10f 100644 --- a/WWW/Library/Implementation/HTAccess.h +++ b/WWW/Library/Implementation/HTAccess.h @@ -140,7 +140,7 @@ Load a document from absolute name addr The absolute address of the document to be accessed. - filter if YES, treat document as HTML + filter_it if YES, treat document as HTML */ @@ -168,7 +168,7 @@ Load a document from absolute name to a stream addr The absolute address of the document to be accessed. - filter if YES, treat document as HTML + filter_it if YES, treat document as HTML ON EXIT, @@ -179,7 +179,7 @@ Load a document from absolute name to a stream Note: This is equivalent to HTLoadDocument */ -extern BOOL HTLoadToStream PARAMS((CONST char * addr, BOOL filter, +extern BOOL HTLoadToStream PARAMS((CONST char * addr, BOOL filter_it, HTStream * sink)); diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c index f9b44054..40032d8a 100644 --- a/WWW/Library/Implementation/HTAnchor.c +++ b/WWW/Library/Implementation/HTAnchor.c @@ -173,7 +173,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChild ARGS2( fprintf(stderr, "HTAnchor_findChild called with NULL parent.\n"); return NULL; } - if (kids = parent->children) { /* parent has children : search them */ + if ((kids = parent->children) != 0) { /* parent has children : search them */ if (tag && *tag) { /* TBL */ while (NULL != (child=(HTChildAnchor *)HTList_nextObject(kids))) { #ifdef CASE_INSENSITIVE_ANCHORS @@ -465,7 +465,7 @@ PRIVATE void deleteLinks ARGS1( * their parents to know that they are no longer * the destination of me's anchor. */ - while (target = (HTLink *)HTList_removeLastObject(me->links)) { + while ((target = (HTLink *)HTList_removeLastObject(me->links)) != 0) { parent = target->dest->parent; if (!HTList_isEmpty(parent->sources)) { /* @@ -555,7 +555,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1( */ if (!HTList_isEmpty(me->children)) { cur = me->children; - while (child = (HTChildAnchor *)HTList_nextObject(cur)) { + while ((child = (HTChildAnchor *)HTList_nextObject(cur)) != 0) { if (child != NULL) { deleteLinks((HTAnchor *)child); } @@ -573,8 +573,8 @@ PUBLIC BOOL HTAnchor_delete ARGS1( * First, recursively delete children and their links. */ if (!HTList_isEmpty(me->children)) { - while (child = (HTChildAnchor *)HTList_removeLastObject( - me->children)) { + while ((child = (HTChildAnchor *)HTList_removeLastObject( + me->children)) != 0) { if (child) { deleteLinks((HTAnchor *)child); if (child->tag) { @@ -628,7 +628,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1( FREE(me->RevTitle); if (me->FileCache) { FILE *fd; - if (fd = fopen(me->FileCache, "r")) { + if ((fd = fopen(me->FileCache, "r")) != 0) { fclose(fd); remove(me->FileCache); } @@ -671,6 +671,10 @@ PUBLIC BOOL HTAnchor_delete ARGS1( */ FREE(me->address); +#ifdef EXP_CHARTRANS + FREE (me->UCStages); +#endif + /* * Finally, kill the parent anchor passed in. */ @@ -1088,3 +1092,155 @@ PUBLIC void HTAnchor_setPhysical ARGS2( StrAllocCopy(me->physical, physical); } } + +#ifdef EXP_CHARTRANS + +#include "UCMap.h" +extern LYUCcharset LYCharSet_UC[]; + +/* We store charset info in the HTParentAnchor object, for several +** "stages". (See UCDefs.h) +** A stream method is supposed to know what stage in the model it is. +** +** General model MIME -> parser -> structured -> HText +** e.g. text/html +** from HTTP: HTMIME.c -> SGML.c -> HTML.c -> GridText.c +** text/plain +** from file: HTFile.c -> HTPlain.c -> GridText.c +** +** The lock/set_by is used to lock e.g. a charset set by an explicit +** HTTP MIME header against overriding by a HTML META tag - the MIME +** header has higher priority. Defaults (from -assume_.. options etc.) +** will not override charset explicitly given by server. +** +** Some advantages of keeping this in the HTAnchor: +** - Global variables are bad. +** - Can remember a charset given by META tag when toggling to SOURCE view. +** - Can remember a charset given by <A CHARSET=...> href in another doc. +** +** We don't modify the HTParentAnchor's charset element +** here, that one will only be set when explicitly given. +*/ +PUBLIC LYUCcharset * HTAnchor_getUCInfoStage ARGS2( + HTParentAnchor *, me, + int, which_stage) +{ + if (me && !me->UCStages) { + int i; + int chndl = UCLYhndl_for_unspec; + UCAnchorInfo * stages = + (UCAnchorInfo*) calloc(1, sizeof(UCAnchorInfo)); + if (stages == NULL) + outofmem(__FILE__, "HTAnchor_getUCInfoStage"); + for(i = 0; i < UCT_STAGEMAX; i++) { + stages->s[i].C.MIMEname = ""; + stages->s[i].LYhndl = -1; + } + if (me->charset) { + chndl = UCGetLYhndl_byMIME(me->charset); + if (chndl < 0) { + chndl = UCLYhndl_for_unrec; + } + } + if (chndl >= 0) { + memcpy(&stages->s[UCT_STAGE_MIME].C, &LYCharSet_UC[chndl], + sizeof(LYUCcharset)); + stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_DEFAULT; + } + else { /* should not happen... */ + stages->s[UCT_STAGE_MIME].C.UChndl = -1; + stages->s[UCT_STAGE_MIME].lock = UCT_SETBY_NONE; + } + stages->s[UCT_STAGE_MIME].LYhndl = chndl; + me->UCStages = stages; + } + if (me) { + return &me->UCStages->s[which_stage].C; + } + return NULL; +} + +PUBLIC int HTAnchor_getUCLYhndl ARGS2( + HTParentAnchor *, me, + int, which_stage) +{ + if (me) { + if (!me->UCStages) { + /* this will allocate and initialize, if not yet done */ + (void) HTAnchor_getUCInfoStage(me, which_stage); + } + if (me->UCStages->s[which_stage].lock > UCT_SETBY_NONE) + return me->UCStages->s[which_stage].LYhndl; + } + return -1; +} + +PUBLIC LYUCcharset * HTAnchor_setUCInfoStage ARGS4( + HTParentAnchor *, me, + int, LYhndl, + int, which_stage, + int, set_by) +{ + if (me) { + /* this will allocate and initialize, if not yet done */ + LYUCcharset * p = HTAnchor_getUCInfoStage(me, which_stage); + /* Can we override? */ + if (set_by >= me->UCStages->s[which_stage].lock) { + me->UCStages->s[which_stage].lock = set_by; + me->UCStages->s[which_stage].LYhndl = LYhndl; + if (LYhndl >= 0) { + memcpy(p, &LYCharSet_UC[LYhndl], + sizeof(LYUCcharset)); + } + else { + p->UChndl = -1; + } + return p; + } + } + return NULL; +} +PUBLIC LYUCcharset * HTAnchor_resetUCInfoStage ARGS4( + HTParentAnchor *, me, + int, LYhndl, + int, which_stage, + int, set_by) +{ + if (!me || !me->UCStages) + return NULL; + me->UCStages->s[which_stage].lock = set_by; + me->UCStages->s[which_stage].LYhndl = LYhndl; + return &me->UCStages->s[which_stage].C; +} + +/* A set_by of (-1) means use the lock value from the from_stage */ +PUBLIC LYUCcharset * HTAnchor_copyUCInfoStage ARGS4( + HTParentAnchor *, me, + int, to_stage, + int, from_stage, + int, set_by) +{ + if (me) { + /* this will allocate and initialize, if not yet done */ + LYUCcharset * p_from = HTAnchor_getUCInfoStage(me, from_stage); + LYUCcharset * p_to = HTAnchor_getUCInfoStage(me, to_stage); + /* Can we override? */ + if (set_by == -1) + set_by = me->UCStages->s[from_stage].lock; + if (set_by == UCT_SETBY_NONE) + set_by = UCT_SETBY_DEFAULT; + if (set_by >= me->UCStages->s[to_stage].lock) { + me->UCStages->s[to_stage].lock = set_by; + me->UCStages->s[to_stage].LYhndl = + me->UCStages->s[from_stage].LYhndl; + + memcpy(p_to, p_from, + sizeof(LYUCcharset)); + + return p_to; + } + } + return NULL; +} + +#endif /* EXP_CHARTRANS */ diff --git a/WWW/Library/Implementation/HTAnchor.h b/WWW/Library/Implementation/HTAnchor.h index 934fe2c7..efa2a307 100644 --- a/WWW/Library/Implementation/HTAnchor.h +++ b/WWW/Library/Implementation/HTAnchor.h @@ -16,6 +16,9 @@ #include "HTList.h" #include "HTAtom.h" +#ifdef EXP_CHARTRANS +#include "UCDefs.h" +#endif #ifdef SHORT_NAMES #define HTAnchor_findChild HTAnFiCh @@ -119,6 +122,9 @@ struct _HTParentAnchor { char * expires; /* Expires */ char * last_modified; /* Last-Modified */ char * server; /* Server */ +#ifdef EXP_CHARTRANS + UCAnchorInfo * UCStages; +#endif }; typedef struct { @@ -372,6 +378,29 @@ extern void HTAnchor_setPhysical PARAMS(( #endif /* HTANCHOR_H */ +#ifdef EXP_CHARTRANS + +extern LYUCcharset * HTAnchor_getUCInfoStage PARAMS((HTParentAnchor * me, + int which_stage)); +extern int HTAnchor_getUCLYhndl PARAMS((HTParentAnchor * me, + int which_stage)); +extern LYUCcharset * HTAnchor_setUCInfoStage PARAMS((HTParentAnchor * me, + int LYhndl, + int which_stage, + int set_by)); +extern LYUCcharset * HTAnchor_setUCInfoStage PARAMS((HTParentAnchor * me, + int LYhndl, + int which_stage, + int set_by)); +extern LYUCcharset * HTAnchor_resetUCInfoStage PARAMS((HTParentAnchor * me, + int LYhndl, + int which_stage, + int set_by)); +extern LYUCcharset * HTAnchor_copyUCInfoStage PARAMS((HTParentAnchor * me, + int to_stage, + int from_stage, + int set_by)); +#endif /* */ diff --git a/WWW/Library/Implementation/HTCJK.h b/WWW/Library/Implementation/HTCJK.h index 8944cd42..c5fa51af 100644 --- a/WWW/Library/Implementation/HTCJK.h +++ b/WWW/Library/Implementation/HTCJK.h @@ -79,7 +79,7 @@ extern void JISx0201TO0208_SJIS PARAMS(( extern unsigned char * SJIS_TO_EUC1 PARAMS(( unsigned char HI, unsigned char LO, - unsigned char * EUC)); + unsigned char * EUCp)); extern unsigned char * SJIS_TO_EUC PARAMS(( unsigned char * src, diff --git a/WWW/Library/Implementation/HTDOS.c b/WWW/Library/Implementation/HTDOS.c new file mode 100644 index 00000000..79a8b463 --- /dev/null +++ b/WWW/Library/Implementation/HTDOS.c @@ -0,0 +1,95 @@ +/* DOS specific routines + + */ + +#include <mem.h> +#include <dos.h> +#include "htstring.h" + +/* PUBLIC HTDOS_wwwName() +** CONVERTS DOS Name into WWW Name +** ON ENTRY: +** dosname DOS file specification (NO NODE) +** +** ON EXIT: +** returns www file specification +** +*/ +char * HTDOS_wwwName (char *dosname) +{ + static char wwwname[1024]; + char *cp_url = wwwname; + + strcpy(wwwname,dosname); + + for ( ; *cp_url != '\0' ; cp_url++) + if(*cp_url == '\\') *cp_url = '/'; + + if(strlen(wwwname) > 3 && *cp_url == '/') + *cp_url = '\0'; + + if(*cp_url == ':') + { + cp_url++; + *cp_url = '/'; + } + +/* + if((strlen(wwwname)>2)&&(wwwname[1]==':')) wwwname[1]='|'; + printf("\n\nwww: %s\n\ndos: %s\n\n",wwwname,dosname); + sleep(5); +*/ + return(wwwname); +} + + +/* PUBLIC HTDOS_name() +** CONVERTS WWW name into a DOS name +** ON ENTRY: +** fn WWW file name +** +** ON EXIT: +** returns dos file specification +** +** Bug: Returns pointer to static -- non-reentrant +*/ +char * HTDOS_name(char *dosname) { + + static char cp_url[1024]; + int joe; + + memset(cp_url, 0, 1023); +/* strset(cp_url,0); */ + sprintf(cp_url, "%s",dosname); + + for(joe = 0; cp_url[joe] != '\0'; joe++) { + if(cp_url[joe] == '/') { + cp_url[joe] = '\\'; + } + } + +// if(strlen(cp_url) < 4) cp_url[] = ':'; + if(strlen(cp_url) == 3) cp_url[3] = '\\'; + + if(strlen(cp_url) == 4) cp_url[4] = '.'; + + if((strlen(cp_url) > 2) && (cp_url[1] == '|')) + cp_url[1] = ':'; + + if((cp_url[1] == '\\') || (cp_url[0] != '\\')) + { +/* + printf("\n\n%s = i%\n\n",cp_url,strlen(cp_url)); + sleep(5); +/**/ + return(cp_url); + } else { +/* + printf("\n\n%s = %i\n\n",cp_url+1,strlen(cp_url)); + sleep(5); +/**/ + return(cp_url+1); + } +} + + diff --git a/WWW/Library/Implementation/HTDOS.h b/WWW/Library/Implementation/HTDOS.h new file mode 100644 index 00000000..2247c5ef --- /dev/null +++ b/WWW/Library/Implementation/HTDOS.h @@ -0,0 +1,34 @@ +/* DOS specific routines + + */ + +#ifndef HTDOS_H +#define HTDOS_H + +/* PUBLIC HTDOS_wwwName() +** CONVERTS DOS Name into WWW Name +** ON ENTRY: +** dosname DOS file specification (NO NODE) +** +** ON EXIT: +** returns www file specification +** +*/ +char * HTDOS_wwwName (char * dosname); + +/* PUBLIC HTDOS_name() +** CONVERTS WWW name into a DOS name +** ON ENTRY: +** fn WWW file name +** +** ON EXIT: +** returns dos file specification +** +** Bug: Returns pointer to static -- non-reentrant +*/ +char * HTDOS_name (char * fn); + +#endif /* not HTDOS_H */ +/* + + End of file HTDOS.h. */ diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c index c90b3473..8be44d44 100644 --- a/WWW/Library/Implementation/HTFTP.c +++ b/WWW/Library/Implementation/HTFTP.c @@ -71,6 +71,10 @@ BUGS: @@@ Limit connection cache size! ** same time. */ +#ifdef DJGPP +#define u_long unsigned long +#endif + #include "HTUtils.h" #include "tcp.h" @@ -108,12 +112,6 @@ BUGS: @@@ Limit connection cache size! #include "LYLeaks.h" -#ifdef REMOVED_CODE -extern char *malloc(); -extern void free(); -extern char *strncpy(); -#endif /* REMOVED_CODE */ - typedef struct _connection { struct _connection * next; /* Link on list */ u_long addr; /* IP address */ @@ -2775,7 +2773,7 @@ PUBLIC int HTFTPLoad ARGS4( } else { format = HTFileFormat(filename, &encoding); } - format = HTCharsetFormat(format, anchor); + format = HTCharsetFormat(format, anchor, -1); binary = (encoding != HTAtom_for("8bit") && encoding != HTAtom_for("7bit")); if (!binary && @@ -3203,7 +3201,7 @@ listen: FileName[len - 2] = '\0'; format = HTFileFormat(FileName, &encoding); - format = HTCharsetFormat(format, anchor); + format = HTCharsetFormat(format, anchor, -1); StrAllocCopy(anchor->content_type, format->name); StrAllocCopy(anchor->content_encoding, "x-compress"); format = HTAtom_for("www/compressed"); @@ -3214,7 +3212,7 @@ listen: FileName[len - 3] == '_') { FileName[len - 3] = '\0'; format = HTFileFormat(FileName, &encoding); - format = HTCharsetFormat(format, anchor); + format = HTCharsetFormat(format, anchor, -1); StrAllocCopy(anchor->content_type, format->name); StrAllocCopy(anchor->content_encoding, "x-gzip"); format = HTAtom_for("www/compressed"); diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c index af433de7..40097a96 100644 --- a/WWW/Library/Implementation/HTFile.c +++ b/WWW/Library/Implementation/HTFile.c @@ -25,6 +25,13 @@ /* #define NO_PARENT_DIR_REFERENCE */ /* Define this for no parent links */ #endif /* !VMS */ +#ifdef DOSPATH +#define GOT_READ_DIR +#include <dirent.h> +#define USE_DIRENT +#include "HTDOS.h" +#endif + #include "HTUtils.h" #include "tcp.h" #include "HTFile.h" /* Implemented here */ @@ -63,6 +70,11 @@ #include "HTBTree.h" #include "HTAlert.h" #include "HTCJK.h" +#ifdef EXP_CHARTRANS +#include "UCDefs.h" +#include "UCMap.h" +#include "UCAux.h" +#endif /* EXP_CHARTRANS */ #include "LYexit.h" #include "LYLeaks.h" @@ -82,13 +94,6 @@ typedef struct _HTSuffix { #endif /* NGROUPS_MAX */ #endif /* NGROUPS */ - -#ifdef USE_DIRENT /* Set this for Sys V systems */ -#define STRUCT_DIRENT struct dirent -#else -#define STRUCT_DIRENT struct direct -#endif /* USE_DIRENT */ - #include "HTML.h" /* For directory object building */ #define PUTC(c) (*target->isa->put_character)(target, c) @@ -120,6 +125,9 @@ extern int current_char_set; extern char *LYchar_set_names[]; extern BOOL HTPassEightBitRaw; extern HTCJKlang HTCJK; +#ifndef EXP_CHARTRANS +#define UCLYhndl_HTFile_for_unspec 0 /* a dummy define */ +#endif PRIVATE char *HTMountRoot = "/Net/"; /* Where to find mounts */ #ifdef VMS @@ -138,6 +146,14 @@ PRIVATE HTSuffix no_suffix = { "*", NULL, NULL, 1.0 }; PRIVATE HTSuffix unknown_suffix = { "*.*", NULL, NULL, 1.0}; +#ifdef _WINDOWS +int exists(char *filename) +{ + return (access(filename,0)==0); +} +#endif + + /* To free up the suffixes at program exit. ** ---------------------------------------- */ @@ -535,7 +551,11 @@ PUBLIC char * HTLocalName ARGS1( FREE(host); if (TRACE) fprintf(stderr, "Node `%s' means path `%s'\n", name, path); +#ifdef DOSPATH + return(HTDOS_name(path)); +#else return(path); +#endif /* DOSPATH */ } else { char * result = (char *)malloc( strlen("/Net/")+strlen(host)+strlen(path)+1); @@ -606,6 +626,7 @@ PUBLIC char * WWW_nameOfFile ARGS1( } if (TRACE) fprintf(stderr, "File `%s'\n\tmeans node `%s'\n", name, result); + return result; } @@ -744,12 +765,15 @@ PUBLIC HTFormat HTFileFormat ARGS2( ** indicated, sets Lynx up for proper handling in relation ** to the currently selected character set. - FM */ -PUBLIC HTFormat HTCharsetFormat ARGS2( +PUBLIC HTFormat HTCharsetFormat ARGS3( HTFormat, format, - HTParentAnchor *, anchor) + HTParentAnchor *, anchor, + int, default_LYhndl) { - char *cp = NULL, *cp1, *cp2; + char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4; + BOOL chartrans_ok = FALSE; + int chndl = -1; int i; FREE(anchor->charset); @@ -765,6 +789,84 @@ PUBLIC HTFormat HTCharsetFormat ARGS2( cp2 += 7; while (*cp2 == ' ' || *cp2 == '=') cp2++; +#ifdef EXP_CHARTRANS + StrAllocCopy(cp3, cp2); /* copy to mutilate more */ + for (cp4=cp3; (*cp4 != '\0' && *cp4 != '"' && + *cp4 != ';' && *cp4 != ':' && + !WHITE(*cp4)); cp4++) + /* nothing */ ; + *cp4 = '\0'; + cp4 = cp3; + chndl = UCGetLYhndl_byMIME(cp3); + if (chndl < 0) { + if (0==strcmp(cp4, "cn-big5")) { + cp4 += 3; + chndl = UCGetLYhndl_byMIME(cp4); + } + else if (0==strncmp(cp4, "cn-gb", 5)) { + StrAllocCopy(cp3, "gb2312"); + cp4 = cp3; + chndl = UCGetLYhndl_byMIME(cp4); + } + } + if (UCCanTranslateFromTo(chndl, current_char_set)) + { + chartrans_ok = YES; + *cp1 = '\0'; + format = HTAtom_for(cp); + StrAllocCopy(anchor->charset, cp4); + HTAnchor_setUCInfoStage(anchor, chndl, + UCT_STAGE_MIME, UCT_SETBY_MIME); + } + else if (chndl < 0) {/* got something but we don't + recognize it */ + chndl = UCLYhndl_for_unrec; + if (UCCanTranslateFromTo(chndl, + current_char_set)) + { + chartrans_ok = YES; + HTAnchor_setUCInfoStage(anchor, chndl, + UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + } + } + FREE(cp3); + if (chartrans_ok) { + LYUCcharset * p_in = + HTAnchor_getUCInfoStage(anchor, + UCT_STAGE_MIME); + LYUCcharset * p_out = + HTAnchor_setUCInfoStage(anchor, + current_char_set, + UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); + if (!p_out) /* try again */ + p_out = + HTAnchor_getUCInfoStage(anchor, + UCT_STAGE_HTEXT); + + if (0==strcmp(p_in->MIMEname,"x-transparent")) + { + HTPassEightBitRaw = TRUE; + HTAnchor_setUCInfoStage(anchor, + HTAnchor_getUCLYhndl(anchor, + UCT_STAGE_HTEXT), + UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + } + if (0==strcmp(p_out->MIMEname,"x-transparent")) + { + HTPassEightBitRaw = TRUE; + HTAnchor_setUCInfoStage(anchor, + HTAnchor_getUCLYhndl(anchor, + UCT_STAGE_MIME), + UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); + } + if (!(p_in->enc & UCT_ENC_CJK) && + (p_in->codepoints & UCT_CP_SUBSETOF_LAT1)){ + HTCJK = NOCJK; + } else if (chndl == current_char_set) { + HTPassEightBitRaw = TRUE; + } + } else /* Fall through to old behavior */ +#endif /* EXP_CHARTRANS */ if (!strncmp(cp2, "us-ascii", 8) || !strncmp(cp2, "iso-8859-1", 10)) { *cp1 = '\0'; @@ -853,6 +955,16 @@ PUBLIC HTFormat HTCharsetFormat ARGS2( } FREE(cp); +#ifdef EXP_CHARTRANS + if (!chartrans_ok && !anchor->charset && default_LYhndl >= 0) { + HTAnchor_setUCInfoStage(anchor, default_LYhndl, + UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + } + HTAnchor_copyUCInfoStage(anchor, + UCT_STAGE_PARSER, UCT_STAGE_MIME, + -1); +#endif + return format; } @@ -906,6 +1018,9 @@ PUBLIC float HTFileValue ARGS1( #ifdef PCNFS #define NO_GROUPS #endif /* PCNFS */ +#ifdef NOUSERS +#define NO_GROUPS +#endif /* PCNFS */ PUBLIC BOOL HTEditable ARGS1( CONST char *, filename) @@ -1033,7 +1148,7 @@ PUBLIC void HTDirEntry ARGS3( ** ------------------------------ ** ** This gives the TITLE and H1 header, and also a link -/** to the parent directory if appropriate. +** to the parent directory if appropriate. ** ** On exit: ** Returns TRUE if an "Up to <parent>" link was not created @@ -1054,6 +1169,10 @@ PUBLIC BOOL HTDirTitles ARGS3( BOOL need_parent_link = FALSE; int i; +#ifdef DOSPATH + BOOL local_link = FALSE; + if (logical[18] == ':') local_link = TRUE; +#endif /* ** Check tildeIsTop for treating home directory as Welcome ** (assume the tilde is not followed by a username). - FM @@ -1160,8 +1279,19 @@ PUBLIC BOOL HTDirTitles ARGS3( relative = (char*) malloc(strlen(current) + 4); if (relative == NULL) outofmem(__FILE__, "HTDirTitles"); + sprintf(relative, "%s/..", current); -#ifndef VMS + +#ifdef DOSPATH + if(local_link) + if (strlen(parent) == 3 ) + StrAllocCat(relative, "/."); +#endif + +#if !defined (VMS) +#ifdef DOSPATH + if(!local_link) +#endif { /* ** On Unix, if it's not ftp and the directory cannot @@ -1324,7 +1454,7 @@ PUBLIC int HTLoadFile ARGS4( ** using that, Lynx users should make the current character ** set "ISO Latin 1" so that 8-bit characters are passed raw. */ - format = HTCharsetFormat(format, anchor); + format = HTCharsetFormat(format, anchor, UCLYhndl_HTFile_for_unspec); #ifdef VMS /* @@ -1424,7 +1554,8 @@ PUBLIC int HTLoadFile ARGS4( cp[len - 2] = '\0'; format = HTFileFormat(cp, &encoding); FREE(cp); - format = HTCharsetFormat(format, anchor); + format = HTCharsetFormat(format, anchor, + UCLYhndl_HTFile_for_unspec); StrAllocCopy(anchor->content_type, format->name); StrAllocCopy(anchor->content_encoding, "x-compress"); format = HTAtom_for("www/compressed"); @@ -1437,7 +1568,8 @@ PUBLIC int HTLoadFile ARGS4( cp[len - 3] = '\0'; format = HTFileFormat(cp, &encoding); FREE(cp); - format = HTCharsetFormat(format, anchor); + format = HTCharsetFormat(format, anchor, + UCLYhndl_HTFile_for_unspec); StrAllocCopy(anchor->content_type, format->name); StrAllocCopy(anchor->content_encoding, "x-gzip"); format = HTAtom_for("www/compressed"); @@ -1511,9 +1643,10 @@ forget_multi: /* ** While there are directory entries to be read... */ +#ifndef DOSPATH if (dirbuf->d_ino == 0) continue; /* if the entry is not being used, skip it */ - +#endif if ((int)strlen(dirbuf->d_name) > baselen && /* Match? */ !strncmp(dirbuf->d_name, base, baselen)) { HTFormat rep = HTFileFormat(dirbuf->d_name, &encoding); @@ -1561,13 +1694,21 @@ forget_multi: ** will hold the directory entry, and a type 'DIR' which is used ** to point to the current directory being read. */ +#ifdef _WINDOWS + if (!exists(localname)) { +#else if (stat(localname,&dir_info) == -1) { /* get file information */ +#endif /* if can't read file information */ if (TRACE) fprintf(stderr, "HTLoadFile: can't stat %s\n", localname); } else { /* Stat was OK */ +#ifdef _WINDOWS + if (stat(localname,&dir_info) == -1) dir_info.st_mode = S_IFDIR; +#endif + if (((dir_info.st_mode) & S_IFMT) == S_IFDIR) { /* ** If localname is a directory. @@ -1637,7 +1778,15 @@ forget_multi: StrAllocCopy(tail, p+1); /* take slash off the beginning */ } FREE(pathname); - + +#ifdef EXP_CHARTRANS + if (UCLYhndl_HTFile_for_unspec >= 0) { + HTAnchor_setUCInfoStage(anchor, + UCLYhndl_HTFile_for_unspec, + UCT_STAGE_PARSER, + UCT_SETBY_DEFAULT); + } +#endif target = HTML_new(anchor, format_out, sink); targetClass = *target->isa; /* Copy routine entry points */ @@ -1673,12 +1822,13 @@ forget_multi: char * dirname = NULL; extern BOOLEAN no_dotfiles, show_dotfiles; +#ifndef DOSPATH if (dirbuf->d_ino == 0) /* ** If the entry is not being used, skip it. */ continue; - +#endif /* ** Skip self, parent if handled in HTDirTitles() ** or if NO_PARENT_DIR_REFERENCE is not defined, @@ -1902,7 +2052,8 @@ open_file: cp[len - 2] = '\0'; format = HTFileFormat(cp, &encoding); FREE(cp); - format = HTCharsetFormat(format, anchor); + format = HTCharsetFormat(format, anchor, + UCLYhndl_HTFile_for_unspec); StrAllocCopy(anchor->content_type, format->name); StrAllocCopy(anchor->content_encoding, "x-compress"); format = HTAtom_for("www/compressed"); @@ -1914,7 +2065,8 @@ open_file: cp[len - 3] = '\0'; format = HTFileFormat(cp, &encoding); FREE(cp); - format = HTCharsetFormat(format, anchor); + format = HTCharsetFormat(format, anchor, + UCLYhndl_HTFile_for_unspec); StrAllocCopy(anchor->content_type, format->name); StrAllocCopy(anchor->content_encoding, "x-gzip"); format = HTAtom_for("www/compressed"); diff --git a/WWW/Library/Implementation/HTFile.h b/WWW/Library/Implementation/HTFile.h index b2a51103..2d37a537 100644 --- a/WWW/Library/Implementation/HTFile.h +++ b/WWW/Library/Implementation/HTFile.h @@ -127,7 +127,8 @@ extern HTFormat HTFileFormat PARAMS(( */ extern HTFormat HTCharsetFormat PARAMS(( HTFormat format, - HTParentAnchor * anchor)); + HTParentAnchor * anchor, + int default_LYhndl)); /* ** Determine file value from file name. diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c index c4f47b76..46ed05f4 100644 --- a/WWW/Library/Implementation/HTGopher.c +++ b/WWW/Library/Implementation/HTGopher.c @@ -761,7 +761,7 @@ PRIVATE int interpret_cso_key ARGS5( { CSOfield_info *fld; - if (fld = ctx->fld) { + if ((fld = ctx->fld) != 0) { /* ** Most substitutions only recognized inside of loops. */ @@ -937,8 +937,8 @@ PRIVATE int parse_cso_fields ARGS2( { char ch; char *p = buf; - int i, code, prev_code, alen; - char *index, *name; + int i, code = 0, prev_code, alen; + char *indx, *name; CSOfield_info *last, *new; extern int interrupted_in_htgetcharacter; @@ -1004,14 +1004,14 @@ PRIVATE int parse_cso_fields ARGS2( /* ** Parse fields within returned line into status, ndx, name, data. */ - index = NULL; + indx = NULL; name = NULL; for (i = 0; p[i]; i++) if (p[i] == ':' ) { p[i] = '\0'; - if (!index) { - index = (char *)&p[i+1]; - code = atoi (index); + if (!indx) { + indx = (char *)&p[i+1]; + code = atoi (indx); } else if (!name) { name = (char *)&p[i+1]; } else { @@ -1073,7 +1073,7 @@ PRIVATE int parse_cso_fields ARGS2( strcpy((char *)&new->attributes[alen-2], " "); new->description = new->desc_buf; new->desc_buf[0] = '\0'; - new->id = atoi(index); + new->id = atoi(indx); /* ** Scan for keywords. */ diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c index 65c6694e..59d0313b 100644 --- a/WWW/Library/Implementation/HTMIME.c +++ b/WWW/Library/Implementation/HTMIME.c @@ -15,6 +15,11 @@ #include "HTMIME.h" /* Implemented here */ #include "HTAlert.h" #include "HTCJK.h" +#ifdef EXP_CHARTRANS +#include "UCMap.h" +#include "UCDefs.h" +#include "UCAux.h" +#endif #include "LYLeaks.h" @@ -332,7 +337,7 @@ PRIVATE void HTMIME_put_character ARGS2( { me->net_ascii = NO; if (strchr(HTAtom_name(me->format), ';') != NULL) { - char *cp = NULL, *cp1, *cp2, *cp3; + char *cp = NULL, *cp1, *cp2, *cp3 = NULL, *cp4; if (TRACE) fprintf(stderr, @@ -351,10 +356,92 @@ PRIVATE void HTMIME_put_character ARGS2( for (i = 0; cp[i]; i++) cp[i] = TOLOWER(cp[i]); if ((cp1=strchr(cp, ';')) != NULL) { + BOOL chartrans_ok = NO; if ((cp2=strstr(cp1, "charset")) != NULL) { + int chndl; cp2 += 7; while (*cp2 == ' ' || *cp2 == '=' || *cp2 == '\"') cp2++; +#ifdef EXP_CHARTRANS + StrAllocCopy(cp3, cp2); /* copy to mutilate more */ + for (cp4=cp3; (*cp4 != '\0' && *cp4 != '\"' && + *cp4 != ';' && *cp4 != ':' && + !WHITE(*cp4)); cp4++) + /* nothing */ ; + *cp4 = '\0'; + cp4 = cp3; + chndl = UCGetLYhndl_byMIME(cp3); + if (chndl < 0) { + if (0==strcmp(cp4, "cn-big5")) { + cp4 += 3; + chndl = UCGetLYhndl_byMIME(cp4); + } + else if (0==strncmp(cp4, "cn-gb", 5)) { + StrAllocCopy(cp3, "gb2312"); + cp4 = cp3; + chndl = UCGetLYhndl_byMIME(cp4); + } + } + if (UCCanTranslateFromTo(chndl, current_char_set)) + { + chartrans_ok = YES; + *cp1 = '\0'; + me->format = HTAtom_for(cp); + StrAllocCopy(me->anchor->charset, cp4); + HTAnchor_setUCInfoStage(me->anchor, chndl, + UCT_STAGE_MIME, UCT_SETBY_MIME); + } + else if (chndl < 0) {/* got something but we don't + recognize it */ + chndl = UCLYhndl_for_unrec; + if (UCCanTranslateFromTo(chndl, + current_char_set)) + { + chartrans_ok = YES; + *cp1 = '\0'; + me->format = HTAtom_for(cp); + HTAnchor_setUCInfoStage(me->anchor, chndl, + UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + } + } + FREE(cp3); + if (chartrans_ok) { + LYUCcharset * p_in = + HTAnchor_getUCInfoStage(me->anchor, + UCT_STAGE_MIME); + LYUCcharset * p_out = + HTAnchor_setUCInfoStage(me->anchor, + current_char_set, + UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); + if (!p_out) /* try again */ + p_out = + HTAnchor_getUCInfoStage(me->anchor, + UCT_STAGE_HTEXT); + + if (0==strcmp(p_in->MIMEname,"x-transparent")) + { + HTPassEightBitRaw = TRUE; + HTAnchor_setUCInfoStage(me->anchor, + HTAnchor_getUCLYhndl(me->anchor, + UCT_STAGE_HTEXT), + UCT_STAGE_MIME, UCT_SETBY_DEFAULT); + } + if (0==strcmp(p_out->MIMEname,"x-transparent")) + { + HTPassEightBitRaw = TRUE; + HTAnchor_setUCInfoStage(me->anchor, + HTAnchor_getUCLYhndl(me->anchor, + UCT_STAGE_MIME), + UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); + } + if (!(p_in->enc & UCT_ENC_CJK) && + (p_in->codepoints & UCT_CP_SUBSETOF_LAT1)){ + HTCJK = NOCJK; + } else if (chndl == current_char_set) { + HTPassEightBitRaw = TRUE; + } + } else /* Fall through to old behavior */ +#endif /* EXP_CHARTRANS */ if (!strncmp(cp2, "us-ascii", 8) || !strncmp(cp2, "iso-8859-1", 10)) { *cp1 = '\0'; @@ -1958,6 +2045,12 @@ PUBLIC HTStream* HTMIMEConvert ARGS3( me->encoding = 0; /* Not set yet */ me->compression_encoding = NULL; /* Not set yet */ me->net_ascii = NO; /* Local character set */ +#ifdef EXP_CHARTRANS + HTAnchor_setUCInfoStage(me->anchor, current_char_set, + UCT_STAGE_STRUCTURED, UCT_SETBY_DEFAULT); + HTAnchor_setUCInfoStage(me->anchor, current_char_set, + UCT_STAGE_HTEXT, UCT_SETBY_DEFAULT); +#endif /* EXP_CHARTRANS */ return me; } diff --git a/WWW/Library/Implementation/HTML.h b/WWW/Library/Implementation/HTML.h index c4bd3caf..ed3aefee 100644 --- a/WWW/Library/Implementation/HTML.h +++ b/WWW/Library/Implementation/HTML.h @@ -7,6 +7,11 @@ #ifndef HTML_H #define HTML_H +#ifdef EXP_CHARTRANS +#include "UCDefs.h" +#include "UCAux.h" +#endif + #ifndef HTUTILS_H #include "HTUtils.h" #endif /* HTUTILS_H */ @@ -132,6 +137,12 @@ struct _HTStructured { BOOL inUnderline; BOOL needBoldH; + +#ifdef EXP_CHARTRANS + LYUCcharset * UCI; /* pointer to node_anchor's UCInfo */ + int UCLYhndl; /* tells us what charset we are fed */ + UCTransParams T; +#endif }; struct _HTStream { @@ -145,7 +156,7 @@ struct _HTStream { extern void HTML_put_character PARAMS((HTStructured *me, char c)); extern void HTML_put_string PARAMS((HTStructured *me, CONST char *s)); extern void HTML_write PARAMS((HTStructured *me, CONST char *s, int l)); -extern void HTML_put_entity PARAMS((HTStructured *me, int entity_number)); +extern int HTML_put_entity PARAMS((HTStructured *me, int entity_number)); #endif /* Lynx_HTML_Handler */ /* P U B L I C diff --git a/WWW/Library/Implementation/HTMLDTD.c b/WWW/Library/Implementation/HTMLDTD.c index bec129dd..2639a461 100644 --- a/WWW/Library/Implementation/HTMLDTD.c +++ b/WWW/Library/Implementation/HTMLDTD.c @@ -118,7 +118,7 @@ static CONST char* entities[] = { "thinsp", /* thin space (not collapsed) */ "thorn", /* small thorn, Icelandic */ "times", /* multiplication sign */ - "trade", /* registerd trademark */ + "trade", /* trade mark sign (U+2122) */ "uacute", /* small u, acute accent */ "ucirc", /* small u, circumflex accent */ "ugrave", /* small u, grave accent */ @@ -131,6 +131,169 @@ static CONST char* entities[] = { #define HTML_ENTITIES 112 +#ifdef EXP_CHARTRANS +/* Extra Entity Names +** ------------------ +** +** This table contains Unicodes in addition to the Names. +** +** Just an idea how it could be done. -kw +* +* I think in the future the whole entities[] thing above could migrate +* to this kind of structure. The structured streams to which +* the SGML modules sends its output could then easily have access +* to both entity names and unicode values for each (special) +* character. Probably the whole translation to display characters +* should be done at that later stage (e.g. in HTML.c). +* What's missing is a way for the later stage to return info +* to SGML whether the entity could be displayed or not. +* (like between SGML_character() and handle_entity() via FoundEntity.) +* Well, trying to do that now. +* Why keep two structures for entities? Backward compatibility.. +*/ + +/* UC_entity_info structure is defined in SGML.h. */ +/* This has to be sorted alphabetically, + bear this in mind when you add some more entities.. + + Now we have here: - all ISO-8859-2 entites + - lrm, rlm, zwnj and zwj +*/ +static CONST UC_entity_info extra_entities[] = { + {"Aacute", 0x00c1}, /* A with acute */ + {"Abreve", 0x0102}, /* A with breve */ + {"Acirc", 0x00c2}, /* A with circumflex */ + {"Aogon", 0x0104}, /* A with ogonek */ + {"Auml", 0x00c4}, /* A with diaeresis */ + {"Cacute", 0x0106}, /* C with acute */ + {"Ccaron", 0x010c}, /* C with caron */ + {"Ccedil", 0x00c7}, /* C with cedilla */ + {"Dcaron", 0x010e}, /* D with caron */ + {"Dstrok", 0x0110}, /* D with stroke */ + {"Eacute", 0x00c9}, /* E with acute */ + {"Ecaron", 0x011a}, /* E with caron */ + {"Eogon", 0x0118}, /* E with ogonek */ + {"Euml", 0x00cb}, /* E with diaeresis */ + {"Iacute", 0x00cd}, /* I with acute */ + {"Icirc", 0x00ce}, /* I with circumflex */ + {"Lacute", 0x0139}, /* L with acute */ + {"Lcaron", 0x013d}, /* L with caron */ + {"Lstrok", 0x0141}, /* L with stroke */ + {"Nacute", 0x0143}, /* N with acute */ + {"Ncaron", 0x0147}, /* N with caron */ + {"Oacute", 0x00d3}, /* O with acute */ + {"Ocirc", 0x00d4}, /* O with circumflex */ + {"Odblac", 0x0150}, /* O with double acute */ + {"Ouml", 0x00d6}, /* O with diaeresis */ + {"Racute", 0x0154}, /* R with acute */ + {"Rcaron", 0x0158}, /* R with caron */ + {"Sacute", 0x015a}, /* S with acute */ + {"Scaron", 0x0160}, /* S with caron */ + {"Scedil", 0x015e}, /* S with cedilla */ + {"Tcaron", 0x0164}, /* T with caron */ + {"Tcedil", 0x0162}, /* T with cedilla */ + {"Uacute", 0x00da}, /* U with acute */ + {"Udblac", 0x0170}, /* U with double acute */ + {"Uring", 0x016e}, /* U with ring above */ + {"Uuml", 0x00dc}, /* U with diaeresis */ + {"Yacute", 0x00dd}, /* Y with acute */ + {"Zacute", 0x0179}, /* Z with acute */ + {"Zcaron", 0x017d}, /* Z with caron */ + {"Zdot", 0x017b}, /* Z with dot above */ + {"aacute", 0x00e1}, /* a with acute */ + {"abreve", 0x0103}, /* a with breve */ + {"acirc", 0x00e2}, /* a with circumflex */ + {"acute", 0x00b4}, /* acuteaccent */ + {"amp", 0x0026}, /* ampersand */ + {"aogon", 0x0105}, /* a with ogonek */ + {"apos", 0x0027}, /* apostrophe */ + {"ast", 0x002a}, /* asterisk */ + {"auml", 0x00e4}, /* a with diaeresis */ + {"breve", 0x02d8}, /* breve */ + {"bsol", 0x005c}, /* reversesolidus */ + {"cacute", 0x0107}, /* c with acute */ + {"caron", 0x02c7}, /* caron */ + {"ccaron", 0x010d}, /* c with caron */ + {"ccedil", 0x00e7}, /* c with cedilla */ + {"cedil", 0x00b8}, /* cedilla */ + {"circ", 0x005e}, /* circumflexaccent */ + {"colon", 0x003a}, /* colon */ + {"comma", 0x002c}, /* comma */ + {"commat", 0x0040}, /* commercialat */ + {"curren", 0x00a4}, /* currencysign */ + {"dblac", 0x02dd}, /* doubleacuteaccent */ + {"dcaron", 0x010f}, /* d with caron */ + {"deg", 0x00b0}, /* degreesign */ + {"divide", 0x00f7}, /* divisionsign */ + {"dollar", 0x0024}, /* dollarsign */ + {"dot", 0x02d9}, /* dotabove */ + {"dstrok", 0x0111}, /* d with stroke */ + {"eacute", 0x00e9}, /* e with acute */ + {"ecaron", 0x011b}, /* e with caron */ + {"eogon", 0x0119}, /* e with ogonek */ + {"equals", 0x003d}, /* equalssign */ + {"euml", 0x00eb}, /* e with diaeresis */ + {"excl", 0x0021}, /* exclamationmark */ + {"grave", 0x0060}, /* graveaccent */ + {"gt", 0x003e}, /* greater-thansign */ + {"hyphen", 0x002d}, /* hyphen-minus */ + {"iacute", 0x00ed}, /* i with acute */ + {"icirc", 0x00ee}, /* i with circumflex */ + {"lacute", 0x013a}, /* l with acute */ + {"lcaron", 0x013e}, /* l with caron */ + {"lcub", 0x007b}, /* leftcurlybracket */ + {"lowbar", 0x005f}, /* lowline */ + {"lpar", 0x0028}, /* leftparenthesis */ + {"lrm", 8206}, /* left-to-right mark */ + {"lsqb", 0x005b}, /* leftsquarebracket */ + {"lstrok", 0x0142}, /* l with stroke */ + {"lt", 0x003c}, /* less-thansign */ + {"nacute", 0x0144}, /* n with acute */ + {"nbsp", 0x00a0}, /* no-breakspace */ + {"ncaron", 0x0148}, /* n with caron */ + {"num", 0x0023}, /* numbersign */ + {"oacute", 0x00f3}, /* o with acute */ + {"ocirc", 0x00f4}, /* o with circumflex */ + {"odblac", 0x0151}, /* o with double acute */ + {"ogon", 0x02db}, /* ogonek */ + {"ouml", 0x00f6}, /* o with diaeresis */ + {"percnt", 0x0025}, /* percentsign */ + {"period", 0x002e}, /* fullstop */ + {"plus", 0x002b}, /* plussign */ + {"quest", 0x003f}, /* questionmark */ + {"quot", 0x0022}, /* quotationmark */ + {"racute", 0x0155}, /* r with acute */ + {"rcaron", 0x0159}, /* r with caron */ + {"rcub", 0x007d}, /* rightcurlybracket */ + {"rlm", 8207}, /* right-to-left mark */ + {"rpar", 0x0029}, /* rightparenthesis */ + {"rsqb", 0x005d}, /* rightsquarebracket */ + {"sacute", 0x015b}, /* s with acute */ + {"scaron", 0x0161}, /* s with caron */ + {"scedil", 0x015f}, /* s with cedilla */ + {"sect", 0x00a7}, /* sectionsign */ + {"semi", 0x003b}, /* semicolon */ + {"shy", 0x00ad}, /* softhyphen */ + {"sol", 0x002f}, /* solidus */ + {"tcaron", 0x0165}, /* t with caron */ + {"tcedil", 0x0163}, /* t with cedilla */ + {"tilde", 0x007e}, /* tilde */ + {"times", 0x00d7}, /* multiplicationsign */ + {"uacute", 0x00fa}, /* u with acute */ + {"udblac", 0x0171}, /* u with double acute */ + {"uml", 0x00a8}, /* diaeresis */ + {"uring", 0x016f}, /* u with ring above */ + {"uuml", 0x00fc}, /* u with diaeresis */ + {"verbar", 0x007c}, /* verticalline */ + {"yacute", 0x00fd}, /* y with acute */ + {"zacute", 0x017a}, /* z with acute */ + {"zcaron", 0x017e}, /* z with caron */ + {"zdot", 0x017c}, /* z with dot above */ + {"zwj", 8205}, /* zero width joiner */ + {"zwnj", 8204}, /* zero width non-joiner */ + +}; +#endif /* EXP_CHARTRANS */ /* Attribute Lists ** --------------- @@ -140,6 +303,7 @@ static CONST char* entities[] = { */ static attr a_attr[] = { /* Anchor attributes */ { "ACCESSKEY" }, + { "CHARSET" }, { "CLASS" }, { "CLEAR" }, { "COORDS" }, @@ -989,7 +1153,7 @@ static HTTag tags[HTML_ELEMENTS] = { { "FIG" , fig_attr, HTML_FIG_ATTRIBUTES, SGML_MIXED }, { "FN" , fn_attr, HTML_FN_ATTRIBUTES, SGML_MIXED }, { "FONT" , font_attr, HTML_FONT_ATTRIBUTES, SGML_EMPTY }, - { "FORM" , form_attr, HTML_FORM_ATTRIBUTES, SGML_MIXED }, + { "FORM" , form_attr, HTML_FORM_ATTRIBUTES, SGML_EMPTY }, { "FRAME" , frame_attr, HTML_FRAME_ATTRIBUTES, SGML_EMPTY }, { "FRAMESET", frameset_attr,HTML_FRAMESET_ATTRIBUTES, SGML_MIXED }, { "H1" , h_attr, HTML_H_ATTRIBUTES, SGML_MIXED }, @@ -1064,7 +1228,11 @@ PUBLIC CONST SGML_dtd HTML_dtd = { tags, HTML_ELEMENTS, entities, - sizeof(entities)/sizeof(char**) + sizeof(entities)/sizeof(char*), +#ifdef EXP_CHARTRANS + extra_entities, + sizeof(extra_entities)/sizeof(UC_entity_info), +#endif }; diff --git a/WWW/Library/Implementation/HTMLDTD.h b/WWW/Library/Implementation/HTMLDTD.h index 4f0fd6e3..ef6c5fbb 100644 --- a/WWW/Library/Implementation/HTMLDTD.h +++ b/WWW/Library/Implementation/HTMLDTD.h @@ -158,30 +158,31 @@ Attribute numbers */ #define HTML_A_ACCESSKEY 0 -#define HTML_A_CLASS 1 -#define HTML_A_CLEAR 2 -#define HTML_A_COORDS 3 -#define HTML_A_DIR 4 -#define HTML_A_HREF 5 -#define HTML_A_ID 6 -#define HTML_A_ISMAP 7 -#define HTML_A_LANG 8 -#define HTML_A_MD 9 -#define HTML_A_NAME 10 -#define HTML_A_NOTAB 11 -#define HTML_A_ONCLICK 12 -#define HTML_A_ONMOUSEOUT 13 -#define HTML_A_ONMOUSEOVER 14 -#define HTML_A_REL 15 -#define HTML_A_REV 16 -#define HTML_A_SHAPE 17 -#define HTML_A_STYLE 18 -#define HTML_A_TABINDEX 19 -#define HTML_A_TARGET 20 -#define HTML_A_TITLE 21 -#define HTML_A_TYPE 22 -#define HTML_A_URN 23 -#define HTML_A_ATTRIBUTES 24 +#define HTML_A_CHARSET 1 /* i18n draft, added tentatively - kw */ +#define HTML_A_CLASS 2 +#define HTML_A_CLEAR 3 +#define HTML_A_COORDS 4 +#define HTML_A_DIR 5 +#define HTML_A_HREF 6 +#define HTML_A_ID 7 +#define HTML_A_ISMAP 8 +#define HTML_A_LANG 9 +#define HTML_A_MD 10 +#define HTML_A_NAME 11 +#define HTML_A_NOTAB 12 +#define HTML_A_ONCLICK 13 +#define HTML_A_ONMOUSEOUT 14 +#define HTML_A_ONMOUSEOVER 15 +#define HTML_A_REL 16 +#define HTML_A_REV 17 +#define HTML_A_SHAPE 18 +#define HTML_A_STYLE 19 +#define HTML_A_TABINDEX 20 +#define HTML_A_TARGET 21 +#define HTML_A_TITLE 22 +#define HTML_A_TYPE 23 +#define HTML_A_URN 24 +#define HTML_A_ATTRIBUTES 25 #define HTML_ADDRESS_CLASS 0 #define HTML_ADDRESS_CLEAR 1 diff --git a/WWW/Library/Implementation/HTMLGen.c b/WWW/Library/Implementation/HTMLGen.c index bea63bac..af6794fc 100644 --- a/WWW/Library/Implementation/HTMLGen.c +++ b/WWW/Library/Implementation/HTMLGen.c @@ -243,11 +243,20 @@ PRIVATE void HTMLGen_end_element ARGS3(HTStructured *, me, ** */ -PRIVATE void HTMLGen_put_entity ARGS2(HTStructured *, me, int, entity_number) +PRIVATE int HTMLGen_put_entity ARGS2(HTStructured *, me, int, entity_number) { + int nent = HTML_dtd.number_of_entities; + HTMLGen_put_character(me, '&'); - HTMLGen_put_string(me, HTML_dtd.entity_names[entity_number]); + if (entity_number < nent) + HTMLGen_put_string(me, HTML_dtd.entity_names[entity_number]); +#ifdef EXP_CHARTRANS + else + HTMLGen_put_string(me, + HTML_dtd.extra_entity_info[entity_number-nent].name); +#endif HTMLGen_put_character(me, ';'); + return HT_OK; } diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c index 1281d2e4..0de7fb71 100644 --- a/WWW/Library/Implementation/HTNews.c +++ b/WWW/Library/Implementation/HTNews.c @@ -122,7 +122,9 @@ PUBLIC void HTSetNewsHost ARGS1(CONST char *, value) PRIVATE BOOL initialized = NO; PRIVATE BOOL initialize NOARGS { +#ifdef NeXTStep char *cp = NULL; +#endif /* ** Get name of Host. @@ -994,7 +996,7 @@ PRIVATE int read_article NOARGS char *l = line; char *p; - while (p=strstr(l, "rticle <")) { + while ((p = strstr(l, "rticle <")) != 0) { char *q = strchr(p,'>'); char *at = strchr(p, '@'); if (q && at && at<q) { @@ -1642,7 +1644,7 @@ PUBLIC int HTLoadNews ARGS4( BOOL spost_wanted; /* Flag: new SSL post to group was asked for */ BOOL sreply_wanted; /* Flag: followup SSL post was asked for */ int first, last; /* First and last articles asked for */ - char *cp; + char *cp = 0; char *ListArg = NULL; char *ProxyHost = NULL; char *ProxyHREF = NULL; diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c index 16f39fc7..350107c2 100644 --- a/WWW/Library/Implementation/HTParse.c +++ b/WWW/Library/Implementation/HTParse.c @@ -63,7 +63,9 @@ PRIVATE void scan ARGS2( { char * after_access; char * p; +#ifdef NOTDEFINED int length = strlen(name); +#endif parts->access = NULL; parts->host = NULL; diff --git a/WWW/Library/Implementation/HTPlain.c b/WWW/Library/Implementation/HTPlain.c index 009f24e7..b23ec0f7 100644 --- a/WWW/Library/Implementation/HTPlain.c +++ b/WWW/Library/Implementation/HTPlain.c @@ -17,6 +17,11 @@ #include "HTStyle.h" #include "HTMLDTD.h" #include "HTCJK.h" +#ifdef EXP_CHARTRANS +#include "UCMap.h" +#include "UCDefs.h" +#include "UCAux.h" +#endif /* EXP_CHARTRANS */ #include "LYLeaks.h" @@ -27,6 +32,9 @@ extern HTStyleSheet * styleSheet; extern int current_char_set; extern char * LYchar_set_names[]; extern CONST char **LYCharSets[]; +#ifdef EXP_CHARTRANS +extern int LYlowest_eightbit[]; +#endif /* EXP_CHARTRANS */ extern CONST char * HTMLGetEntityName PARAMS((int i)); extern BOOL HTPassEightBitRaw; extern BOOL HTPassHighCtrlRaw; @@ -41,8 +49,46 @@ struct _HTStream { CONST HTStreamClass * isa; HText * text; +#ifdef EXP_CHARTRANS + LYUCcharset * UCI; /* pointer to node_anchor's UCInfo */ + int in_char_set; /* tells us what charset we are fed */ + int htext_char_set; /* what charset feed to HText */ + char utf_count; + long utf_char; + char utf_buf[7]; + char * utf_buf_p; + UCTransParams T; +#endif /* EXP_CHARTRANS */ }; +#ifdef EXP_CHARTRANS + +PRIVATE char replace_buf [61]; /* buffer for replacement strings */ + +PRIVATE void htplain_get_chartrans_info ARGS2(HTStream *, me, + HTParentAnchor *, anchor) +{ + if (me->in_char_set < 0) { + HTAnchor_copyUCInfoStage(anchor, UCT_STAGE_PARSER, UCT_STAGE_MIME, + UCT_SETBY_PARSER); + me->in_char_set = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_PARSER); + } + if (me->htext_char_set < 0) { + int chndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT); + if (chndl < 0) { + chndl = current_char_set; + HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_HTEXT, + UCT_SETBY_DEFAULT); + } + HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_HTEXT, + UCT_SETBY_DEFAULT); + me->htext_char_set = HTAnchor_getUCLYhndl(anchor, + UCT_STAGE_HTEXT); + } + me->UCI = HTAnchor_getUCInfoStage(anchor,UCT_STAGE_PARSER); +} +#endif /* EXP_CHARTRANS */ + /* Write the buffer out to the socket ** ---------------------------------- */ @@ -53,6 +99,15 @@ struct _HTStream { ** A C T I O N R O U T I N E S */ +#ifdef EXP_CHARTRANS + /* for forward reference to HTPlain_write - kw */ +#ifdef _WINDOWS +PRIVATE void HTPlain_write (HTStream * me, CONST char* s, int l); +#else +PRIVATE void HTPlain_write PARAMS((HTStream * me, CONST char* s, int l)); +#endif /* _WINDOWS */ +#endif /* EXP_CHARTRANS */ + /* Character handling ** ------------------ */ @@ -78,6 +133,11 @@ PRIVATE void HTPlain_put_character ARGS2(HTStream *, me, char, c) HTPlain_lastraw = c; if (c == '\r') { HText_appendCharacter(me->text, '\n'); +#ifdef EXP_CHARTRANS + /* for now don't repeat everything here that has been done below - kw*/ + } else if ((unsigned char)c >= 127) { + HTPlain_write(me, &c, 1); +#endif } else if (HTCJK != NOCJK) { HText_appendCharacter(me->text, c); } else if ((unsigned char)c >= 127 && (unsigned char)c < 161 && @@ -93,7 +153,7 @@ PRIVATE void HTPlain_put_character ARGS2(HTStream *, me, char, c) } else if ((unsigned char)c > 160) { if (!HTPassEightBitRaw && strncmp(LYchar_set_names[current_char_set], "ISO Latin 1", 11)) { - int len, high, low, i, diff; + int len, high, low, i, diff=1; CONST char * name; int value = (int)((unsigned char)c - 160); name = HTMLGetEntityName(value); @@ -149,6 +209,11 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) { CONST char * p; CONST char * e = s+l; +#ifdef EXP_CHARTRANS + BOOL chk; + long unsign_c, uck; + char c_p; +#endif /* EXP_CHARTRANS */ for (p = s; p < e; p++) { #ifdef REMOVE_CR_ONLY @@ -172,55 +237,187 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) HTPlain_lastraw = *p; if (*p == '\r') { HText_appendCharacter(me->text, '\n'); + continue; + } +#ifdef EXP_CHARTRANS + unsign_c = (unsigned char)(*p); + c_p = *p; + + if (me->T.decode_utf8) { + /* Combine UTF-8 into Unicode */ + /* Incomplete characters silently ignored */ + /* from Linux kernel's console.c */ + if((unsigned char)(*p) > 0x7f) { + if (me->utf_count > 0 && (*p & 0xc0) == 0x80) { + me->utf_char = (me->utf_char << 6) | (*p & 0x3f); + me->utf_count--; + *(me->utf_buf_p++) = *p; + if (me->utf_count == 0) { + *(me->utf_buf_p) = '\0'; + unsign_c = me->utf_char; + if (unsign_c<256) c_p = (char)unsign_c; + } + else continue; /* iterate for more */ + } else { + me->utf_buf_p = me->utf_buf; + *(me->utf_buf_p++) = *p; + if ((*p & 0xe0) == 0xc0) { + me->utf_count = 1; + me->utf_char = (*p & 0x1f); + } else if ((*p & 0xf0) == 0xe0) { + me->utf_count = 2; + me->utf_char = (*p & 0x0f); + } else if ((*p & 0xf8) == 0xf0) { + me->utf_count = 3; + me->utf_char = (*p & 0x07); + } else if ((*p & 0xfc) == 0xf8) { + me->utf_count = 4; + me->utf_char = (*p & 0x03); + } else if ((*p & 0xfe) == 0xfc) { + me->utf_count = 5; + me->utf_char = (*p & 0x01); + } else { /* garbage */ + me->utf_count = 0; + me->utf_buf_p = me->utf_buf; + *(me->utf_buf_p) = '\0'; + } + continue; /* iterate for more */ + } + } else { /* got an ASCII char */ + me->utf_count = 0; + me->utf_buf_p = me->utf_buf; + *(me->utf_buf_p) = '\0'; + } + } + + + if (me->T.trans_to_uni && unsign_c >= 127) { + unsign_c = UCTransToUni(c_p, me->in_char_set); + if (unsign_c > 0) { + if (unsign_c < 256) { + c_p = (char)unsign_c; + } + } + } + + /* At this point we have either unsign_c in Unicode + (and c in latin1 if unsign_c is in the latin1 range), + or unsign_c and c will have to be passed raw. */ + +#else +#define unsign_c (unsigned char)*p +#define c_p *p +#endif /* EXP_CHARTRANS */ /* ** If CJK mode is on, we'll assume the document matches ** the user's selected character set, and if not, the ** user should toggle off raw/CJK mode to reload. - FM */ - } else if (HTCJK != NOCJK) { - HText_appendCharacter(me->text, *p); + if (HTCJK != NOCJK) { + HText_appendCharacter(me->text, c_p); + +#ifndef EXP_CHARTRANS +#define PASSHICTRL HTPassHighCtrlRaw +#define PASS8859SPECL HTPassHighCtrlRaw +#define PASSHI8BIT HTPassEightBitRaw +#else +#define PASSHICTRL (me->T.transp || unsign_c >= LYlowest_eightbit[me->in_char_set]) +#define PASS8859SPECL me->T.pass_160_173_raw +#define PASSHI8BIT (HTPassEightBitRaw || (me->T.do_8bitraw && !me->T.trans_from_uni)) +#endif /* EXP_CHARTRANS */ + /* ** If HTPassHighCtrlRaw is set (e.g., for KOI8-R) assume the ** document matches and pass 127-160 8-bit characters. If it ** doesn't match, the user should toggle raw/CJK mode off. - FM */ - } else if ((unsigned char)*p >= 127 && (unsigned char)*p < 161 && - HTPassHighCtrlRaw) { + } else if (unsign_c >= 127 && unsign_c < 161 && + PASSHICTRL && PASS8859SPECL) { + HText_appendCharacter(me->text, *p); + } else if (unsign_c == 173 && PASS8859SPECL) { HText_appendCharacter(me->text, *p); /* ** If neither HTPassHighCtrlRaw nor CJK is set, play it safe ** and treat 160 (nbsp) as an ASCII space (32). - FM */ - } else if ((unsigned char)*p == 160) { + } else if (unsign_c == 160) { HText_appendCharacter(me->text, ' '); /* ** If neither HTPassHighCtrlRaw nor CJK is set, play it safe ** and ignore 173 (shy). - FM */ - } else if ((unsigned char)*p == 173) { + } else if (unsign_c == 173) { continue; +#ifdef EXP_CHARTRANS + } else if (me->T.strip_raw_char_in && + (unsigned char)*p >= 0xc0 && + (unsigned char)*p < 255) { + /* KOI special: strip high bit, gives (somewhat) readable ASCII */ + HText_appendCharacter(me->text, (char)(*p & 0x7f)); +#endif /* EXP_CHARTRANS */ /* ** If we get to here, pass the displayable ASCII characters. - FM */ - } else if (((unsigned char)*p >= 32 && (unsigned char)*p < 127) || + } else if ((unsign_c >= 32 && unsign_c < 127) || +#ifdef EXP_CHARTRANS + (PASSHI8BIT && c_p>=LYlowest_eightbit[me->htext_char_set])|| +#endif *p == '\n' || *p == '\t') { + HText_appendCharacter(me->text, c_p); + +#ifdef EXP_CHARTRANS + } else if (me->T.use_raw_char_in) { HText_appendCharacter(me->text, *p); +/****************************************************************** + * I. LATIN-1 OR UCS2 TO DISPLAY CHARSET + ******************************************************************/ + } else if ((chk = (me->T.trans_from_uni && unsign_c >= 160)) && + (uck = UCTransUniChar(unsign_c, me->htext_char_set)) >= 32 && + uck < 256) { + if (TRACE) + fprintf(stderr,"UCTransUniChar returned 0x%lx:'%c'.\n",uck,(char)uck); + HText_appendCharacter(me->text, (char)(uck & 0xff)); + } else if (chk && (uck == -4) && + /* Not found; look for replacement string */ + (uck = UCTransUniCharStr(replace_buf,60, unsign_c, + me->htext_char_set, 0) >= 0 ) ) { + /* No further tests for valididy - assume that whoever + defined replacement strings knew what she was doing. */ + + HText_appendText(me->text, replace_buf); + + /* + ** If we get to here, and should have translated, translation has + ** failed so far. + */ + } else if (chk && unsign_c > 127 && me->T.output_utf8 && + *me->utf_buf) { + HText_appendText(me->text, me->utf_buf); + me->utf_buf_p = me->utf_buf; + *(me->utf_buf_p) = '\0'; + + + } else if (me->T.trans_from_uni && unsign_c > 255) { + sprintf(replace_buf,"U%.2lx",unsign_c); + HText_appendText(me->text, replace_buf); +#endif /* EXP_CHARTRANS */ + /* ** If we get to here and HTPassEightBitRaw or the ** selected character set is not "ISO Latin 1", ** use the translation tables for 161-255 8-bit ** characters (173 was handled above). - FM */ - } else if ((unsigned char)*p > 160) { - if (!HTPassEightBitRaw && + } else if (unsign_c > 160) { + if (!HTPassEightBitRaw && unsign_c <= 255 && strncmp(LYchar_set_names[current_char_set], "ISO Latin 1", 11)) { /* ** Attempt to translate. - FM */ - int len, high, low, i, diff; + int len, high, low, i, diff=1; CONST char * name; - int value = (int)((unsigned char)*p - 160); + int value = (int)(unsign_c - 160); name = HTMLGetEntityName(value); len = strlen(name); for(low=0, high = HTML_dtd.number_of_entities; @@ -238,15 +435,48 @@ PRIVATE void HTPlain_write ARGS3(HTStream *, me, CONST char*, s, int, l) if (diff) { /* ** Something went wrong in the translation, so - ** pass the raw character and hope it's OK. - FM + ** either output as UTF8 or a hex representation or + ** pass the raw character and hope it's OK. */ - HText_appendCharacter(me->text, *p); +#ifdef EXP_CHARTRANS + if (!PASSHI8BIT) + c_p = (char)unsign_c; + if (me->T.output_utf8 && + *me->utf_buf) { + HText_appendText(me->text, me->utf_buf); + me->utf_buf_p = me->utf_buf; + *(me->utf_buf_p) = '\0'; + + } else if (me->T.trans_from_uni) { + sprintf(replace_buf,"U%.2lx",unsign_c); + HText_appendText(me->text, replace_buf); + } else +#endif /* EXP_CHARTRANS */ + HText_appendCharacter(me->text, c_p); } } else { /* ** Didn't attempt a translation. - FM */ - HText_appendCharacter(me->text, *p); +#ifdef EXP_CHARTRANS + /* either output as UTF8 or a hex representation or + ** pass the raw character and hope it's OK. + */ + if (unsign_c <= 255 && !PASSHI8BIT) + c_p = (char)unsign_c; + if (unsign_c > 127 && + me->T.output_utf8 && + *me->utf_buf) { + HText_appendText(me->text, me->utf_buf); + me->utf_buf_p = me->utf_buf; + *(me->utf_buf_p) = '\0'; + + } else if (me->T.trans_from_uni && unsign_c >= 127) { + sprintf(replace_buf,"U%.2lx",unsign_c); + HText_appendText(me->text, replace_buf); + } else +#endif /* EXP_CHARTRANS */ + HText_appendCharacter(me->text, c_p); } } #endif /* REMOVE_CR_ONLY */ @@ -302,6 +532,20 @@ PUBLIC HTStream* HTPlainPresent ARGS3( HTPlain_lastraw = -1; +#ifdef EXP_CHARTRANS + me->utf_count = 0; + me->utf_char = 0; + me->utf_buf[0] = me->utf_buf[6] = '\0'; + me->utf_buf_p = me->utf_buf; + me->htext_char_set = + HTAnchor_getUCLYhndl(anchor,UCT_STAGE_HTEXT); + me->in_char_set = HTAnchor_getUCLYhndl(anchor,UCT_STAGE_PARSER); + htplain_get_chartrans_info(me, anchor); + UCSetTransParams(&me->T, + me->in_char_set, me->UCI, + me->htext_char_set, + HTAnchor_getUCInfoStage(anchor,UCT_STAGE_HTEXT)); +#endif /* EXP_CHARTRANS */ me->text = HText_new(anchor); HText_setStyle(me->text, HTStyleNamed(styleSheet, "Example")); HText_beginAppend(me->text); diff --git a/WWW/Library/Implementation/HTStyle.c b/WWW/Library/Implementation/HTStyle.c index 5b31e252..480719ea 100644 --- a/WWW/Library/Implementation/HTStyle.c +++ b/WWW/Library/Implementation/HTStyle.c @@ -265,13 +265,13 @@ HTStyleSheet * HTStyleSheetAddStyle ARGS2 HTStyleSheet * HTStyleSheetRemoveStyle ARGS2 (HTStyleSheet *,self, HTStyle *,style) { - if (self->styles = style) { + if (self->styles == style) { self->styles = style->next; return self; } else { HTStyle * scan; for(scan = self->styles; scan; scan = scan->next) { - if (scan->next = style) { + if (scan->next == style) { scan->next = style->next; return self; } diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c index c8809dc4..710005ab 100644 --- a/WWW/Library/Implementation/HTTCP.c +++ b/WWW/Library/Implementation/HTTCP.c @@ -21,6 +21,7 @@ #include "HTAccess.h" #include "HTParse.h" #include "HTAlert.h" +#include "HTTCP.h" #ifdef NSL_FORK #include <signal.h> @@ -103,18 +104,14 @@ extern int errno; #ifndef VM #ifndef VMS -#ifndef NeXT #ifndef THINK_C -#ifndef __NetBSD__ -#ifndef __FreeBSD__ -#ifndef BSDI + +#ifdef DECL_SYS_ERRLIST extern char *sys_errlist[]; /* see man perror on cernvax */ extern int sys_nerr; -#endif /* BSDI */ -#endif /* !__FreeBSD__ */ -#endif /* !__NetBSD__ */ +#endif /* DECL_SYS_ERRLIST */ + #endif /* !THINK_C */ -#endif /* !NeXT */ #endif /* !VMS */ #endif /* !VM */ @@ -390,6 +387,10 @@ PUBLIC int HTParseInet ARGS2( ** Parse host number if present. */ if (dotcount_ip == 3) { /* Numeric node address: */ + +#ifdef DJGPP + sin->sin_addr.s_addr = htonl(aton(host)); +#else #ifdef DGUX_OLD sin->sin_addr.s_addr = inet_addr(host).s_addr; /* See arpa/inet.h */ #else @@ -399,6 +400,7 @@ PUBLIC int HTParseInet ARGS2( sin->sin_addr.s_addr = inet_addr(host); /* See arpa/inet.h */ #endif /* GUSI */ #endif /* DGUX_OLD */ +#endif /* DJGPP */ FREE(host); } else { /* Alphanumeric node name: */ #ifdef MVS /* Oustanding problem with crash in MVS gethostbyname */ @@ -498,7 +500,16 @@ PUBLIC int HTParseInet ARGS2( #endif /* MVS */ #else /* Not NSL_FORK: */ - +#ifdef DJGPP + sin->sin_addr.s_addr = htonl(resolve(host)); + FREE(host); + if (sin->sin_addr.s_addr == 0) { + if (TRACE) + fprintf(stderr, + "HTTPAccess: Can't find internet node name `%s'.\n",host); + return -1; /* Fail? */ + } +#else phost = gethostbyname(host); /* See netdb.h */ #ifdef MVS if (TRACE) @@ -525,6 +536,7 @@ PUBLIC int HTParseInet ARGS2( #else memcpy((void *)&sin->sin_addr, phost->h_addr, phost->h_length); #endif /* VMS && CMU_TCP */ +#endif /* DJGPP */ #endif /* NSL_FORK */ } @@ -687,6 +699,7 @@ PUBLIC int HTDoConnect ARGS4( return HT_NO_DATA; } +#ifndef DOSPATH #if !defined(NO_IOCTL) || defined(USE_FCNTL) /* ** Make the socket non-blocking, so the connect can be canceled. @@ -702,8 +715,9 @@ PUBLIC int HTDoConnect ARGS4( #endif /* USE_FCNTL */ if (ret == -1) _HTProgress("Could not make connection non-blocking."); -#endif /* !NO_IOCTL || USE_FCNTL */ } +#endif /* !NO_IOCTL || USE_FCNTL */ +#endif /* DOSPATH */ /* ** Issue the connect. Since the server can't do an instantaneous @@ -721,6 +735,7 @@ PUBLIC int HTDoConnect ARGS4( } else #endif /* SOCKS */ status = connect(*s, (struct sockaddr*)&soc_address, sizeof(soc_address)); +#ifndef DJGPP /* ** According to the Sun man page for connect: ** EINPROGRESS The socket is non-blocking and the con- @@ -856,7 +871,7 @@ PUBLIC int HTDoConnect ARGS4( } } } - +#endif /* DJGPP */ if (status < 0) { /* ** The connect attempt failed or was interrupted, @@ -864,6 +879,7 @@ PUBLIC int HTDoConnect ARGS4( */ NETCLOSE(*s); } +#ifndef DOSPATH #if !defined(NO_IOCTL) || defined(USE_FCNTL) else { /* @@ -879,6 +895,7 @@ PUBLIC int HTDoConnect ARGS4( _HTProgress("Could not restore socket to blocking."); } #endif /* !NO_IOCTL || USE_FCNTL */ +#endif /* DOSPATH */ FREE(line); return status; diff --git a/WWW/Library/Implementation/HTTCP.h b/WWW/Library/Implementation/HTTCP.h index 1187c459..b4dab1d6 100644 --- a/WWW/Library/Implementation/HTTCP.h +++ b/WWW/Library/Implementation/HTTCP.h @@ -26,11 +26,13 @@ ** returns a pointer to a static string which must be copied if ** it is to be kept. */ +#ifndef _WINDOWS #ifdef __STDC__ - extern const char * HTInetString(struct sockaddr_in* sin); + extern const char * HTInetString(struct sockaddr_in* mysin); #else extern char * HTInetString(); #endif +#endif /* Encode INET status (as in sys/errno.h) inet_status() @@ -88,7 +90,7 @@ extern unsigned int HTCardinal PARAMS((int *pstatus, ** field is left unchanged in *sin. */ #ifdef __STDC__ - extern int HTParseInet(struct sockaddr_in * sin, CONST char * str); + extern int HTParseInet(struct sockaddr_in * mysin, CONST char * str); /*!! had to change this to get it to compile. CTB */ #else extern int HTParseInet(); diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c index e4ad1517..e78870d6 100644 --- a/WWW/Library/Implementation/HTTP.c +++ b/WWW/Library/Implementation/HTTP.c @@ -260,13 +260,13 @@ try_again: strcasecomp(HTAtom_name(pres->rep), "www/compressed")) { if (pres->quality < 1.0) { if (pres->maxbytes > 0) { - sprintf(temp, ";q=%4.3f;mxb=%d", + sprintf(temp, ";q=%4.3f;mxb=%ld", pres->quality, pres->maxbytes); } else { sprintf(temp, ";q=%4.3f", pres->quality); } } else if (pres->maxbytes > 0) { - sprintf(temp, ";mxb=%d", pres->maxbytes); + sprintf(temp, ";mxb=%ld", pres->maxbytes); } else { temp[0] = '\0'; } diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c index a9bf8527..99b91295 100644 --- a/WWW/Library/Implementation/HTTelnet.c +++ b/WWW/Library/Implementation/HTTelnet.c @@ -31,9 +31,13 @@ #include "HTAccess.h" #include "HTAlert.h" -#ifndef VMS +#if !defined (VMS) && !defined (_WINDOWS) #include "../../../userdefs.h" /* for TELNET_COMMAND and RLOGIN_COMMAND */ -#endif /* not VMS */ +#endif /* not VMS or _WINDOWS */ + +#ifdef _WINDOWS /* ../../.. doesn't work for me WB */ +#include "userdefs.h" /* for TELNET_COMMAND and RLOGIN_COMMAND */ +#endif #include "LYLeaks.h" @@ -158,7 +162,7 @@ PRIVATE int remote_session ARGS2(char *, access, char *, host) #endif /* Most unix machines suppport username only with rlogin */ -#if defined(unix) +#if defined(unix) || defined(DOSPATH) #ifndef TELNET_DONE if (login_protocol == rlogin) { sprintf(command, "%s %s%s%s", RLOGIN_COMMAND, diff --git a/WWW/Library/Implementation/HTUU.c b/WWW/Library/Implementation/HTUU.c index 68cad23b..4e6bcf4f 100644 --- a/WWW/Library/Implementation/HTUU.c +++ b/WWW/Library/Implementation/HTUU.c @@ -130,7 +130,7 @@ PUBLIC int HTUU_decode ARGS3(char *, bufcoded, int, outbufsize) { /* single character decode */ -#define DEC(c) pr2six[c] +#define DEC(c) pr2six[(int)c] #define MAXVAL 63 static int first = 1; diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h index 5267a7c2..2c5576b5 100644 --- a/WWW/Library/Implementation/HTUtils.h +++ b/WWW/Library/Implementation/HTUtils.h @@ -9,15 +9,146 @@ #ifndef DEBUG #define DEBUG /* Noone ever turns this off as trace is too important */ -#endif /* Keeep option for really small memory applications tho */ +#endif /* Keep option for really small memory applications tho */ #ifndef HTUTILS_H #define HTUTILS_H +#ifdef HAVE_CONFIG_H +#include <lynx_cfg.h> /* generated by autoconf 'configure' script */ +#else + +/* Explicit system-configure */ +#ifdef VMS +#define NO_SIZECHANGE +#endif + +/* FIXME: these will be removed after completing auto-configure script */ + +#ifdef _IBMR2 +#define USE_DIRENT /* sys V style directory open */ +#endif /* _IBMR2 */ + +#ifdef _SYSV3 +#include <fcntl.h> +#define USE_DIRENT /* sys V style directory open */ +#endif /* _SYSV3 */ + +/* Solaris. */ +#if defined(sun) && defined(__svr4__) && !defined(USE_DIRENT) +#define USE_DIRENT /* sys V style directory open */ +#endif /* sun && __svr4__ && !USE_DIRENT */ + +#ifdef __alpha +#define USE_DIRENT +#endif /* __alpha */ + +#ifndef USE_DIRENT +#ifdef SVR4 +#define USE_DIRENT +#endif /* SVR4 */ +#endif /* !USE_DIRENT */ + +#ifndef SOLARIS2 +#include <string.h> /* For bzero etc */ +#endif /* !SOLARIS2 */ + +#ifdef SCO +#define sco +#endif /* SCO */ +#ifdef sco +#include <sys/fcntl.h> +#define USE_DIRENT +#endif /* sco */ + +/* +Intergraph CLIX + */ +#ifdef CLIX +#include <sys/fcntl.h> +#define USE_DIRENT +#endif /* CLIX */ + +#ifdef ISC +#ifndef NO_UNISTD_H +#include <sys/unistd.h> +#endif /* !NO_UNISTD_H */ +#else +#if !defined(NO_UNISTD_H) && !defined(VMS) +#include <unistd.h> +#endif /* !NO_UNISTD_H && !VMS */ +#endif /* ISC */ + +#if defined(SVR4) || defined(UNIXWARE) +#include <sys/fcntl.h> +#ifndef NO_FILIO_H /* BSD Interactive doesn't have filio.h. */ +#include <sys/filio.h> +#endif /* !NO_FILIO_H */ +#endif /* SVR4 || UNIXWARE */ + +/* +SOLARIS 2 + */ +#ifdef SOLARIS2 +#include <sys/filio.h> +#endif /* SOLARIS2 */ + +#ifndef NO_FILIO_H +#define NO_FILIO_H /* prevent conflict between autoconf & BSDI make */ +#endif + +/* Accommodate pre-autoconf Makefile */ + +#ifndef NO_CBREAK +#define HAVE_CBREAK 1 +#endif + +#ifndef NO_CUSERID +#define HAVE_CUSERID 1 +#endif + +#ifndef NO_FILIO_H +#define HAVE_SYS_FILIO_H 1 +#endif + +#ifndef NO_GETCWD +#define HAVE_GETCWD 1 +#endif + +#ifndef NO_KEYPAD +#define HAVE_KEYPAD 1 +#endif + +#ifndef NO_PUTENV +#define HAVE_PUTENV 1 +#endif + +#ifndef NO_SIZECHANGE +#define HAVE_SIZECHANGE 1 +#endif + +#ifndef NO_TTYTYPE +#define HAVE_TTYTYPE 1 +#endif + +#ifndef NO_UNISTD_H +#define HAVE_UNISTD_H 1 +#endif + +#ifndef NO_UTMP +#define HAVE_UTMP 1 +#endif + +#endif + #ifdef _WINDOWS /* SCW */ #include "windef.h" #define BOOLEAN_DEFINED -#endif +#define va_arg +#include <dos.h> +#define popen _popen +#define pclose _pclose +#endif /* _WINDOWS */ #ifdef SHORT_NAMES #define WWW_TraceFlag HTTrFlag @@ -265,18 +396,6 @@ Out Of Memory checking for malloc() return: LYOutOfMemory = TRUE; exit(-1);} /* extern void outofmem PARAMS((const char *fname, const char *func)); */ - -/* - - WHO PUT THESE IN AND WHAT ARE THEY ANYWAY? - - */ -#ifdef THEY_WILL_BE_REMOVED -extern void msg_init PARAMS((int height)); -extern void msg_printf PARAMS((int y, const char *fmt, ...)); -extern void msg_exit PARAMS((int wait_for_key)); -#endif - /* Upper- and Lowercase macros diff --git a/WWW/Library/Implementation/LYexit.h b/WWW/Library/Implementation/LYexit.h index 4d7ca529..7007d615 100644 --- a/WWW/Library/Implementation/LYexit.h +++ b/WWW/Library/Implementation/LYexit.h @@ -25,6 +25,10 @@ /* * Constant defines */ +#ifdef _WINDOWS +#undef exit +#endif /* _WINDOWS */ + #define exit LYexit #define atexit LYatexit #define ATEXITSIZE 32 @@ -46,7 +50,7 @@ */ extern void LYexit PARAMS((int status)); #ifdef __STDC__ -extern int LYatexit(void (*function)()); +extern int LYatexit(void (*function)(void)); #else extern int LYatexit(); #endif /* __STDC__ */ diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c index c20801f6..7cfbd68d 100644 --- a/WWW/Library/Implementation/SGML.c +++ b/WWW/Library/Implementation/SGML.c @@ -21,6 +21,12 @@ #include "LYLeaks.h" +#ifdef EXP_CHARTRANS +#include "UCMap.h" +#include "UCDefs.h" +#include "UCAux.h" +#endif + #define INVALID (-1) #define FREE(x) if (x) {free(x); x = NULL;} @@ -103,10 +109,80 @@ struct _HTStream { char * url; char * csi; int csi_index; +#ifdef EXP_CHARTRANS + HTParentAnchor * node_anchor; + LYUCcharset * UCI; /* pointer into anchor's UCInfo */ + int in_char_set; /* tells us what charset we are fed */ + LYUCcharset * htmlUCI; /* pointer into anchor's UCInfo for target*/ + int html_char_set; /* tells us what we feed to target stream */ + char utf_count; + long utf_char; + char utf_buf[7]; + char * utf_buf_p; + UCTransParams T; +#endif /* EXP_CHARTRANS */ } ; +#ifdef EXP_CHARTRANS + +PRIVATE void set_chartrans_handling ARGS3( + HTStream *, context, + HTParentAnchor *, anchor, + int, chndl) +{ + extern int current_char_set; + + if (chndl < 0) { + chndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_STRUCTURED); + if (chndl < 0) + chndl = HTAnchor_getUCLYhndl(anchor, UCT_STAGE_HTEXT); + if (chndl < 0) + chndl = current_char_set; + HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_HTEXT, + UCT_SETBY_DEFAULT); + HTAnchor_setUCInfoStage(anchor, chndl, UCT_STAGE_STRUCTURED, + UCT_SETBY_DEFAULT); + context->htmlUCI = HTAnchor_getUCInfoStage( + anchor,UCT_STAGE_STRUCTURED); + context->html_char_set = HTAnchor_getUCLYhndl( + context->node_anchor,UCT_STAGE_STRUCTURED); + } + UCSetTransParams(&context->T, + context->in_char_set, context->UCI, + context->html_char_set, context->htmlUCI); +} + +PRIVATE void change_chartrans_handling ARGS1( + HTStream *, context) +{ + int new_LYhndl = HTAnchor_getUCLYhndl(context->node_anchor, + UCT_STAGE_PARSER); + if (new_LYhndl != context->in_char_set && + new_LYhndl >= 0) { /* something changed. but ignore if a META + wants an unknown charset. */ + LYUCcharset * new_UCI = HTAnchor_getUCInfoStage(context->node_anchor, + UCT_STAGE_PARSER); + if (new_UCI) { + LYUCcharset * next_UCI = HTAnchor_getUCInfoStage( + context->node_anchor,UCT_STAGE_STRUCTURED); + int next_LYhndl = HTAnchor_getUCLYhndl( + context->node_anchor,UCT_STAGE_STRUCTURED); + context->UCI = new_UCI; + context->in_char_set = new_LYhndl; + context->htmlUCI = next_UCI; + context->html_char_set = next_LYhndl; + set_chartrans_handling(context, context->node_anchor, next_LYhndl); + } + } +} +#endif /* EXP_CHARTRANS */ + #define PUTC(ch) ((*context->actions->put_character)(context->target, ch)) +#ifdef EXP_CHARTRANS +#define PUTUTF8(code) (UCPutUtf8_charstring((HTStream *)context->target, \ + (putc_func_t*)(context->actions->put_character), code)) +#endif extern BOOL historical_comments; extern BOOL minimal_comments; @@ -163,6 +239,32 @@ PRIVATE void handle_attribute_value ARGS2( context->current_attribute_number = INVALID; /* can't have two assignments! */ } +#ifdef EXP_CHARTRANS +/* translate some Unicodes to Lynx special codes and output them. */ +PRIVATE BOOL put_special_unicodes ARGS2( + HTStream *, context, + long, code) +{ + if (code == 160) { + PUTC(1); + } else if (code==173) { + PUTC(7); + } else if (code == 8194 || code == 8195 || code == 8201) { + /* + ** ensp, emsp or thinsp. + */ + PUTC(2); + } else if (code == 8211 || code == 8212) { + /* + ** ndash or mdash. + */ + PUTC('-'); + } else { + return NO; /* return NO if nothing done */ + } + return YES; /* we have handled it */ +} +#endif /* Handle entity ** ------------- @@ -175,8 +277,14 @@ PRIVATE void handle_attribute_value ARGS2( ** Bug-fix: ** Modified SGML_character() so we only come here with terminator ** as '\0' and check a FoundEntity flag. -- Foteos Macrides +** +** Modified more (for use with CHARTRANS): */ +#ifdef EXP_CHARTRANS +PRIVATE char replace_buf [61]; /* buffer for replacement strings */ +#endif + PRIVATE BOOL FoundEntity = FALSE; PRIVATE void handle_entity ARGS2( @@ -184,6 +292,11 @@ PRIVATE void handle_entity ARGS2( char, term) { CONST char ** entities = context->dtd->entity_names; +#ifdef EXP_CHARTRANS + CONST UC_entity_info * extra_entities = context->dtd->extra_entity_info; + extern int current_char_set; + int rc; +#endif CONST char *s = context->string->data; int high, low, i, diff; @@ -223,6 +336,48 @@ PRIVATE void handle_entity ARGS2( return; } } +#ifdef EXP_CHARTRANS + /* repeat for extra entities if not found... hack... -kw */ + if (TRACE) + fprintf(stderr, "SGML: Unknown entity %s so far, checking extra...\n", s); + for (low = 0, high = context->dtd->number_of_extra_entities; + high > low; + diff < 0 ? (low = i+1) : (high = i)) { /* Binary serach */ + i = (low + (high-low)/2); + diff = strcmp(extra_entities[i].name, s); /* Case sensitive! */ + if (diff==0) { /* success: found it */ + if (put_special_unicodes(context, extra_entities[i].code)) { + FoundEntity = TRUE; + return; + } else if (context->T.output_utf8 && + PUTUTF8(extra_entities[i].code)) { + FoundEntity = TRUE; + return; + } + if ((rc = UCTransUniChar(extra_entities[i].code,current_char_set)) + > 0) { /* Could do further checks here... -kw */ + PUTC(rc); + FoundEntity = TRUE; + return; + } else if ((rc == -4) && /* Not found; look for replacement string */ + (rc = UCTransUniCharStr(replace_buf,60, + extra_entities[i].code, + current_char_set, 0) >= 0 ) ) { + CONST char *p; + for (p=replace_buf; *p; p++) + PUTC(*p); + FoundEntity = TRUE; + return; + } + rc = (*context->actions->put_entity)(context->target, + i+context->dtd->number_of_entities); + if (rc != HT_CANNOT_TRANSLATE) { + FoundEntity = TRUE; + return; + } + } + } +#endif /* ** If entity string not found, display as text. */ @@ -430,6 +585,11 @@ PRIVATE void start_element ARGS1( N->tag = new_tag; context->element_stack = N; } +#ifdef EXP_CHARTRANS + else { /* check for result of META tag. */ + change_chartrans_handling(context); + } +#endif /* EXP_CHARTRANS */ } @@ -475,7 +635,6 @@ PUBLIC void SGML_free ARGS1( { int i; HTElement * cur; - HTElement * next; HTTag * t; /* @@ -567,7 +726,7 @@ PUBLIC void SGML_setCallerData ARGS2( PUBLIC void SGML_character ARGS2( HTStream *, context, - char, c) + char, c_in) { CONST SGML_dtd *dtd = context->dtd; HTChunk *string = context->string; @@ -576,12 +735,114 @@ PUBLIC void SGML_character ARGS2( extern char *LYchar_set_names[]; extern CONST char * HTMLGetEntityName PARAMS((int i)); +#ifdef EXP_CHARTRANS + extern int LYlowest_eightbit[]; + char * p; + BOOLEAN chk; /* helps (?) walk through all the else ifs... */ + long clong,uck; /* enough bits for UCS4 ... */ + char c; + char saved_char_in = '\0'; + + /* Now some fun with the preprocessor... + for EXP_CHARTRANS, use copies for c an unsign_c==clong, so that we + can revert back to the unchanged c_in. + if EXP_CHARTRANS is undefined, these all are the same variable. */ +#define unsign_c clong + +#else +#define c c_in +#define unsign_c (unsigned char)c +#endif + +#ifdef EXP_CHARTRANS + c = c_in; + clong = (unsigned char)c; /* a.k.a. unsign_c */ + + if (context->T.decode_utf8) { + /* Combine UTF-8 into Unicode */ + /* Incomplete characters silently ignored */ + /* from Linux kernel's console.c */ + if((unsigned char)c > 0x7f) { + if (context->utf_count > 0 && (c & 0xc0) == 0x80) { + context->utf_char = (context->utf_char << 6) | (c & 0x3f); + context->utf_count--; + *(context->utf_buf_p++) = c; + if (context->utf_count == 0) { + *(context->utf_buf_p) = '\0'; + clong = context->utf_char; + if (clong<256) c = (char)clong; + goto top1; + } + else return; /* wait for more */ + } else { + context->utf_buf_p = context->utf_buf; + *(context->utf_buf_p++) = c; + if ((c & 0xe0) == 0xc0) { + context->utf_count = 1; + context->utf_char = (c & 0x1f); + } else if ((c & 0xf0) == 0xe0) { + context->utf_count = 2; + context->utf_char = (c & 0x0f); + } else if ((c & 0xf8) == 0xf0) { + context->utf_count = 3; + context->utf_char = (c & 0x07); + } else if ((c & 0xfc) == 0xf8) { + context->utf_count = 4; + context->utf_char = (c & 0x03); + } else if ((c & 0xfe) == 0xfc) { + context->utf_count = 5; + context->utf_char = (c & 0x01); + } else { /* garbage */ + context->utf_count = 0; + context->utf_buf_p = context->utf_buf; + *(context->utf_buf_p) = '\0'; + } + return; /* wait for more */ + } + } else { /* got an ASCII char */ + context->utf_count = 0; + context->utf_buf_p = context->utf_buf; + *(context->utf_buf_p) = '\0'; + /* goto top; */ + } + } + + if (context->T.strip_raw_char_in) + saved_char_in = c; + + if (context->T.trans_to_uni && unsign_c >= 127) { + clong = UCTransToUni(c, context->in_char_set); + if (clong > 0) { + saved_char_in = c; + if (clong < 256) { + c = (char)clong; + } + } + goto top1; + } else { + goto top0a; + } + + /* At this point we have either unsign_c a.k.a. clong in Unicode + (and c in latin1 if clong is in the latin1 range), + or unsign_c and c will have to be passed raw. */ + +#endif /* EXP_CHARTRANS */ + + top: +#ifdef EXP_CHARTRANS + saved_char_in = '\0'; +top0a: + *(context->utf_buf) = '\0'; + clong = (unsigned char)c; +#endif +top1: /* ** Ignore low ISO 646 7-bit control characters ** if HTCJK is not set. - FM */ - if ((unsigned char)c < 32 && + if (unsign_c < 32 && c != 9 && c != 10 && c != 13 && HTCJK == NOCJK) return; @@ -590,16 +851,21 @@ top: ** Ignore 127 if we don't have HTPassHighCtrlRaw ** or HTCJK set. - FM */ +#ifndef EXP_CHARTRANS +#define PASSHICTRL HTPassHighCtrlRaw +#else +#define PASSHICTRL (context->T.transp || unsign_c >= LYlowest_eightbit[context->in_char_set]) +#endif /* EXP_CHARTRANS */ if (c == 127 && - !(HTPassHighCtrlRaw || HTCJK != NOCJK)) + !(PASSHICTRL || HTCJK != NOCJK)) return; /* ** Ignore 8-bit control characters 128 - 159 if ** neither HTPassHighCtrlRaw nor HTCJK is set. - FM */ - if ((unsigned char)c > 127 && (unsigned char)c < 160 && - !(HTPassHighCtrlRaw || HTCJK != NOCJK)) + if (unsign_c > 127 && unsign_c < 160 && + !(PASSHICTRL || HTCJK != NOCJK)) return; /* @@ -630,7 +896,7 @@ top: PUTC(c); break; } - if (c == '&' && (!context->element_stack || + if (c == '&' && unsign_c < 127 && (!context->element_stack || (context->element_stack->tag && (context->element_stack->tag->contents == SGML_MIXED || @@ -641,7 +907,7 @@ top: */ string->size = 0; context->state = S_ero; - } else if (c == '<') { + } else if (c == '<' && unsign_c < 127) { /* ** Setting up for possible tag. - FM */ @@ -651,35 +917,74 @@ top: context->element_stack->tag->contents == SGML_LITTERAL) ? S_litteral : S_tag; +#ifndef EXP_CHARTRANS +#define PASS8859SPECL HTPassHighCtrlRaw +#else +#define PASS8859SPECL context->T.pass_160_173_raw +#endif /* EXP_CHARTRANS */ /* ** Convert 160 (nbsp) to Lynx special character if ** neither HTPassHighCtrlRaw nor HTCJK is set. - FM */ - } else if ((unsigned char)c == 160 && - !(HTPassHighCtrlRaw || HTCJK != NOCJK)) { + } else if (unsign_c == 160 && + !(PASS8859SPECL || HTCJK != NOCJK)) { PUTC(1); /* ** Convert 173 (shy) to Lynx special character if ** neither HTPassHighCtrlRaw nor HTCJK is set. - FM */ - } else if ((unsigned char)c == 173 && - !(HTPassHighCtrlRaw || HTCJK != NOCJK)) { + } else if (unsign_c == 173 && + !(PASS8859SPECL || HTCJK != NOCJK)) { PUTC(7); + +#ifdef EXP_CHARTRANS + } else if (context->T.use_raw_char_in && saved_char_in) { + /* only if the original character is still in saved_char_in, + otherwise we may be iterating from a goto top */ + PUTC(saved_char_in); + saved_char_in = '\0'; +/****************************************************************** + * I. LATIN-1 OR UCS2 TO DISPLAY CHARSET + ******************************************************************/ + } else if ((chk = (context->T.trans_from_uni && unsign_c >= 160)) && + (uck = UCTransUniChar(unsign_c, context->html_char_set)) >= 32 && + uck < 256) { + if (TRACE) + fprintf(stderr,"UCTransUniChar returned 0x%lx:'%c'.\n",uck,(char)uck); + c = (char)(uck & 0xff); + PUTC(c); + } else if (chk && (uck == -4) && + /* Not found; look for replacement string */ + (uck = UCTransUniCharStr(replace_buf,60, clong, + context->html_char_set, 0) >= 0 ) ) { + CONST char *p; + /* No further tests for valididy - assume that whoever + defined replacement strings knew what she was doing. */ + + for (p=replace_buf; *p; p++) + PUTC(*p); +#endif /* EXP_CHARTRANS */ + /* ** If it's any other (> 160) 8-bit chararcter, and ** we have not set HTPassEightBitRaw nor HTCJK, nor ** have the "ISO Latin 1" character set selected, ** back translate for our character set. - FM */ - } else if ((unsigned char)c > 160 && - !(HTPassEightBitRaw || HTCJK != NOCJK) && +#ifndef EXP_CHARTRANS +#define PASSHI8BIT HTPassEightBitRaw +#else +#define PASSHI8BIT (HTPassEightBitRaw || (context->T.do_8bitraw && !context->T.trans_from_uni)) +#endif /* EXP_CHARTRANS */ + } else if (unsign_c > 160 && unsign_c < 256 && + !(PASSHI8BIT || HTCJK != NOCJK) && strncmp(LYchar_set_names[current_char_set], "ISO Latin 1", 11)) { int i; int value; string->size = 0; - value = (int)((unsigned char)c - 160); + value = (int)(unsign_c - 160); EntityName = HTMLGetEntityName(value); for (i = 0; EntityName[i]; i++) HTChunkPutc(string, EntityName[i]); @@ -688,6 +993,37 @@ top: string->size = 0; if (!FoundEntity) PUTC(';'); +#ifdef EXP_CHARTRANS + /* + ** If we get to here and have an ASCII char, pass the character. + */ + } else if (unsign_c < 127 && unsign_c > 0) { + PUTC(c); + /* + ** If we get to here, and should have translated, translation has + ** failed so far. + */ + } else if (context->T.output_utf8 && + *context->utf_buf) { + for (p=context->utf_buf; *p; p++) + PUTC(*p); + context->utf_buf_p = context->utf_buf; + *(context->utf_buf_p) = '\0'; + + } else if (context->T.strip_raw_char_in && saved_char_in && + ((unsigned char)saved_char_in >= 0xc0) && + ((unsigned char)saved_char_in < 255)) { + /* KOI8 special: strip high bit, gives (somewhat) readable ASCII + or KOI7 - it was constructed that way! */ + PUTC((char)(saved_char_in & 0x7f)); + saved_char_in = '\0'; + + } else if ((unsigned char)c<LYlowest_eightbit[context->html_char_set] + || (context->T.trans_from_uni && !HTPassEightBitRaw)) { + sprintf(replace_buf,"U%.2lx",unsign_c); + for (p=replace_buf; *p; p++) + PUTC(*p); +#endif /* EXP_CHARTRANS */ /* ** If we get to here, pass the character. - FM */ @@ -746,7 +1082,7 @@ top: ** Handle possible named entity. */ case S_entity: - if ((unsigned char)c < 127 && isalnum((unsigned char)c)) { + if (unsign_c < 127 && isalnum((unsigned char)c)) { /* ** Accept valid ASCII character. - FM */ @@ -758,7 +1094,7 @@ top: */ PUTC('&'); context->state = S_text; - goto top; + goto top1; } else { /* ** Terminate entity name and try to handle it. - FM @@ -774,7 +1110,7 @@ top: ** not the "standard" semi-colon for HTML. - FM */ if (!FoundEntity || c != ';') - goto top; + goto top1; } break; @@ -782,7 +1118,7 @@ top: ** Handle possible numeric entity. */ case S_cro: - if ((unsigned char)c < 127 && isdigit((unsigned char)c)) { + if (unsign_c < 127 && isdigit((unsigned char)c)) { /* ** Accept only valid ASCII digits. - FM */ @@ -795,8 +1131,8 @@ top: PUTC('&'); PUTC('#'); context->state = S_text; - goto top; - } else if ((unsigned char)c > 127 || isalnum((unsigned char)c)) { + goto top1; + } else if (unsign_c > 127 || isalnum((unsigned char)c)) { /* ** We have digit(s), but not a valid terminator, ** so recover the "&#" and digit(s) and recycle @@ -809,7 +1145,7 @@ top: PUTC(string->data[i]); string->size = 0; context->state = S_text; - goto top; + goto top1; } else { /* ** Terminate the numeric entity and try to handle it. - FM @@ -817,6 +1153,40 @@ top: int value, i; HTChunkTerminate(string); if (sscanf(string->data, "%d", &value) == 1) { +#ifdef EXP_CHARTRANS + if (value==160) { + /* we *always* should interpret this as Latin1 here! */ + PUTC(1); + string->size = 0; + context->state = S_text; + if (c != ';') + goto top1; + break; + } + if ((uck = UCTransUniChar(value,current_char_set)) >= 32 && + uck < 256 && + (uck < 127 || + uck >= LYlowest_eightbit[context->html_char_set]) + ) { + if (uck==160 && current_char_set==0) + PUTC(1); /* would only happen if some other unicode + is mapped to Latin-1 160 */ + else if (uck==173 && current_char_set==0) + PUTC(7); /* would only happen if some other unicode + is mapped to Latin-1 173 */ + else + PUTC(FROMASCII((char)uck)); + } else + if ((uck == -4) && /* Not found; look for replacement string */ + (uck = UCTransUniCharStr(replace_buf,60,value, + current_char_set, 0) >= 0 ) ) { + for (p=replace_buf; *p; p++) + PUTC(*p); + } else if (context->T.output_utf8 && + PUTUTF8(value)) { + /* do nothing more */ ; + } else +#endif /* EXP_CHARTRANS */ if (value == 8482) { /* ** trade Handle as named entity. - FM @@ -828,8 +1198,8 @@ top: HTChunkPutc(string, 'd'); HTChunkPutc(string, 'e'); context->state = S_entity; - goto top; - } + goto top1; + } else /* ** Show the numeric entity if the value: ** (1) Is greater than 255 (until we support Unicode). @@ -871,7 +1241,7 @@ top: PUTC(string->data[i]); string->size = 0; context->state = S_text; - goto top; + goto top1; } } else if (value == 160) { /* @@ -921,7 +1291,7 @@ top: PUTC(string->data[i]); string->size = 0; context->state = S_text; - goto top; + goto top1; } } /* @@ -934,7 +1304,7 @@ top: ** the "standard" semi-colon for HTML. - FM */ if (c != ';') - goto top; + goto top1; } else { /* ** Not an entity, and don't know why not, so add the @@ -963,7 +1333,7 @@ top: ** Tag */ case S_tag: /* new tag */ - if ((unsigned char)c < 127 && isalnum((unsigned char)c)) { + if (unsign_c < 127 && isalnum((unsigned char)c)) { /* ** Add valid ASCII character. - FM */ @@ -985,7 +1355,7 @@ top: */ context->state = S_text; PUTC('<'); - goto top; + goto top1; } else { /* End of tag name */ /* ** Try to handle tag. - FM @@ -1436,7 +1806,7 @@ top: string->size = 0; context->state = S_tag_gap; if (c == '>') /* We emulated the Netscape bug, so we go */ - goto top; /* back and treat it as the tag terminator */ + goto top1; /* back and treat it as the tag terminator */ } else if (c == '\033') { /* ** Setting up for possible double quotes in CJK escape @@ -1450,7 +1820,7 @@ top: break; case S_end: /* </ */ - if ((unsigned char)c < 127 && isalnum((unsigned char)c)) + if (unsign_c < 127 && isalnum((unsigned char)c)) HTChunkPutc(string, c); else { /* End of end tag name */ HTTag * t=0; @@ -1554,6 +1924,29 @@ top: context->state = S_text; } break; + } else if (tag_OK && + !strcasecomp(string->data, "FORM")) { + /* + ** Handle a FORM end tag. We declared FORM + ** as SGML_EMPTY to prevent "expected tag + ** substitution" and avoid throwing the + ** HTML.c stack out of whack (Wow, what + ** a hack! 8-). - FM + */ + if (TRACE) + fprintf(stderr, "SGML: End </%s>\n", string->data); + (*context->actions->end_element) + (context->target, + (context->current_tag - context->dtd->tags), + (char **)&context->include); + string->size = 0; + context->current_attribute_number = INVALID; + if (c != '>') { + context->state = S_junk_tag; + } else { + context->state = S_text; + } + break; } else { /* ** Handle all other end tags normally. - FM @@ -1814,8 +2207,9 @@ PUBLIC CONST HTStreamClass SGMLParser = ** */ -PUBLIC HTStream* SGML_new ARGS2( +PUBLIC HTStream* SGML_new ARGS3( CONST SGML_dtd *, dtd, + HTParentAnchor *, anchor, HTStructured *, target) { int i; @@ -1851,6 +2245,26 @@ PUBLIC HTStream* SGML_new ARGS2( context->url = NULL; context->csi = NULL; context->csi_index = 0; +#ifdef EXP_CHARTRANS + context->node_anchor = anchor; /*only for chartrans info. could be NULL? */ + + context->utf_count = 0; + context->utf_char = 0; + context->utf_buf[0] = context->utf_buf[6] = '\0'; + context->utf_buf_p = context->utf_buf; + + UCTransParams_clear(&context->T); + context->in_char_set = + HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER); + if (context->in_char_set < 0) { + HTAnchor_copyUCInfoStage(anchor, UCT_STAGE_PARSER, UCT_STAGE_MIME, + -1); + context->in_char_set = + HTAnchor_getUCLYhndl(anchor, UCT_STAGE_PARSER); + } + context->UCI=HTAnchor_getUCInfoStage(anchor, UCT_STAGE_PARSER); + set_chartrans_handling(context, anchor, -1); +#endif /* EXP_CHARTRANS */ return context; } diff --git a/WWW/Library/Implementation/SGML.h b/WWW/Library/Implementation/SGML.h index 5fa799d5..7ab47c82 100644 --- a/WWW/Library/Implementation/SGML.h +++ b/WWW/Library/Implementation/SGML.h @@ -24,6 +24,7 @@ #include "HTUtils.h" #endif /* HTUTILS_H */ #include "HTStream.h" +#include "HTAnchor.h" /* @@ -77,11 +78,22 @@ struct _tag{ ** ** Not the whole DTD, but all this parser usues of it. */ +#ifdef EXP_CHARTRANS +typedef struct { + char* name; + long code; +} UC_entity_info; +#endif + typedef struct { HTTag * tags; /* Must be in strcmp order by name */ int number_of_tags; CONST char ** entity_names; /* Must be in strcmp order by name */ int number_of_entities; +#ifdef EXP_CHARTRANS + CONST UC_entity_info * extra_entity_info; /* strcmp order by name */ + int number_of_extra_entities; +#endif } SGML_dtd; @@ -149,7 +161,7 @@ typedef struct _HTStructuredClass{ int element_number, char ** include)); - void (*put_entity) PARAMS(( + int (*put_entity) PARAMS(( HTStructured* me, int entity_number)); @@ -182,6 +194,7 @@ Create an SGML parser extern HTStream* SGML_new PARAMS(( CONST SGML_dtd * dtd, + HTParentAnchor * anchor, HTStructured * target)); extern CONST HTStreamClass SGMLParser; diff --git a/WWW/Library/Implementation/UCAux.h b/WWW/Library/Implementation/UCAux.h new file mode 100644 index 00000000..0094595d --- /dev/null +++ b/WWW/Library/Implementation/UCAux.h @@ -0,0 +1,41 @@ +#ifndef UCAUX_H +#define UCAUX_H + +extern BOOL UCCanUniTranslateFrom PARAMS((int from)); +extern BOOL UCCanTranslateUniTo PARAMS((int to)); +extern BOOL UCCanTranslateFromTo PARAMS((int from, int to)); + +struct _UCTransParams +{ + BOOL transp, do_cjk, decode_utf8, output_utf8, + use_raw_char_in, strip_raw_char_in, + pass_160_173_raw, do_8bitraw, + trans_to_uni, trans_from_uni; +}; +typedef struct _UCTransParams UCTransParams; + +extern void UCSetTransParams PARAMS(( + UCTransParams * pT, + int cs_in, + CONST LYUCcharset * p_in, + int cs_out, + CONST LYUCcharset * p_out)); + +extern void UCTransParams_clear PARAMS(( + UCTransParams * pT)); + +#ifndef HTSTREAM_H +#include "HTStream.h" +#endif + +typedef void + putc_func_t PARAMS(( + HTStream* me, + char ch)); + +extern BOOL UCPutUtf8_charstring PARAMS(( + HTStream * target, + putc_func_t * actions, + long code)); + +#endif /* UCAUX_H */ diff --git a/WWW/Library/Implementation/UCDefs.h b/WWW/Library/Implementation/UCDefs.h new file mode 100644 index 00000000..0c8966ea --- /dev/null +++ b/WWW/Library/Implementation/UCDefs.h @@ -0,0 +1,79 @@ +/* Definitions for EXP_CHARTRANS */ + +#ifndef UCDEFS_H +#define UCDEFS_H + +typedef struct _LYUCcharset { + int UChndl; + char *MIMEname; + int enc; + int repertoire; + int codepoints; + int cpranges; /* which ranges have valid displayable chars + (including nbsp and shy) */ + int like8859; /* for which ranges is it like 8859-1 */ +} LYUCcharset; + +#define UCT_ENC_7BIT 0 +#define UCT_ENC_8BIT 1 +#define UCT_ENC_8859 2 /* ??? */ +#define UCT_ENC_2022 3 +#define UCT_ENC_MAYBE2022 4 +#define UCT_ENC_CJK 5 +#define UCT_ENC_16BIT 6 +#define UCT_ENC_UTF8 7 + + +#define UCT_REP_SUBSETOF_LAT1 0x01 +#define UCT_REP_SUPERSETOF_LAT1 0x02 +#define UCT_REP_IS_LAT1 UCT_REP_SUBSETOF_LAT1 | UCT_REP_SUPERSETOF_LAT1 +/* assume everything we deal with is included in the UCS2 reperoire, + so a flag for _REP_SUBSETOF_UCS2 would be redundant */ + +/* more general description how the code points relate to 8859-1 and UCS: */ +#define UCT_CP_SUBSETOF_LAT1 0x01 /* implies UCT_CP_SUBSETOF_UCS2 */ +#define UCT_CP_SUPERSETOF_LAT1 0x02 +#define UCT_CP_SUBSETOF_UCS2 0x04 + +#define UCT_CP_IS_LAT1 UCT_CP_SUBSETOF_LAT1 | UCT_CP_SUPERSETOF_LAT1 + +/* more specific bitflags for practically important code point ranges: */ +#define UCT_R_LOWCTRL 0x08 /* 0x00-0x1F, for completeness */ +#define UCT_R_7BITINV 0x10 /* invariant, displayable 7bit chars */ +#define UCT_R_7BITNAT 0x20 /* displayable 7bit, national */ +#define UCT_R_HIGHCTRL 0x40 +#define UCT_R_8859SPECL 0x80 /* special chars in 8859-x sets: nbsp and shy*/ +#define UCT_R_HIGH8BIT 0x100 /* rest of 0xA0-0xFF range */ + +#define UCT_R_ASCII UCT_R_7BITINV | UCT_R_7BITNAT /*displayable US-ASCII*/ +#define UCT_R_LAT1 UCT_R_ASCII | UCT_R_8859SPECL | UCT_R_HIGH8BIT +#define UCT_R_8859S UCT_R_ASCII | UCT_R_8859SPECL +#define UCT_R_8BIT UCT_R_LAT1 | UCT_R_HIGHCTRL /* full 8bit range */ + +/* For the following some coments are in HTAnchor.c. */ + +#define UCT_STAGE_MIME 0 +#define UCT_STAGE_PARSER 1 /* What the parser (SGML.c) gets to see */ +#define UCT_STAGE_STRUCTURED 2 /* What the structured stream (HTML) gets fed*/ +#define UCT_STAGE_HTEXT 3 /* What gets fed to the HText_* functions */ +#define UCT_STAGEMAX 4 + +#define UCT_SETBY_NONE 0 +#define UCT_SETBY_DEFAULT 1 +#define UCT_SETBY_STRUCTURED 2 /* structured stream stage */ +#define UCT_SETBY_PARSER 3 /* set by SGML parser or similar */ +#define UCT_SETBY_MIME 4 /* set explicitly by MIME charset parameter */ + +typedef struct _UCStageInfo +{ + int lock; /* by what it has been set */ + int LYhndl; + LYUCcharset C; +} UCStageInfo; + +typedef struct _UCAnchorInfo +{ + struct _UCStageInfo s[UCT_STAGEMAX]; +} UCAnchorInfo; + +#endif /* UCDEFS_H */ diff --git a/WWW/Library/Implementation/UCMap.h b/WWW/Library/Implementation/UCMap.h new file mode 100644 index 00000000..93351ed4 --- /dev/null +++ b/WWW/Library/Implementation/UCMap.h @@ -0,0 +1,20 @@ +typedef long UCode_t; + +PUBLIC int UCTransUniChar PARAMS((UCode_t unicode, int charset_out)); +PUBLIC int UCTransUniCharStr PARAMS((char *outbuf, int buflen, UCode_t unicode, + int charset_out, int chk_single_flag)); +PUBLIC int UCTransChar PARAMS((char ch_in, int charset_in, int charset_out)); +PUBLIC int UCTransCharStr PARAMS((char *outbuf, int buflen, char ch_in, + int charset_in, int charset_out, int chk_single_flag)); +PUBLIC UCode_t UCTransToUni PARAMS((char ch_in, int charset_in)); +PUBLIC int UCGetLYhndl_byMIME PARAMS((CONST char *p)); +PUBLIC int UCGetRawUniMode_byLYhndl PARAMS((int i)); + +PUBLIC int UCLYhndl_for_unspec; +PUBLIC int UCLYhndl_for_unrec; +PUBLIC int UCLYhndl_HTFile_for_unspec; +PUBLIC int UCLYhndl_HTFile_for_unrec; + +#define UCTRANS_NOTFOUND (-4) + +#define HT_CANNOT_TRANSLATE -4 /* could go into HTUtils.h */ diff --git a/WWW/Library/Implementation/tcp.h b/WWW/Library/Implementation/tcp.h index 99b63224..7f38e545 100644 --- a/WWW/Library/Implementation/tcp.h +++ b/WWW/Library/Implementation/tcp.h @@ -65,6 +65,37 @@ typedef struct sockaddr_in SockA; /* See netinet/in.h */ #define STDIO_H #endif /* !STDIO_H */ +#if HAVE_DIRENT_H +# include <dirent.h> +# define D_NAMLEN(dirent) strlen((dirent)->d_name) +# define STRUCT_DIRENT struct dirent +# define GOT_READ_DIR 1 /* if directory reading functions are available */ +#else +# define D_NAMLEN(dirent) (dirent)->d_namlen +# define STRUCT_DIRENT struct direct +# define direct dirent /* FIXME */ +# if HAVE_SYS_NDIR_H +# include <sys/ndir.h> +# endif +# if HAVE_SYS_DIR_H +# include <sys/dir.h> +# endif +# if HAVE_NDIR_H +# include <ndir.h> +# endif +#endif + +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + #ifdef _AIX #define AIX #endif /* _AIX */ @@ -72,38 +103,17 @@ typedef struct sockaddr_in SockA; /* See netinet/in.h */ #define unix #endif /* AIX */ -#ifdef _IBMR2 -#define USE_DIRENT /* sys V style directory open */ -#endif /* _IBMR2 */ - -#ifdef _SYSV3 +#if HAVE_FCNTL_H #include <fcntl.h> -#include <dirent.h> -#endif /* _SYSV3 */ - -/* Solaris. */ -#if defined(sun) && defined(__svr4__) && !defined(USE_DIRENT) -#define USE_DIRENT /* sys V style directory open */ -#endif /* sun && __svr4__ && !USE_DIRENT */ - -#ifdef __alpha -#define USE_DIRENT -#endif /* __alpha */ - -#ifndef USE_DIRENT -#ifdef SVR4 -#define USE_DIRENT -#endif /* SVR4 */ -#endif /* !USE_DIRENT */ +#else +#if HAVE_SYS_FCNTL_H +#include <sys/fcntl.h> +#endif +#endif -#ifndef SOLARIS2 +#if HAVE_STRING_H #include <string.h> /* For bzero etc */ -#endif /* !SOLARIS2 */ - -/* Use builtin strdup when appropriate. */ -#if defined(ultrix) || defined(VMS) || defined(NeXT) -extern char *strdup (); -#endif /* ultrix || VMS || NeXT */ +#endif /* HAVE_STRING_H */ /* @@ -117,6 +127,47 @@ extern char *strdup (); /* +IBM-PC running Windows NT + + These parameters providede by Susan C. Weber <sweber@kyle.eitech.com>. +*/ + +#ifdef _WINDOWS +#include "fcntl.h" /* For HTFile.c */ +#include "sys\types.h" /* For HTFile.c */ +#include "sys\stat.h" /* For HTFile.c */ +#undef NETREAD +#undef NETWRITE +#undef NETCLOSE +#undef IOCTL +#define NETREAD(s,b,l) recv((s),(b),(l),0) +#define NETWRITE(s,b,l) send((s),(b),(l),0) +#define NETCLOSE(s) closesocket(s) +#define IOCTL ioctlsocket +#include <io.h> +#include <string.h> +#include <process.h> +#include <time.h> +#include <errno.h> +#include <direct.h> +#include <stdio.h> +#include <winsock.h> +typedef struct sockaddr_in SockA; /* See netinet/in.h */ +#define EINPROGRESS (WSABASEERR+36) +#define EALREADY (WSABASEERR+37) +#define EISCONN (WSABASEERR+56) +#define EINTR (WSABASEERR+4) +#define EAGAIN (WSABASEERR+1002) +#define ENOTCONN (WSABASEERR+57) +#define ECONNRESET (WSABASEERR+54) +#define EINVAL 22 +#define INCLUDES_DONE +#define TCP_INCLUDES_DONE +#endif /* WINDOWS */ + + + +/* VAX/VMS @@ -149,10 +200,10 @@ VAX/VMS #undef SOCKET_READ #undef NETWRITE #undef NETCLOSE -#undef IOCTL #define SOCKET_READ(s,b,l) ((s)>10 ? netread((s),(b),(l)) : read((s),(b),(l))) #define NETWRITE(s,b,l) ((s)>10 ? netwrite((s),(b),(l)) : write((s),(b),(l))) #define NETCLOSE(s) ((s)>10 ? netclose(s) : close(s)) +#undef IOCTL #define IOCTL(a,b,c) -1 /* disables ioctl function */ #define NO_IOCTL /* flag to check if ioctl is disabled */ #endif /* WIN_TCP */ @@ -387,49 +438,32 @@ struct timeval { #define GLOBALREF extern #endif /* !GLOBALREF */ +#ifdef DJGPP +#undef SELECT +#define TCP_INCLUDES_DONE +#define NO_IOCTL +#include <errno.h> +#include <sys/types.h> +#include <socket.h> -/* -SCO ODT unix version - */ -#ifdef SCO -#define sco -#endif /* SCO */ -#ifdef sco -#include <sys/fcntl.h> -#define USE_DIRENT -#endif /* sco */ +#undef NETWRITE +#define NETWRITE write_s +#undef NETREAD +#define NETREAD read_s +#undef NETCLOSE +#define NETCLOSE close_s +#endif /* -Intergraph CLIX +SCO ODT unix version */ -#ifdef CLIX -#include <sys/fcntl.h> -#define USE_DIRENT -#endif /* CLIX */ - -#ifdef ISC -#ifndef NO_UNISTD_H -#include <sys/unistd.h> -#endif /* !NO_UNISTD_H */ -#else -#if !defined(NO_UNISTD_H) && !defined(VMS) +#if HAVE_UNISTD_H #include <unistd.h> -#endif /* !NO_UNISTD_H && !VMS */ -#endif /* ISC */ - -#if defined(SVR4) || defined(UNIXWARE) -#include <sys/fcntl.h> -#ifndef NO_FILIO_H /* BSD Interactive doesn't have filio.h. */ -#include <sys/filio.h> -#endif /* !NO_FILIO_H */ -#endif /* SVR4 || UNIXWARE */ +#endif /* HAVE_UNISTD_H */ -/* -SOLARIS 2 - */ -#ifdef SOLARIS2 +#if HAVE_SYS_FILIO_H #include <sys/filio.h> -#endif /* SOLARIS2 */ +#endif /* HAVE_SYS_FILIO_H */ /* MIPS unix @@ -447,9 +481,9 @@ Regular BSD unix versions #ifndef INCLUDES_DONE #include <sys/types.h> /* #include <streams/streams.h> not ultrix */ -#ifndef SOLARIS2 +#if HAVE_STRING_H #include <string.h> -#endif /* !SOLARIS2 */ +#endif /* HAVE_STRING_H */ #include <errno.h> /* independent */ #ifdef SCO #include <sys/timeb.h> @@ -490,6 +524,7 @@ typedef int pid_t; #define INCLUDES_DONE #endif /* Normal includes */ +/* FIXME: this should be autoconf'd */ /* Interactive UNIX for i386 and i486 -- Thanks to jeffrey@itm.itm.org */ #ifdef ISC #include <net/errno.h> @@ -497,7 +532,6 @@ typedef int pid_t; #include <sys/tty.h> #include <sys/sioctl.h> #include <sys/bsdtypes.h> -#include <sys/fcntl.h> #ifndef MERGE #define MERGE #include <sys/pty.h> @@ -506,7 +540,7 @@ typedef int pid_t; #include <sys/pty.h> #endif /* !MERGE */ #ifndef USE_DIRENT -#define USE_DIRENT /* sys V style directory open */ +#define USE_DIRENT /* sys V style directory open */ #endif /* USE_DIRENT */ #include <sys/dirent.h> #endif /* ISC */ @@ -517,6 +551,18 @@ typedef int pid_t; #define unix #endif /* UNIX && !unix */ +#ifdef HAVE_CONFIG_H + +# ifdef HAVE_LIMITS_H +# include <limits.h> +# endif /* HAVE_LIMITS_H */ +# if !defined(MAXINT) && defined(INT_MAX) +# define MAXINT INT_MAX +# endif /* !MAXINT && INT_MAX */ + +#else + +/* FIXME: remove after completing configure-script */ #ifdef unix /* if this is to compile on a UNIX machine */ #define GOT_READ_DIR 1 /* if directory reading functions are available */ #ifdef USE_DIRENT /* sys v version */ @@ -538,6 +584,16 @@ typedef int pid_t; #endif /* !MAXINT && INT_MAX */ #endif /* unix */ +#ifndef VM +#ifndef VMS +#ifndef THINK_C +#define DECL_SYS_ERRLIST 1 +#endif /* !THINK_C */ +#endif /* !VMS */ +#endif /* !VM */ + +#endif /* !HAVE_CONFIG_H */ + /* Defaults ======== diff --git a/WWW/Library/djgpp/CommonMakefile b/WWW/Library/djgpp/CommonMakefile new file mode 100644 index 00000000..e0b6a171 --- /dev/null +++ b/WWW/Library/djgpp/CommonMakefile @@ -0,0 +1,379 @@ +# Common Makefile for W3 Library Code +# ----------------------------------- +# +# (c) CERN 1990, 1991 -- see Copyright.html for conditions +# +# This file should be invariant between systems. +# DEPENDENCIES NOT COMPLETE @@ +# +# make Compile and link the software (private version) +# make install Copy it into the system (implies make) +# make update Copy installed version into installed version +# make uninstall Unlink installed version from the system +# make clean Remove intermediate files +# make cleanall Remove intremediate files and products +# +# Macros required to be defined already for make: +# +# CC The C compiler +# CFLAGS Flags for $(CC) -- except the -I which are below +# LFLAGS Flags for ld +# LYFLAGS Flags for Lynx +# +# WWW The WWW source tree directory +# +# Macros needed for make install: +# +# LIBDIR Directory for installed library +#______________________________________________________________________ + +# If this env var is set to something else Some makes will use that instead +SHELL = /bin/sh + +# .h files are distributed but originally are made from the +# self-documenting hypertext files. + +.SUFFIXES: .h .html +.html.h: +# - chmod +w $*.h + www -w90 -na -to text/x-c $*.html > $*.h +# chmod -w $*.h + +# If this is actually run in a subdirectory, +# +# WWW = ../../.. +# WWW = ../.. For [cernlib] build in this directory + +WC = $(WWW)/Library +CMN = $(WWW)/Library/Implementation/ +VMS = $(CMN)vms +# Where shall we put the objects and built library? + +LOB = $(WTMP)/Library/$(WWW_MACH) + +# Only needed if HTWAIS.c is to be compiled. Put into your Makefile.include +# uncomment these and fill in WAISINC for adding direct wais access +# to Lynx. +#HTWAIS = $(LOB)/HTWAIS.o +#WAIS = YES +#WAISINC = -I../../../../freeWAIS-0.202/ir +#WAISCFLAGS = -DDIRECT_WAIS +# + +# This path, if relative, is taken relative to the directory +# in which this makefile is, not the pwd. This screws up the +# recursive invocation +# include $(CMN)Version.make +include $(ABS)$(WWW)/Library/Implementation/Version.make + +# XMOsAIC hack is only for server to cope with xmosaic kludge for mmedia +# +# add -DNEW_GATEWAY here for the new gateway config stuff +CFLAGS2 = $(CFLAGS) $(LYFLAGS) $(WAISCFLAGS) -I$(CMN) -DXMOSAIC_HACK -DACCESS_AUTH + +CERNLIBBIN = $(WWW)/bin + +COMMON = $(LOB)/HTParse.o $(LOB)/HTAccess.o $(LOB)/HTTP.o \ + $(LOB)/HTFile.o $(LOB)/HTBTree.o $(LOB)/HTFTP.o $(LOB)/HTTCP.o \ + $(LOB)/SGML.o $(LOB)/HTMLDTD.o $(LOB)/HTChunk.o \ + $(LOB)/HTPlain.o $(LOB)/HTWriter.o \ + $(LOB)/HTMLGen.o \ + $(LOB)/HTAtom.o $(LOB)/HTAnchor.o $(LOB)/HTStyle.o \ + $(LOB)/HTList.o $(LOB)/HTString.o $(LOB)/HTDOS.o \ + $(LOB)/HTRules.o $(LOB)/HTFormat.o $(LOB)/HTMIME.o \ + $(LOB)/HTHistory.o $(LOB)/HTNews.o $(LOB)/HTGopher.o \ + $(LOB)/HTTelnet.o $(LOB)/HTFinger.o $(LOB)/HTWSRC.o $(HTWAIS) \ + $(LOB)/HTAAUtil.o $(LOB)/HTAAServ.o $(LOB)/HTAABrow.o \ + $(LOB)/HTAAFile.o $(LOB)/HTPasswd.o $(LOB)/HTGroup.o \ + $(LOB)/HTACL.o $(LOB)/HTAuth.o $(LOB)/HTAAProt.o \ + $(LOB)/HTAssoc.o $(LOB)/HTLex.o $(LOB)/HTUU.o + +CFILES = $(CMN)HTParse.c $(CMN)HTAccess.c $(CMN)HTTP.c $(CMN)HTFile.c \ + $(CMN)HTBTree.c \ + $(CMN)HTFTP.c $(CMN)HTTCP.c $(CMN)SGML.c \ + $(CMN)HTMLDTD.c \ + $(CMN)HTPlain.c $(CMN)HTWriter.c \ + $(CMN)HTDOS.c $(CMN)HTMLGen.c \ + $(CMN)HTChunk.c $(CMN)HTAtom.c $(CMN)HTAnchor.c $(CMN)HTStyle.c \ + $(CMN)HTList.c $(CMN)HTString.c $(CMN)HTRules.c \ + $(CMN)HTFormat.c $(CMN)HTMIME.c $(CMN)HTHistory.c \ + $(CMN)HTNews.c $(CMN)HTGopher.c $(CMN)HTTelnet.c \ + $(CMN)HTFinger.c $(CMN)HTWAIS.c $(CMN)HTWSRC.c \ + $(CMN)HTAAUtil.c $(CMN)HTAAServ.c $(CMN)HTAABrow.c \ + $(CMN)HTAAFile.c $(CMN)HTPasswd.c $(CMN)HTGroup.c \ + $(CMN)HTACL.c $(CMN)HTAuth.c $(CMN)HTAAProt.c \ + $(CMN)HTAssoc.c $(CMN)HTLex.c $(CMN)HTUU.c + +HFILES = $(CMN)HTParse.h $(CMN)HTAccess.h $(CMN)HTTP.h $(CMN)HTFile.h \ + $(CMN)HTBTree.h $(CMN)HTFTP.h $(CMN)HTTCP.h \ + $(CMN)SGML.h $(CMN)HTML.h $(CMN)HTMLDTD.h $(CMN)HTChunk.h \ + $(CMN)HTPlain.h $(CMN)HTWriter.h \ + $(CMN)HTFWriter.h $(CMN)HTMLGen.h $(CMN)HTDOS.h \ + $(CMN)HTStream.h \ + $(CMN)HTAtom.h $(CMN)HTAnchor.h $(CMN)HTStyle.h \ + $(CMN)HTList.h \ + $(CMN)HTString.h $(CMN)HTAlert.h $(CMN)HTRules.h \ + $(CMN)HTFormat.h $(CMN)HTInit.h \ + $(CMN)HTMIME.h $(CMN)HTHistory.h $(CMN)HTNews.h \ + $(CMN)HTGopher.h \ + $(CMN)HTUtils.h $(CMN)tcp.h $(CMN)HText.h \ + $(CMN)HTTelnet.h $(CMN)HTFinger.h \ + $(CMN)HTWAIS.h $(CMN)HTWSRC.h \ + $(CMN)HTAAUtil.h $(CMN)HTAAServ.h $(CMN)HTAABrow.h \ + $(CMN)HTAAFile.h $(CMN)HTPasswd.h $(CMN)HTGroup.h \ + $(CMN)HTACL.h $(CMN)HTAuth.h $(CMN)HTAAProt.h \ + $(CMN)HTAssoc.h $(CMN)HTLex.h $(CMN)HTUU.h + +SOURCES = $(CFILES) $(HFILES) $(CMN)Version.make \ + $(CMN)CommonMakefile $(CMN)Makefile \ + $(WWW)/README.txt $(WWW)/Copyright.txt $(WWW)/BUILD $(WWW)/Makefile +SPECIFIC = $(WWW)/All/*/Makefile.include $(WWW)/All/Implementation/Makefile* \ + $(VMS)/descrip.mms $(VMS)/build_multinet.com \ + $(VMS)/COPYING.LIB $(VMS)/setup.com $(VMS)/multinet.opt \ + $(VMS)/patchlevel.h $(VMS)/ufc-crypt.h \ + $(VMS)/crypt.c $(VMS)/crypt_util.c \ + $(VMS)/getline.c $(VMS)/getpass.c \ + $(VMS)/HTVMSUtils.h $(VMS)/HTVMSUtils.c + + +# Library +# +# On SGI, ranlib is unnecessary and does not exist so we ignore errors +# for that step +$(LOB)/libwww.a : $(COMMON) + ar r $(LOB)/libwww.a $(COMMON) + -ranlib $(LOB)/libwww.a + +# Clean up everything generatable except final products +clean : + rm $(LOB)/*.o $(LOB)/.created + -rmdir $(LOB) + +# Clean up everything generatable including final products + +cleanall : clean + rm $(LOB)/libwww.a + +# Install W3 library into system space (not normally necessary) + +install : libwww.a + if [ ! -r $(LIBDIR) ] mkdir $(LIBDIR) + cp libwww.a $(LIBDIR)/libwww.a + +uninstall : + rm $(LIBDIR)/libwww.a + +# Distribution use only: +# ---------------------- + +# Needs www version 2.4 or later to do this +inc : $(HFILES) + echo Include files generated from hypertext. + +binary : /pub/www/bin/$(WWW_MACH)/libwww_$(VC).a + echo FTP archive binary Libray $(VC) for $(WWW_MACH) up to date. + + +/pub/www/bin/$(WWW_MACH)/libwww_$(VC).a : libwww.a + -mkdir /pub/www/bin/$(WWW_MACH) + cp libwww.a /pub/www/bin/$(WWW_MACH)/libwww_$(VC).a + +# Source Distribution: + +distribute : /pub/www/README.txt /pub/www/Copyright.txt + (cd $(WWW)/..; WWW=WWW ABS=`pwd`/ make $(MFLAGS) \ + -f WWW/Library/Implementation/CommonMakefile \ + /pub/www/src/WWWLibrary_$(VC).tar.Z) + (cd ../Implementation; cvs tag \ + `sed -e 's/VC = /v/' Version.make | sed -e 's?\.?/?'` ) + echo Distribution of Library version $(VC) up to date. + +/pub/www/src/WWWLibrary_$(VC).tar.Z : $(SOURCES) + tar cf /pub/www/src/WWWLibrary_$(VC).tar \ + $(SOURCES) $(SPECIFIC) $(WC)/*/Makefile + compress /pub/www/src/WWWLibrary_$(VC).tar + + +# Hypertext supplied in text format +# --------------------------------- + +$(WWW)/README.txt : $(WWW)/../README.html + www -n -p66 http://www.w3.org/hypertext/README.html \ + > $(WWW)/README.txt +/pub/www/README.txt : $(WWW)/README.txt + cp $(WWW)/README.txt /pub/www/README.txt + +$(WWW)/Copyright.txt : $(WWW)/../Copyright.html + www -n -p66 http://www.w3.org/hypertext/Copyright.html \ + > $(WWW)/Copyright.txt +/pub/www/Copyright.txt : $(WWW)/Copyright.txt + cp $(WWW)/Copyright.txt /pub/www/Copyright.txt + +# Common code +# ----------- + +# Directory for object files - .created checks it exists + +OE = $(LOB)/.created +$(OE) : + if [ ! -r $(WTMP) ] ; then mkdir $(WTMP); else echo OK ; fi + if [ ! -r $(WTMP)/Library ] ; then mkdir $(WTMP)/Library; else echo OK ; fi + if [ ! -r $(WTMP)/Library/$(WWW_MACH) ] ; \ + then mkdir $(WTMP)/Library/$(WWW_MACH); else echo OK ; fi + touch $@ + +$(LOB)/HTList.o : $(OE) $(CMN)HTList.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTList.c + +$(LOB)/HTAnchor.o : $(OE) $(CMN)HTAnchor.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAnchor.c + +$(LOB)/HTFormat.o : $(OE) $(CMN)HTFormat.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTFormat.c + +$(LOB)/HTMIME.o : $(OE) $(CMN)HTMIME.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTMIME.c + +$(LOB)/HTHistory.o : $(OE) $(CMN)HTHistory.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTHistory.c + +$(LOB)/HTDOS.o : $(OE) $(CMN)HTDOS.c $(CMN)HTUtils.h $(CMN)../../../userdefs.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTDOS.c + +$(LOB)/HTNews.o : $(OE) $(CMN)HTNews.c $(CMN)HTUtils.h $(CMN)HTList.h\ + $(CMN)HTMLDTD.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTNews.c + +$(LOB)/HTGopher.o : $(OE) $(CMN)HTGopher.c $(CMN)HTUtils.h $(CMN)HTList.h \ + $(CMN)HTMLDTD.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTGopher.c + +$(LOB)/HTTelnet.o : $(OE) $(CMN)HTTelnet.c $(CMN)HTUtils.h $(CMN)HTTelnet.h $(CMN)../../../userdefs.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTTelnet.c + +$(LOB)/HTFinger.o : $(OE) $(CMN)HTFinger.c $(CMN)HTUtils.h $(CMN)HTList.h \ + $(CMN)HTMLDTD.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTFinger.c + +$(LOB)/HTStyle.o : $(OE) $(CMN)HTStyle.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTStyle.c + +$(LOB)/HTAtom.o : $(OE) $(CMN)HTAtom.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAtom.c + +$(LOB)/HTChunk.o : $(OE) $(CMN)HTChunk.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTChunk.c + +$(LOB)/HTString.o : $(OE) $(CMN)HTString.c $(CMN)HTUtils.h $(CMN)Version.make + $(CC) -c -o $@ $(CFLAGS2) -DVC=\"$(VC)\" $(CMN)HTString.c + +$(LOB)/HTRules.o : $(OE) $(CMN)HTRules.c $(CMN)HTUtils.h $(CMN)Version.make \ + $(CMN)HTAAServ.h $(CMN)HTAAProt.h + $(CC) -c -o $@ $(CFLAGS2) -DVC=\"$(VC)\" $(CMN)HTRules.c + +$(LOB)/SGML.o : $(OE) $(CMN)SGML.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)SGML.c + +$(LOB)/HTMLGen.o : $(OE) $(CMN)HTMLGen.c $(CMN)HTUtils.h $(CMN)HTMLDTD.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTMLGen.c + +$(LOB)/HTMLDTD.o : $(OE) $(CMN)HTMLDTD.c $(CMN)SGML.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTMLDTD.c + +$(LOB)/HTPlain.o : $(OE) $(CMN)HTPlain.c $(CMN)HTPlain.h $(CMN)HTStream.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTPlain.c + +$(LOB)/HTWAIS.o : $(OE) $(CMN)HTWAIS.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(WAISINC) $(CMN)HTWAIS.c + +$(LOB)/HTWSRC.o : $(OE) $(CMN)HTWSRC.c $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTWSRC.c + +$(LOB)/HTWriter.o : $(OE) $(CMN)HTWriter.c $(CMN)HTWriter.h $(CMN)HTStream.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTWriter.c + + +# Access Authorization + +$(LOB)/HTAAUtil.o : $(OE) $(CMN)HTAAUtil.c $(CMN)HTAAUtil.h \ + $(CMN)HTUtils.h $(CMN)HTString.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAAUtil.c + +$(LOB)/HTAAFile.o : $(OE) $(CMN)HTAAFile.c $(CMN)HTAAFile.h \ + $(CMN)HTAAUtil.h $(CMN)HTUtils.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAAFile.c + +$(LOB)/HTPasswd.o : $(OE) $(CMN)HTPasswd.c $(CMN)HTPasswd.h \ + $(CMN)HTAAUtil.h $(CMN)HTAAFile.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTPasswd.c + +$(LOB)/HTGroup.o : $(OE) $(CMN)HTGroup.c $(CMN)HTGroup.h \ + $(CMN)HTAAUtil.h $(CMN)HTAAFile.h \ + $(CMN)HTAssoc.h $(CMN)HTLex.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTGroup.c + +$(LOB)/HTACL.o : $(OE) $(CMN)HTACL.c $(CMN)HTACL.h \ + $(CMN)HTAAUtil.h $(CMN)HTAAFile.h $(CMN)HTGroup.h \ + $(CMN)HTAssoc.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTACL.c + +$(LOB)/HTAuth.o : $(OE) $(CMN)HTAuth.c $(CMN)HTAuth.h \ + $(CMN)HTAAUtil.h $(CMN)HTPasswd.h $(CMN)HTAAFile.h \ + $(CMN)HTAssoc.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAuth.c + +$(LOB)/HTAAServ.o : $(OE) $(CMN)HTAAServ.c $(CMN)HTAAServ.h \ + $(CMN)HTAAUtil.h $(CMN)HTAAFile.h $(CMN)HTPasswd.h \ + $(CMN)HTGroup.h $(CMN)HTACL.h $(CMN)HTAuth.h \ + $(CMN)HTUU.h $(CMN)HTParse.h $(CMN)HTList.h \ + $(CMN)HTUtils.h $(CMN)HTString.h $(CMN)HTRules.h \ + $(CMN)HTAAProt.h $(CMN)HTAssoc.h $(CMN)HTLex.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAAServ.c + +$(LOB)/HTAABrow.o : $(OE) $(CMN)HTAABrow.c $(CMN)HTAABrow.h \ + $(CMN)HTAAUtil.h $(CMN)HTUU.h \ + $(CMN)HTUtils.h $(CMN)HTString.h \ + $(CMN)HTParse.h $(CMN)HTList.h $(CMN)HTAlert.h \ + $(CMN)HTAssoc.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAABrow.c + +$(LOB)/HTAAProt.o : $(OE) $(CMN)HTAAProt.c $(CMN)HTAAProt.h \ + $(CMN)HTUtils.h $(CMN)HTAAUtil.h $(CMN)HTAAFile.h \ + $(CMN)HTAssoc.h $(CMN)HTLex.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAAProt.c + +$(LOB)/HTAssoc.o : $(OE) $(CMN)HTAssoc.c $(CMN)HTAssoc.h \ + $(CMN)HTUtils.h $(CMN)HTString.h $(CMN)HTList.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAssoc.c + +$(LOB)/HTLex.o : $(OE) $(CMN)HTLex.c $(CMN)HTLex.h $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTLex.c + +$(LOB)/HTUU.o : $(OE) $(CMN)HTUU.c $(CMN)HTUU.h $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTUU.c + + +# Communications & Files + +$(LOB)/HTTP.o : $(OE) $(CMN)HTTP.c $(CMN)HTUtils.h $(CMN)HTAABrow.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTTP.c + +$(LOB)/HTTCP.o : $(OE) $(CMN)HTTCP.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTTCP.c + +$(LOB)/HTFile.o : $(OE) $(CMN)HTFile.c $(CMN)HTUtils.h \ + $(CMN)HTMLDTD.h $(CMN)HTAAServ.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTFile.c + +$(LOB)/HTBTree.o : $(OE) $(CMN)HTBTree.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTBTree.c + +$(LOB)/HTFTP.o : $(OE) $(CMN)HTFTP.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTFTP.c + +$(LOB)/HTAccess.o : $(OE) $(CMN)HTAccess.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTAccess.c + +$(LOB)/HTParse.o : $(OE) $(CMN)HTParse.c $(CMN)HTUtils.h + $(CC) -c -o $@ $(CFLAGS2) $(CMN)HTParse.c + diff --git a/WWW/Library/djgpp/makefile b/WWW/Library/djgpp/makefile new file mode 100644 index 00000000..2d096a16 --- /dev/null +++ b/WWW/Library/djgpp/makefile @@ -0,0 +1,29 @@ +# Make WWW under unix for a.n.other unix system (bsd) +# Use this as a template + +# For W3 distribution, machine type for subdirectories +WWW_MACH = djgpp + +# The ASIS repository's name for the machine we are on +ASIS_MACH = hardware/os + +CFLAGS = -O -DEXP_CHARTRANS -DCOLOR_CURSES -DDOSPATH -DNOUSERS -DDEBUG -I../../../djgpp/tcplib/include -I../../../djgpp/tcplib/include/tcp +LFLAGS = +CC = gcc + +# Directory for installed binary: +BINDIR = /usr/local/bin + +# Where is the W3 object library to be installed (not normally done)? +LIBDIR = $(WWW)/Library/Implementation/$(WWW_MACH) + +#_________________ OK if normal W3 distribution +# Where is the WWW source root? +WWW = ../.. + +# Where should temporary (object) files go? +WTMP = ../.. + +include $(WWW)/Library/Implementation/Version.make +#include $(WWW)/Library/Implementation/CommonMakefile +include ./CommonMakefile diff --git a/WWW/Library/unix/Makefile b/WWW/Library/unix/Makefile index c8d32fd9..e894af92 100644 --- a/WWW/Library/unix/Makefile +++ b/WWW/Library/unix/Makefile @@ -26,5 +26,5 @@ WWW = ../.. WTMP = ../.. +include $(WWW)/Library/Implementation/Version.make include $(WWW)/Library/Implementation/CommonMakefile - diff --git a/WWW/Library/unix/makefile.in b/WWW/Library/unix/makefile.in new file mode 100644 index 00000000..ea576adc --- /dev/null +++ b/WWW/Library/unix/makefile.in @@ -0,0 +1,54 @@ +# Make WWW under unix for a.n.other unix system (bsd) +# Use this as a template + +# For W3 distribution, machine type for subdirectories +WWW_MACH = unix + +# The ASIS repository's name for the machine we are on +ASIS_MACH = hardware/os + +LFLAGS = + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +srcdir = @srcdir@ +VPATH = $(srcdir) + +LYFLAGS = # FIXME: set in parent makefile + +CC = @CC@ +CPPOPTS = @DEFS@ @CPPFLAGS@ $(LYFLAGS) +CFLAGS = $(CPPOPTS) @CFLAGS@ + +# Directory for installed binary: +BINDIR = @bindir@ + +# Where is the W3 object library to be installed (not normally done)? +LIBDIR = $(WWW)/Library/Implementation/$(WWW_MACH) + +#_________________ OK if normal W3 distribution +# Where is the WWW source root? +WWW = ../.. + +# Where should temporary (object) files go? +WTMP = ../.. + +@make_include_left@$(WWW)/Library/Implementation/Version.make@make_include_right@ +@make_include_left@$(WWW)/Library/Implementation/CommonMakefile@make_include_right@ + +# Override values set in CommonMakefile + +RANLIB = @RANLIB@ + +all : $(LOB)/libwww.a + +.SUFFIXES: .i .h .html + +.c.o: +@SHOW_CC@ + @ECHO_CC@$(CC) $(CPPOPTS) $(CFLAGS) -c $(srcdir)/$*.c + +.c.i: +@SHOW_CC@ + @ECHO_CC@$(CPP) -C $(CPPOPTS) $*.c >$@ + |