This commit is contained in:
Alan Dipert
2010-03-08 05:55:21 -05:00
commit 29c82be0c2
528 changed files with 159411 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
#define AnchoredImage_width 40
#define AnchoredImage_height 10
static char AnchoredImage_bits[] = {
0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00,
0x00, 0x80, 0x07, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0xff,
0x1f, 0xfc, 0xff, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0xff, 0x0f, 0x00,
0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00,
0x80, 0x01};

16
libhtmlw/DelayedImage.xbm Normal file
View File

@@ -0,0 +1,16 @@
#define DelayedImage_width 40
#define DelayedImage_height 30
static char DelayedImage_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xfc,
0x01, 0xfe, 0x3f, 0x00, 0xfe, 0x03, 0xfe, 0x3f, 0x00, 0xff, 0x07, 0xfe,
0x3f, 0x80, 0xff, 0x0f, 0xfe, 0x3f, 0xc0, 0xff, 0x1f, 0xfe, 0x3f, 0xe0,
0xff, 0x3f, 0xfe, 0x3f, 0xf0, 0xff, 0x7f, 0xfe, 0x3f, 0x00, 0x00, 0x00,
0xfe, 0x3f, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x00, 0x00, 0xfe, 0x3f,
0xc0, 0x07, 0x00, 0xfe, 0x3f, 0xf0, 0x1f, 0x00, 0xfe, 0x3f, 0xf8, 0x3f,
0x00, 0xfe, 0x3f, 0xfc, 0x7f, 0x00, 0xfe, 0x3f, 0xfc, 0x7f, 0x00, 0x00,
0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0xfe,
0xff, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x00,
0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00,
0xf8, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x07,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

193
libhtmlw/DrawingArea.c Normal file
View File

@@ -0,0 +1,193 @@
/*
* A minimalistic constraint widget
*
* Sun Sep 12 20:03:49 GMT 1993 Gustaf Neumann
*/
#include "../config.h"
#ifndef MOTIF
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
/*
#include <X11/Xmu/Converters.h>
#include <X11/Xmu/CharSet.h>
#include <X11/Xaw/XawInit.h>
*/
#include "DrawingAreaP.h"
/* Private Definitions */
static void ClassInitialize(), ClassPartInitialize(), Initialize(), Resize();
/*static void ConstraintInitialize();*/
static Boolean SetValues()/*, ConstraintSetValues()*/ ;
static XtGeometryResult GeometryManager(), PreferredGeometry();
/*static void ChangeManaged();*/
DrawingAreaClassRec drawingAreaClassRec = {
{ /* core_class fields */
/* superclass */ (WidgetClass) &constraintClassRec,
/* class_name */ "DrawingArea",
/* widget_size */ sizeof(DrawingAreaRec),
/* class_initialize */ ClassInitialize,
/* class_part_init */ ClassPartInitialize,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ XtInheritRealize,
/* actions */ NULL,
/* num_actions */ 0,
/* resources */ NULL,
/* num_resources */ 0,
/* xrm_class */ NULLQUARK,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave*/ TRUE,
/* visible_interest */ FALSE,
/* destroy */ NULL,
/* resize */ Resize,
/* expose */ XtInheritExpose,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* tm_table */ NULL,
/* query_geometry */ PreferredGeometry,
/* display_accelerator*/ XtInheritDisplayAccelerator,
/* extension */ NULL
},
{ /* composite_class fields */
/* geometry_manager */ GeometryManager,
/* change_managed */ NULL, /*ChangeManaged,*/
/* insert_child */ XtInheritInsertChild,
/* delete_child */ XtInheritDeleteChild,
/* extension */ NULL
},
{ /* constraint_class fields */
/* subresourses */ NULL,
/* subresource_count */ 0,
/* constraint_size */ 0,
/* initialize */ NULL, /*ConstraintInitialize,*/
/* destroy */ NULL,
/* set_values */ NULL, /*ConstraintSetValues,*/
/* extension */ NULL
},
{ /* DrawingArea_class fields */
/* dummy */ 0
}
};
WidgetClass drawingAreaWidgetClass = (WidgetClass)&drawingAreaClassRec;
/****************************************************************
*
* Private Procedures
*
****************************************************************/
static void ClassInitialize()
{
}
static void ClassPartInitialize(class)
WidgetClass class;
{
}
/* ARGSUSED */
static void Initialize(request, new, args, num_args)
Widget request, new;
ArgList args;
Cardinal *num_args;
{
/*
DrawingAreaWidget daw = (DrawingAreaWidget)new;
*/
}
static void Resize(w)
Widget w;
{
/*
DrawingAreaWidget daw = (DrawingAreaWidget)w;
WidgetList children = daw->composite.children;
int num_children = daw->composite.num_children;
Widget *childP;
Position x, y;
Dimension width, height;
*/
}
/* ARGSUSED */
static XtGeometryResult GeometryManager(w, request, reply)
Widget w;
XtWidgetGeometry *request;
XtWidgetGeometry *reply; /* RETURN */
{
/*
Dimension old_width, old_height;
DrawingAreaWidget daw = (DrawingAreaWidget) XtParent(w);
DrawingAreaConstraints DrawingArea = (DrawingAreaConstraints) w->core.constraints;
XtWidgetGeometry allowed;
XtGeometryResult ret_val;
*/
return(XtGeometryNo);
}
/* ARGSUSED */
static Boolean SetValues(current, request, new, args, num_args)
Widget current, request, new;
ArgList args;
Cardinal *num_args;
{
return( FALSE );
}
/*ARGSUSED*/
static Boolean ConstraintSetValues(current, request, new, args, num_args)
Widget current, request, new;
ArgList args;
Cardinal *num_args;
{
/*
register DrawingAreaConstraints cfc =
(DrawingAreaConstraints) current->core.constraints;
register DrawingAreaConstraints nfc =
(DrawingAreaConstraints) new->core.constraints;
*/
return( FALSE );
}
static void ChangeManaged(w)
Widget w;
{
/*
DrawingAreaWidget daw = (DrawingAreaWidget)w;
DrawingAreaConstraints DrawingArea;
WidgetList children, childP;
int num_children = daw->composite.num_children;
Widget child;
*/
}
static XtGeometryResult PreferredGeometry( widget, request, reply )
Widget widget;
XtWidgetGeometry *request, *reply;
{
/*
DrawingAreaWidget w = (DrawingAreaWidget)widget;
*/
return XtGeometryNo;
}
#endif

35
libhtmlw/DrawingArea.h Normal file
View File

@@ -0,0 +1,35 @@
#ifndef _XawDrawingArea_h
#define _XawDrawingArea_h
/* #include <X11/Constraint.h> */
/***********************************************************************
*
* DrawingArea Widget
*
***********************************************************************/
/* Parameters:
Name Class RepType Default Value
---- ----- ------- -------------
background Background Pixel XtDefaultBackground
border BorderColor Pixel XtDefaultForeground
borderWidth BorderWidth Dimension 1
defaultDistance Thickness int 4
destroyCallback Callback Pointer NULL
height Height Dimension computed at realize
mappedWhenManaged MappedWhenManaged Boolean True
sensitive Sensitive Boolean True
width Width Dimension computed at realize
x Position Position 0
y Position Position 0
*/
typedef struct _DrawingAreaClassRec *DrawingAreaWidgetClass;
typedef struct _DrawingAreaRec *DrawingAreaWidget;
extern WidgetClass drawingAreaWidgetClass;
#endif /* _XawDrawingArea_h */

45
libhtmlw/DrawingAreaP.h Normal file
View File

@@ -0,0 +1,45 @@
/* DrawingArea widget private definitions */
#ifndef _XawDrawingAreaP_h
#define _XawDrawingAreaP_h
#include "DrawingArea.h"
#include <X11/ConstrainP.h>
#define XtInheritLayout ((Boolean (*)())_XtInherit)
typedef struct {
int dummy;
} DrawingAreaClassPart;
typedef struct _DrawingAreaClassRec {
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
DrawingAreaClassPart drawingArea_class;
} DrawingAreaClassRec;
extern DrawingAreaClassRec drawingAreaClassRec;
typedef struct _DrawingAreaPart {
int dummy;
} DrawingAreaPart;
typedef struct _DrawingAreaRec {
CorePart core;
CompositePart composite;
ConstraintPart constraint;
DrawingAreaPart drawingArea;
} DrawingAreaRec;
typedef struct _DrawingAreaConstraintsPart {
int dummy;
} DrawingAreaConstraintsPart;
typedef struct _DrawingAreaConstraintsRec {
int dummy;
} DrawingAreaConstraintsRec, *DrawingAreaConstraints;
#endif /* _XawDrawingAreaP_h */

1922
libhtmlw/HTML-PSformat.c Normal file

File diff suppressed because it is too large Load Diff

1924
libhtmlw/HTML-PSformat.c.org Normal file

File diff suppressed because it is too large Load Diff

7138
libhtmlw/HTML.c Normal file

File diff suppressed because it is too large Load Diff

638
libhtmlw/HTML.h Normal file
View File

@@ -0,0 +1,638 @@
/****************************************************************************
* NCSA Mosaic for the X Window System *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* mosaic@ncsa.uiuc.edu *
* *
* Copyright (C) 1993, Board of Trustees of the University of Illinois *
* *
* NCSA Mosaic software, both binary and source (hereafter, Software) is *
* copyrighted by The Board of Trustees of the University of Illinois *
* (UI), and ownership remains with the UI. *
* *
* The UI grants you (hereafter, Licensee) a license to use the Software *
* for academic, research and internal business purposes only, without a *
* fee. Licensee may distribute the binary and source code (if released) *
* to third parties provided that the copyright notice and this statement *
* appears on all copies and that no charge is associated with such *
* copies. *
* *
* Licensee may make derivative works. However, if Licensee distributes *
* any derivative work based on or derived from the Software, then *
* Licensee will (1) notify NCSA regarding its distribution of the *
* derivative work, and (2) clearly notify users that such derivative *
* work is a modified version and not the original NCSA Mosaic *
* distributed by the UI. *
* *
* Any Licensee wishing to make commercial use of the Software should *
* contact the UI, c/o NCSA, to negotiate an appropriate license for such *
* commercial use. Commercial use includes (1) integration of all or *
* part of the source code into a product for sale or license by or on *
* behalf of Licensee to third parties, or (2) distribution of the binary *
* code or source code to third parties that need it to utilize a *
* commercial product sold or licensed by or on behalf of Licensee. *
* *
* UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR *
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED *
* WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE *
* USERS OF THIS SOFTWARE. *
* *
* By using or copying this Software, Licensee agrees to abide by the *
* copyright law and all other applicable laws of the U.S. including, but *
* not limited to, export control laws, and the terms of this license. *
* UI shall have the right to terminate this license immediately by *
* written notice upon Licensee's breach of, or non-compliance with, any *
* of its terms. Licensee may be held legally responsible for any *
* copyright infringement that is caused or encouraged by Licensee's *
* failure to abide by the terms of this license. *
* *
* Comments and questions are welcome and can be sent to *
* mosaic-x@ncsa.uiuc.edu. *
****************************************************************************/
#ifndef HTML_H
#define HTML_H
#ifdef MOTIF
#include <Xm/Xm.h>
#if (XmVERSION == 1)&&(XmREVISION >= 2)
#undef MOTIF1_2
#define MOTIF1_2
#endif
#else
#include <X11/Intrinsic.h>
#include <X11/Constraint.h>
#endif /* MOTIF */
#include <X11/StringDefs.h>
typedef int (*visitTestProc)();
typedef void (*pointerTrackProc)();
typedef struct ele_ref_rec {
int id, pos;
} ElementRef;
typedef struct link_rec {
char *href;
char *role;
} LinkInfo;
/*
* Public functions
*/
#ifdef _NO_PROTO
extern char *HTMLGetText ();
extern char *HTMLGetTextAndSelection ();
extern char **HTMLGetHRefs ();
extern char **HTMLGetImageSrcs ();
extern void *HTMLGetWidgetInfo ();
extern void HTMLFreeWidgetInfo ();
extern void HTMLFreeImageInfo ();
extern LinkInfo *HTMLGetLinks ();
extern int HTMLPositionToId ();
extern int HTMLIdToPosition ();
extern int HTMLAnchorToPosition ();
extern int HTMLAnchorToId ();
extern void HTMLGotoId ();
extern void HTMLRetestAnchors ();
extern void HTMLClearSelection ();
extern void HTMLSetSelection ();
extern void HTMLSetText ();
extern void HTMLSetAppInsensitive();
extern int HTMLSearchText ();
extern int HTMLSearchNews();
extern void HTMLSetAppSensitive();
extern void HTMLTraverseTabGroups();
extern void HTMLDrawBackgroundImage();
extern void HTMLSetFocusPolicy();
#else
extern char *HTMLGetText (Widget w, int pretty, char *url, char *time_str);
extern char *HTMLGetTextAndSelection (Widget w, char **startp, char **endp,
char **insertp);
extern char **HTMLGetHRefs (Widget w, int *num_hrefs);
extern char **HTMLGetImageSrcs (Widget w, int *num_srcs);
extern void *HTMLGetWidgetInfo (Widget w);
extern void HTMLFreeWidgetInfo (void *ptr);
extern void HTMLFreeImageInfo (Widget w);
extern LinkInfo *HTMLGetLinks (Widget w, int *num_links);
extern int HTMLPositionToId(Widget w, int x, int y);
extern int HTMLIdToPosition(Widget w, int element_id, int *x, int *y);
extern int HTMLAnchorToPosition(Widget w, char *name, int *x, int *y);
extern int HTMLAnchorToId(Widget w, char *name);
extern void HTMLGotoId(Widget w, int element_id, int correction);
extern void HTMLRetestAnchors(Widget w, visitTestProc testFunc);
extern void HTMLClearSelection (Widget w);
extern void HTMLSetSelection (Widget w, ElementRef *start, ElementRef *end);
extern void HTMLSetText (Widget w, char *text, char *header_text,
char *footer_text, int element_id,
char *target_anchor, void *ptr);
extern int HTMLSearchNews(Widget w,ElementRef *m_start, ElementRef *m_end);
extern int HTMLSearchText (Widget w, char *pattern,
ElementRef *m_start, ElementRef *m_end, int backward, int caseless);
extern void HTMLSetAppInsensitive(Widget hw);
extern void HTMLSetAppSensitive(Widget hw);
extern void HTMLTraverseTabGroups();
extern void HTMLDrawBackgroundImage(Widget w, int x, int y, int width,
int height);
extern void HTMLSetFocusPolicy(Widget w, int to);
#endif /* _NO_PROTO */
/*
* Public Structures
*/
typedef struct acall_rec {
XEvent *event;
int element_id;
char *text;
char *href;
} WbAnchorCallbackData;
typedef struct fcall_rec {
XEvent *event;
char *href;
char *method;
char *enctype;
char *enc_entity;
char *format;
int attribute_count;
char **attribute_names;
char **attribute_values;
} WbFormCallbackData;
typedef struct form_rec {
Widget hw;
char *action;
char *method;
char *enctype;
char *enc_entity;
char *format;
int start, end;
Widget button_pressed; /* match button pressed to one of submits */
struct form_rec *next;
} FormInfo;
/* Client-Side Ismap -- SWP */
typedef struct coord_rec {
int coord;
struct coord_rec *next;
} CoordInfo;
typedef struct area_rec {
int shape;
CoordInfo *coordList;
CoordInfo *currentCoord;
char *href;
char *alt;
struct area_rec *next;
} AreaInfo;
typedef struct map_rec {
char *name;
AreaInfo *areaList;
AreaInfo *currentArea;
struct map_rec *next;
} MapInfo;
typedef struct image_rec {
char *usemap;
MapInfo *map;
int ismap;
FormInfo *fptr;
int internal;
int delayed;
int fetched;
int width, height;
int num_colors;
int *reds;
int *greens;
int *blues;
int bg_index;
unsigned char *image_data;
unsigned char *clip_data;
int transparent;
Pixmap image;
Pixmap clip;
char *text;
char *src;
} ImageInfo;
typedef struct wid_rec {
Widget w;
int type;
int id;
int x, y;
int width, height;
int seeable;
char *name;
char *value;
char *password;
char **mapping;
Boolean checked;
Boolean mapped;
struct wid_rec *next;
struct wid_rec *prev;
} WidgetInfo;
typedef enum { F_NONE, F_TEXT, F_IMAGE, F_WIDGET} FieldType;
typedef struct table_field {
int colSpan; /* number of cells this spans vertically */
int rowSpan; /* number of cells this spans horizontally */
Boolean contVert; /* does this cell continue from previous */
Boolean contHoriz; /* does this cell continue from previous */
int alignment; /* contents alignment */
int maxWidth;
int minWidth;
int maxHeight;
int minHeight;
int colWidth; /* uniform width for all element in this col*/
int rowHeight; /* uniform hieght for all element in the row*/
Boolean header; /* is this field created with <TH> or <TD> */
/* contents */
FieldType type;
char *text;
XFontStruct *font;
char **formattedText;
int numLines; /* for formatted text */
ImageInfo *image;
WidgetInfo *winfo;
} TableField;
typedef struct table_rec {
Boolean borders;
char *caption;
int captionAlignment;
struct mark_up *mptr;
int width,height;
int bwidth,bheight;
int numColumns;
int numRows;
TableField *table;
} TableInfo;
typedef struct sel_rec {
Widget hw;
struct mark_up *mptr;
int is_value;
char *retval_buf;
char *option_buf;
char **returns;
char **options;
int option_cnt;
char **value;
int value_cnt;
} SelectInfo;
typedef ImageInfo *(*resolveImageProc)();
/*
* defines for client-side ismap -- SWP
*/
#define AREA_RECT 0
#define AREA_CIRCLE 1
#define AREA_POLYGON 2
/*
* defines and structures used for the formatted element list
*/
#define E_TEXT (1 << 0)
#define E_BULLET (1 << 1)
#define E_LINEFEED (1 << 2)
#define E_IMAGE (1 << 3)
#define E_WIDGET (1 << 4)
#define E_HRULE (1 << 5)
#define E_TABLE (1 << 6)
#define E_ANCHOR (1 << 7)
#define E_MAP (1 << 8)
/* define alignment values */
#define ALIGN_BOTTOM 0
#define ALIGN_MIDDLE 1
#define ALIGN_TOP 2
#define ALIGN_LEFT 3
#define ALIGN_CENTER 4
#define ALIGN_RIGHT 5
struct ele_rec {
int type;
ImageInfo *pic_data;
WidgetInfo *widget_data;
TableInfo *table_data;
XFontStruct *font;
int alignment;
Boolean internal;
Boolean selected;
int indent_level;
int start_pos, end_pos;
int x, y;
int bwidth;
int y_offset;
int width;
int line_number;
int line_height;
int ele_id;
int underline_number;
Boolean dashed_underline;
Boolean strikeout;
unsigned long fg;
unsigned long bg;
char *anchorName;
char *anchorHRef;
char *anchorSubject;
char *edata;
int edata_len;
struct ele_rec *next;
struct ele_rec *prev;
};
struct ref_rec {
char *anchorHRef;
struct ref_rec *next;
};
struct delay_rec {
char *src;
struct delay_rec *next;
};
/*
* defines and structures used for the HTML parser, and the
* parsed object list.
*/
/* Mark types */
#define M_UNKNOWN -1
#define M_NONE 0
#define M_TITLE 1
#define M_HEADER_1 2
#define M_HEADER_2 3
#define M_HEADER_3 4
#define M_HEADER_4 5
#define M_HEADER_5 6
#define M_HEADER_6 7
#define M_ANCHOR 8
#define M_PARAGRAPH 9
#define M_ADDRESS 10
#define M_PLAIN_TEXT 11
#define M_UNUM_LIST 12
#define M_NUM_LIST 13
#define M_LIST_ITEM 14
#define M_DESC_LIST 15
#define M_DESC_TITLE 16
#define M_DESC_TEXT 17
#define M_PREFORMAT 18
#define M_PLAIN_FILE 19
#define M_LISTING_TEXT 20
#define M_INDEX 21
#define M_MENU 22
#define M_DIRECTORY 23
#define M_IMAGE 24
#define M_FIXED 25
#define M_BOLD 26
#define M_ITALIC 27
#define M_EMPHASIZED 28
#define M_STRONG 29
#define M_CODE 30
#define M_SAMPLE 31
#define M_KEYBOARD 32
#define M_VARIABLE 33
#define M_CITATION 34
#define M_BLOCKQUOTE 35
#define M_STRIKEOUT 36
#define M_INPUT 37
#define M_FORM 38
#define M_HRULE 39
#define M_LINEBREAK 40
#define M_BASE 41
#define M_SELECT 42
#define M_OPTION 43
#define M_TEXTAREA 44
#define M_TABLE 45
#define M_CAPTION 46
#define M_TABLE_HEADER 47
#define M_TABLE_ROW 48
#define M_TABLE_DATA 49
#define M_SUP 50
#define M_SUB 51
#define M_FIGURE 52
#define M_COMMENT 53
#define M_DOC_HEAD 54 /* amb 2 */
#define M_UNDERLINED 55 /* amb 2 */
#define M_DOC_BODY 56 /* amb 2 */
#define M_FRAME 57
#define M_MAP 58 /* swp - client side ismap */
#define M_AREA 59 /* swp - client side ismap */
#define M_CENTER 60
/* syntax of Mark types */
#define MT_TITLE "title"
#define MT_HEADER_1 "h1"
#define MT_HEADER_2 "h2"
#define MT_HEADER_3 "h3"
#define MT_HEADER_4 "h4"
#define MT_HEADER_5 "h5"
#define MT_HEADER_6 "h6"
#define MT_ANCHOR "a"
#define MT_PARAGRAPH "p"
#define MT_ADDRESS "address"
#define MT_PLAIN_TEXT "xmp"
#define MT_UNUM_LIST "ul"
#define MT_NUM_LIST "ol"
#define MT_LIST_ITEM "li"
#define MT_DESC_LIST "dl"
#define MT_DESC_TITLE "dt"
#define MT_DESC_TEXT "dd"
#define MT_PREFORMAT "pre"
#define MT_PLAIN_FILE "plaintext"
#define MT_LISTING_TEXT "listing"
#define MT_INDEX "isindex"
#define MT_MENU "menu"
#define MT_DIRECTORY "dir"
#define MT_IMAGE "img"
#define MT_FIGURE "fig"
#define MT_FIXED "tt"
#define MT_BOLD "b"
#define MT_ITALIC "i"
#define MT_EMPHASIZED "em"
#define MT_STRONG "strong"
#define MT_CODE "code"
#define MT_SAMPLE "samp"
#define MT_KEYBOARD "kbd"
#define MT_VARIABLE "var"
#define MT_CITATION "cite"
#define MT_BLOCKQUOTE "blockquote"
#define MT_STRIKEOUT "strike"
#define MT_INPUT "input"
#define MT_FORM "form"
#define MT_HRULE "hr"
#define MT_LINEBREAK "br"
#define MT_BASE "base"
#define MT_SELECT "select"
#define MT_OPTION "option"
#define MT_TEXTAREA "textarea"
#define MT_TABLE "table"
#define MT_CAPTION "caption"
#define MT_TABLE_ROW "tr"
#define MT_TABLE_HEADER "th"
#define MT_TABLE_DATA "td"
#define MT_SUP "sup"
#define MT_SUB "sub"
#define MT_DOC_HEAD "head" /* amb 2 */
#define MT_UNDERLINED "u" /* amb 2 */
#define MT_DOC_BODY "body"
#define MT_FRAME "frame"
#define MT_MAP "map" /* swp - client side ismap */
#define MT_AREA "area" /* swp - client side ismap */
#define MT_CENTER "center"
/* anchor tags */
#define AT_NAME "name"
#define AT_HREF "href"
#define AT_SUBJECT "subject"
#define AT_TITLE "title"
struct mark_up {
int type;
int is_end;
char *start;
char *text;
char *end;
struct mark_up *next;
};
/*
* New resource names
*/
#define WbNmarginWidth "marginWidth"
#define WbNmarginHeight "marginHeight"
#define WbNtext "text"
#define WbNheaderText "headerText"
#define WbNfooterText "footerText"
#define WbNtitleText "titleText"
#define WbNanchorUnderlines "anchorUnderlines"
#define WbNvisitedAnchorUnderlines "visitedAnchorUnderlines"
#define WbNdashedAnchorUnderlines "dashedAnchorUnderlines"
#define WbNdashedVisitedAnchorUnderlines "dashedVisitedAnchorUnderlines"
#define WbNanchorColor "anchorColor"
#define WbNvisitedAnchorColor "visitedAnchorColor"
#define WbNactiveAnchorFG "activeAnchorFG"
#define WbNactiveAnchorBG "activeAnchorBG"
#define WbNfancySelections "fancySelections"
#define WbNimageBorders "imageBorders"
#define WbNdelayImageLoads "delayImageLoads"
#define WbNisIndex "isIndex"
#define WbNitalicFont "italicFont"
#define WbNboldFont "boldFont"
#define WbNfixedFont "fixedFont"
#define WbNmeterFont "meterFont"
#define WbNtoolbarFont "toolbarFont"
#define WbNfixedboldFont "fixedboldFont"
#define WbNfixeditalicFont "fixeditalicFont"
#define WbNheader1Font "header1Font"
#define WbNheader2Font "header2Font"
#define WbNheader3Font "header3Font"
#define WbNheader4Font "header4Font"
#define WbNheader5Font "header5Font"
#define WbNheader6Font "header6Font"
#define WbNaddressFont "addressFont"
#define WbNplainFont "plainFont"
#define WbNplainboldFont "plainboldFont"
#define WbNplainitalicFont "plainitalicFont"
#define WbNlistingFont "listingFont"
#define WbNanchorCallback "anchorCallback"
#define WbNlinkCallback "linkCallback"
#define WbNsubmitFormCallback "submitFormCallback"
#define WbNpreviouslyVisitedTestFunction "previouslyVisitedTestFunction"
#define WbNresolveImageFunction "resolveImageFunction"
#define WbNresolveDelayedImage "resolveDelayedImage"
#define WbNpercentVerticalSpace "percentVerticalSpace"
#define WbNpointerMotionCallback "pointerMotionCallback"
#define WbNverticalScrollOnRight "verticalScrollOnRight"
#define WbNhorizontalScrollOnTop "horizontalScrollOnTop"
#define WbNview "view"
#define WbNverticalScrollBar "verticalScrollBar"
#define WbNhorizontalScrollBar "horizontalScrollBar"
#define WbNsupSubFont "supSubFont" /* amb */
#define WbNbodyColors "bodyColors"
#define WbNbodyImages "bodyImages"
/*
* New resource classes
*/
#define WbCMarginWidth "MarginWidth"
#define WbCMarginHeight "MarginHeight"
#define WbCText "Text"
#define WbCHeaderText "HeaderText"
#define WbCFooterText "FooterText"
#define WbCTitleText "TitleText"
#define WbCAnchorUnderlines "AnchorUnderlines"
#define WbCVisitedAnchorUnderlines "VisitedAnchorUnderlines"
#define WbCDashedAnchorUnderlines "DashedAnchorUnderlines"
#define WbCDashedVisitedAnchorUnderlines "DashedVisitedAnchorUnderlines"
#define WbCAnchorColor "AnchorColor"
#define WbCVisitedAnchorColor "VisitedAnchorColor"
#define WbCActiveAnchorFG "ActiveAnchorFG"
#define WbCActiveAnchorBG "ActiveAnchorBG"
#define WbCFancySelections "FancySelections"
#define WbCImageBorders "ImageBorders"
#define WbCDelayImageLoads "DelayImageLoads"
#define WbCIsIndex "IsIndex"
#define WbCItalicFont "ItalicFont"
#define WbCBoldFont "BoldFont"
#define WbCFixedFont "FixedFont"
#define WbCMeterFont "MeterFont"
#define WbCToolbarFont "ToolbarFont"
#define WbCFixedboldFont "FixedboldFont"
#define WbCFixeditalicFont "FixeditalicFont"
#define WbCHeader1Font "Header1Font"
#define WbCHeader2Font "Header2Font"
#define WbCHeader3Font "Header3Font"
#define WbCHeader4Font "Header4Font"
#define WbCHeader5Font "Header5Font"
#define WbCHeader6Font "Header6Font"
#define WbCAddressFont "AddressFont"
#define WbCPlainFont "PlainFont"
#define WbCPlainboldFont "PlainboldFont"
#define WbCPlainitalicFont "PlainitalicFont"
#define WbCListingFont "ListingFont"
#define WbCPreviouslyVisitedTestFunction "PreviouslyVisitedTestFunction"
#define WbCResolveImageFunction "ResolveImageFunction"
#define WbCResolveDelayedImage "ResolveDelayedImage"
#define WbCPercentVerticalSpace "PercentVerticalSpace"
#define WbCPointerMotionCallback "PointerMotionCallback"
#define WbCVerticalScrollOnRight "VerticalScrollOnRight"
#define WbCHorizontalScrollOnTop "HorizontalScrollOnTop"
#define WbCView "View"
#define WbCVerticalScrollBar "VerticalScrollBar"
#define WbCHorizontalScrollBar "HorizontalScrollBar"
#define WbCSupSubFont "SupSubFont" /* amb */
#define WbCBodyColors "BodyColors"
#define WbCBodyImages "BodyImages"
typedef struct _HTMLClassRec *HTMLWidgetClass;
typedef struct _HTMLRec *HTMLWidget;
extern WidgetClass htmlWidgetClass;
#endif /* HTML_H */

270
libhtmlw/HTMLP.h Normal file
View File

@@ -0,0 +1,270 @@
/****************************************************************************
* NCSA Mosaic for the X Window System *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* mosaic@ncsa.uiuc.edu *
* *
* Copyright (C) 1993, Board of Trustees of the University of Illinois *
* *
* NCSA Mosaic software, both binary and source (hereafter, Software) is *
* copyrighted by The Board of Trustees of the University of Illinois *
* (UI), and ownership remains with the UI. *
* *
* The UI grants you (hereafter, Licensee) a license to use the Software *
* for academic, research and internal business purposes only, without a *
* fee. Licensee may distribute the binary and source code (if released) *
* to third parties provided that the copyright notice and this statement *
* appears on all copies and that no charge is associated with such *
* copies. *
* *
* Licensee may make derivative works. However, if Licensee distributes *
* any derivative work based on or derived from the Software, then *
* Licensee will (1) notify NCSA regarding its distribution of the *
* derivative work, and (2) clearly notify users that such derivative *
* work is a modified version and not the original NCSA Mosaic *
* distributed by the UI. *
* *
* Any Licensee wishing to make commercial use of the Software should *
* contact the UI, c/o NCSA, to negotiate an appropriate license for such *
* commercial use. Commercial use includes (1) integration of all or *
* part of the source code into a product for sale or license by or on *
* behalf of Licensee to third parties, or (2) distribution of the binary *
* code or source code to third parties that need it to utilize a *
* commercial product sold or licensed by or on behalf of Licensee. *
* *
* UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR *
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED *
* WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE *
* USERS OF THIS SOFTWARE. *
* *
* By using or copying this Software, Licensee agrees to abide by the *
* copyright law and all other applicable laws of the U.S. including, but *
* not limited to, export control laws, and the terms of this license. *
* UI shall have the right to terminate this license immediately by *
* written notice upon Licensee's breach of, or non-compliance with, any *
* of its terms. Licensee may be held legally responsible for any *
* copyright infringement that is caused or encouraged by Licensee's *
* failure to abide by the terms of this license. *
* *
* Comments and questions are welcome and can be sent to *
* mosaic-x@ncsa.uiuc.edu. *
****************************************************************************/
#ifndef HTMLP_H
#define HTMLP_H
#include "HTML.h"
#ifdef MOTIF
#include <Xm/XmP.h>
# ifdef MOTIF1_2
# include <Xm/ManagerP.h>
# endif /* MOTIF1_2 */
#else
#include <X11/IntrinsicP.h>
#include <X11/ConstrainP.h>
#endif /* MOTIF */
#include <X11/Xatom.h>
#ifndef VMS
#include <X11/Xmu/Atoms.h>
#else
#include <XMU/Atoms.h>
#endif
/*
* Used for special images
*/
#define INTERNAL_IMAGE "internal-"
/* New fields for the HTML widget class */
typedef struct _HTMLClassPart
{
int none; /* no extra HTML class stuff */
} HTMLClassPart;
typedef struct _HTMLClassRec
{
CoreClassPart core_class;
CompositeClassPart composite_class;
ConstraintClassPart constraint_class;
#ifdef MOTIF
XmManagerClassPart manager_class;
#endif /* MOTIF */
HTMLClassPart html_class;
} HTMLClassRec;
extern HTMLClassRec htmlClassRec;
/* New fields for the HTML widget */
typedef struct _HTMLPart
{
/* Resources */
Dimension margin_width;
Dimension margin_height;
Widget view;
Widget hbar;
Widget vbar;
Widget frame;
Boolean hbar_top;
Boolean vbar_right;
XtCallbackList anchor_callback;
XtCallbackList link_callback;
XtCallbackList form_callback;
char *title;
char *raw_text;
char *header_text;
char *footer_text;
/*
* Without motif we have to define our own forground resource
* instead of using the manager's
*/
#ifndef MOTIF
Pixel foreground;
#endif
Pixel anchor_fg;
Pixel visitedAnchor_fg;
Pixel activeAnchor_fg;
Pixel activeAnchor_bg;
Boolean body_colors;
Boolean body_images;
int bg_image;
Pixmap bgmap_SAVE;
Pixmap bgclip_SAVE;
int bg_height;
int bg_width;
Pixel foreground_SAVE;
Pixel anchor_fg_SAVE;
Pixel visitedAnchor_fg_SAVE;
Pixel activeAnchor_fg_SAVE;
Pixel activeAnchor_bg_SAVE;
Pixel top_color_SAVE;
Pixel bottom_color_SAVE;
Pixel background_SAVE;
int num_anchor_underlines;
int num_visitedAnchor_underlines;
Boolean dashed_anchor_lines;
Boolean dashed_visitedAnchor_lines;
Boolean fancy_selections;
Boolean border_images;
Boolean delay_images;
Boolean is_index;
int percent_vert_space;
XFontStruct *font;
XFontStruct *italic_font;
XFontStruct *bold_font;
XFontStruct *meter_font;
XFontStruct *toolbar_font;
XFontStruct *fixed_font;
XFontStruct *fixedbold_font;
XFontStruct *fixeditalic_font;
XFontStruct *header1_font;
XFontStruct *header2_font;
XFontStruct *header3_font;
XFontStruct *header4_font;
XFontStruct *header5_font;
XFontStruct *header6_font;
XFontStruct *address_font;
XFontStruct *plain_font;
XFontStruct *plainbold_font;
XFontStruct *plainitalic_font;
XFontStruct *listing_font;
/* amb */
XFontStruct *supsub_font;
/* end amb */
XtPointer previously_visited_test;
XtPointer resolveImage;
XtPointer resolveDelayedImage;
XtPointer pointer_motion_callback;
/* PRIVATE */
Dimension max_pre_width;
Dimension view_width;
Dimension view_height;
int doc_width;
int doc_height;
int scroll_x;
int scroll_y;
Boolean use_hbar;
Boolean use_vbar;
struct ele_rec *formatted_elements;
int line_count;
struct ele_rec **line_array;
struct ele_rec *select_start;
struct ele_rec *select_end;
int sel_start_pos;
int sel_end_pos;
struct ele_rec *new_start;
struct ele_rec *new_end;
int new_start_pos;
int new_end_pos;
struct ele_rec *active_anchor;
GC drawGC;
int press_x;
int press_y;
Time but_press_time;
Time selection_time;
struct mark_up *html_objects;
struct mark_up *html_header_objects;
struct mark_up *html_footer_objects;
struct ref_rec *my_visited_hrefs;
struct delay_rec *my_delayed_images;
WidgetInfo *widget_list;
FormInfo *form_list;
MapInfo *map_list;
struct ele_rec *cached_tracked_ele;
Boolean focus_follows_mouse;
Boolean obscured;
} HTMLPart;
typedef struct _HTMLRec
{
CorePart core;
CompositePart composite;
ConstraintPart constraint;
#ifdef MOTIF
XmManagerPart manager;
#endif /* MOTIF */
HTMLPart html;
} HTMLRec;
/*
* to reduce the number of MOTIF/ATHENA ifdefs around the code
* we use some generalized constants
x */
#ifdef MOTIF
# define XxNx XmNx
# define XxNy XmNy
# define XxNwidth XmNwidth
# define XxNheight XmNheight
# define XxNset XmNset
# define XxNvalue XmNvalue
#else
# define XxNx XtNx
# define XxNy XtNy
# define XxNwidth XtNwidth
# define XxNheight XtNheight
# define XxNset XtNstate
# define XxNvalue XtNstring
#endif /* MOTIF */
#endif /* HTMLP_H */

173
libhtmlw/HTMLamp.h Normal file
View File

@@ -0,0 +1,173 @@
/****************************************************************************
* NCSA Mosaic for the X Window System *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* mosaic@ncsa.uiuc.edu *
* *
* Copyright (C) 1993, Board of Trustees of the University of Illinois *
* *
* NCSA Mosaic software, both binary and source (hereafter, Software) is *
* copyrighted by The Board of Trustees of the University of Illinois *
* (UI), and ownership remains with the UI. *
* *
* The UI grants you (hereafter, Licensee) a license to use the Software *
* for academic, research and internal business purposes only, without a *
* fee. Licensee may distribute the binary and source code (if released) *
* to third parties provided that the copyright notice and this statement *
* appears on all copies and that no charge is associated with such *
* copies. *
* *
* Licensee may make derivative works. However, if Licensee distributes *
* any derivative work based on or derived from the Software, then *
* Licensee will (1) notify NCSA regarding its distribution of the *
* derivative work, and (2) clearly notify users that such derivative *
* work is a modified version and not the original NCSA Mosaic *
* distributed by the UI. *
* *
* Any Licensee wishing to make commercial use of the Software should *
* contact the UI, c/o NCSA, to negotiate an appropriate license for such *
* commercial use. Commercial use includes (1) integration of all or *
* part of the source code into a product for sale or license by or on *
* behalf of Licensee to third parties, or (2) distribution of the binary *
* code or source code to third parties that need it to utilize a *
* commercial product sold or licensed by or on behalf of Licensee. *
* *
* UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR *
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED *
* WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE *
* USERS OF THIS SOFTWARE. *
* *
* By using or copying this Software, Licensee agrees to abide by the *
* copyright law and all other applicable laws of the U.S. including, but *
* not limited to, export control laws, and the terms of this license. *
* UI shall have the right to terminate this license immediately by *
* written notice upon Licensee's breach of, or non-compliance with, any *
* of its terms. Licensee may be held legally responsible for any *
* copyright infringement that is caused or encouraged by Licensee's *
* failure to abide by the terms of this license. *
* *
* Comments and questions are welcome and can be sent to *
* mosaic-x@ncsa.uiuc.edu. *
****************************************************************************/
typedef struct amp_esc_rec {
char *tag;
char value;
} AmpEsc;
static AmpEsc AmpEscapes[] = {
{"lt", '<'},
{"LT", '<'},
{"gt", '>'},
{"GT", '>'},
{"amp", '&'},
{"AMP", '&'},
{"quot", '\"'},
{"QUOT", '\"'},
{"nbsp", '\240'},
{"iexcl", '\241'},
{"cent", '\242'},
{"pound", '\243'},
{"curren", '\244'},
{"yen", '\245'},
{"brvbar", '\246'},
{"sect", '\247'},
{"uml", '\250'},
{"copy", '\251'},
{"ordf", '\252'},
{"laquo", '\253'},
{"not", '\254'},
{"shy", '\255'},
{"reg", '\256'},
{"hibar", '\257'},
{"deg", '\260'},
{"plusmn", '\261'},
{"sup2", '\262'},
{"sup3", '\263'},
{"acute", '\264'},
{"micro", '\265'},
{"para", '\266'},
{"middot", '\267'},
{"cedil", '\270'},
{"sup1", '\271'},
{"ordm", '\272'},
{"raquo", '\273'},
{"frac14", '\274'},
{"frac12", '\275'},
{"frac34", '\276'},
{"iquest", '\277'},
{"Agrave", '\300'},
{"Aacute", '\301'},
{"Acirc", '\302'},
{"Atilde", '\303'},
{"Auml", '\304'},
{"Aring", '\305'},
{"AElig", '\306'},
{"Ccedil", '\307'},
{"Egrave", '\310'},
{"Eacute", '\311'},
{"Ecirc", '\312'},
{"Euml", '\313'},
{"Igrave", '\314'},
{"Iacute", '\315'},
{"Icirc", '\316'},
{"Iuml", '\317'},
{"ETH", '\320'},
{"Ntilde", '\321'},
{"Ograve", '\322'},
{"Oacute", '\323'},
{"Ocirc", '\324'},
{"Otilde", '\325'},
{"Ouml", '\326'},
{"times", '\327'}, /* ? */
{"Oslash", '\330'},
{"Ugrave", '\331'},
{"Uacute", '\332'},
{"Ucirc", '\333'},
{"Uuml", '\334'},
{"Yacute", '\335'},
{"THORN", '\336'},
{"szlig", '\337'},
{"agrave", '\340'},
{"aacute", '\341'},
{"acirc", '\342'},
{"atilde", '\343'},
{"auml", '\344'},
{"aring", '\345'},
{"aelig", '\346'},
{"ccedil", '\347'},
{"egrave", '\350'},
{"eacute", '\351'},
{"ecirc", '\352'},
{"euml", '\353'},
{"igrave", '\354'},
{"iacute", '\355'},
{"icirc", '\356'},
{"iuml", '\357'},
{"eth", '\360'},
{"ntilde", '\361'},
{"ograve", '\362'},
{"oacute", '\363'},
{"ocirc", '\364'},
{"otilde", '\365'},
{"ouml", '\366'},
{"divide", '\367'}, /* ? */
{"oslash", '\370'},
{"ugrave", '\371'},
{"uacute", '\372'},
{"ucirc", '\373'},
{"uuml", '\374'},
{"yacute", '\375'},
{"thorn", '\376'},
{"yuml", '\377'},
{NULL, '\0'},
};

7059
libhtmlw/HTMLformat.c Normal file

File diff suppressed because it is too large Load Diff

1054
libhtmlw/HTMLimages.c Normal file

File diff suppressed because it is too large Load Diff

736
libhtmlw/HTMLjot.c Normal file
View File

@@ -0,0 +1,736 @@
/****************************************************************************
* NCSA Mosaic for the X Window System *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* mosaic@ncsa.uiuc.edu *
* *
* Copyright (C) 1993, Board of Trustees of the University of Illinois *
* *
* NCSA Mosaic software, both binary and source (hereafter, Software) is *
* copyrighted by The Board of Trustees of the University of Illinois *
* (UI), and ownership remains with the UI. *
* *
* The UI grants you (hereafter, Licensee) a license to use the Software *
* for academic, research and internal business purposes only, without a *
* fee. Licensee may distribute the binary and source code (if released) *
* to third parties provided that the copyright notice and this statement *
* appears on all copies and that no charge is associated with such *
* copies. *
* *
* Licensee may make derivative works. However, if Licensee distributes *
* any derivative work based on or derived from the Software, then *
* Licensee will (1) notify NCSA regarding its distribution of the *
* derivative work, and (2) clearly notify users that such derivative *
* work is a modified version and not the original NCSA Mosaic *
* distributed by the UI. *
* *
* Any Licensee wishing to make commercial use of the Software should *
* contact the UI, c/o NCSA, to negotiate an appropriate license for such *
* commercial use. Commercial use includes (1) integration of all or *
* part of the source code into a product for sale or license by or on *
* behalf of Licensee to third parties, or (2) distribution of the binary *
* code or source code to third parties that need it to utilize a *
* commercial product sold or licensed by or on behalf of Licensee. *
* *
* UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR *
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED *
* WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE *
* USERS OF THIS SOFTWARE. *
* *
* By using or copying this Software, Licensee agrees to abide by the *
* copyright law and all other applicable laws of the U.S. including, but *
* not limited to, export control laws, and the terms of this license. *
* UI shall have the right to terminate this license immediately by *
* written notice upon Licensee's breach of, or non-compliance with, any *
* of its terms. Licensee may be held legally responsible for any *
* copyright infringement that is caused or encouraged by Licensee's *
* failure to abide by the terms of this license. *
* *
* Comments and questions are welcome and can be sent to *
* mosaic-x@ncsa.uiuc.edu. *
****************************************************************************/
#include "../config.h"
#ifdef MOTIF
/*
#include <stdio.h>
#include "inkstore.h"
#include "HTMLP.h"
#include <sys/types.h>
#include <netinet/in.h>
*/
#include <stdio.h>
#include "inkstore.h"
#ifndef VMS
#include <sys/types.h>
#include <netinet/in.h>
#else
#ifndef MULTINET
#ifndef SOCKETSHR /* BGT */
#include <types.h>
#else /* BGT */
#include "socketshr_files:types.h"
#endif /* BGT */
#if defined(SOCKETSHR) && defined(__DECC)
#define __FD_SET 1
#endif /* DEC C V5.2 socket.h conflicts with SOCKETSHR types.h, GEC */
#include <socket.h>
#ifdef __SOCKET_TYPEDEFS
#define CADDR_T
#define __CADDR_T
#endif /* Different CADDR_T defs in VMS include files, BSN OK for OVMS 1.5? */
#include <in.h>
#include <netdb.h>
#ifdef SOCKETSHR /* BGT */
#include "socketshr_files:socketshr.h"
#if defined(__DECC) && !defined(__alpha)
#undef fprintf
#endif /* Avoid possible problems, GEC */
#endif /* BGT */
#else
#if defined(__TIME_T) && !defined(__TYPES_LOADED) && !defined(__TYPES)
#define __TYPES_LOADED
#endif /* Different defs in OpenVMS and MultiNet include files, BSN */
#ifdef __DECC
#define _POSIX_C_SOURCE
#endif /* DEC C, GEC */
#include "multinet_root:[multinet.include.sys]types.h"
#ifdef __DECC
#undef _POSIX_C_SOURCE
#endif /* DEC C, GEC */
#include "multinet_root:[multinet.include.netinet]in.h"
#endif /* MULTINET - UCX, BSN */
#endif /* VMS, BSN */
#ifdef VMS /* moved here to preclude warning message about caddr_t */
#ifdef __DECC
#define _POSIX_C_SOURCE
#endif /* DEC C, GEC */
#ifdef __DECC
#undef _POSIX_C_SOURCE
#endif /* DEC C, GEC */
#endif /* VMS, GEC for PGE */
#include "HTMLP.h"
typedef struct stroke_rec {
Boolean draw;
int x, y;
struct stroke_rec *next;
} Stroke;
typedef struct jot_rec {
Widget w;
int width, height;
Pixmap pix;
Boolean drawing;
int last_x, last_y;
int min_x, min_y;
int max_x, max_y;
int stroke_cnt;
Stroke *strokes;
Stroke *last_stroke;
struct jot_rec *next;
} JotInfo;
#ifndef DISABLE_TRACE
extern int htmlwTrace;
#endif
static JotInfo *JotList = NULL;
static JotInfo *JotCurrent = NULL;
void
NewJot(w, width, height)
Widget w;
int width, height;
{
if (JotCurrent == NULL)
{
JotList = (JotInfo *)malloc(sizeof(JotInfo));
JotCurrent = JotList;
JotCurrent->w = w;
JotCurrent->width = width;
JotCurrent->height = height;
JotCurrent->pix = NULL;
JotCurrent->drawing = False;
JotCurrent->strokes = NULL;
JotCurrent->last_stroke = NULL;
JotCurrent->stroke_cnt = 0;
JotCurrent->min_x = width;
JotCurrent->max_x = 0;
JotCurrent->min_y = height;
JotCurrent->max_y = 0;
JotCurrent->next = NULL;
}
else
{
JotCurrent->next = (JotInfo *)malloc(sizeof(JotInfo));
JotCurrent = JotCurrent->next;
JotCurrent->w = w;
JotCurrent->width = width;
JotCurrent->height = height;
JotCurrent->pix = NULL;
JotCurrent->drawing = False;
JotCurrent->strokes = NULL;
JotCurrent->last_stroke = NULL;
JotCurrent->stroke_cnt = 0;
JotCurrent->min_x = width;
JotCurrent->max_x = 0;
JotCurrent->min_y = height;
JotCurrent->max_y = 0;
JotCurrent->next = NULL;
}
}
JotInfo *
GetJot(w)
Widget w;
{
JotInfo *jptr;
jptr = JotList;
while (jptr != NULL)
{
if (jptr->w == w)
{
break;
}
jptr = jptr->next;
}
return(jptr);
}
void
FreeStrokes(sptr)
Stroke *sptr;
{
Stroke *tptr;
while (sptr != NULL)
{
tptr = sptr;
sptr = sptr->next;
tptr->next = NULL;
free((char *)tptr);
}
}
void
ClearJot(hw, w, width, height)
HTMLWidget hw;
Widget w;
int width, height;
{
JotInfo *jptr;
XClearArea(XtDisplay(w), XtWindow(w),
0, 0, width, height, False);
jptr = GetJot(w);
if (jptr == NULL)
{
return;
}
if (jptr->pix != NULL)
{
XSetForeground(XtDisplay(w), hw->html.drawGC,
hw->core.background_pixel);
XFillRectangle(XtDisplay(w), jptr->pix,
hw->html.drawGC,
0, 0, jptr->width, jptr->height);
}
FreeStrokes(jptr->strokes);
jptr->strokes = NULL;
jptr->last_stroke = NULL;
jptr->stroke_cnt = 0;
jptr->drawing = False;
jptr->min_x = width;
jptr->max_x = 0;
jptr->min_y = height;
jptr->max_y = 0;
}
void
AddStroke(jptr, sptr, drawing)
JotInfo *jptr;
Stroke *sptr;
Boolean drawing;
{
if (jptr->strokes == NULL)
{
jptr->strokes = sptr;
jptr->last_stroke = jptr->strokes;
jptr->last_stroke->next = NULL;
}
else
{
jptr->last_stroke->next = sptr;
jptr->last_stroke = jptr->last_stroke->next;
jptr->last_stroke->next = NULL;
}
jptr->last_x = sptr->x;
jptr->last_y = sptr->y;
jptr->drawing = drawing;
if (sptr->x < jptr->min_x)
{
jptr->min_x = sptr->x;
}
if (sptr->x > jptr->max_x)
{
jptr->max_x = sptr->x;
}
if (sptr->y < jptr->min_y)
{
jptr->min_y = sptr->y;
}
if (sptr->y > jptr->max_y)
{
jptr->max_y = sptr->y;
}
jptr->stroke_cnt++;
}
void
EVJotExpose(w, data, event)
Widget w;
XtPointer data;
XEvent *event;
{
XExposeEvent *ExEvent = (XExposeEvent *)event;
HTMLWidget hw = (HTMLWidget)data;
JotInfo *jptr;
jptr = GetJot(w);
if (jptr == NULL)
{
return;
}
if (jptr->pix == NULL)
{
jptr->pix = XCreatePixmap(XtDisplay(w), XtWindow(w),
jptr->width, jptr->height,
XDefaultDepth(XtDisplay(w), XDefaultScreen(XtDisplay(w))));
if (jptr->pix == NULL)
{
return;
}
XSetForeground(XtDisplay(w), hw->html.drawGC,
hw->core.background_pixel);
XFillRectangle(XtDisplay(w), jptr->pix,
hw->html.drawGC,
0, 0, jptr->width, jptr->height);
}
XCopyArea(XtDisplay(w), jptr->pix, XtWindow(w),
hw->html.drawGC,
ExEvent->x, ExEvent->y,
ExEvent->width, ExEvent->height,
ExEvent->x, ExEvent->y);
}
void
EVJotPress(w, data, event)
Widget w;
XtPointer data;
XEvent *event;
{
XButtonPressedEvent *BuEvent = (XButtonPressedEvent *)event;
HTMLWidget hw = (HTMLWidget)data;
JotInfo *jptr;
Stroke *sptr;
jptr = GetJot(w);
if (jptr == NULL)
{
return;
}
sptr = (Stroke *)malloc(sizeof(Stroke));
if (sptr == NULL)
{
return;
}
sptr->x = BuEvent->x;
sptr->y = BuEvent->y;
sptr->draw = False;
sptr->next = NULL;
/*
* Without motif we use our own foreground resource instead of
* using the manager's
*/
XSetForeground(XtDisplay(w), hw->html.drawGC,
#ifdef MOTIF
hw->manager.foreground);
#else
hw->html.foreground);
#endif /* MOTIF */
XDrawPoint(XtDisplay(w), XtWindow(w),
hw->html.drawGC, sptr->x, sptr->y);
if (jptr->pix != NULL)
{
XDrawPoint(XtDisplay(w), jptr->pix,
hw->html.drawGC, sptr->x, sptr->y);
}
AddStroke(jptr, sptr, True);
}
void
EVJotMove(w, data, event)
Widget w;
XtPointer data;
XEvent *event;
{
XPointerMovedEvent *MoEvent = (XPointerMovedEvent *)event;
HTMLWidget hw = (HTMLWidget)data;
JotInfo *jptr;
Stroke *sptr;
jptr = GetJot(w);
if (jptr == NULL)
{
return;
}
if (jptr->drawing == False)
{
return;
}
sptr = (Stroke *)malloc(sizeof(Stroke));
if (sptr == NULL)
{
return;
}
sptr->x = MoEvent->x;
sptr->y = MoEvent->y;
sptr->draw = True;
sptr->next = NULL;
/*
* Without motif we use our own foreground resource instead of
* using the manager's
*/
XSetForeground(XtDisplay(w), hw->html.drawGC,
#ifdef MOTIF
hw->manager.foreground);
#else
hw->html.foreground);
#endif /* MOTIF */
XDrawLine(XtDisplay(w), XtWindow(w), hw->html.drawGC,
jptr->last_x, jptr->last_y, sptr->x, sptr->y);
if (jptr->pix != NULL)
{
XDrawLine(XtDisplay(w), jptr->pix, hw->html.drawGC,
jptr->last_x, jptr->last_y, sptr->x, sptr->y);
}
AddStroke(jptr, sptr, True);
}
void
EVJotRelease(w, data, event)
Widget w;
XtPointer data;
XEvent *event;
{
XButtonReleasedEvent *BuEvent = (XButtonReleasedEvent *)event;
HTMLWidget hw = (HTMLWidget)data;
JotInfo *jptr;
Stroke *sptr;
jptr = GetJot(w);
if (jptr == NULL)
{
return;
}
if (jptr->drawing == False)
{
return;
}
sptr = (Stroke *)malloc(sizeof(Stroke));
if (sptr == NULL)
{
return;
}
sptr->x = BuEvent->x;
sptr->y = BuEvent->y;
sptr->draw = True;
sptr->next = NULL;
/*
* Without motif we use our own foreground resource instead of
* using the manager's
*/
XSetForeground(XtDisplay(w), hw->html.drawGC,
#ifdef MOTIF
hw->manager.foreground);
#else
hw->html.foreground);
#endif /* MOTIF */
XDrawLine(XtDisplay(w), XtWindow(w), hw->html.drawGC,
jptr->last_x, jptr->last_y, sptr->x, sptr->y);
if (jptr->pix != NULL)
{
XDrawLine(XtDisplay(w), jptr->pix, hw->html.drawGC,
jptr->last_x, jptr->last_y, sptr->x, sptr->y);
}
AddStroke(jptr, sptr, True);
}
char *
EJB_JOTfromJot(w)
Widget w;
{
int i, cnt;
int dlen, total;
u_long val;
unsigned char uchar;
JotInfo *jptr;
Stroke *sptr;
unsigned char *data;
unsigned char *dptr;
unsigned char *buffer;
unsigned char *bptr;
jptr = GetJot(w);
if (jptr == NULL)
{
return(NULL);
}
dlen = (2 * sizeof(u_long) + sizeof(char)) * jptr->stroke_cnt;
data = (unsigned char *)malloc(dlen);
cnt = 0;
sptr = jptr->strokes;
dptr = data;
while ((sptr != NULL)&&(cnt < jptr->stroke_cnt))
{
val = htonl((u_long)sptr->x);
/*
bcopy((char *)&val, (char *)dptr, sizeof(u_long));
*/
memcpy((char *)dptr, (char *)&val, sizeof(u_long));
dptr = dptr + sizeof(u_long);
val = htonl((u_long)sptr->y);
/*
bcopy((char *)&val, (char *)dptr, sizeof(u_long));
*/
memcpy((char *)dptr, (char *)&val, sizeof(u_long));
dptr = dptr + sizeof(u_long);
if (sptr->draw == False)
{
uchar = 0;
}
else
{
uchar = 1;
}
*dptr++ = uchar;
cnt++;
sptr = sptr->next;
}
for (i=cnt; i<jptr->stroke_cnt; i++)
{
val = 0;
/*
bcopy((char *)&val, (char *)dptr, sizeof(u_long));
*/
memcpy((char *)dptr, (char *)&val, sizeof(u_long));
dptr = dptr + sizeof(u_long);
val = 0;
/*
bcopy((char *)&val, (char *)dptr, sizeof(u_long));
*/
memcpy((char *)dptr, (char *)&val, sizeof(u_long));
dptr = dptr + sizeof(u_long);
uchar = 0;
*dptr++ = uchar;
}
#ifndef DISABLE_TRACE
if (htmlwTrace) {
fprintf(stderr, "Packaging up %d points\n", jptr->stroke_cnt);
}
#endif
cnt = 0;
dptr = data;
for (i=0; i<dlen; i++)
{
if ((*dptr == 0)||(*dptr == 1))
{
cnt++;
}
dptr++;
}
total = dlen + cnt + 1;
buffer = (unsigned char *)malloc(total);
bptr = buffer;
dptr = data;
for (i=0; i<dlen; i++)
{
if (*dptr == 0)
{
*bptr++ = (unsigned char)'o';
*bptr++ = (unsigned char)'O';
}
else if (*dptr == 'o')
{
*bptr++ = (unsigned char)'o';
*bptr++ = (unsigned char)'o';
}
else
{
*bptr++ = *dptr;
}
dptr++;
}
*bptr = (unsigned char)'\0';
free((char *)data);
return((char *)buffer);
}
typedef struct my_INK_POINT {
XY32 position;
INK_BUTTONS buttons;
} MY_INK_POINT;
unsigned char *
JOTfromJot(w, buffer_len)
Widget w;
int *buffer_len;
{
int i, cnt;
int dlen, total;
JotInfo *jptr;
Stroke *sptr;
MY_INK_POINT *dataArray;
INK_BUNDLE_RECORD *iptr;
INK_PENDATA_RECORD *pptr;
INK_END_RECORD *eptr;
unsigned char *buffer;
jptr = GetJot(w);
if (jptr == NULL)
{
return(NULL);
}
dlen = sizeof(MY_INK_POINT) * jptr->stroke_cnt;
dataArray = (MY_INK_POINT *)malloc(dlen);
cnt = 0;
sptr = jptr->strokes;
while ((sptr != NULL)&&(cnt < jptr->stroke_cnt));
{
dataArray[cnt].position.x = sptr->x;
dataArray[cnt].position.y = sptr->y;
dataArray[cnt].buttons = inkPointDefaultButtons;
dataArray[cnt].buttons |= flag0;
if ((sptr->next != NULL)&&(sptr->next->draw == False))
{
}
else
{
dataArray[cnt].buttons |= flag1;
}
cnt++;
sptr = sptr->next;
}
for (i=cnt; i<jptr->stroke_cnt; i++)
{
dataArray[i].position.x = 0;
dataArray[i].position.y = 0;
dataArray[i].buttons = inkPointDefaultButtons;
}
iptr = (INK_BUNDLE_RECORD *)malloc(inkRecordBundleSize);
iptr->header.recordType = inkRecordBundle;
iptr->header.recordLength = inkRecordBundleSize;
iptr->version = inkPointDefaultVersion;
iptr->compactionType = inkNoCompression;
iptr->flags = (inkPointDefaultBundleFlags | inkButtonDataPresent);
iptr->penUnitsPerX = inkPointDefaultPenUnitsPerX;
iptr->penUnitsPerY = inkPointDefaultPenUnitsPerY;
pptr = (INK_PENDATA_RECORD *)malloc(inkRecordPenDataSize(dlen));
pptr->header.recordType = inkRecordPenData;
pptr->header.recordLength = inkRecordPenDataSize(dlen);
pptr->bounds.origin.x = jptr->min_x;
pptr->bounds.origin.y = jptr->min_y;
pptr->bounds.size.w = jptr->max_x - jptr->min_x + 1;
pptr->bounds.size.h = jptr->max_y - jptr->min_y + 1;
/*
bcopy((char *)dataArray, (char *)pptr->inkData, dlen);
*/
memcpy((char *)pptr->inkData, (char *)dataArray, dlen);
free((char *)dataArray);
/*
pptr->inkData = dataArray;
*/
eptr = (INK_END_RECORD *)malloc(inkRecordEndSize);
eptr->header.recordType = inkRecordEnd;
total = inkRecordBundleSize + inkRecordPenDataSize(dlen) +
inkRecordEndSize;
buffer = (unsigned char *)malloc(total);
/*
bcopy((char *)iptr, buffer, inkRecordBundleSize);
*/
memcpy(buffer, (char *)iptr, inkRecordBundleSize);
/*
bcopy((char *)pptr, (char *)(buffer + inkRecordBundleSize),
inkRecordPenDataSize(dlen));
*/
memcpy((char *)(buffer + inkRecordBundleSize), (char *)pptr,
inkRecordPenDataSize(dlen));
/*
bcopy((char *)eptr, (char *)(buffer + inkRecordBundleSize +
inkRecordPenDataSize(dlen)), inkRecordEndSize);
*/
memcpy((char *)(buffer + inkRecordBundleSize +
inkRecordPenDataSize(dlen)), (char *)eptr, inkRecordEndSize);
free((char *)iptr);
free((char *)pptr);
free((char *)eptr);
*buffer_len = total;
return(buffer);
}
#endif /* MOTIF */

935
libhtmlw/HTMLlists.c Normal file
View File

@@ -0,0 +1,935 @@
/****************************************************************************
* NCSA Mosaic for the X Window System *
* Software Development Group *
* National Center for Supercomputing Applications *
* University of Illinois at Urbana-Champaign *
* 605 E. Springfield, Champaign IL 61820 *
* mosaic@ncsa.uiuc.edu *
* *
* Copyright (C) 1993, Board of Trustees of the University of Illinois *
* *
* NCSA Mosaic software, both binary and source (hereafter, Software) is *
* copyrighted by The Board of Trustees of the University of Illinois *
* (UI), and ownership remains with the UI. *
* *
* The UI grants you (hereafter, Licensee) a license to use the Software *
* for academic, research and internal business purposes only, without a *
* fee. Licensee may distribute the binary and source code (if released) *
* to third parties provided that the copyright notice and this statement *
* appears on all copies and that no charge is associated with such *
* copies. *
* *
* Licensee may make derivative works. However, if Licensee distributes *
* any derivative work based on or derived from the Software, then *
* Licensee will (1) notify NCSA regarding its distribution of the *
* derivative work, and (2) clearly notify users that such derivative *
* work is a modified version and not the original NCSA Mosaic *
* distributed by the UI. *
* *
* Any Licensee wishing to make commercial use of the Software should *
* contact the UI, c/o NCSA, to negotiate an appropriate license for such *
* commercial use. Commercial use includes (1) integration of all or *
* part of the source code into a product for sale or license by or on *
* behalf of Licensee to third parties, or (2) distribution of the binary *
* code or source code to third parties that need it to utilize a *
* commercial product sold or licensed by or on behalf of Licensee. *
* *
* UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR *
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED *
* WARRANTY. THE UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE *
* USERS OF THIS SOFTWARE. *
* *
* By using or copying this Software, Licensee agrees to abide by the *
* copyright law and all other applicable laws of the U.S. including, but *
* not limited to, export control laws, and the terms of this license. *
* UI shall have the right to terminate this license immediately by *
* written notice upon Licensee's breach of, or non-compliance with, any *
* of its terms. Licensee may be held legally responsible for any *
* copyright infringement that is caused or encouraged by Licensee's *
* failure to abide by the terms of this license. *
* *
* Comments and questions are welcome and can be sent to *
* mosaic-x@ncsa.uiuc.edu. *
****************************************************************************/
#include "../config.h"
#include <stdio.h>
#include "HTML.h"
#ifndef DISABLE_TRACE
extern int htmlwTrace;
#endif
/*
* Code to manage a linked list of parsed HTML objects generated
* from a raw text file.
* Also code to manage a linked list of formatted elements that
* make up a page of a formatted document.
*/
/*
* Free up the passed linked list of parsed elements, freeing
* all memory associates with each element.
*/
void
FreeObjList(List)
struct mark_up *List;
{
struct mark_up *current;
struct mark_up *mptr;
current = List;
while (current != NULL)
{
mptr = current;
current = current->next;
mptr->next = NULL;
if (mptr->start != NULL)
{
free((char *)mptr->start);
}
if (mptr->text != NULL)
{
free((char *)mptr->text);
}
if (mptr->end != NULL)
{
free((char *)mptr->end);
}
free((char *)mptr);
}
}
/*
* Add an object to the parsed object list.
* return a pointer to the current (end) position in the list.
* If the object is a normal text object containing nothing but
* white space, throw it out, unless we have been told to keep
* white space.
*/
struct mark_up *
AddObj(listp, current, mark, keep_wsp)
struct mark_up **listp;
struct mark_up *current;
struct mark_up *mark;
int keep_wsp;
{
if (mark == NULL)
{
return(current);
}
/*
* Throw out normal text blocks that are only white space,
* unless keep_wsp is set.
*/
if ((mark->type == M_NONE)&&(!keep_wsp))
{
char *ptr;
ptr = mark->text;
if (ptr == NULL)
{
free((char *)mark);
return(current);
}
/*
* No longer throw out whitespace, it is important to keep
* white space between tags.
while ((*ptr == ' ')||(*ptr == '\t')||(*ptr == '\n'))
{
ptr++;
}
*
*/
if (*ptr == '\0')
{
free(mark->text);
free((char *)mark);
return(current);
}
}
/*
* Add object to either the head of the list for a new list,
* or at the end after the current pointer.
*/
if (*listp == NULL)
{
*listp = mark;
current = *listp;
}
else
{
current->next = mark;
current = current->next;
}
current->next = NULL;
return(current);
}
/*
* Convert type number to a printed string for debug
*/
void
PrintType(type)
int type;
{
#ifndef DISABLE_TRACE
if (htmlwTrace) {
switch(type)
{
case M_NONE:
fprintf(stderr,"M_NONE");
break;
case M_TITLE:
fprintf(stderr,"M_TITLE");
break;
case M_FIXED:
fprintf(stderr,"M_FIXED");
break;
case M_BOLD:
fprintf(stderr,"M_BOLD");
break;
case M_ITALIC:
fprintf(stderr,"M_ITALIC");
break;
case M_EMPHASIZED:
fprintf(stderr,"M_EMPHASIZED");
break;
case M_STRONG:
fprintf(stderr,"M_STRONG");
break;
case M_CODE:
fprintf(stderr,"M_CODE");
break;
case M_SAMPLE:
fprintf(stderr,"M_SAMPLE");
break;
case M_KEYBOARD:
fprintf(stderr,"M_KEYBOARD");
break;
case M_VARIABLE:
fprintf(stderr,"M_VARIABLE");
break;
case M_CITATION:
fprintf(stderr,"M_CITATION");
break;
case M_STRIKEOUT:
fprintf(stderr,"M_STRIKEOUT");
break;
case M_HEADER_1:
fprintf(stderr,"M_HEADER_1");
break;
case M_HEADER_2:
fprintf(stderr,"M_HEADER_2");
break;
case M_HEADER_3:
fprintf(stderr,"M_HEADER_3");
break;
case M_HEADER_4:
fprintf(stderr,"M_HEADER_4");
break;
case M_HEADER_5:
fprintf(stderr,"M_HEADER_5");
break;
case M_HEADER_6:
fprintf(stderr,"M_HEADER_6");
break;
case M_ANCHOR:
fprintf(stderr,"M_ANCHOR");
break;
case M_PARAGRAPH:
fprintf(stderr,"M_PARAGRAPH");
break;
case M_ADDRESS:
fprintf(stderr,"M_ADDRESS");
break;
case M_PLAIN_TEXT:
fprintf(stderr,"M_PLAIN_TEXT");
break;
case M_LISTING_TEXT:
fprintf(stderr,"M_LISTING_TEXT");
break;
case M_UNUM_LIST:
fprintf(stderr,"M_UNUM_LIST");
break;
case M_NUM_LIST:
fprintf(stderr,"M_NUM_LIST");
break;
case M_MENU:
fprintf(stderr,"M_MENU");
break;
case M_DIRECTORY:
fprintf(stderr,"M_DIRECTORY");
break;
case M_LIST_ITEM:
fprintf(stderr,"M_LIST_ITEM");
break;
case M_DESC_LIST:
fprintf(stderr,"M_DESC_LIST");
break;
case M_DESC_TITLE:
fprintf(stderr,"M_DESC_TITLE");
break;
case M_DESC_TEXT:
fprintf(stderr,"M_DESC_TEXT");
break;
case M_IMAGE:
fprintf(stderr,"M_IMAGE");
break;
case M_SELECT:
fprintf(stderr,"M_SELECT");
break;
case M_OPTION:
fprintf(stderr,"M_OPTION");
break;
case M_INPUT:
fprintf(stderr,"M_INPUT");
break;
case M_TEXTAREA:
fprintf(stderr,"M_TEXTAREA");
break;
case M_FORM:
fprintf(stderr,"M_FORM");
break;
case M_INDEX:
fprintf(stderr,"M_INDEX");
break;
case M_HRULE:
fprintf(stderr,"M_HRULE");
break;
case M_BASE:
fprintf(stderr,"M_BASE");
break;
case M_LINEBREAK:
fprintf(stderr,"M_LINEBREAK");
break;
case M_BLOCKQUOTE:
fprintf(stderr,"M_BLOCKQUOTE");
break;
default:
fprintf(stderr,"UNKNOWN %d", type);
break;
}
}
#endif
}
/*
* Print the contents of a parsed object list, for debug
*/
void
PrintList(list)
struct mark_up *list;
{
struct mark_up *mptr;
#ifndef DISABLE_TRACE
if (htmlwTrace) {
mptr = list;
while (mptr != NULL)
{
PrintType(mptr->type);
if (mptr->is_end)
{
fprintf(stderr," END");
}
else
{
fprintf(stderr," START");
}
if (mptr->text != NULL)
{
fprintf(stderr,"\n{\n\t");
fprintf(stderr,"%s", mptr->text);
fprintf(stderr,"}\n");
}
else
{
fprintf(stderr,"\n");
}
mptr = mptr->next;
}
}
#endif
}
/*
* Used to find the longest line (in characters) in a collection
* of text blocks. cnt is the running count of characters, and
* txt is the pointer to the current text block. Since we are
* finding line widths, a newline resets the width count.
*/
char *
MaxTextWidth(txt, cnt)
char *txt;
int *cnt;
{
char *start;
char *end;
int width;
if (txt == NULL)
{
return(NULL);
}
width = *cnt;
start = txt;
/*
* If this blocks starts with a newline, reset the width
* count, and skip the newline.
*/
if (*start == '\n')
{
width = 0;
start++;
}
end = start;
/*
* count characters, stoping either at a newline, or at the
* end of this text block. Expand tabs.
*/
while ((*end != '\0')&&(*end != '\n'))
{
if (*end == '\t')
{
width = ((width / 8) + 1) * 8;
}
else
{
width++;
}
end++;
}
*cnt = width;
return(end);
}
/*
* Free up the passed linked list of formatted elements, freeing
* all memory associates with each element.
*/
void
FreeLineList(list)
struct ele_rec *list;
{
struct ele_rec *current;
struct ele_rec *eptr;
current = list;
while (current != NULL)
{
eptr = current;
current = current->next;
eptr->next = NULL;
if (eptr->edata != NULL)
{
free((char *)eptr->edata);
}
if (eptr->anchorHRef != NULL)
{
free((char *)eptr->anchorHRef);
}
if (eptr->anchorName != NULL)
{
free((char *)eptr->anchorName);
}
if (eptr->anchorSubject != NULL)
{
free((char *)eptr->anchorSubject);
}
free((char *)eptr);
}
}
/*
* Add an element to the linked list of formatted elements.
* return a pointer to the current (end) position in the list.
*/
struct ele_rec *
AddEle(elistp, current, eptr)
struct ele_rec **elistp;
struct ele_rec *current;
struct ele_rec *eptr;
{
if (eptr == NULL)
{
return(current);
}
/*
* Add object to either the head of the list for a new list,
* or at the end after the current pointer.
*/
if (*elistp == NULL)
{
*elistp = eptr;
(*elistp)->next = NULL;
(*elistp)->prev = NULL;
current = *elistp;
}
else
{
current->next = eptr;
eptr->prev = current;
current = current->next;
current->next = NULL;
}
return(current);
}
/*
* Contruct and return an array of pointers into the element list that
* indexes the elements by line number.
* Note, lines containing only while space will have NULL pointers
* into the element list.
*/
struct ele_rec **
MakeLineList(elist, max_line)
struct ele_rec *elist;
int max_line;
{
int i;
struct ele_rec *eptr;
struct ele_rec **ll;
/*
* malloc index array
*/
ll = (struct ele_rec **)malloc(sizeof(struct ele_rec *) * max_line);
if (ll == NULL)
{
fprintf(stderr, "cannot allocate space for line list\n");
exit(1);
}
/*
* zero the index array
*/
for (i=0; i<max_line; i++)
{
ll[i] = NULL;
}
/*
* fill in pointers to beginning of the lines
*/
eptr = elist;
while (eptr != NULL)
{
if (eptr->line_number > max_line)
{
break;
}
if (ll[eptr->line_number - 1] == NULL)
{
ll[eptr->line_number - 1] = eptr;
}
eptr = eptr->next;
}
return(ll);
}
/*
* Passed in 2 element pointers, and element positions.
* Function should return 1 if if start occurs before end.
* Otherwise return 0.
*/
int
ElementLessThan(start, end, start_pos, end_pos)
struct ele_rec *start;
struct ele_rec *end;
int start_pos, end_pos;
{
struct ele_rec *current;
/*
* Deal with start or end being NULL
*/
if ((start == NULL)&&(end == NULL))
{
return(0);
}
else if ((start == NULL)&&(end != NULL))
{
return(1);
}
else if ((start != NULL)&&(end == NULL))
{
return(0);
}
/*
* Deal with easy identical case
*/
if (start == end)
{
if (start_pos < end_pos)
{
return(1);
}
else
{
return(0);
}
}
/*
* We know element Ids are always equal or increasing within a
* list.
*/
if (start->ele_id < end->ele_id)
{
return(1);
}
else if (start->ele_id == end->ele_id)
{
current = start;
while (current != NULL)
{
if (current->ele_id != start->ele_id)
{
break;
}
else if (current == end)
{
break;
}
current = current->next;
}
if (current == end)
{
return(1);
}
else
{
return(0);
}
}
else
{
return(0);
}
}
/*
* Passed in 2 element pointers, and element positions.
* Function should return 1 if they need to be swapped in order for then
* to proceed left to right and top to bottom in the text.
* Otherwise return 0.
*/
int
SwapElements(start, end, start_pos, end_pos)
struct ele_rec *start;
struct ele_rec *end;
int start_pos, end_pos;
{
struct ele_rec *current;
/*
* Deal with start or end being NULL
*/
if ((start == NULL)&&(end == NULL))
{
return(0);
}
else if ((start == NULL)&&(end != NULL))
{
return(1);
}
else if ((start != NULL)&&(end == NULL))
{
return(0);
}
/*
* Deal with easy identical case
*/
if (start == end)
{
if (start_pos > end_pos)
{
return(1);
}
else
{
return(0);
}
}
/*
* We know element Ids are always equal or increasing within a
* list.
*/
if (start->ele_id < end->ele_id)
{
return(0);
}
else if (start->ele_id == end->ele_id)
{
current = start;
while (current != NULL)
{
if (current->ele_id != start->ele_id)
{
break;
}
else if (current == end)
{
break;
}
current = current->next;
}
if (current == end)
{
return(0);
}
else
{
return(1);
}
}
else
{
return(1);
}
}
/*
* Free up the allocated list of internal hrefs.
*/
void
FreeHRefs(list)
struct ref_rec *list;
{
struct ref_rec *hptr;
struct ref_rec *tptr;
hptr = list;
while (hptr != NULL)
{
tptr = hptr;
hptr = hptr->next;
if (tptr->anchorHRef != NULL)
{
free((char *)tptr->anchorHRef);
}
free((char *)tptr);
}
}
/*
* Find an element in the linked list of Internal HREFS.
* return a pointer to the element, or NULL if not found.
*/
struct ref_rec *
FindHRef(list, href)
struct ref_rec *list;
char *href;
{
struct ref_rec *hptr;
if (href == NULL)
{
return(NULL);
}
hptr = list;
while (hptr != NULL)
{
if (strcmp(hptr->anchorHRef, href) == 0)
{
break;
}
hptr = hptr->next;
}
return(hptr);
}
/*
* Add an element to the linked list of Internal HREFS we
* have visited before.
* return a pointer to the head of the new list.
*/
struct ref_rec *
AddHRef(list, href)
struct ref_rec *list;
char *href;
{
struct ref_rec *hptr;
if (href == NULL)
{
return(list);
}
hptr = FindHRef(list, href);
if (hptr == NULL)
{
hptr = (struct ref_rec *)malloc(sizeof(struct ref_rec));
if (hptr == NULL)
{
#ifndef DISABLE_TRACE
if (htmlwTrace) {
fprintf(stderr, "cannot extend internal href list\n");
}
#endif
return(list);
}
hptr->anchorHRef = (char *)malloc(strlen(href) + 1);
if (hptr->anchorHRef == NULL)
{
free((char *)hptr);
#ifndef DISABLE_TRACE
if (htmlwTrace) {
fprintf(stderr, "cannot extend internal href list\n");
}
#endif
return(list);
}
strcpy(hptr->anchorHRef, href);
hptr->next = list;
list = hptr;
}
return(list);
}
/*
* Free up the allocated list of visited delayed images
*/
void
FreeDelayedImages(list)
struct delay_rec *list;
{
struct delay_rec *iptr;
struct delay_rec *tptr;
iptr = list;
while (iptr != NULL)
{
tptr = iptr;
iptr = iptr->next;
if (tptr->src != NULL)
{
free((char *)tptr->src);
}
free((char *)tptr);
}
}
/*
* Find an element in the linked list of visited delayed images.
* return a pointer to the element, or NULL if not found.
*/
struct delay_rec *
FindDelayedImage(list, src)
struct delay_rec *list;
char *src;
{
struct delay_rec *iptr;
if (src == NULL)
{
return(NULL);
}
iptr = list;
while (iptr != NULL)
{
if (strcmp(iptr->src, src) == 0)
{
break;
}
iptr = iptr->next;
}
return(iptr);
}
/*
* Add an element to the linked list of visited delayed images.
* return a pointer to the head of the new list.
*/
struct delay_rec *
AddDelayedImage(list, src)
struct delay_rec *list;
char *src;
{
struct delay_rec *iptr;
if (src == NULL)
{
return(list);
}
iptr = FindDelayedImage(list, src);
if (iptr == NULL)
{
iptr = (struct delay_rec *)malloc(sizeof(struct delay_rec));
if (iptr == NULL)
{
#ifndef DISABLE_TRACE
if (htmlwTrace) {
fprintf(stderr, "cannot extend visited delayed images list\n");
}
#endif
return(list);
}
iptr->src = (char *)malloc(strlen(src) + 1);
if (iptr->src == NULL)
{
free((char *)iptr);
#ifndef DISABLE_TRACE
if (htmlwTrace) {
fprintf(stderr, "cannot extend visited delayed images list\n");
}
#endif
return(list);
}
strcpy(iptr->src, src);
iptr->next = list;
list = iptr;
}
return(list);
}

1633
libhtmlw/HTMLparse.c Normal file

File diff suppressed because it is too large Load Diff

1286
libhtmlw/HTMLtable.c Normal file

File diff suppressed because it is too large Load Diff

4345
libhtmlw/HTMLwidgets.c Normal file

File diff suppressed because it is too large Load Diff

21
libhtmlw/Makefile Normal file
View File

@@ -0,0 +1,21 @@
LIBTARGET = libhtmlw.a
all: $(LIBTARGET)
CFILES = HTML.c HTMLlists.c HTMLformat.c HTMLparse.c HTMLimages.c HTMLwidgets.c HTML-PSformat.c DrawingArea.c HTMLjot.c HTMLtable.c list.c
OBJS = $(CFILES:.c=.o)
$(OBJS): HTML.h HTMLP.h
$(LIBTARGET): $(OBJS)
-rm -f $(LIBTARGET)
ar rv $(LIBTARGET) $(OBJS)
$(RANLIB) $(LIBTARGET)
HTMLimages.o: AnchoredImage.xbm DelayedImage.xbm
clean:
-rm $(LIBTARGET) *.o
tags:
etags -t *.[ch]

33
libhtmlw/Makefile.in Normal file
View File

@@ -0,0 +1,33 @@
# @configure_output@
# This file is used by Autoconf to make the real Makefile.
# DO NOT EDIT THIS FILE!
# If you want to change something do it to the Makefile autoconf
# creates. You should never have to edit this file.
CC= @CC@
LIBS = @LIBS@
CFLAGS = @CFLAGS@
RANLIB = @RANLIB@
LIBTARGET = libhtmlw.a
all: $(LIBTARGET)
CFILES = HTML.c HTMLlists.c HTMLformat.c HTMLparse.c HTMLimages.c HTMLwidgets.c HTML-PSformat.c DrawingArea.c HTMLjot.c HTMLtable.c list.c
OBJS = $(CFILES:.c=.o)
$(OBJS): HTML.h HTMLP.h
$(LIBTARGET): $(OBJS)
-rm -f $(LIBTARGET)
ar rv $(LIBTARGET) $(OBJS)
$(RANLIB) $(LIBTARGET)
HTMLimages.o: AnchoredImage.xbm DelayedImage.xbm
clean:
-rm $(LIBTARGET) *.o
tags:
etags -t *.[ch]

21
libhtmlw/Makefile.orig Normal file
View File

@@ -0,0 +1,21 @@
LIBTARGET = libhtmlw.a
all: $(LIBTARGET)
CFILES = HTML.c HTMLlists.c HTMLformat.c HTMLparse.c HTMLimages.c HTMLwidgets.c HTML-PSformat.c DrawingArea.c HTMLjot.c HTMLtable.c list.c
OBJS = $(CFILES:.c=.o)
$(OBJS): HTML.h HTMLP.h
$(LIBTARGET): $(OBJS)
-rm -f $(LIBTARGET)
ar rv $(LIBTARGET) $(OBJS)
$(RANLIB) $(LIBTARGET)
HTMLimages.o: AnchoredImage.xbm DelayedImage.xbm
clean:
-rm $(LIBTARGET) *.o
tags:
etags -t *.[ch]

46
libhtmlw/NoImage.xbm Normal file
View File

@@ -0,0 +1,46 @@
#define NoImage_width 64
#define NoImage_height 64
static char NoImage_bits[] = {
0x00, 0x00, 0x40, 0x55, 0x55, 0x55, 0x55, 0x04, 0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x44, 0x44, 0x44, 0x44, 0x44, 0x0c,
0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1d, 0x00, 0x40, 0xc4, 0xff,
0xff, 0xff, 0x7f, 0x1e, 0x00, 0x10, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x0f,
0x00, 0x40, 0xfe, 0x00, 0x00, 0x00, 0x50, 0x06, 0x00, 0x88, 0x0f, 0x55,
0x55, 0x55, 0x05, 0x01, 0x00, 0xc0, 0x57, 0x00, 0x00, 0x00, 0x40, 0x01,
0x00, 0xf2, 0x03, 0x11, 0x11, 0x11, 0x11, 0x03, 0x00, 0x70, 0x44, 0x44,
0x44, 0x44, 0x44, 0x03, 0x00, 0xb5, 0xf0, 0xff, 0xff, 0xff, 0x9f, 0x03,
0x00, 0x18, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03, 0x80, 0x2c, 0x7f, 0x50,
0x55, 0x55, 0xc1, 0x01, 0x00, 0x4d, 0x4f, 0x05, 0x00, 0x00, 0x20, 0x00,
0x80, 0x94, 0x13, 0x10, 0x11, 0x11, 0x31, 0x00, 0x00, 0xc1, 0x44, 0x44,
0x44, 0x44, 0x64, 0x00, 0x40, 0x76, 0x10, 0xf1, 0xff, 0xff, 0x71, 0x00,
0x00, 0x23, 0xc5, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x40, 0x30, 0xf8, 0x3f,
0x00, 0x00, 0x7c, 0x00, 0x00, 0x55, 0xfc, 0x01, 0x00, 0x00, 0x10, 0x00,
0x00, 0x08, 0x1f, 0x54, 0x05, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x0f, 0x01,
0x10, 0x00, 0x00, 0x00, 0x00, 0x84, 0x43, 0x10, 0x01, 0x00, 0x00, 0x00,
0x00, 0xcc, 0x01, 0x44, 0x24, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x10, 0x10,
0x51, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x44, 0x84, 0x00, 0x00, 0x00,
0x00, 0x70, 0x08, 0x11, 0x91, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x44,
0x44, 0x01, 0x00, 0x00, 0x00, 0x18, 0x08, 0x11, 0x11, 0x01, 0x00, 0x00,
0x00, 0x14, 0x40, 0x44, 0x44, 0x03, 0x00, 0x00, 0x00, 0x10, 0x08, 0x11,
0x11, 0x03, 0x00, 0x00, 0x00, 0x10, 0x40, 0x44, 0x44, 0x03, 0x00, 0x00,
0x00, 0x00, 0x08, 0x11, 0x11, 0x03, 0x02, 0x00, 0x00, 0x00, 0x40, 0x44,
0xc4, 0x03, 0x0c, 0x00, 0x00, 0x00, 0x10, 0x11, 0x91, 0x03, 0x09, 0x00,
0x00, 0x00, 0x00, 0x44, 0xc4, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x40, 0x11,
0xf1, 0x81, 0x65, 0x00, 0x00, 0x00, 0x00, 0x44, 0xf4, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x11, 0x79, 0x20, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x46,
0x3e, 0x40, 0x33, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x88, 0x27, 0x00,
0x00, 0x00, 0x00, 0xe0, 0x07, 0xc2, 0x11, 0x00, 0x00, 0x0a, 0x00, 0x00,
0x80, 0xf0, 0x16, 0x00, 0x80, 0xa0, 0xaa, 0xaa, 0x2a, 0xf4, 0x90, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x7d, 0x4d, 0x00, 0x40, 0x44, 0x44, 0x44,
0x44, 0x3f, 0xa9, 0x00, 0x00, 0x11, 0x11, 0x11, 0xd1, 0x4f, 0x5c, 0x00,
0x80, 0xfc, 0xff, 0xff, 0xff, 0x13, 0x46, 0x00, 0x00, 0xfe, 0xff, 0xff,
0xff, 0x44, 0x5b, 0x00, 0x40, 0x1c, 0x00, 0x00, 0x00, 0xd1, 0x27, 0x00,
0x10, 0x55, 0x55, 0x55, 0x55, 0xe4, 0x31, 0x00, 0x40, 0x00, 0x00, 0x00,
0x40, 0x78, 0x35, 0x00, 0x08, 0x11, 0x11, 0x11, 0x11, 0x7e, 0x18, 0x00,
0x40, 0x44, 0x44, 0x44, 0xc4, 0x5f, 0x1c, 0x00, 0x90, 0xff, 0xff, 0xff,
0xff, 0x17, 0x0f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x45, 0x07, 0x00,
0x94, 0x01, 0x00, 0x00, 0x00, 0xd1, 0x03, 0x00, 0x40, 0x55, 0x55, 0x55,
0x55, 0xf4, 0x01, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x00, 0x00,
0x44, 0x44, 0x44, 0x44, 0x44, 0x3f, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11,
0xf1, 0x1f, 0x00, 0x00, 0xf4, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00,
0xf0, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00};

View File

@@ -0,0 +1,46 @@
#define NoImage_width 64
#define NoImage_height 64
static char NoImage_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xfc,
0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x1f,
0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xfc, 0xff,
0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x06,
0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00,
0x00, 0x00, 0xc0, 0x01, 0x00, 0xe0, 0x01, 0xfe, 0xff, 0xff, 0xff, 0x03,
0x00, 0x70, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x00, 0x30, 0xf8, 0xff,
0xff, 0xff, 0xff, 0x03, 0x00, 0x18, 0xfc, 0xff, 0xff, 0xff, 0xff, 0x03,
0x00, 0x08, 0x7e, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x0c, 0x0f, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00, 0x00, 0x38, 0x00,
0x00, 0xc0, 0x00, 0xfc, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x62, 0xc0, 0xff,
0xff, 0xff, 0x7f, 0x00, 0x00, 0x22, 0xf0, 0xff, 0xff, 0xff, 0x7f, 0x00,
0x00, 0x30, 0xf8, 0x3f, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x11, 0xfc, 0x01,
0x00, 0x00, 0x10, 0x00, 0x00, 0x09, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x03, 0xf0,
0x0f, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x01, 0xfc, 0x3f, 0x00, 0x00, 0x00,
0x00, 0xc0, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0xff,
0x7f, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0xff, 0xff, 0x00, 0x00, 0x00,
0x00, 0x20, 0x80, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x10, 0xc0, 0xff,
0xff, 0x01, 0x00, 0x00, 0x00, 0x10, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x00,
0x00, 0x10, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x10, 0xc0, 0xff,
0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x03, 0x00, 0x00,
0x00, 0x00, 0xc0, 0xff, 0xff, 0x03, 0x08, 0x00, 0x00, 0x00, 0xc0, 0xff,
0xff, 0x03, 0x08, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x01, 0x08, 0x00,
0x00, 0x00, 0x80, 0xff, 0xff, 0x01, 0x44, 0x00, 0x00, 0x00, 0x80, 0xff,
0xff, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x06, 0x00,
0x00, 0x00, 0x00, 0xfe, 0x3f, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0xfc,
0x1f, 0x80, 0x23, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xc0, 0x21, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf8, 0x90, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x7e, 0x18, 0x00,
0x00, 0x3e, 0x00, 0x00, 0xf8, 0x3f, 0x88, 0x00, 0x00, 0xfe, 0xff, 0xff,
0xff, 0x0f, 0x4c, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x03, 0x46, 0x00,
0x00, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x43, 0x00, 0x00, 0x1c, 0x00, 0x00,
0x00, 0xc0, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x31, 0x00,
0x80, 0x03, 0x00, 0x00, 0x00, 0x7c, 0x30, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0x7f, 0x18, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x1c, 0x00,
0xc0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x0e, 0x00, 0xc0, 0xff, 0xff, 0xff,
0xff, 0x01, 0x07, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x70, 0x00, 0x00, 0x00,
0x00, 0xfe, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00,
0xfc, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff,
0xff, 0x03, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

138
libhtmlw/descrip.mms Executable file
View File

@@ -0,0 +1,138 @@
! MMS description file for LIBHTMLW
! Bjorn S. Nilsson, Aleph, CERN, 20-Nov-1993
! (Mosaic version 2.0)
! Motif 1.2 support added on 3-Jun-1994
! Mosaic 2.4 20-Aug-1994
!
! Usage:
! $ MMS for DEC/UCX
! $ MMS/MACRO=(MULTINET=1) for Multinet
! $ MMS/MACRO=(PATHWAY=1) for Pathway
! $ MMS/MACRO=(SOCKETSHR=1) for SOCKETSHR BGT
! Add a DEBUG=1 macro when debugging.
! Add a DECC=1 macro when compiling with DEC C.
! Add a MOTIF1_2 macro when Motif 1.2 is installed.
!
! You may have to use the /IGNORE=WARNING qualifier to make MMS run all
! the way through if you get (acceptable) compilation warnings.
!
WDIR = [.$(WORK)]
LIBTARGET = $(WDIR)libhtmlw.olb
.IFDEF MOTIF1_2
MOTIF = MOTIF,MOTIF1_2
.ELSE
MOTIF = MOTIF
.ENDIF
.IFDEF PATHWAY
.IFDEF DECC
.INCLUDE [-.TWG]DECC_PREFIX_RULES.MMS
CQUALC=/DECC/Standard=VAXC/Precision=SINGLE $(CC_PREFIX_NO_SIN)
.ELSE
.IFDEF DECCVAXC
CQUALC=/VAXC/Precision=SINGLE
.ELSE
CQUALC=/Precision=SINGLE
.ENDIF
.ENDIF
CDEFS = /DEFINE=($(MOTIF),XMOSAIC)
.ELSE ! Not PATHWAY
.IFDEF SOCKETSHR ! BGT
.IFDEF DECC ! BGT
CQUALC=/DECC/Standard=VAXC/Precision=SINGLE/Prefix=ANSI ! BGT
.ELSE ! BGT
.IFDEF DECCVAXC
CQUALC=/VAXC/Precision=SINGLE
.ELSE
CQUALC=/Precision=SINGLE
.ENDIF
.ENDIF ! BGT
CDEFS = /DEFINE=($(MOTIF),XMOSAIC,SOCKETSHR) ! BGT
.ELSE ! Not SOCKETSHR BGT
.IFDEF MULTINET
.IFDEF DECC
CQUALC=/DECC/Standard=VAXC/Precision=SINGLE/Prefix=ANSI
.ELSE
.IFDEF DECCVAXC
CQUALC=/VAXC/Precision=SINGLE
.ELSE
CQUALC=/Precision=SINGLE
.ENDIF
.ENDIF
CDEFS = /DEFINE=($(MOTIF),XMOSAIC,MULTINET)
.ELSE ! Not MultiNet
!UCX
.IFDEF DECC
CQUALC=/DECC/Standard=VAXC/Precision=SINGLE
.ELSE
.IFDEF DECCVAXC
CQUALC=/VAXC/Precision=SINGLE
.ELSE
CQUALC=/Precision=SINGLE
.ENDIF
.ENDIF
CDEFS = /DEFINE=($(MOTIF),XMOSAIC)
.ENDIF
.ENDIF
.ENDIF ! BGT
.IFDEF DEBUG
CFLAGS = $(CQUALC)$(CDEFS)/NoOpt/Debug
.ELSE
CFLAGS = $(CQUALC)$(CDEFS)
.ENDIF
.FIRST
@ If F$Search("$(LIBTARGET)") .EQS. "" Then Library/Create $(LIBTARGET)
@ Define/NoLog Odir $(WDIR)
.IFDEF PATHWAY
@ @[-.twg]def
.ELSE
@ Define/NoLog Sys SYS$Library
.IFDEF DECC
.IFDEF ALPHA
@ If F$TRNLNM("ALPHA$LIBRARY") .NES. "" Then Define/NoLog Sys Alpha$Library
.ELSE
@ If F$TRNLNM("DECC$LIBRARY_INCLUDE") .NES. "" Then Define/NoLog Sys DECC$Library_Include
.ENDIF
.ENDIF
.ENDIF
OBJECTS = Odir:HTML.obj Odir:HTMLlists.obj Odir:HTMLformat.obj \
Odir:HTMLparse.obj Odir:HTMLimages.obj Odir:HTMLwidgets.obj \
Odir:HTML-PSformat.obj Odir:HTMLjot.obj Odir:HTMLtable.obj Odir:list.obj
$(LIBTARGET) : $(LIBTARGET)($(OBJECTS))
@ Write SYS$Output "Library libhtmlw.olb built."
Odir:HTML.obj : HTML.c
Odir:HTMLlists.obj : HTMLlists.c
Odir:HTMLformat.obj : HTMLformat.c
Odir:HTMLparse.obj : HTMLparse.c
Odir:HTMLimages.obj : HTMLimages.c
Odir:HTMLwidgets.obj : HTMLwidgets.c
Odir:HTML-PSformat.obj : HTML-PSformat.c
Odir:HTMLjot.obj : HTMLjot.c
Odir:HTMLtable.obj : HTMLtable.c
Odir:list.obj : list.c
.c.obj :
$(CC)$(CFLAGS)/OBJECT=$@ $<
.obj.olb
$(LIBR) $(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE)
clean :
Delete/Log $(WDIR)*.OBJ;*
Delete/Log $(LIBTARGET);*

1844
libhtmlw/inkstore.h Normal file

File diff suppressed because it is too large Load Diff

331
libhtmlw/list.c Normal file
View File

@@ -0,0 +1,331 @@
/*
* Copyright (C) 1992, Board of Trustees of the University of Illinois.
*
* Permission is granted to copy and distribute source with out fee.
* Commercialization of this product requires prior licensing
* from the National Center for Supercomputing Applications of the
* University of Illinois. Commercialization includes the integration of this
* code in part or whole into a product for resale. Free distribution of
* unmodified source and use of NCSA software is not considered
* commercialization.
*
*/
/*
* list.c: This module contains list manipulation routines that cunstruct
* and maintain a linked list of data items. The record at the head of each
* list contains pointers to the head, tail, and current list position.
* the list itsself is doubly linked with both next and previous pointers.
*
* ddt
*/
#include <stdio.h>
#include "listP.h"
#include "../config.h"
#ifndef MALLOC
#define MALLOC malloc
#define FREE free
#endif
#define NIL 0
#ifndef DISABLE_TRACE
extern int htmlwTrace;
#endif
static void ListPrintErr(s)
char *s;
{
#ifndef DISABLE_TRACE
if (htmlwTrace) {
fprintf(stderr,"%s",s);
}
#endif
}
/*
* This function returns the data located at the head of the linked list,
* or NIL if the list is empty. As a side effect current is also set to
* the head of the list.
*/
char *ListHead(theList)
List theList;
{
if (!theList)
return(NIL);
theList->current = theList->head;
if (theList->head)
return(theList->head->value);
else
return(NIL);
}
/*
* This function returns the data located at the tail of the linked list,
* or NIL if the list is empty. As a side effect current is also set to
* the tail of the list.
*/
char *ListTail(theList)
List theList;
{
if (!theList)
return(NIL);
theList->current = theList->tail;
if (theList->tail)
return(theList->tail->value);
else
return(NIL);
}
/*
* This function returns the data located at the current position in the
* linked list, or NIL if the list is empty.
*/
char *ListCurrent(theList)
List theList;
{
if (!theList)
return(NIL);
if (theList->current)
return(theList->current->value);
else
return(NIL);
}
/*
* This function returns the data located at the next element of the linked
* list after the current position, or NIL if the list is empty, or you
* are at its end.
* As a side effect current is also set to the next entry in the list.
*/
char *ListNext(theList)
List theList;
{
if (!theList)
return(NIL);
if (theList->current) {
theList->current = theList->current->next;
return(ListCurrent(theList));
}
else
return(NIL);
}
/*
* This function returns the data located at the previous element of the linked
* list before the current position, or NIL if the list is empty.
* As a side effect current is also set to the previous entry in the list.
*/
char *ListPrev(theList)
List theList;
{
if (!theList)
return(NIL);
if (theList->current) {
theList->current = theList->current->prev;
return(ListCurrent(theList));
}
else
return(NIL);
}
/*
* Create a list head and initialize it to NIL.
*/
List ListCreate()
{
List retVal;
if (!(retVal = (List) MALLOC(sizeof(struct LISTSTRUCT)))) {
ListPrintErr("Out of Memory\n");
return((List) 0);
}
retVal->head = NIL;
retVal->tail = NIL;
retVal->current = NIL;
retVal->listCount = 0;
return(retVal);
}
/*
* Destroy a list head, and free all associated memory.
*/
void ListDestroy(theList)
List theList;
{
struct LISTINSTANCE *l;
struct LISTINSTANCE *m;
if (!theList)
return;
l = theList->head;
while(l) {
m = l;
l = l->next;
FREE(m);
}
FREE(theList);
}
/*
* Add an entry to the end of the linked list. Current is changed to point to
* the added element.
*/
int ListAddEntry(theList,v)
/* return 0 on failure */
List theList;
char *v; /* data to be added */
{
struct LISTINSTANCE *l;
if (!(l =(struct LISTINSTANCE *) MALLOC(sizeof(struct LISTINSTANCE)))){
ListPrintErr("Out of Memory\n");
return(0);
}
l->value = v;
l->next = NIL;
l->prev = NIL;
if (theList->head == NIL)
theList->tail = theList->head = l;
else {
theList->tail->next = l;
l->prev = theList->tail;
theList->tail = l;
}
theList->current = l;
theList->listCount++;
return(1);
}
/*
* Search the list for an entry with a matching value field, and return
* a pointer to that list element. Current is changed to point to the
* element returned.
*/
static struct LISTINSTANCE *SearchListByValue(theList,v)
List theList;
char *v;
{
struct LISTINSTANCE *l;
l = theList->head;
while (l != NIL) {
if (l->value == v) {
theList->current = l;
return(l);
}
else {
l = l->next;
}
}
theList->current = l;
return(NIL);
}
/*
* Find the list entry with a matching value field, and delete it
* from the list. Set current to point to the element after the deleted
* element in the list.
*/
int ListDeleteEntry(theList,v)
/* removes the first occurance of v from the list */
/* return 0 if value not in list else 1 */
List theList;
char *v;
{
struct LISTINSTANCE *l;
char *retV;
if (!(l = SearchListByValue(theList,v)))
return(0);
if (l->prev)
l->prev->next = l->next;
else
theList->head = l->next;
if (l->next)
l->next->prev = l->prev;
else
theList->tail = l->prev;
theList->current = l->next;
retV = l->value;
FREE(l);
theList->listCount--;
return(1);
}
int ListMakeEntryCurrent(theList,entry)
/* return 0 on failure */
List theList;
char *entry;
{
struct LISTINSTANCE *l;
if (theList) {
if (!(l = SearchListByValue(theList,entry)))
return(0);
theList->current = l;
return(1);
}
return(0);
}
int ListCount(theList)
/* return the number of elements in the list */
/* current position pointer is not affected */
List theList;
{
/*
char *entry;
int count;
struct LISTINSTANCE *saveCurrent;
*/
if (theList) {
return(theList->listCount);
}
else {
return(0);
}
}
/* return indexed entry. Index starts at 0 */
/* the current list pointer will be set to this entry */
/* return 0 on failure */
char *ListGetIndexedEntry(theList,number)
List theList;
int number;
{
char *entry;
register int x;
if (!theList) {
return(0);
}
entry = ListHead(theList);
for (x = 0; x < number; x++) {
if (!entry) {
return(0);
}
entry = ListNext(theList);
}
return(entry);
}

29
libhtmlw/list.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 1992, Board of Trustees of the University of Illinois.
*
* Permission is granted to copy and distribute source with out fee.
* Commercialization of this product requires prior licensing
* from the National Center for Supercomputing Applications of the
* University of Illinois. Commercialization includes the integration of this
* code in part or whole into a product for resale. Free distribution of
* unmodified source and use of NCSA software is not considered
* commercialization.
*
*/
typedef struct LISTSTRUCT *List;
extern List ListCreate();
extern void ListDestroy();
extern int ListAddEntry();
extern int ListDeleteEntry();
extern int ListMakeEntryCurrent();
extern int ListCount();
extern char *ListHead();
extern char *ListTail();
extern char *ListCurrent();
extern char *ListNext();
extern char *ListPrev();
extern char *ListGetIndexedEntry();

34
libhtmlw/listP.h Normal file
View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 1992, Board of Trustees of the University of Illinois.
*
* Permission is granted to copy and distribute source with out fee.
* Commercialization of this product requires prior licensing
* from the National Center for Supercomputing Applications of the
* University of Illinois. Commercialization includes the integration of this
* code in part or whole into a product for resale. Free distribution of
* unmodified source and use of NCSA software is not considered
* commercialization.
*
*/
#ifndef ___HAS_LIST_STUFF_BEEN_INCLUDED_BEFORE___
#define ___HAS_LIST_STUFF_BEEN_INCLUDED_BEFORE___
#include <stdlib.h>
#include "list.h"
struct LISTINSTANCE {
char *value;
struct LISTINSTANCE *next;
struct LISTINSTANCE *prev;
};
struct LISTSTRUCT {
struct LISTINSTANCE *head;
struct LISTINSTANCE *tail;
struct LISTINSTANCE *current;
int listCount;
};
#endif