init
This commit is contained in:
commit
29c82be0c2
68
COPYRIGHT
Normal file
68
COPYRIGHT
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
Everything not already copyrighted by CERN is copyrighted by NCSA
|
||||||
|
(including the contents of the libhtmlw, libnet, libXmx, and src
|
||||||
|
directories, but not including the contents of libdtm, which is
|
||||||
|
entirely public domain).
|
||||||
|
|
||||||
|
The official NCSA Mosaic copyright statement follows.
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* 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. *
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
For more information on copyright and licensing issues, contact:
|
||||||
|
|
||||||
|
Jae Allen
|
||||||
|
Software Development Group
|
||||||
|
National Center for Supercomputing Applications
|
||||||
|
605 E. Springfield, Champaign IL 61820
|
||||||
|
jallen@ncsa.uiuc.edu
|
6
ChangeLog
Normal file
6
ChangeLog
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Mosaic 2.7b6
|
||||||
|
|
||||||
|
* ported to modern Linux
|
||||||
|
* added info tag to gopher
|
||||||
|
* fixed text/html; iso xxxxx bug
|
||||||
|
* moved all startup files into .mosaic directory
|
94
FEATURES
Normal file
94
FEATURES
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
NCSA Mosaic Features List
|
||||||
|
*************************
|
||||||
|
|
||||||
|
This list is up to date for version 2.5 of NCSA Mosaic.
|
||||||
|
|
||||||
|
o Support for accessing documents, images, audio, video, animations, and data
|
||||||
|
through World Wide Web, Gopher, WAIS, FTP, NNTP/Usenet news, telnet,
|
||||||
|
tn3270, and local files; and via gateways, Techinfo, TeXinfo, Archie, CSO
|
||||||
|
qi/ph, relational databases, and other sources.
|
||||||
|
o Friendly X/Motif user interface.
|
||||||
|
o Color and monochrome default X resource settings.
|
||||||
|
o Multiple independent document viewing windows.
|
||||||
|
o Completely interruptible network input/output, with full status indication
|
||||||
|
during network operations.
|
||||||
|
o Support for interactive fill-out forms inside documents, to enable powerful
|
||||||
|
database and search engine front-ends. Fill-out forms can contain text entry
|
||||||
|
areas (single- or multi-line), option buttons, radio buttons, option menus,
|
||||||
|
scrolled lists, and image maps. Fill-out form elements are instantiated as
|
||||||
|
Motif widgets.
|
||||||
|
o Support for standard World Wide Web authentication scheme, providing
|
||||||
|
security about equivalent to telnet's username/password scheme.
|
||||||
|
o Customizable encryption hooks to allow external PEM or PGP encryption to
|
||||||
|
be used to request and receive encrypted documents.
|
||||||
|
o Support for encrypted submission of forms.
|
||||||
|
o Support for first time encryption of all http communication.
|
||||||
|
o Extensive HTTP/1.0 support, including the ability to allow a remote
|
||||||
|
server to
|
||||||
|
return URL redirections rather than documents for transparent forwarding of
|
||||||
|
information pointers.
|
||||||
|
o Ability to pass any or all URL access methods to a proxy gateway to simulate
|
||||||
|
direct network connection for those behind firewalls.
|
||||||
|
o Direct access to WAIS databases, including support for binary files and
|
||||||
|
multiformat responses.
|
||||||
|
o Built-in support for recognizing and handling GIF, JPEG, TIFF, audio, AIFF,
|
||||||
|
DVI, MPEG, MIME, XWD, RGB, HDF, PostScript files and forking off
|
||||||
|
appropriate viewers.
|
||||||
|
o Full customizability of recognized formats, external viewers, and file
|
||||||
|
extensions.
|
||||||
|
o Ability to fire off arbitrary client-side shell scripts in response to
|
||||||
|
hyperlink
|
||||||
|
activations via format/viewer customization options.
|
||||||
|
o Ability to natively view data inside HDF and netCDF scientific data files,
|
||||||
|
with powerful hypermedia interface to explore internal structure of data
|
||||||
|
files.
|
||||||
|
o Inlined images in formatted (HTML) text: X bitmaps and GIF images can be
|
||||||
|
included anywhere inside a document, and can act as hyperlink anchors. Image
|
||||||
|
files themselves can be located anywhere on the network. Images can act as
|
||||||
|
maps, so clicking on them sends coordinates of click to remote server.
|
||||||
|
o Automatic dithering of inlined images on monochrome displays.
|
||||||
|
o Support of GIF89 transparent background in inlined images.
|
||||||
|
o Flexible inlined-image caching with customizable image cache size.
|
||||||
|
o Delayed image loading mode, to avoid automatic loading of all images in
|
||||||
|
accessed documents for users with slow network connections.
|
||||||
|
o Visited document history list per window.
|
||||||
|
o Global history with previously visited locations visually distinct; global
|
||||||
|
history is persistent across sessions.
|
||||||
|
o Hotlist/bookmark capability -- keep list of interesting documents,
|
||||||
|
add/remove/rename items, list is persistent across sessions. Now stored
|
||||||
|
in nested HTML.
|
||||||
|
o Personal annotations with GUI annotation entry dialog; annotations can later
|
||||||
|
be edited or deleted, and hyperlinks to existing annotations are inlined
|
||||||
|
into subsequent accesses of an annotated document. (Any document from any
|
||||||
|
server via any access method can be annotated.)
|
||||||
|
o Audio (voice) annotations with GUI for controlling recording process (SGI,
|
||||||
|
SGI, and HP only).
|
||||||
|
o Transparent and automatic uncompression of compressed (.Z) and gzip'd (.z or
|
||||||
|
.gz) files (over FTP, HTTP0, HTTP/1.0, local files, and Gopher).
|
||||||
|
o "Load to local disk" mode, for pulling down arbitrary binary files and
|
||||||
|
saving them to local disk without viewing them.
|
||||||
|
o In-document search capability.
|
||||||
|
o Fully 8-bit clean for formatted and plain text.
|
||||||
|
o On-the-fly font and hyperlink style selection.
|
||||||
|
o Hardcoded menu entries for popular network starting points, including the
|
||||||
|
NCSA Internet Resources Meta-Index.
|
||||||
|
o Keyword search capability (for WAIS, Gopher, Archie, etc.).
|
||||||
|
o Cut and paste formatted text into other X windows.
|
||||||
|
o Ability to display arbitrarily long documents.
|
||||||
|
o Save/mail/print documents in several formats, including formatted ASCII
|
||||||
|
text and PostScript.
|
||||||
|
o Online hypertext help and FAQ list.
|
||||||
|
o No config or resource file installation required; self-contained
|
||||||
|
executable.
|
||||||
|
o Extremely customizable via compile-time definitions, X resources, and
|
||||||
|
standard configuration file formats (including mailcap files for
|
||||||
|
format/viewer customization).
|
||||||
|
o Can be controlled by signals to allow use as a full-featured help or
|
||||||
|
information presentation subsystems by existing applications.
|
||||||
|
o Integrated with NCSA Collage and NCSA DTM to broadcast documents into
|
||||||
|
real-time networked workgroup collaboration sessions.
|
||||||
|
o It's PURIFY'D!!!
|
||||||
|
o Common Client Interface (CCI) support to allow external applications
|
||||||
|
to communicate with Mosaic via TCP/IP.
|
||||||
|
o Kiosk mode
|
||||||
|
o Editor Hook
|
400
INSTALL
Normal file
400
INSTALL
Normal file
@ -0,0 +1,400 @@
|
|||||||
|
=================================
|
||||||
|
Installation Notes: NCSA X Mosaic
|
||||||
|
=================================
|
||||||
|
|
||||||
|
=================
|
||||||
|
Table of Contents
|
||||||
|
=================
|
||||||
|
Section One: Introduction
|
||||||
|
How our Makefile works and what we would like from you...
|
||||||
|
Section Two: Step-by-Step
|
||||||
|
Four easy steps to X Mosaic.
|
||||||
|
Section Three: The Makefile.OS
|
||||||
|
How the Makefiles are set up and what means what.
|
||||||
|
Section Four: Disclaimer
|
||||||
|
If captured, we will disavow all knowledge...
|
||||||
|
|
||||||
|
=========================
|
||||||
|
Section One: Introduction
|
||||||
|
=========================
|
||||||
|
|
||||||
|
First you will need to edit the Makefile for your OS. The toplevel makefile
|
||||||
|
simply calls one of the specific makefiles located in the directory
|
||||||
|
"makefiles". Its purpose is to enable a quick way of using the correct
|
||||||
|
makefile for people who recompile Mosaic again and again. It also facillitates
|
||||||
|
adding a new platform. There are two ways to use the toplevel makefile: First
|
||||||
|
you can manually specify "make <OS>" where <OS> is one of the items listed
|
||||||
|
when you type "make help" or "make list" or you set the environment variable
|
||||||
|
"DEV_ARCH" (developer architecture) to one of the same items. Of course, this
|
||||||
|
assumes you have made the necessary adjustments to the makefile of your
|
||||||
|
choice. In the near future we intend to implement autoconf (GNU) which should
|
||||||
|
solve _everyone's_ problems.
|
||||||
|
|
||||||
|
=========================
|
||||||
|
Section Two: Step-by-Step
|
||||||
|
=========================
|
||||||
|
|
||||||
|
1) Edit "makefiles/Makefile.OS" (issue "make list" from toplevel to see
|
||||||
|
a list of supported OSs). See Section Three for more information.
|
||||||
|
2) Compile any external libraries you need (from what you selected in your
|
||||||
|
Makefile.OS.
|
||||||
|
3) Install Mosaic in your favorite thrid party directory.
|
||||||
|
4) Start up Mosaic and READ THE RELEASE NOTES! There have, no doubt, been
|
||||||
|
tremendous strides forward!
|
||||||
|
|
||||||
|
==============================
|
||||||
|
Section Three: The Makefile.OS
|
||||||
|
==============================
|
||||||
|
|
||||||
|
What I am going to do is simply include Makefile.solaris-24 and explain each
|
||||||
|
part. To save space, only the configurable section is included. My comments
|
||||||
|
are noted by:
|
||||||
|
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
Comment
|
||||||
|
:::
|
||||||
|
|
||||||
|
----------------------------Makefile.solaris-24------------------------------
|
||||||
|
# Toplevel Makefile for NCSA Mosaic.
|
||||||
|
|
||||||
|
# You shouldn't need to touch any of the Makefiles in the various
|
||||||
|
# source subdirectories if you configure this Makefile correctly.
|
||||||
|
|
||||||
|
# If you need to make serious changes to get Mosaic to compile on your
|
||||||
|
# platform, send context diffs to mosaic-x@ncsa.uiuc.edu.
|
||||||
|
|
||||||
|
# -------------------------- CUSTOMIZABLE OPTIONS ----------------------------
|
||||||
|
|
||||||
|
prereleaseflags = -DPRERELEASE
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
The prereleaseflags variable should not be modified as it allows us to set the
|
||||||
|
correct version as well as dictating whether or not the comment card is
|
||||||
|
active.
|
||||||
|
:::
|
||||||
|
|
||||||
|
RANLIB = /bin/true
|
||||||
|
#### On non-SGI's, this should be ranlib.
|
||||||
|
# RANLIB = ranlib
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
The RANLIB variable should be set according to whether or not your system
|
||||||
|
needs to have libraries ranlibed.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#CC = cc
|
||||||
|
#### On Sun's, this should be gcc (ANSI required).
|
||||||
|
CC = gcc
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
Set your compiler here. If you use something other than one of the two
|
||||||
|
listed, make it so, otherwise comment one or the other out.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### Linker Flags -- Primarily for linking static on linux-elf.
|
||||||
|
#ldflags = -static
|
||||||
|
ldflags =
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is where you stick anything extra for linking. This will only affect the
|
||||||
|
final link of Mosaic (not building libraries).
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### For a few files in the source, some compilers may need to be kicked
|
||||||
|
#### in K&R mode. E.g., on SGI's, -cckr does this.
|
||||||
|
# knrflag = -cckr
|
||||||
|
#### On most systems, no flag is needed.
|
||||||
|
knrflag =
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This does exactly what the comment above says. It is used on every compile.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### Random system configuration flags.
|
||||||
|
#### --> *** For Motif 1.2 ON ANY PLATFORM, do -DMOTIF1_2 *** <--
|
||||||
|
#### For IBM AIX 3.2, do -D_BSD
|
||||||
|
#### For NeXT, do -DNEXT
|
||||||
|
#### For HP/UX, do -Aa -D_HPUX_SOURCE
|
||||||
|
#### For Dell SVR4, do -DSVR4
|
||||||
|
#### For Solaris, do -DSVR4 -DSOLARIS
|
||||||
|
#### For Esix 4.0.4 and Solaris x86 2.1, do -DSVR4
|
||||||
|
#### For Convex whatever, do -DCONVEX
|
||||||
|
#### For SCO ODT 3.0, do -DSCO -DSVR4 -DMOTIF1_2
|
||||||
|
#### For Motorola SVR4, do -DSVR4 -DMOTOROLA -DMOTIF1_2
|
||||||
|
sysconfigflags = -DSOLARIS -DSVR4 -DMOTIF1_2 -DSOLARIS24
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is used to pass in weird system flags...basically, if they aren't defined
|
||||||
|
or defined correctly for your system to not barf on the source code, add it
|
||||||
|
here. This is given to every compile line.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### System libraries.
|
||||||
|
# syslibs = -lPW -lsun -lmalloc
|
||||||
|
#### For AIX 3.2
|
||||||
|
# syslibs = -lPW -lbsd
|
||||||
|
#### For most other Motif platforms:
|
||||||
|
# syslibs = -lPW
|
||||||
|
#### For Sun's and Ultrix and HP and BSD/386:
|
||||||
|
# syslibs =
|
||||||
|
#### For Sun's with no DNS:
|
||||||
|
# syslibs = -lresolv
|
||||||
|
#### For SCO ODT:
|
||||||
|
# syslibs = -lPW -lsocket -lmalloc
|
||||||
|
#### For Dell SVR4:
|
||||||
|
# syslibs = -lnsl -lsocket -lc -lucb
|
||||||
|
#### For Solaris (2.x) --nsl does not link correctly staticly.
|
||||||
|
syslibs = -lnsl /usr/lib/libsocket.a /usr/ccs/lib/libgen.a
|
||||||
|
#### For Motorola SVR4:
|
||||||
|
# syslibs = -lnsl -lsocket -lgen
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
These are any additional libraries needed (system libs only).
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### X include file locations -- if your platform puts the X include
|
||||||
|
#### files in a strange place, set this variable appropriately. Else
|
||||||
|
#### don't worry about it.
|
||||||
|
#### HP X11R4 version:
|
||||||
|
# xinc = -I/usr/include/Motif1.1 -I/usr/include/X11R4
|
||||||
|
#### HP X11R5 version:
|
||||||
|
# xinc = -I/usr/include/Motif1.2 -I/usr/local/X11R5/include
|
||||||
|
#### NeXT version:
|
||||||
|
# xinc = -I/usr/include/X11
|
||||||
|
#### BSD/386
|
||||||
|
# xinc = -I/usr/X11/include
|
||||||
|
#### Solaris 2.x (Patched X11R5 and Motif libs)
|
||||||
|
xinc = -I/usr/openwin/include -I/usr/dt/include
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is where you specify where you have installed your X libraries. Some
|
||||||
|
systems have everything off of /usr/lib, some are not so lucky. If you
|
||||||
|
are compiling and you get an error of "can't find include file XXX.h" it is
|
||||||
|
more than likely a problem here (or if you don't have a particular lib
|
||||||
|
installed.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### X library locations.
|
||||||
|
# xlibs = -lXm_s -lXmu -lXt_s -lX11_s
|
||||||
|
#### For Sun's (at least running stock X/Motif as installed on our machines):
|
||||||
|
# xlibs = /usr/lib/libXm.a /usr/lib/libXmu.a /usr/lib/libXt.a /usr/lib/libXext.a /usr/lib/libX11.a -lm
|
||||||
|
#### For HP-UX 8.00:
|
||||||
|
# xlibs = -L/usr/lib/Motif1.1 -lXm -L/usr/lib/X11R4 -lXmu -lXt -lX11
|
||||||
|
#### For HP-UX 9.01: The X11R5 libraries are here on our systems
|
||||||
|
# xlibs = -L/usr/lib/Motif1.2 -lXm -L/usr/lib/X11R5 -L/usr/lib/X11R4 -lXmu -lXt -lX11
|
||||||
|
#### For NeXT:
|
||||||
|
# xlibs = -L/usr/lib/X11 -lXm -lXmu -lXt -lX11
|
||||||
|
#### For Dell SVR4:
|
||||||
|
# xlibs = -L/usr/X5/lib -lXm -lXmu -lXt -lXext -lX11
|
||||||
|
#### For Solaris (2.x) (Use static to go from machine to machine)
|
||||||
|
xlibs = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/dt/lib -lXm
|
||||||
|
xlibs += /usr/openwin/lib/libXmu.a /usr/openwin/lib/libXt.a
|
||||||
|
xlibs += /usr/openwin/lib/libXext.a -lX11
|
||||||
|
xlibs += /usr/lib/libm.a
|
||||||
|
#### For SCO ODT 3.0 (I'm told that -lXtXm_s is *not* a typo :-):
|
||||||
|
# xlibs = -lXtXm_s -lXmu -lX11_s
|
||||||
|
#### For nearly everyone else:
|
||||||
|
# xlibs = -lXm -lXmu -lXt -lX11
|
||||||
|
#### For BSD/386:
|
||||||
|
# xlibs = -L/usr/X11/lib -lXm -lXmu -lXt -lX11
|
||||||
|
#### For Motorola SVR4:
|
||||||
|
# xlibs = -lXm -lXmu -lXt -lXext -lX11 -lm
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is where you specify exactly what X libraries to link in and in what
|
||||||
|
order (Yes, it matters. List the libraries in dependent order.).
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### DTM AND HDF SUPPORT; READ CAREFULLY
|
||||||
|
|
||||||
|
#### If you want to compile with DTM and HDF support, you should leave
|
||||||
|
#### the following lines uncommented and make sure you have a copy of
|
||||||
|
#### HDF 3.3 (r1 or later) installed and ready. You can find HDF on
|
||||||
|
#### ftp.ncsa.uiuc.edu in /HDF.
|
||||||
|
|
||||||
|
#### If you do not want to compile with DTM and HDF support, comment
|
||||||
|
#### the following lines out. (If you are compiling from source for
|
||||||
|
#### the first time, you should probably not bother with HDF and DTM
|
||||||
|
#### support.)
|
||||||
|
|
||||||
|
#### dtmmachtype needs to be set to one of the following:
|
||||||
|
#### sun, sgi, dec, ibm, next, cray, convex
|
||||||
|
#### If your platform is not one of the above, then either do not compile
|
||||||
|
#### with HDF/DTM support or try hacking libdtm/makefile.
|
||||||
|
|
||||||
|
dtmmachtype = solaris
|
||||||
|
dtmdirs = libdtm libnet
|
||||||
|
dtmlibs = ../libnet/libnet.a ../libdtm/libdtm.a
|
||||||
|
dtmflags = -DHAVE_DTM -I.. -I../libnet
|
||||||
|
hdfdir = /hdf2/install/solaris
|
||||||
|
hdflibs = $(hdfdir)/lib/libmfhdf.a $(hdfdir)/lib/libdf.a
|
||||||
|
hdfflags = -DHAVE_HDF -DHDF -I$(hdfdir)/include
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is one of those external libraries you will need to obtain if you want
|
||||||
|
HDF support (there is no real purpose for building the dtm libs unless you
|
||||||
|
use HDF. If you are not going to use it, comment it out.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### PNG SUPPORT
|
||||||
|
#### For inline PNG support, the following should be defined:
|
||||||
|
#### The libraries currently used are PNGLIB 0.81 and ZLIB 0.95
|
||||||
|
|
||||||
|
pngdir = /xdev/mosaic/libpng/solaris-24
|
||||||
|
pnglibdir = $(pngdir)/lib
|
||||||
|
pngincludedir = $(pngdir)/include
|
||||||
|
pnglibs = $(pnglibdir)/libpng.a $(pnglibdir)/libz.a -lm
|
||||||
|
pngflags = -I$(pngincludedir) -DHAVE_PNG
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is one of those external libraries you will need to obtain if you want
|
||||||
|
PNG support. Comment it out if you aren't going to use it.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### JPEG SUPPORT
|
||||||
|
#### For inline JPEG support, the following should be defined:
|
||||||
|
#### The library used is Independent JPEG Group (IJG's) 5.0a.
|
||||||
|
|
||||||
|
jpegdir = /xdev/mosaic/libjpeg/solaris-24
|
||||||
|
jpeglibs = $(jpegdir)/lib/libjpeg.a
|
||||||
|
jpegflags = -I$(jpegdir)/include -DHAVE_JPEG
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is one of those external libraries you will need to obtain if you want
|
||||||
|
JPEG support. Comment it out if you aren't going to use it.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### KERBEROS SUPPORT
|
||||||
|
####
|
||||||
|
#### If you want Mosaic to support Kerberos authentication, set the
|
||||||
|
#### following flags appropriately. You can support Kerberos V4 and/or V5,
|
||||||
|
#### although it's most likely that your realm supports one or the other.
|
||||||
|
#### To enable DES-encryption of HTTP messages via Kerberos key exchange,
|
||||||
|
#### define the KRB-ENCRYPT flag.
|
||||||
|
|
||||||
|
##krb4dir = /usr/athena
|
||||||
|
#krb4dir = /xdev/mosaic/libkrb4/solaris-24
|
||||||
|
#krb4libs = $(krb4dir)/lib/libkrb.a $(krb4dir)/lib/libdes.a
|
||||||
|
#krb4flags = -DKRB4 -I$(krb4dir)/include
|
||||||
|
|
||||||
|
##krb5dir = /krb5
|
||||||
|
#krb5dir = /xdev/mosaic/libkrb5/solaris-24
|
||||||
|
#krb5libs = $(krb5dir)/lib/libkrb5.a $(krb5dir)/lib/libcrypto.a $(krb5dir)/util/et/libcom_err.a
|
||||||
|
#krb5flags = -DKRB5 -I$(krb5dir)/include -I$(krb5dir)/include/krb5
|
||||||
|
|
||||||
|
#Do not comment out.
|
||||||
|
krbflags = $(krb4flags) $(krb5flags)
|
||||||
|
krblibs = $(krb4libs) $(krb5libs)
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is one of those external libraries you will need to obtain if you want
|
||||||
|
KERBEROS 4 or 5 (you can have both) support. If you do not want to use it,
|
||||||
|
comment out the first two groups, but not the group that expressly tells you
|
||||||
|
to leave it alone.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### DIRECT WAIS SUPPORT
|
||||||
|
|
||||||
|
#### If you want to have Mosaic be able to communicate directly with
|
||||||
|
#### WAIS servers, do set the following flags appropriately. We
|
||||||
|
#### recommend linking with CNIDR's freeWAIS 0.5 distribution; other
|
||||||
|
#### WAIS distributions may work but we have not tested them with
|
||||||
|
#### Mosaic. freeWAIS 0.5 can currently (Sept.1995) be found at
|
||||||
|
#### ftp://sunsite.unc.edu/pub/wais/servers/freeWAIS
|
||||||
|
|
||||||
|
#### If you do not wish to link to the WAIS libraries, then comment
|
||||||
|
#### the following lines out. Mosaic will then communicate with WAIS
|
||||||
|
#### servers via a HTTP gateway.
|
||||||
|
|
||||||
|
#### -lm is required for freeWAIS 0.5, as ceil() is used.
|
||||||
|
|
||||||
|
waisroot = /xdev/mosaic/freeWAIS/solaris24
|
||||||
|
waisflags = -DDIRECT_WAIS -I$(waisroot)/include
|
||||||
|
waislibdir = $(waisroot)/bin
|
||||||
|
waislibs = $(waislibdir)/inv.a $(waislibdir)/wais.a $(waislibdir)/libftw.a -lm
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is one of those external libraries you will need to obtain if you want
|
||||||
|
WAIS support. Comment it out if you don't want it.
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### Customization flags:
|
||||||
|
#### . If you want Mosaic to come up with monochrome colors by default,
|
||||||
|
#### use -DMONO_DEFAULT
|
||||||
|
#### . If you want to define the default Mosaic home page, set
|
||||||
|
#### -DHOME_PAGE_DEFAULT=\\\"url\\\"
|
||||||
|
#### . If you want to define the default Mosaic documentation directory
|
||||||
|
#### (should be a URL), set -DDOCS_DIRECTORY_DEFAULT=\\\"url\\\"
|
||||||
|
#### . Other things you can define are spelled out in src/mosaic.h.
|
||||||
|
customflags =
|
||||||
|
:::
|
||||||
|
SWP
|
||||||
|
---
|
||||||
|
This is the section which will set up various minor things in Mosaic.
|
||||||
|
:::
|
||||||
|
|
||||||
|
# ---------------------- END OF CUSTOMIZABLE OPTIONS -------------------------
|
||||||
|
---------------------------Makefile.solaris-24--------------------------------
|
||||||
|
|
||||||
|
And that should be all you need to know about our Makefiles. Again, if you
|
||||||
|
make modifications to it for support on your OS, please send in patches so
|
||||||
|
we can support your platform.
|
||||||
|
|
||||||
|
========================
|
||||||
|
Section Four: Disclaimer
|
||||||
|
========================
|
||||||
|
|
||||||
|
The Makefiles provided are done so with the following intentions:
|
||||||
|
|
||||||
|
o They are used to compile the Mosaic binaries that NCSA provides.
|
||||||
|
o They are meant to be used as _guidelines_ for others who wish
|
||||||
|
to compile Mosaic for themselves.
|
||||||
|
o They do _not_ compile all of the necessary libraries.
|
||||||
|
o They _will_ require editing to work for your system. Each config-
|
||||||
|
urable section explains what it is and what it expects.
|
||||||
|
o They are _not_ guarunteed to work.
|
||||||
|
|
||||||
|
Note that the file "Makefile" is now simply a mechanism for calling the
|
||||||
|
correct Makefile. This is due in large part to the finger
|
||||||
|
of Tom Lane who very pointedly pointed out that if it does not compile Mosaic
|
||||||
|
for all of the platforms, it shouldn't be there! No, this is not intended as
|
||||||
|
a slight to Tom...we simply had not thought it through.
|
||||||
|
|
||||||
|
Another note...the 2.8 distribution tree will be drastically changing. Do not
|
||||||
|
expect patches for 2.7x to work for 2.8x. We will be moving the libraries
|
||||||
|
out of the distribution tree and into a "library" distribution along with
|
||||||
|
pointers to completely external libs (jpeg, png, zlib, etc). Since we have
|
||||||
|
these libs in binary form, we will probably distribute a "binary_libs" archive
|
||||||
|
of all the libs we build with for each platform (for those who can't get the
|
||||||
|
lib to build or simply don't care to take the time, but still want to play
|
||||||
|
with the source to Mosaic).
|
||||||
|
|
||||||
|
The last note is for future reference. As a side project we have been playing
|
||||||
|
with autoconf (ftp://prep.ai.mit.edu/pub/gnu). Please take into
|
||||||
|
account that these are side projects which would certainly make life easy,
|
||||||
|
but since these Makefiles suffice for us it is our intention to focus our
|
||||||
|
efforts on more important features. HOWEVER, if someone out there in the
|
||||||
|
great space wishes to perform this feat for us, we would gladly accept.
|
||||||
|
|
||||||
|
Scott Powers spowers@ncsa.uiuc.edu \ The N.C.S.A. X Mosaic
|
||||||
|
Paul Bleisch pbleisch@ncsa.uiuc.edu \ Development Team
|
||||||
|
Dan Pape dpape@ncsa.uiuc.edu >
|
||||||
|
Tommy Reilly tpreilly@ncsa.uiuc.edu / Comments? Suggestions? Problems?
|
||||||
|
Brian Swetland swetland@ncsa.uiuc.edu/ mosaic-x@ncsa.uiuc.edu
|
||||||
|
|
186
Makefile
Normal file
186
Makefile
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
##
|
||||||
|
## Toplevel Makefile for all Makefiles
|
||||||
|
##
|
||||||
|
|
||||||
|
##
|
||||||
|
## Scott Powers
|
||||||
|
##
|
||||||
|
|
||||||
|
all: dev_$(DEV_ARCH)
|
||||||
|
|
||||||
|
list: dev_
|
||||||
|
help: dev_
|
||||||
|
dev_::
|
||||||
|
@echo "You must specify one of the following or set the environment variable"
|
||||||
|
@echo "[DEV_ARCH] to one of the following:"
|
||||||
|
@echo " alpha -- DEC Alpha AXP running OSF/1"
|
||||||
|
@echo " bsdi -- x86 running BSDI BSD/OS 2.1"
|
||||||
|
@echo " dec -- DEC 2100 running Ultrix 4.3"
|
||||||
|
@echo " hp -- HP 9000/735 running HP-UX A.09.01"
|
||||||
|
@echo " ibm -- IBM RS6000 running AIX 4.4 BSD"
|
||||||
|
@echo " indy -- SGI Indy running IRIX 5.3"
|
||||||
|
@echo " linux -- x86 running Linux 1.2.13 DYNAMIC"
|
||||||
|
@echo " linux-static -- x86 running Linux 1.2.13 ALL STATIC"
|
||||||
|
@echo " linux-static-motif -- x86 running Linux 1.2.13 STATIC MOTIF"
|
||||||
|
@echo " sco -- x86 running SCO System V 3.2"
|
||||||
|
@echo " sgi -- SGI Iris running IRIS 4.0.2"
|
||||||
|
@echo " solaris-23 -- SPARCstation 20 running Solaris 2.3"
|
||||||
|
@echo " solaris-24 -- SPARCstation 20 running Solaris 2.4"
|
||||||
|
@echo " solaris-24-x86 -- x86 running Solaris 2.4 for x86"
|
||||||
|
@echo " sun -- SPARCserver 690MP running SunOS 4.1.3"
|
||||||
|
@echo " sun-lresolv -- SPARCserver 690MP running SunOS 4.1.3"
|
||||||
|
@echo " "
|
||||||
|
@echo "To make a Purify or Quantify version of Mosaic, put a 'p_' or"
|
||||||
|
@echo " 'q_' in front of the platform."
|
||||||
|
@echo "If your OS is not listed, you will need to copy one of the"
|
||||||
|
@echo " the Makefiles.OS in the 'makefiles' directory, edit it for"
|
||||||
|
@echo " your system, edit this Makefile to add your system, compile,"
|
||||||
|
@echo " and send in your changes to: mosaic-x@ncsa.uiuc.edu."
|
||||||
|
|
||||||
|
purifyd:
|
||||||
|
$(MAKE) p_$(DEV_ARCH)
|
||||||
|
|
||||||
|
quantifyd:
|
||||||
|
$(MAKE) q_$(DEV_ARCH)
|
||||||
|
|
||||||
|
rm_and_touch:
|
||||||
|
@rm -f config.h
|
||||||
|
@touch config.h
|
||||||
|
|
||||||
|
dev_alpha: rm_and_touch alpha
|
||||||
|
alpha: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.alpha DEV_ARCH=alpha
|
||||||
|
p_alpha: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.alpha purifyd DEV_ARCH=alpha
|
||||||
|
q_alpha: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.alpha quantifyd DEV_ARCH=alpha
|
||||||
|
|
||||||
|
dev_bsdi: rm_and_touch bsdi
|
||||||
|
bsdi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.bsdi DEV_ARCH=bsdi
|
||||||
|
p_bsdi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.bsdi purifyd DEV_ARCH=bsdi
|
||||||
|
q_bsdi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.bsdi quantifyd DEV_ARCH=bsdi
|
||||||
|
|
||||||
|
dev_dec: rm_and_touch dec
|
||||||
|
dec: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.dec DEV_ARCH=dec
|
||||||
|
p_dec: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.dec purifyd DEV_ARCH=dec
|
||||||
|
q_dec: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.dec quantifyd DEV_ARCH=dec
|
||||||
|
|
||||||
|
dev_hp: rm_and_touch hp
|
||||||
|
hp: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.hp DEV_ARCH=hp
|
||||||
|
p_hp: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.hp purifyd DEV_ARCH=hp
|
||||||
|
q_hp: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.hp quantifyd DEV_ARCH=hp
|
||||||
|
|
||||||
|
dev_ibm: rm_and_touch ibm
|
||||||
|
ibm: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.ibm DEV_ARCH=ibm
|
||||||
|
p_ibm: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.ibm purifyd DEV_ARCH=ibm
|
||||||
|
q_ibm: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.ibm quantifyd DEV_ARCH=ibm
|
||||||
|
|
||||||
|
dev_indy: rm_and_touch indy
|
||||||
|
indy: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.indy DEV_ARCH=indy
|
||||||
|
p_indy: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.indy purifyd DEV_ARCH=indy
|
||||||
|
q_indy: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.indy quantifyd DEV_ARCH=indy
|
||||||
|
|
||||||
|
dev_linux: rm_and_touch linux
|
||||||
|
linux: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux DEV_ARCH=linux
|
||||||
|
p_linux: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux purifyd DEV_ARCH=linux
|
||||||
|
q_linux: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux quantifyd DEV_ARCH=linux
|
||||||
|
|
||||||
|
dev_linux_static: rm_and_touch linux_static
|
||||||
|
linux_static: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux staticd DEV_ARCH=linux
|
||||||
|
p_linux_static: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux p_staticd DEV_ARCH=linux
|
||||||
|
q_linux_static: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux q_staticd DEV_ARCH=linux
|
||||||
|
|
||||||
|
dev_linux_static_motif: rm_and_touch linux_static_motif
|
||||||
|
linux_static_motif: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux static_motifd DEV_ARCH=linux
|
||||||
|
p_linux_static_motif: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux p_static_motifd DEV_ARCH=linux
|
||||||
|
q_linux_static_motif: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux q_static_motifd DEV_ARCH=linux
|
||||||
|
|
||||||
|
dev_sco: rm_and_touch sco
|
||||||
|
sco: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sco DEV_ARCH=sco
|
||||||
|
p_sco: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sco purifyd DEV_ARCH=sco
|
||||||
|
q_sco: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sco quantifyd DEV_ARCH=sco
|
||||||
|
|
||||||
|
dev_sgi: rm_and_touch sgi
|
||||||
|
sgi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sgi DEV_ARCH=sgi
|
||||||
|
p_sgi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sgi purifyd DEV_ARCH=sgi
|
||||||
|
q_sgi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sgi quantifyd DEV_ARCH=sgi
|
||||||
|
|
||||||
|
dev_solaris-23: rm_and_touch solaris-23
|
||||||
|
solaris-23: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-23 DEV_ARCH=solaris-23
|
||||||
|
p_solaris-23: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-23 purifyd DEV_ARCH=solaris-23
|
||||||
|
q_solaris-23: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-23 quantifyd DEV_ARCH=solaris-23
|
||||||
|
|
||||||
|
dev_solaris-24: rm_and_touch solaris-24
|
||||||
|
solaris-24: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24 DEV_ARCH=solaris-24
|
||||||
|
p_solaris-24: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24 purifyd DEV_ARCH=solaris-24
|
||||||
|
q_solaris-24: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24 quantifyd DEV_ARCH=solaris-24
|
||||||
|
|
||||||
|
dev_solaris-24-x86: rm_and_touch solaris-24-x86
|
||||||
|
solaris-24-x86: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24-x86 DEV_ARCH=solaris-24-x86
|
||||||
|
p_solaris-24-x86: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24-x86 purifyd DEV_ARCH=solaris-24-x86
|
||||||
|
q_solaris-24-x86: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24-x86 quantifyd DEV_ARCH=solaris-24-x86
|
||||||
|
|
||||||
|
dev_sun: rm_and_touch sun
|
||||||
|
sun: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun DEV_ARCH=sun
|
||||||
|
p_sun: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun purifyd DEV_ARCH=sun
|
||||||
|
q_sun: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun quantifyd DEV_ARCH=sun
|
||||||
|
|
||||||
|
dev_sun-lresolv: rm_and_touch sun-lresolv
|
||||||
|
sun-lresolv: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun-lresolv DEV_ARCH=sun-lresolv
|
||||||
|
p_sun-lresolv: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun-lresolv purifyd DEV_ARCH=sun-lresolv
|
||||||
|
q_sun-lresolv: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun-lresolv quantifyd DEV_ARCH=sun-lresolv
|
||||||
|
|
||||||
|
clean:
|
||||||
|
cd libXmx; $(MAKE) clean
|
||||||
|
cd libdtm; $(MAKE) clean
|
||||||
|
cd libhtmlw; $(MAKE) clean
|
||||||
|
cd libnet; $(MAKE) clean
|
||||||
|
cd libnut; $(MAKE) clean
|
||||||
|
cd libwww2; $(MAKE) clean
|
||||||
|
cd src; $(MAKE) clean MOSAIC="Mosaic"
|
||||||
|
@echo "Done cleaning..."
|
125
Makefile.in
Normal file
125
Makefile.in
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
#/****************************************************************************
|
||||||
|
# * 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. *
|
||||||
|
# ****************************************************************************/
|
||||||
|
# @configure_input@
|
||||||
|
|
||||||
|
# end of variables: The remaining are the basic targets
|
||||||
|
|
||||||
|
dtmdirs=@dtmdirs@
|
||||||
|
bindir=@bindir@
|
||||||
|
|
||||||
|
all: default
|
||||||
|
|
||||||
|
default: $(dtmdirs) libwww2 libXmx libhtmlw libnut src
|
||||||
|
@echo \*\*\* Welcome to NCSA Mosaic.
|
||||||
|
|
||||||
|
purifyd: $(dtmdirs) libwww2 libXmx libhtmlw libnut src-purifyd
|
||||||
|
@echo \*\*\* Welcome to Purify'd NCSA Mosaic.
|
||||||
|
|
||||||
|
quantifyd: $(dtmdirs) libwww2 libXmx libhtmlw libnut src-quantifyd
|
||||||
|
@echo \*\*\* Welcome to Quantify'd NCSA Mosaic.
|
||||||
|
|
||||||
|
libXmx::
|
||||||
|
@echo --- Building libXmx
|
||||||
|
cd libXmx; $(MAKE)
|
||||||
|
|
||||||
|
libhtmlw::
|
||||||
|
@echo --- Building libhtmlw
|
||||||
|
cd libhtmlw; $(MAKE)
|
||||||
|
libwww2::
|
||||||
|
@echo --- Building libwww2
|
||||||
|
cd libwww2; $(MAKE)
|
||||||
|
|
||||||
|
libnut::
|
||||||
|
@echo --- Building libnut
|
||||||
|
cd libnut; $(MAKE)
|
||||||
|
|
||||||
|
src::
|
||||||
|
@echo --- Building src
|
||||||
|
cd src; $(MAKE) MOSAIC=Mosaic
|
||||||
|
|
||||||
|
src-purifyd::
|
||||||
|
@echo --- Building Purify'd src
|
||||||
|
cd src; $(MAKE) PURIFY=purify MOSAIC=Mosaic-p
|
||||||
|
|
||||||
|
src-quantifyd::
|
||||||
|
@echo --- Building Quantify'd src
|
||||||
|
cd src; $(MAKE) PURIFY=quantify MOSAIC=Mosaic-q
|
||||||
|
|
||||||
|
libnet::
|
||||||
|
@echo --- Building libnet
|
||||||
|
cd libnet; $(MAKE)
|
||||||
|
|
||||||
|
libdtm::
|
||||||
|
@echo --- Building libdtm
|
||||||
|
cd libdtm; $(MAKE)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm config.cache config.h config.status *~ core config.log
|
||||||
|
cd libXmx; $(MAKE) $@
|
||||||
|
cd libhtmlw; $(MAKE) $@
|
||||||
|
cd libwww2; $(MAKE) $@
|
||||||
|
cd src; $(MAKE) MOSAIC=Mosaic $@
|
||||||
|
cd libnet; $(MAKE) $@
|
||||||
|
cd libdtm; $(MAKE) $@
|
||||||
|
cd libnut; $(MAKE) $@
|
||||||
|
|
||||||
|
wclean:
|
||||||
|
cd libhtmlw; $(MAKE) $@
|
||||||
|
cd src; $(MAKE) MOSAIC=Mosaic $@
|
||||||
|
|
||||||
|
install:
|
||||||
|
$(INSTALL) ./src/Mosaic $(bindir)/
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(UNINSTALL) $(bindir)/Mosaic
|
186
Makefile.orig
Normal file
186
Makefile.orig
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
##
|
||||||
|
## Toplevel Makefile for all Makefiles
|
||||||
|
##
|
||||||
|
|
||||||
|
##
|
||||||
|
## Scott Powers
|
||||||
|
##
|
||||||
|
|
||||||
|
all: dev_$(DEV_ARCH)
|
||||||
|
|
||||||
|
list: dev_
|
||||||
|
help: dev_
|
||||||
|
dev_::
|
||||||
|
@echo "You must specify one of the following or set the environment variable"
|
||||||
|
@echo "[DEV_ARCH] to one of the following:"
|
||||||
|
@echo " alpha -- DEC Alpha AXP running OSF/1"
|
||||||
|
@echo " bsdi -- x86 running BSDI BSD/OS 2.1"
|
||||||
|
@echo " dec -- DEC 2100 running Ultrix 4.3"
|
||||||
|
@echo " hp -- HP 9000/735 running HP-UX A.09.01"
|
||||||
|
@echo " ibm -- IBM RS6000 running AIX 4.4 BSD"
|
||||||
|
@echo " indy -- SGI Indy running IRIX 5.3"
|
||||||
|
@echo " linux -- x86 running Linux 1.2.13 DYNAMIC"
|
||||||
|
@echo " linux-static -- x86 running Linux 1.2.13 ALL STATIC"
|
||||||
|
@echo " linux-static-motif -- x86 running Linux 1.2.13 STATIC MOTIF"
|
||||||
|
@echo " sco -- x86 running SCO System V 3.2"
|
||||||
|
@echo " sgi -- SGI Iris running IRIS 4.0.2"
|
||||||
|
@echo " solaris-23 -- SPARCstation 20 running Solaris 2.3"
|
||||||
|
@echo " solaris-24 -- SPARCstation 20 running Solaris 2.4"
|
||||||
|
@echo " solaris-24-x86 -- x86 running Solaris 2.4 for x86"
|
||||||
|
@echo " sun -- SPARCserver 690MP running SunOS 4.1.3"
|
||||||
|
@echo " sun-lresolv -- SPARCserver 690MP running SunOS 4.1.3"
|
||||||
|
@echo " "
|
||||||
|
@echo "To make a Purify or Quantify version of Mosaic, put a 'p_' or"
|
||||||
|
@echo " 'q_' in front of the platform."
|
||||||
|
@echo "If your OS is not listed, you will need to copy one of the"
|
||||||
|
@echo " the Makefiles.OS in the 'makefiles' directory, edit it for"
|
||||||
|
@echo " your system, edit this Makefile to add your system, compile,"
|
||||||
|
@echo " and send in your changes to: mosaic-x@ncsa.uiuc.edu."
|
||||||
|
|
||||||
|
purifyd:
|
||||||
|
$(MAKE) p_$(DEV_ARCH)
|
||||||
|
|
||||||
|
quantifyd:
|
||||||
|
$(MAKE) q_$(DEV_ARCH)
|
||||||
|
|
||||||
|
rm_and_touch:
|
||||||
|
@rm -f config.h
|
||||||
|
@touch config.h
|
||||||
|
|
||||||
|
dev_alpha: rm_and_touch alpha
|
||||||
|
alpha: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.alpha DEV_ARCH=alpha
|
||||||
|
p_alpha: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.alpha purifyd DEV_ARCH=alpha
|
||||||
|
q_alpha: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.alpha quantifyd DEV_ARCH=alpha
|
||||||
|
|
||||||
|
dev_bsdi: rm_and_touch bsdi
|
||||||
|
bsdi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.bsdi DEV_ARCH=bsdi
|
||||||
|
p_bsdi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.bsdi purifyd DEV_ARCH=bsdi
|
||||||
|
q_bsdi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.bsdi quantifyd DEV_ARCH=bsdi
|
||||||
|
|
||||||
|
dev_dec: rm_and_touch dec
|
||||||
|
dec: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.dec DEV_ARCH=dec
|
||||||
|
p_dec: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.dec purifyd DEV_ARCH=dec
|
||||||
|
q_dec: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.dec quantifyd DEV_ARCH=dec
|
||||||
|
|
||||||
|
dev_hp: rm_and_touch hp
|
||||||
|
hp: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.hp DEV_ARCH=hp
|
||||||
|
p_hp: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.hp purifyd DEV_ARCH=hp
|
||||||
|
q_hp: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.hp quantifyd DEV_ARCH=hp
|
||||||
|
|
||||||
|
dev_ibm: rm_and_touch ibm
|
||||||
|
ibm: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.ibm DEV_ARCH=ibm
|
||||||
|
p_ibm: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.ibm purifyd DEV_ARCH=ibm
|
||||||
|
q_ibm: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.ibm quantifyd DEV_ARCH=ibm
|
||||||
|
|
||||||
|
dev_indy: rm_and_touch indy
|
||||||
|
indy: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.indy DEV_ARCH=indy
|
||||||
|
p_indy: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.indy purifyd DEV_ARCH=indy
|
||||||
|
q_indy: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.indy quantifyd DEV_ARCH=indy
|
||||||
|
|
||||||
|
dev_linux: rm_and_touch linux
|
||||||
|
linux: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux DEV_ARCH=linux
|
||||||
|
p_linux: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux purifyd DEV_ARCH=linux
|
||||||
|
q_linux: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux quantifyd DEV_ARCH=linux
|
||||||
|
|
||||||
|
dev_linux_static: rm_and_touch linux_static
|
||||||
|
linux_static: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux staticd DEV_ARCH=linux
|
||||||
|
p_linux_static: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux p_staticd DEV_ARCH=linux
|
||||||
|
q_linux_static: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux q_staticd DEV_ARCH=linux
|
||||||
|
|
||||||
|
dev_linux_static_motif: rm_and_touch linux_static_motif
|
||||||
|
linux_static_motif: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux static_motifd DEV_ARCH=linux
|
||||||
|
p_linux_static_motif: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux p_static_motifd DEV_ARCH=linux
|
||||||
|
q_linux_static_motif: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.linux q_static_motifd DEV_ARCH=linux
|
||||||
|
|
||||||
|
dev_sco: rm_and_touch sco
|
||||||
|
sco: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sco DEV_ARCH=sco
|
||||||
|
p_sco: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sco purifyd DEV_ARCH=sco
|
||||||
|
q_sco: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sco quantifyd DEV_ARCH=sco
|
||||||
|
|
||||||
|
dev_sgi: rm_and_touch sgi
|
||||||
|
sgi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sgi DEV_ARCH=sgi
|
||||||
|
p_sgi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sgi purifyd DEV_ARCH=sgi
|
||||||
|
q_sgi: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sgi quantifyd DEV_ARCH=sgi
|
||||||
|
|
||||||
|
dev_solaris-23: rm_and_touch solaris-23
|
||||||
|
solaris-23: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-23 DEV_ARCH=solaris-23
|
||||||
|
p_solaris-23: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-23 purifyd DEV_ARCH=solaris-23
|
||||||
|
q_solaris-23: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-23 quantifyd DEV_ARCH=solaris-23
|
||||||
|
|
||||||
|
dev_solaris-24: rm_and_touch solaris-24
|
||||||
|
solaris-24: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24 DEV_ARCH=solaris-24
|
||||||
|
p_solaris-24: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24 purifyd DEV_ARCH=solaris-24
|
||||||
|
q_solaris-24: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24 quantifyd DEV_ARCH=solaris-24
|
||||||
|
|
||||||
|
dev_solaris-24-x86: rm_and_touch solaris-24-x86
|
||||||
|
solaris-24-x86: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24-x86 DEV_ARCH=solaris-24-x86
|
||||||
|
p_solaris-24-x86: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24-x86 purifyd DEV_ARCH=solaris-24-x86
|
||||||
|
q_solaris-24-x86: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.solaris-24-x86 quantifyd DEV_ARCH=solaris-24-x86
|
||||||
|
|
||||||
|
dev_sun: rm_and_touch sun
|
||||||
|
sun: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun DEV_ARCH=sun
|
||||||
|
p_sun: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun purifyd DEV_ARCH=sun
|
||||||
|
q_sun: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun quantifyd DEV_ARCH=sun
|
||||||
|
|
||||||
|
dev_sun-lresolv: rm_and_touch sun-lresolv
|
||||||
|
sun-lresolv: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun-lresolv DEV_ARCH=sun-lresolv
|
||||||
|
p_sun-lresolv: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun-lresolv purifyd DEV_ARCH=sun-lresolv
|
||||||
|
q_sun-lresolv: rm_and_touch
|
||||||
|
$(MAKE) -f makefiles/Makefile.sun-lresolv quantifyd DEV_ARCH=sun-lresolv
|
||||||
|
|
||||||
|
clean:
|
||||||
|
cd libXmx; $(MAKE) clean
|
||||||
|
cd libdtm; $(MAKE) clean
|
||||||
|
cd libhtmlw; $(MAKE) clean
|
||||||
|
cd libnet; $(MAKE) clean
|
||||||
|
cd libnut; $(MAKE) clean
|
||||||
|
cd libwww2; $(MAKE) clean
|
||||||
|
cd src; $(MAKE) clean MOSAIC="Mosaic"
|
||||||
|
@echo "Done cleaning..."
|
19
README
Normal file
19
README
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
=NCSA Mosaic=
|
||||||
|
|
||||||
|
==Building==
|
||||||
|
|
||||||
|
* I was able to compile and run on Ubuntu 9.10. You'll have to install these packages first:
|
||||||
|
|
||||||
|
sudo apt-get install build-essential libmotif3 libmotif-dev libpng3
|
||||||
|
|
||||||
|
* Next, build with:
|
||||||
|
|
||||||
|
make linux
|
||||||
|
|
||||||
|
* Run!
|
||||||
|
|
||||||
|
src/Mosaic
|
||||||
|
|
||||||
|
==Thanks==
|
||||||
|
|
||||||
|
I started with this: http://seanm.ca/mosaic/ and applied the patch on the page. I pulled a bunch of getline()'s out. Presto.
|
120
README.old
Normal file
120
README.old
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
NCSA Mosaic for the X Window System Version 2.6
|
||||||
|
===============================================
|
||||||
|
|
||||||
|
Welcome to NCSA Mosaic for the X Window System 2.6!
|
||||||
|
|
||||||
|
This README details installation steps.
|
||||||
|
|
||||||
|
More complete information and documentation on NCSA Mosaic is
|
||||||
|
available online, via NCSA Mosaic.
|
||||||
|
|
||||||
|
|
||||||
|
Binaries
|
||||||
|
--------
|
||||||
|
|
||||||
|
NCSA Mosaic is known to compile on the following platforms:
|
||||||
|
|
||||||
|
SGI (IRIX 4.0.x and 5.x)
|
||||||
|
IBM (AIX 3.2.4)
|
||||||
|
Sun (SunOS 4.1.3, 5.3, and 5.4 (Solaris))
|
||||||
|
DECstation 5000-200 (Ultrix 4.x)
|
||||||
|
DEC Alpha (OSF/1 1.3 and 3.0)
|
||||||
|
Hewlett Packard (HP/UX 7.x, 8.x, 9.x)
|
||||||
|
Pentium (Linux 1.1.94)
|
||||||
|
|
||||||
|
Binaries for these platforms (and possibly others) are available on
|
||||||
|
ftp.ncsa.uiuc.edu in /Mosaic/Unix/binaries/
|
||||||
|
|
||||||
|
If you have to make nontrivial changes to NCSA Mosaic to get it to
|
||||||
|
compile on a particular platform, please send a set of context diffs
|
||||||
|
(e.g., 'diff -c oldfile newfile') to mosaic-x@ncsa.uiuc.edu.
|
||||||
|
|
||||||
|
|
||||||
|
Installation Instructions
|
||||||
|
-------------------------
|
||||||
|
|
||||||
|
Simply examine the toplevel Makefile, change the appropriate
|
||||||
|
customizable options, and type 'make'.
|
||||||
|
|
||||||
|
The final result is a single independent executable, src/Mosaic.
|
||||||
|
|
||||||
|
(The Makefile.[sun,dec,ibm,alpha,etc.] files are the Makefiles we use
|
||||||
|
locally for compilation on various platforms; they will almost
|
||||||
|
certainly NOT WORK for you without modification. We recommend you
|
||||||
|
start with the stock Makefile and make modifications as necessary to
|
||||||
|
avoid confusion.)
|
||||||
|
|
||||||
|
There is one tricky thing:
|
||||||
|
|
||||||
|
-- You have the option of compiling in support for NCSA HDF, a
|
||||||
|
platform-independent hierarchical scientific data format, and NCSA
|
||||||
|
DTM, a network-based message-passing protocol useful for exchanging
|
||||||
|
scientific data between applications. If you compile one of them
|
||||||
|
in, you should compile both of them in.
|
||||||
|
|
||||||
|
If you don't already know what HDF and DTM are and want to compile
|
||||||
|
Mosaic quickly, forget about them for the time being -- you can
|
||||||
|
always recompile later.
|
||||||
|
|
||||||
|
The DTM library is in subdirectory libdtm. The HDF library must be
|
||||||
|
obtained separately from ftp.ncsa.uiuc.edu in /HDF; get version
|
||||||
|
4.0b1 or later. Set the various options in the Makefile to point
|
||||||
|
to all the right places, and you should be set.
|
||||||
|
|
||||||
|
NOTE: Nothing less than 4.0b1 will work.
|
||||||
|
|
||||||
|
After You Have Compiled
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
If you do not normally run Motif on your system (e.g., if you run Sun
|
||||||
|
OpenWindows instead), then you may get a whole bunch of run-time
|
||||||
|
errors about translations when you start Mosaic.
|
||||||
|
|
||||||
|
If this happens, copy the file XKeysymDB (included in this directory)
|
||||||
|
to /usr/lib/X11. (If you compile Mosaic yourself, you may need to
|
||||||
|
place this file elsewhere, depending on your X configuration.) See
|
||||||
|
the FAQ list online for more information.
|
||||||
|
|
||||||
|
|
||||||
|
X Defaults
|
||||||
|
----------
|
||||||
|
|
||||||
|
NCSA Mosaic includes sets of fallback X resources that provide
|
||||||
|
reasonable screen display properties for three configurations: color,
|
||||||
|
monochrome, and color SGI. (Color SGI has its own configuration since
|
||||||
|
SGI systems commonly use a gamma correction factor of 1.7, which makes
|
||||||
|
their screens brighter than usual.)
|
||||||
|
|
||||||
|
If you compile NCSA Mosaic out of the box, or if you download a binary
|
||||||
|
from ftp.ncsa.uiuc.edu, the default resources will be for a color
|
||||||
|
display (or, if you compile on an SGI, the default will be for color
|
||||||
|
SGI). See the Makefile for information on how to have monochrome
|
||||||
|
resources by default. On the command line, the flags '-mono' and
|
||||||
|
'-color' allow you to switch resource configurations at runtime.
|
||||||
|
|
||||||
|
For your convenience, three corresponding X app-defaults files are
|
||||||
|
included in this distribution: app-defaults.color,
|
||||||
|
app-defaults.color-sgi, and app-defaults.mono.
|
||||||
|
|
||||||
|
|
||||||
|
Bug Reports and Comments
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Bug reports and other comments can be sent to mosaic-x@ncsa.uiuc.edu.
|
||||||
|
|
||||||
|
If you find NCSA Mosaic useful or particularly interesting, please
|
||||||
|
also send us a note -- continued development of this project partially
|
||||||
|
depends on user feedback and support.
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
=============================================================================
|
||||||
|
Scott Powers spowers@ncsa.uiuc.edu \ The N.C.S.A. X Mosaic
|
||||||
|
Kristin Buxton kbuxton@uiuc.edu \ Development Team
|
||||||
|
Dan Pape dpape@ncsa.uiuc.edu >
|
||||||
|
Tommy Reilly tpreilly@uiuc.edu / Comments? Suggestions? Problems?
|
||||||
|
Brian Swetland swetland@uiuc.edu / mosaic-x@ncsa.uiuc.edu
|
||||||
|
=============================================================================
|
||||||
|
|
||||||
|
Software Development Group
|
||||||
|
National Center for Supercomputing Applications
|
1010
README.resources.html
Normal file
1010
README.resources.html
Normal file
File diff suppressed because it is too large
Load Diff
3
TODO
Normal file
3
TODO
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
- create .mosaic dir if necessary!
|
||||||
|
|
||||||
|
- XmFontListCreate obsolete
|
39
XKeysymDB
Normal file
39
XKeysymDB
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
!
|
||||||
|
! OSF Keysyms
|
||||||
|
!
|
||||||
|
osfBackSpace :1004FF08
|
||||||
|
osfInsert :1004FF63
|
||||||
|
osfDelete :1004FFFF
|
||||||
|
osfCopy :1004FF02
|
||||||
|
osfCut :1004FF03
|
||||||
|
osfPaste :1004FF04
|
||||||
|
|
||||||
|
osfAddMode :1004FF31
|
||||||
|
osfPrimaryPaste :1004FF32
|
||||||
|
osfQuickPaste :1004FF33
|
||||||
|
|
||||||
|
osfPageUp :1004FF41
|
||||||
|
osfPageDown :1004FF42
|
||||||
|
|
||||||
|
osfEndLine :1004FF57
|
||||||
|
osfBeginLine :1004FF58
|
||||||
|
|
||||||
|
osfActivate :1004FF44
|
||||||
|
|
||||||
|
osfMenuBar :1004FF45
|
||||||
|
|
||||||
|
osfClear :1004FF0B
|
||||||
|
osfCancel :1004FF69
|
||||||
|
osfHelp :1004FF6A
|
||||||
|
osfMenu :1004FF67
|
||||||
|
osfSelect :1004FF60
|
||||||
|
osfUndo :1004FF65
|
||||||
|
|
||||||
|
osfLeft :1004FF51
|
||||||
|
osfUp :1004FF52
|
||||||
|
osfRight :1004FF53
|
||||||
|
osfDown :1004FF54
|
||||||
|
|
||||||
|
! DEC specific keysyms
|
||||||
|
!
|
||||||
|
DRemove :1000FF00
|
118
app-defaults.color
Normal file
118
app-defaults.color
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
Mosaic*XmLabel*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmLabelGadget*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmScale*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmBulletinBoard*labelFontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*optionmenu.XmLabelGadget*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmPushButton*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmPushButtonGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmToggleButton*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmToggleButtonGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*optionmenu*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmIconGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmBulletinBoard*buttonFontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*menubar*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmPushButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmLabelGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmPushButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmCascadeButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmCascadeButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmCascadeButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmCascadeButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmToggleButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*pulldownmenu*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmList*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmText.fontList: -*-lucidatypewriter-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmTextField.fontList: -*-lucidatypewriter-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
|
||||||
|
Mosaic*optionmenu*marginHeight: 0
|
||||||
|
Mosaic*optionmenu*marginTop: 5
|
||||||
|
Mosaic*optionmenu*marginBottom: 5
|
||||||
|
Mosaic*optionmenu*marginWidth: 5
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginHeight: 1
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginWidth: 1
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginLeft: 3
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginRight: 3
|
||||||
|
Mosaic*XmList*listMarginWidth: 3
|
||||||
|
Mosaic*menubar*marginHeight: 1
|
||||||
|
Mosaic*menubar.marginHeight: 0
|
||||||
|
Mosaic*menubar*marginLeft: 1
|
||||||
|
Mosaic*menubar.spacing: 7
|
||||||
|
Mosaic*XmMenuShell*marginLeft: 3
|
||||||
|
Mosaic*XmMenuShell*marginRight: 4
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*spacing: 2
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*marginHeight: 0
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*indicatorSize: 12
|
||||||
|
Mosaic*XmMenuShell*XmLabelGadget*marginHeight: 4
|
||||||
|
Mosaic*XmToggleButtonGadget*spacing: 4
|
||||||
|
Mosaic*XmToggleButton*spacing: 4
|
||||||
|
Mosaic*XmScrolledWindow*spacing: 0
|
||||||
|
Mosaic*XmScrollBar*width: 18
|
||||||
|
Mosaic*XmScrollBar*height: 18
|
||||||
|
Mosaic*XmScale*scaleHeight: 20
|
||||||
|
Mosaic*XmText*marginHeight: 4
|
||||||
|
Mosaic*fsb*XmText*width: 420
|
||||||
|
Mosaic*fsb*XmTextField*width: 420
|
||||||
|
Mosaic*fillOnSelect: True
|
||||||
|
Mosaic*visibleWhenOff: True
|
||||||
|
Mosaic*XmText*highlightThickness: 0
|
||||||
|
Mosaic*XmTextField*highlightThickness: 0
|
||||||
|
Mosaic*XmPushButton*highlightThickness: 0
|
||||||
|
Mosaic*XmScrollBar*highlightThickness: 0
|
||||||
|
Mosaic*highlightThickness: 0
|
||||||
|
Mosaic*keyboardFocusPolicy: pointer
|
||||||
|
|
||||||
|
Mosaic*TitleFont: -adobe-times-bold-r-normal-*-24-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Font: -adobe-times-medium-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*ItalicFont: -adobe-times-medium-i-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*BoldFont: -adobe-times-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixedFont: -adobe-courier-medium-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixedboldFont: -adobe-courier-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixeditalicFont: -adobe-courier-medium-o-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header1Font: -adobe-times-bold-r-normal-*-24-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header2Font: -adobe-times-bold-r-normal-*-18-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header3Font: -adobe-times-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header4Font: -adobe-times-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header5Font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header6Font: -adobe-times-bold-r-normal-*-10-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*AddressFont: -adobe-times-medium-i-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainFont: -adobe-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainboldFont: -adobe-courier-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainitalicFont: -adobe-courier-medium-o-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*ListingFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*supSubFont: -adobe-times-medium-r-normal-*-10-*-*-*-*-*-iso8859-1
|
||||||
|
|
||||||
|
Mosaic*Foreground: #000000000000
|
||||||
|
Mosaic*XmScrollBar*Foreground: #bfbfbfbfbfbf
|
||||||
|
Mosaic*XmLabel*Foreground: #1d1d15155b5b
|
||||||
|
Mosaic*XmToggleButton*Foreground: #1d1d15155b5b
|
||||||
|
Mosaic*XmPushButton*Foreground: #5b5b00000000
|
||||||
|
Mosaic*logo*Foreground: #1d1d15155b5b
|
||||||
|
|
||||||
|
Mosaic*Background: #bfbfbfbfbfbf
|
||||||
|
|
||||||
|
Mosaic*XmList*Background: #bfbfbfbfbfbf
|
||||||
|
Mosaic*XmText*Background: #bfbfbfbfbfbf
|
||||||
|
Mosaic*XmSelectionBox*Background: #bfbfbfbfbfbf
|
||||||
|
Mosaic*XmMessageBox*Background: #bfbfbfbfbfbf
|
||||||
|
Mosaic*XmTextField*Background: #9c9c9c9c9c9c
|
||||||
|
|
||||||
|
Mosaic*TopShadowColor: #e7e7e7e7e7e7
|
||||||
|
Mosaic*XmList*TopShadowColor: #e7e7e7e7e7e7
|
||||||
|
Mosaic*XmText*TopShadowColor: #e7e7e7e7e7e7
|
||||||
|
Mosaic*XmSelectionBox*TopShadowColor: #e7e7e7e7e7e7
|
||||||
|
Mosaic*XmMessageBox*TopShadowColor: #e7e7e7e7e7e7
|
||||||
|
|
||||||
|
Mosaic*TroughColor: #646464646464
|
||||||
|
Mosaic*SelectColor: #ffffffff0000
|
||||||
|
Mosaic*HighlightColor: #bfbfbfbfbfbf
|
||||||
|
|
||||||
|
Mosaic*visitedAnchorColor: #3f3f0f0f7b7b
|
||||||
|
Mosaic*anchorColor: #00000000b0b0
|
||||||
|
Mosaic*activeAnchorFG: #ffff00000000
|
||||||
|
Mosaic*activeAnchorBG: #bfbfbfbfbfbf
|
||||||
|
|
||||||
|
Mosaic*AnchorUnderlines: 1
|
||||||
|
Mosaic*VisitedAnchorUnderlines: 1
|
||||||
|
Mosaic*DashedVisitedAnchorUnderlines: True
|
||||||
|
Mosaic*VerticalScrollOnRight: True
|
115
app-defaults.color-sgi
Normal file
115
app-defaults.color-sgi
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
Mosaic*XmLabel*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmLabelGadget*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmScale*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmBulletinBoard*labelFontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*optionmenu.XmLabelGadget*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmPushButton*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmPushButtonGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmToggleButton*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmToggleButtonGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*optionmenu*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmIconGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmBulletinBoard*buttonFontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*menubar*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmPushButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmLabelGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmPushButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmCascadeButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmCascadeButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmCascadeButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmCascadeButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmToggleButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*pulldownmenu*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmList*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmText.fontList: -*-lucidatypewriter-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmTextField.fontList: -*-lucidatypewriter-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
|
||||||
|
Mosaic*optionmenu*marginHeight: 0
|
||||||
|
Mosaic*optionmenu*marginTop: 5
|
||||||
|
Mosaic*optionmenu*marginBottom: 5
|
||||||
|
Mosaic*optionmenu*marginWidth: 5
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginHeight: 1
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginWidth: 1
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginLeft: 3
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginRight: 3
|
||||||
|
Mosaic*XmList*listMarginWidth: 3
|
||||||
|
Mosaic*menubar*marginHeight: 1
|
||||||
|
Mosaic*menubar.marginHeight: 0
|
||||||
|
Mosaic*menubar*marginLeft: 1
|
||||||
|
Mosaic*menubar.spacing: 7
|
||||||
|
Mosaic*XmMenuShell*marginLeft: 3
|
||||||
|
Mosaic*XmMenuShell*marginRight: 4
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*spacing: 2
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*marginHeight: 0
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*indicatorSize: 12
|
||||||
|
Mosaic*XmMenuShell*XmLabelGadget*marginHeight: 4
|
||||||
|
Mosaic*XmToggleButtonGadget*spacing: 4
|
||||||
|
Mosaic*XmToggleButton*spacing: 4
|
||||||
|
Mosaic*XmScrolledWindow*spacing: 0
|
||||||
|
Mosaic*XmScrollBar*width: 18
|
||||||
|
Mosaic*XmScrollBar*height: 18
|
||||||
|
Mosaic*XmScale*scaleHeight: 20
|
||||||
|
Mosaic*XmText*marginHeight: 4
|
||||||
|
Mosaic*fsb*XmText*width: 420
|
||||||
|
Mosaic*fsb*XmTextField*width: 420
|
||||||
|
Mosaic*fillOnSelect: True
|
||||||
|
Mosaic*visibleWhenOff: True
|
||||||
|
Mosaic*XmText*highlightThickness: 0
|
||||||
|
Mosaic*XmTextField*highlightThickness: 0
|
||||||
|
Mosaic*XmPushButton*highlightThickness: 0
|
||||||
|
Mosaic*XmScrollBar*highlightThickness: 0
|
||||||
|
Mosaic*highlightThickness: 0
|
||||||
|
Mosaic*keyboardFocusPolicy: pointer
|
||||||
|
|
||||||
|
Mosaic*TitleFont: -adobe-times-bold-r-normal-*-24-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Font: -adobe-times-medium-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*ItalicFont: -adobe-times-medium-i-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*BoldFont: -adobe-times-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixedFont: -adobe-courier-medium-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixedboldFont: -adobe-courier-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixeditalicFont: -adobe-courier-medium-o-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header1Font: -adobe-times-bold-r-normal-*-24-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header2Font: -adobe-times-bold-r-normal-*-18-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header3Font: -adobe-times-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header4Font: -adobe-times-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header5Font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header6Font: -adobe-times-bold-r-normal-*-10-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*AddressFont: -adobe-times-medium-i-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainFont: -adobe-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainboldFont: -adobe-courier-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainitalicFont: -adobe-courier-medium-o-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*ListingFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*supSubFont: -adobe-times-medium-r-normal-*-10-*-*-*-*-*-iso8859-1
|
||||||
|
|
||||||
|
Mosaic*Foreground: #000000000000
|
||||||
|
Mosaic*XmScrollBar*Foreground: #afafafafafaf
|
||||||
|
Mosaic*Background: #afafafafafaf
|
||||||
|
Mosaic*XmList*Background: #afafafafafaf
|
||||||
|
Mosaic*XmText*Background: #afafafafafaf
|
||||||
|
Mosaic*TroughColor: #545454545454
|
||||||
|
Mosaic*XmSelectionBox*Background: #afafafafafaf
|
||||||
|
Mosaic*XmMessageBox*Background: #afafafafafaf
|
||||||
|
Mosaic*XmLabel*Foreground: #1d1d15155b5b
|
||||||
|
Mosaic*XmToggleButton*Foreground: #1d1d15155b5b
|
||||||
|
Mosaic*XmPushButton*Foreground: #5b5b00000000
|
||||||
|
Mosaic*logo*Foreground: #1d1d15155b5b
|
||||||
|
Mosaic*XmTextField*Background: #8c8c8c8c8c8c
|
||||||
|
Mosaic*SelectColor: #ffffffff0000
|
||||||
|
Mosaic*HighlightColor: #afafafafafaf
|
||||||
|
|
||||||
|
Mosaic*TopShadowColor: #dfdfdfdfdfdf
|
||||||
|
Mosaic*XmList*TopShadowColor: #dfdfdfdfdfdf
|
||||||
|
Mosaic*XmText*TopShadowColor: #dfdfdfdfdfdf
|
||||||
|
Mosaic*XmSelectionBox*TopShadowColor: #dfdfdfdfdfdf
|
||||||
|
Mosaic*XmMessageBox*TopShadowColor: #dfdfdfdfdfdf
|
||||||
|
|
||||||
|
Mosaic*visitedAnchorColor: #272705055b5b
|
||||||
|
Mosaic*anchorColor: #00000000b0b0
|
||||||
|
Mosaic*activeAnchorFG: #ffff00000000
|
||||||
|
Mosaic*activeAnchorBG: #afafafafafaf
|
||||||
|
|
||||||
|
Mosaic*AnchorUnderlines: 1
|
||||||
|
Mosaic*VisitedAnchorUnderlines: 1
|
||||||
|
Mosaic*DashedVisitedAnchorUnderlines: True
|
||||||
|
Mosaic*VerticalScrollOnRight: True
|
98
app-defaults.mono
Normal file
98
app-defaults.mono
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
Mosaic*XmLabel*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmLabelGadget*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmScale*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmBulletinBoard*labelFontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*optionmenu.XmLabelGadget*fontList: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*XmPushButton*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmPushButtonGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmToggleButton*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmToggleButtonGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*optionmenu*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmIconGadget*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmBulletinBoard*buttonFontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*menubar*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmPushButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmLabelGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmPushButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmCascadeButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmCascadeButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmCascadeButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmCascadeButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmToggleButton*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*pulldownmenu*fontList: -*-helvetica-bold-o-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmList*fontList: -*-helvetica-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmText.fontList: -*-lucidatypewriter-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
Mosaic*XmTextField.fontList: -*-lucidatypewriter-medium-r-normal-*-14-*-iso8859-1
|
||||||
|
|
||||||
|
Mosaic*optionmenu*marginHeight: 0
|
||||||
|
Mosaic*optionmenu*marginTop: 5
|
||||||
|
Mosaic*optionmenu*marginBottom: 5
|
||||||
|
Mosaic*optionmenu*marginWidth: 5
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginHeight: 1
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginWidth: 1
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginLeft: 3
|
||||||
|
Mosaic*pulldownmenu*XmPushButton*marginRight: 3
|
||||||
|
Mosaic*XmList*listMarginWidth: 3
|
||||||
|
Mosaic*menubar*marginHeight: 1
|
||||||
|
Mosaic*menubar.marginHeight: 0
|
||||||
|
Mosaic*menubar*marginLeft: 1
|
||||||
|
Mosaic*menubar.spacing: 7
|
||||||
|
Mosaic*XmMenuShell*marginLeft: 3
|
||||||
|
Mosaic*XmMenuShell*marginRight: 4
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*spacing: 2
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*marginHeight: 0
|
||||||
|
Mosaic*XmMenuShell*XmToggleButtonGadget*indicatorSize: 12
|
||||||
|
Mosaic*XmMenuShell*XmLabelGadget*marginHeight: 4
|
||||||
|
Mosaic*XmToggleButtonGadget*spacing: 4
|
||||||
|
Mosaic*XmToggleButton*spacing: 4
|
||||||
|
Mosaic*XmScrolledWindow*spacing: 0
|
||||||
|
Mosaic*XmScrollBar*width: 18
|
||||||
|
Mosaic*XmScrollBar*height: 18
|
||||||
|
Mosaic*XmScale*scaleHeight: 20
|
||||||
|
Mosaic*XmText*marginHeight: 4
|
||||||
|
Mosaic*fsb*XmText*width: 420
|
||||||
|
Mosaic*fsb*XmTextField*width: 420
|
||||||
|
Mosaic*fillOnSelect: True
|
||||||
|
Mosaic*visibleWhenOff: True
|
||||||
|
Mosaic*XmText*highlightThickness: 0
|
||||||
|
Mosaic*XmTextField*highlightThickness: 0
|
||||||
|
Mosaic*XmPushButton*highlightThickness: 0
|
||||||
|
Mosaic*XmScrollBar*highlightThickness: 0
|
||||||
|
Mosaic*highlightThickness: 0
|
||||||
|
Mosaic*keyboardFocusPolicy: pointer
|
||||||
|
|
||||||
|
Mosaic*TitleFont: -adobe-times-bold-r-normal-*-24-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Font: -adobe-times-medium-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*ItalicFont: -adobe-times-medium-i-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*BoldFont: -adobe-times-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixedFont: -adobe-courier-medium-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixedboldFont: -adobe-courier-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*FixeditalicFont: -adobe-courier-medium-o-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header1Font: -adobe-times-bold-r-normal-*-24-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header2Font: -adobe-times-bold-r-normal-*-18-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header3Font: -adobe-times-bold-r-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header4Font: -adobe-times-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header5Font: -adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*Header6Font: -adobe-times-bold-r-normal-*-10-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*AddressFont: -adobe-times-medium-i-normal-*-17-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainFont: -adobe-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainboldFont: -adobe-courier-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*PlainitalicFont: -adobe-courier-medium-o-normal-*-14-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*ListingFont: -adobe-courier-medium-r-normal-*-12-*-*-*-*-*-iso8859-1
|
||||||
|
Mosaic*supSubFont: -adobe-times-medium-r-normal-*-10-*-*-*-*-*-iso8859-1
|
||||||
|
|
||||||
|
Mosaic*Foreground: black
|
||||||
|
Mosaic*Background: white
|
||||||
|
Mosaic*TopShadowColor: black
|
||||||
|
Mosaic*BottomShadowColor: black
|
||||||
|
Mosaic*anchorColor: black
|
||||||
|
Mosaic*visitedAnchorColor: black
|
||||||
|
Mosaic*activeAnchorFG: black
|
||||||
|
Mosaic*activeAnchorBG: white
|
||||||
|
Mosaic*TroughColor: black
|
||||||
|
Mosaic*SelectColor: black
|
||||||
|
Mosaic*AnchorUnderlines: 1
|
||||||
|
Mosaic*VisitedAnchorUnderlines: 1
|
||||||
|
Mosaic*DashedVisitedAnchorUnderlines: True
|
||||||
|
Mosaic*VerticalScrollOnRight: True
|
20
auth/pgp-dec
Executable file
20
auth/pgp-dec
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Set this to the password to your secret key
|
||||||
|
PGPPASS=mypassword
|
||||||
|
# Set this to the location of your keyrings and config files
|
||||||
|
PGPPATH=/usr6/rob/.pgp
|
||||||
|
# Set this to your user name, the name on your secret key
|
||||||
|
PGPUSER=robm@ncsa.uiuc.edu
|
||||||
|
# Set this to the full path to the PGP binary on your system
|
||||||
|
PGPBIN=/usr/local/bin/pgp
|
||||||
|
|
||||||
|
# You shouldn't need to edit anything after this line
|
||||||
|
|
||||||
|
export PGPPASS
|
||||||
|
export PGPPATH
|
||||||
|
|
||||||
|
# Make sure PGP doesn't try to make temp files in /
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
|
exec $PGPBIN -f -u $PGPUSER 2>/dev/null
|
20
auth/pgp-enc
Executable file
20
auth/pgp-enc
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Set this to the password to your secret keyring
|
||||||
|
PGPPASS=mypassword
|
||||||
|
# Set this to the directory you keep your PGP keyrings and config files at
|
||||||
|
PGPPATH=/usr6/rob/.pgp
|
||||||
|
# Set this to your user name, the name on your secret key
|
||||||
|
PGPUSER=robm@ncsa.uiuc.edu
|
||||||
|
# Set this to the full pathname of the PGP binary on your system
|
||||||
|
PGPBIN=/usr/local/bin/pgp
|
||||||
|
|
||||||
|
# That should be all you need to edit
|
||||||
|
|
||||||
|
export PGPPASS
|
||||||
|
export PGPPATH
|
||||||
|
|
||||||
|
# Make sure PGP doesn't try to make temp files in /
|
||||||
|
cd /tmp
|
||||||
|
|
||||||
|
exec $PGPBIN -fe $* -u $PGPUSER 2>/dev/null
|
17
auth/ripem-dec
Executable file
17
auth/ripem-dec
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Set this to wherever you placed my hacked version of uudecode
|
||||||
|
HACKED_UUDECODE=/X11/robm/Mosaic/auth/uudecode
|
||||||
|
# Set this to the name of your key, or your user name.
|
||||||
|
PEMUSER=robm@ncsa.uiuc.edu
|
||||||
|
# Set these to the location of your public and secret key files
|
||||||
|
PUBKEY=$HOME/.key-public
|
||||||
|
SECKEY=$HOME/.key-secret
|
||||||
|
# Set this to the password to your secret key
|
||||||
|
KEYPASS=mypassword
|
||||||
|
# Set this to the location of your RIPEM executable
|
||||||
|
RIPEMBIN=/usr/local/bin/ripem
|
||||||
|
|
||||||
|
# That should be all you need to edit
|
||||||
|
|
||||||
|
$RIPEMBIN -d -Y g -u $PEMUSER -p $PUBKEY -s $SECKEY -k $KEYPASS | $HACKED_UUDECODE
|
20
auth/ripem-enc
Executable file
20
auth/ripem-enc
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Set this to the name of your key, or your user name.
|
||||||
|
PEMUSER=robm@ncsa.uiuc.edu
|
||||||
|
# Set these to the location of your public and secret key files
|
||||||
|
PUBKEY=$HOME/.key-public
|
||||||
|
SECKEY=$HOME/.key-secret
|
||||||
|
# Set this to the password to your secret key
|
||||||
|
KEYPASS=mypassword
|
||||||
|
# Set this to your system's uuencode, or to my included version if your
|
||||||
|
# system doesn't have one (AIX)
|
||||||
|
UUENCODE=/bin/uuencode
|
||||||
|
# Set this to the location of your RIPEM executable
|
||||||
|
RIPEMBIN=/usr/local/bin/ripem
|
||||||
|
|
||||||
|
$UUENCODE foo | $RIPEMBIN -e -h i -Y g -u $PEMUSER -s $SECKEY -p $PUBKEY -k $KEYPASS -r $*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
30
config
Executable file
30
config
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# A script to store configuration variables for Mosaic's external
|
||||||
|
# software packages
|
||||||
|
#
|
||||||
|
# In all cases configure will check the dir you supply for all libs and
|
||||||
|
# header files as well the lib and include subdirectories of that directory.
|
||||||
|
# So if you do things right and install everything in a place like
|
||||||
|
# /usr/local/include and /usr/local/lib
|
||||||
|
# you can just enter /usr/local (the default) for every field.
|
||||||
|
#
|
||||||
|
# Where to find jpeg stuff
|
||||||
|
jpegdir=/usr/local
|
||||||
|
|
||||||
|
# Where to find libz (don't need any headers)
|
||||||
|
zdir=/usr/local
|
||||||
|
|
||||||
|
# Where to find png stuff
|
||||||
|
pngdir=/usr/local
|
||||||
|
|
||||||
|
# Where to find wais stuff
|
||||||
|
waisdir=
|
||||||
|
|
||||||
|
# Where to find hdf stuff
|
||||||
|
hdfdir=
|
||||||
|
|
||||||
|
# Use DTM? (yes or no)
|
||||||
|
with_dtm=no
|
||||||
|
|
||||||
|
echo ./configure --with-jpegdir=$jpegdir --with-zdir=${zdir} --with-pngdir=$pngdir --with-wais=$waisdir --with-hdfdir=$hdfdir --enable-dtm=$with_dtm $*
|
||||||
|
./configure --with-jpegdir=$jpegdir --with-zdir=${zdir} --with-pngdir=$pngdir --with-wais=$waisdir --with-hdfdir=$hdfdir --enable-dtm=$with_dtm $*
|
565
config.guess
vendored
Executable file
565
config.guess
vendored
Executable file
@ -0,0 +1,565 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Attempt to guess a canonical system name.
|
||||||
|
# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This file is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# Written by Per Bothner <bothner@cygnus.com>.
|
||||||
|
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||||
|
#
|
||||||
|
# This script attempts to guess a canonical system name similar to
|
||||||
|
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||||
|
# exits with 0. Otherwise, it exits with 1.
|
||||||
|
#
|
||||||
|
# The plan is that this can be called by configure scripts if you
|
||||||
|
# don't specify an explicit system type (host/target name).
|
||||||
|
#
|
||||||
|
# Only a few systems have been added to this list; please add others
|
||||||
|
# (but try to keep the structure clean).
|
||||||
|
#
|
||||||
|
|
||||||
|
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||||
|
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||||
|
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||||
|
PATH=$PATH:/.attbin ; export PATH
|
||||||
|
fi
|
||||||
|
|
||||||
|
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
||||||
|
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||||
|
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||||
|
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||||
|
|
||||||
|
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||||
|
|
||||||
|
# Note: order is significant - the case branches are not exclusive.
|
||||||
|
|
||||||
|
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||||
|
alpha:OSF1:V*:*)
|
||||||
|
# After 1.2, OSF1 uses "V1.3" for uname -r.
|
||||||
|
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
|
||||||
|
exit 0 ;;
|
||||||
|
alpha:OSF1:*:*)
|
||||||
|
# 1.2 uses "1.2" for uname -r.
|
||||||
|
echo alpha-dec-osf${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
21064:Windows_NT:50:3)
|
||||||
|
echo alpha-dec-winnt3.5
|
||||||
|
exit 0 ;;
|
||||||
|
amiga:NetBSD:*:*)
|
||||||
|
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||||
|
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||||
|
exit 0;;
|
||||||
|
Pyramid*:OSx*:*:*)
|
||||||
|
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||||
|
echo pyramid-pyramid-sysv3
|
||||||
|
else
|
||||||
|
echo pyramid-pyramid-bsd
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
sun4*:SunOS:5.*:*)
|
||||||
|
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
|
exit 0 ;;
|
||||||
|
i86pc:SunOS:5.*:*)
|
||||||
|
echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
|
exit 0 ;;
|
||||||
|
sun4*:SunOS:6*:*)
|
||||||
|
# According to config.sub, this is the proper way to canonicalize
|
||||||
|
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
|
||||||
|
# it's likely to be more like Solaris than SunOS4.
|
||||||
|
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||||
|
exit 0 ;;
|
||||||
|
sun4*:SunOS:*:*)
|
||||||
|
case "`/usr/bin/arch -k`" in
|
||||||
|
Series*|S4*)
|
||||||
|
UNAME_RELEASE=`uname -v`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# Japanese Language versions have a version number like `4.1.3-JL'.
|
||||||
|
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
|
||||||
|
exit 0 ;;
|
||||||
|
sun3*:SunOS:*:*)
|
||||||
|
echo m68k-sun-sunos${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
atari*:NetBSD:*:*)
|
||||||
|
echo m68k-atari-netbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
sun3*:NetBSD:*:*)
|
||||||
|
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
mac68k:NetBSD:*:*)
|
||||||
|
echo m68k-apple-netbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
RISC*:ULTRIX:*:*)
|
||||||
|
echo mips-dec-ultrix${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
VAX*:ULTRIX*:*:*)
|
||||||
|
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
mips:*:4*:UMIPS)
|
||||||
|
echo mips-mips-riscos4sysv
|
||||||
|
exit 0 ;;
|
||||||
|
mips:*:5*:RISCos)
|
||||||
|
echo mips-mips-riscos${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
m88k:CX/UX:7*:*)
|
||||||
|
echo m88k-harris-cxux7
|
||||||
|
exit 0 ;;
|
||||||
|
m88k:*:4*:R4*)
|
||||||
|
echo m88k-motorola-sysv4
|
||||||
|
exit 0 ;;
|
||||||
|
m88k:*:3*:R3*)
|
||||||
|
echo m88k-motorola-sysv3
|
||||||
|
exit 0 ;;
|
||||||
|
AViiON:dgux:*:*)
|
||||||
|
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||||
|
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||||
|
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||||
|
else
|
||||||
|
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||||
|
echo m88k-dolphin-sysv3
|
||||||
|
exit 0 ;;
|
||||||
|
M88*:*:R3*:*)
|
||||||
|
# Delta 88k system running SVR3
|
||||||
|
echo m88k-motorola-sysv3
|
||||||
|
exit 0 ;;
|
||||||
|
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
|
||||||
|
echo m88k-tektronix-sysv3
|
||||||
|
exit 0 ;;
|
||||||
|
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
|
||||||
|
echo m68k-tektronix-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
*:IRIX*:*:*)
|
||||||
|
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
|
||||||
|
exit 0 ;;
|
||||||
|
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
|
||||||
|
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
|
||||||
|
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
|
||||||
|
i[34]86:AIX:*:*)
|
||||||
|
echo i386-ibm-aix
|
||||||
|
exit 0 ;;
|
||||||
|
*:AIX:2:3)
|
||||||
|
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||||
|
sed 's/^ //' << EOF >dummy.c
|
||||||
|
#include <sys/systemcfg.h>
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
if (!__power_pc())
|
||||||
|
exit(1);
|
||||||
|
puts("powerpc-ibm-aix3.2.5");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||||
|
rm -f dummy.c dummy
|
||||||
|
echo rs6000-ibm-aix3.2.5
|
||||||
|
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||||
|
echo rs6000-ibm-aix3.2.4
|
||||||
|
else
|
||||||
|
echo rs6000-ibm-aix3.2
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
*:AIX:*:4)
|
||||||
|
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
|
||||||
|
IBM_ARCH=rs6000
|
||||||
|
else
|
||||||
|
IBM_ARCH=powerpc
|
||||||
|
fi
|
||||||
|
if [ -x /usr/bin/oslevel ] ; then
|
||||||
|
IBM_REV=`/usr/bin/oslevel`
|
||||||
|
else
|
||||||
|
IBM_REV=4.${UNAME_RELEASE}
|
||||||
|
fi
|
||||||
|
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
|
||||||
|
exit 0 ;;
|
||||||
|
*:AIX:*:*)
|
||||||
|
echo rs6000-ibm-aix
|
||||||
|
exit 0 ;;
|
||||||
|
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
|
||||||
|
echo romp-ibm-bsd4.4
|
||||||
|
exit 0 ;;
|
||||||
|
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||||
|
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||||
|
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||||
|
*:BOSX:*:*)
|
||||||
|
echo rs6000-bull-bosx
|
||||||
|
exit 0 ;;
|
||||||
|
DPX/2?00:B.O.S.:*:*)
|
||||||
|
echo m68k-bull-sysv3
|
||||||
|
exit 0 ;;
|
||||||
|
9000/[34]??:4.3bsd:1.*:*)
|
||||||
|
echo m68k-hp-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
|
||||||
|
echo m68k-hp-bsd4.4
|
||||||
|
exit 0 ;;
|
||||||
|
9000/[3478]??:HP-UX:*:*)
|
||||||
|
case "${UNAME_MACHINE}" in
|
||||||
|
9000/31? ) HP_ARCH=m68000 ;;
|
||||||
|
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||||
|
9000/7?? | 9000/8?[79] ) HP_ARCH=hppa1.1 ;;
|
||||||
|
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||||
|
esac
|
||||||
|
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||||
|
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||||
|
exit 0 ;;
|
||||||
|
3050*:HI-UX:*:*)
|
||||||
|
sed 's/^ //' << EOF >dummy.c
|
||||||
|
#include <unistd.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
long cpu = sysconf (_SC_CPU_VERSION);
|
||||||
|
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
|
||||||
|
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
|
||||||
|
results, however. */
|
||||||
|
if (CPU_IS_PA_RISC (cpu))
|
||||||
|
{
|
||||||
|
switch (cpu)
|
||||||
|
{
|
||||||
|
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
|
||||||
|
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
|
||||||
|
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
|
||||||
|
default: puts ("hppa-hitachi-hiuxwe2"); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (CPU_IS_HP_MC68K (cpu))
|
||||||
|
puts ("m68k-hitachi-hiuxwe2");
|
||||||
|
else puts ("unknown-hitachi-hiuxwe2");
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||||
|
rm -f dummy.c dummy
|
||||||
|
echo unknown-hitachi-hiuxwe2
|
||||||
|
exit 0 ;;
|
||||||
|
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||||
|
echo hppa1.1-hp-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
9000/8??:4.3bsd:*:*)
|
||||||
|
echo hppa1.0-hp-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||||
|
echo hppa1.1-hp-osf
|
||||||
|
exit 0 ;;
|
||||||
|
hp8??:OSF1:*:*)
|
||||||
|
echo hppa1.0-hp-osf
|
||||||
|
exit 0 ;;
|
||||||
|
parisc*:Lites*:*:*)
|
||||||
|
echo hppa1.1-hp-lites
|
||||||
|
exit 0 ;;
|
||||||
|
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||||
|
echo c1-convex-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||||
|
if getsysinfo -f scalar_acc
|
||||||
|
then echo c32-convex-bsd
|
||||||
|
else echo c2-convex-bsd
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||||
|
echo c34-convex-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||||
|
echo c38-convex-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||||
|
echo c4-convex-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
CRAY*X-MP:*:*:*)
|
||||||
|
echo xmp-cray-unicos
|
||||||
|
exit 0 ;;
|
||||||
|
CRAY*Y-MP:*:*:*)
|
||||||
|
echo ymp-cray-unicos${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
CRAY*C90:*:*:*)
|
||||||
|
echo c90-cray-unicos${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
CRAY-2:*:*:*)
|
||||||
|
echo cray2-cray-unicos
|
||||||
|
exit 0 ;;
|
||||||
|
hp3[0-9][05]:NetBSD:*:*)
|
||||||
|
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
*:FreeBSD:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||||
|
exit 0 ;;
|
||||||
|
*:NetBSD:*:*)
|
||||||
|
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||||
|
exit 0 ;;
|
||||||
|
*:GNU:*:*)
|
||||||
|
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||||
|
exit 0 ;;
|
||||||
|
*:Linux:*:*)
|
||||||
|
# The BFD linker knows what the default object file format is, so
|
||||||
|
# first see if it will tell us.
|
||||||
|
ld_help_string=`ld --help 2>&1`
|
||||||
|
if echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
|
||||||
|
echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
|
||||||
|
elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
|
||||||
|
echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
|
||||||
|
elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
|
||||||
|
echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
|
||||||
|
elif test "${UNAME_MACHINE}" = "alpha" ; then
|
||||||
|
echo alpha-unknown-linux ; exit 0
|
||||||
|
else
|
||||||
|
# Either a pre-BFD a.out linker (linuxoldld) or one that does not give us
|
||||||
|
# useful --help. Gcc wants to distinguish between linuxoldld and linuxaout.
|
||||||
|
test ! -d /usr/lib/ldscripts/. \
|
||||||
|
&& echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0
|
||||||
|
# Determine whether the default compiler is a.out or elf
|
||||||
|
cat >dummy.c <<EOF
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{
|
||||||
|
#ifdef __ELF__
|
||||||
|
printf ("%s-unknown-linux\n", argv[1]);
|
||||||
|
#else
|
||||||
|
printf ("%s-unknown-linuxaout\n", argv[1]);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||||
|
rm -f dummy.c dummy
|
||||||
|
fi ;;
|
||||||
|
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||||
|
# are messed up and put the nodename in both sysname and nodename.
|
||||||
|
i[34]86:DYNIX/ptx:4*:*)
|
||||||
|
echo i386-sequent-sysv4
|
||||||
|
exit 0 ;;
|
||||||
|
i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*)
|
||||||
|
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||||
|
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||||
|
else
|
||||||
|
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
i[34]86:*:3.2:*)
|
||||||
|
if test -f /usr/options/cb.name; then
|
||||||
|
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||||
|
echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
|
||||||
|
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||||
|
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||||
|
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||||
|
echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
|
||||||
|
else
|
||||||
|
echo ${UNAME_MACHINE}-unknown-sysv32
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
Intel:Mach:3*:*)
|
||||||
|
echo i386-unknown-mach3
|
||||||
|
exit 0 ;;
|
||||||
|
paragon:*:*:*)
|
||||||
|
echo i860-intel-osf1
|
||||||
|
exit 0 ;;
|
||||||
|
i860:*:4.*:*) # i860-SVR4
|
||||||
|
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
|
||||||
|
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
|
||||||
|
else # Add other i860-SVR4 vendors below as they are discovered.
|
||||||
|
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
mini*:CTIX:SYS*5:*)
|
||||||
|
# "miniframe"
|
||||||
|
echo m68010-convergent-sysv
|
||||||
|
exit 0 ;;
|
||||||
|
M680[234]0:*:R3V[567]*:*)
|
||||||
|
test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
|
||||||
|
3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0)
|
||||||
|
uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
|
&& echo i486-ncr-sysv4.3 && exit 0 ;;
|
||||||
|
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||||
|
uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
|
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||||
|
m680[234]0:LynxOS:2.[23]*:*)
|
||||||
|
echo m68k-lynx-lynxos${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
mc68030:UNIX_System_V:4.*:*)
|
||||||
|
echo m68k-atari-sysv4
|
||||||
|
exit 0 ;;
|
||||||
|
i[34]86:LynxOS:2.[23]*:*)
|
||||||
|
echo i386-lynx-lynxos${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
TSUNAMI:LynxOS:2.[23]*:*)
|
||||||
|
echo sparc-lynx-lynxos${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
rs6000:LynxOS:2.[23]*:*)
|
||||||
|
echo rs6000-lynx-lynxos${UNAME_RELEASE}
|
||||||
|
exit 0 ;;
|
||||||
|
RM*:SINIX-*:*:*)
|
||||||
|
echo mips-sni-sysv4
|
||||||
|
exit 0 ;;
|
||||||
|
*:SINIX-*:*:*)
|
||||||
|
if uname -p 2>/dev/null >/dev/null ; then
|
||||||
|
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||||
|
echo ${UNAME_MACHINE}-sni-sysv4
|
||||||
|
else
|
||||||
|
echo ns32k-sni-sysv
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||||
|
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||||
|
|
||||||
|
cat >dummy.c <<EOF
|
||||||
|
#ifdef _SEQUENT_
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/utsname.h>
|
||||||
|
#endif
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
#if defined (sony)
|
||||||
|
#if defined (MIPSEB)
|
||||||
|
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||||
|
I don't know.... */
|
||||||
|
printf ("mips-sony-bsd\n"); exit (0);
|
||||||
|
#else
|
||||||
|
#include <sys/param.h>
|
||||||
|
printf ("m68k-sony-newsos%s\n",
|
||||||
|
#ifdef NEWSOS4
|
||||||
|
"4"
|
||||||
|
#else
|
||||||
|
""
|
||||||
|
#endif
|
||||||
|
); exit (0);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||||
|
printf ("arm-acorn-riscix"); exit (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (hp300) && !defined (hpux)
|
||||||
|
printf ("m68k-hp-bsd\n"); exit (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (NeXT)
|
||||||
|
#if !defined (__ARCHITECTURE__)
|
||||||
|
#define __ARCHITECTURE__ "m68k"
|
||||||
|
#endif
|
||||||
|
int version;
|
||||||
|
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||||
|
printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3");
|
||||||
|
exit (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (MULTIMAX) || defined (n16)
|
||||||
|
#if defined (UMAXV)
|
||||||
|
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||||
|
#else
|
||||||
|
#if defined (CMU)
|
||||||
|
printf ("ns32k-encore-mach\n"); exit (0);
|
||||||
|
#else
|
||||||
|
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__386BSD__)
|
||||||
|
printf ("i386-unknown-bsd\n"); exit (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (sequent)
|
||||||
|
#if defined (i386)
|
||||||
|
printf ("i386-sequent-dynix\n"); exit (0);
|
||||||
|
#endif
|
||||||
|
#if defined (ns32000)
|
||||||
|
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (_SEQUENT_)
|
||||||
|
struct utsname un;
|
||||||
|
|
||||||
|
uname(&un);
|
||||||
|
|
||||||
|
if (strncmp(un.version, "V2", 2) == 0) {
|
||||||
|
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||||
|
}
|
||||||
|
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||||
|
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||||
|
}
|
||||||
|
printf ("i386-sequent-ptx\n"); exit (0);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (vax)
|
||||||
|
#if !defined (ultrix)
|
||||||
|
printf ("vax-dec-bsd\n"); exit (0);
|
||||||
|
#else
|
||||||
|
printf ("vax-dec-ultrix\n"); exit (0);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (alliant) && defined (i860)
|
||||||
|
printf ("i860-alliant-bsd\n"); exit (0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||||
|
rm -f dummy.c dummy
|
||||||
|
|
||||||
|
# Apollos put the system type in the environment.
|
||||||
|
|
||||||
|
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
|
||||||
|
|
||||||
|
# Convex versions that predate uname can use getsysinfo(1)
|
||||||
|
|
||||||
|
if [ -x /usr/convex/getsysinfo ]
|
||||||
|
then
|
||||||
|
case `getsysinfo -f cpu_type` in
|
||||||
|
c1*)
|
||||||
|
echo c1-convex-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
c2*)
|
||||||
|
if getsysinfo -f scalar_acc
|
||||||
|
then echo c32-convex-bsd
|
||||||
|
else echo c2-convex-bsd
|
||||||
|
fi
|
||||||
|
exit 0 ;;
|
||||||
|
c34*)
|
||||||
|
echo c34-convex-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
c38*)
|
||||||
|
echo c38-convex-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
c4*)
|
||||||
|
echo c4-convex-bsd
|
||||||
|
exit 0 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
#echo '(Unable to guess system type)' 1>&2
|
||||||
|
|
||||||
|
exit 1
|
38
config.h.in
Normal file
38
config.h.in
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/* src/config.h.in. Generated automatically from configure.in by autoheader. */
|
||||||
|
|
||||||
|
/* Define to empty if the keyword does not work. */
|
||||||
|
#undef const
|
||||||
|
|
||||||
|
#undef XMOSAIC
|
||||||
|
#undef PRERELEASE
|
||||||
|
|
||||||
|
/* Defines for system types */
|
||||||
|
#undef ALPHA
|
||||||
|
#undef _BSD
|
||||||
|
#undef DGUX
|
||||||
|
#undef NEXT
|
||||||
|
#undef _HPUX_SOURCE
|
||||||
|
#undef MO_IRIX5
|
||||||
|
#undef SVR4
|
||||||
|
#undef SOLARIS
|
||||||
|
#undef SOLARIS23
|
||||||
|
#undef SOLARIS24
|
||||||
|
#undef SOLARIS24X86
|
||||||
|
#undef SCO
|
||||||
|
#undef SUN
|
||||||
|
#undef CONVEX
|
||||||
|
#undef MOTOROLA
|
||||||
|
#undef BROKEN_MOTIF
|
||||||
|
|
||||||
|
/* external software packages */
|
||||||
|
#undef HAVE_JPEG
|
||||||
|
#undef HAVE_PNG
|
||||||
|
#undef HAVE_DTM
|
||||||
|
#undef HAVE_WAIS
|
||||||
|
|
||||||
|
|
||||||
|
/* define to figure motif version (does anybody use 1.0?)*/
|
||||||
|
#undef MOTIF
|
||||||
|
#undef MOTIF1_1
|
||||||
|
#undef MOTIF1_2
|
||||||
|
#undef MOTIF2_0
|
867
config.sub
vendored
Executable file
867
config.sub
vendored
Executable file
@ -0,0 +1,867 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Configuration validation subroutine script, version 1.1.
|
||||||
|
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||||
|
# This file is (in principle) common to ALL GNU software.
|
||||||
|
# The presence of a machine in this file suggests that SOME GNU software
|
||||||
|
# can handle that machine. It does not imply ALL GNU software can.
|
||||||
|
#
|
||||||
|
# This file is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||||
|
# Supply the specified configuration type as an argument.
|
||||||
|
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||||
|
# Otherwise, we print the canonical config type on stdout and succeed.
|
||||||
|
|
||||||
|
# This file is supposed to be the same for all GNU packages
|
||||||
|
# and recognize all the CPU types, system types and aliases
|
||||||
|
# that are meaningful with *any* GNU software.
|
||||||
|
# Each package is responsible for reporting which valid configurations
|
||||||
|
# it does not support. The user should be able to distinguish
|
||||||
|
# a failure to support a valid configuration from a meaningless
|
||||||
|
# configuration.
|
||||||
|
|
||||||
|
# The goal of this file is to map all the various variations of a given
|
||||||
|
# machine specification into a single specification in the form:
|
||||||
|
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||||
|
# It is wrong to echo any other type of specification.
|
||||||
|
|
||||||
|
if [ x$1 = x ]
|
||||||
|
then
|
||||||
|
echo Configuration name missing. 1>&2
|
||||||
|
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||||
|
echo "or $0 ALIAS" 1>&2
|
||||||
|
echo where ALIAS is a recognized configuration type. 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# First pass through any local machine types.
|
||||||
|
case $1 in
|
||||||
|
*local*)
|
||||||
|
echo $1
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Separate what the user gave into CPU-COMPANY and OS (if any).
|
||||||
|
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||||
|
if [ $basic_machine != $1 ]
|
||||||
|
then os=`echo $1 | sed 's/.*-/-/'`
|
||||||
|
else os=; fi
|
||||||
|
|
||||||
|
### Let's recognize common machines as not being operating systems so
|
||||||
|
### that things like config.sub decstation-3100 work. We also
|
||||||
|
### recognize some manufacturers as not being operating systems, so we
|
||||||
|
### can provide default operating systems below.
|
||||||
|
case $os in
|
||||||
|
-sun*os*)
|
||||||
|
# Prevent following clause from handling this invalid input.
|
||||||
|
;;
|
||||||
|
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
|
||||||
|
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
|
||||||
|
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||||
|
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||||
|
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||||
|
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
|
||||||
|
os=
|
||||||
|
basic_machine=$1
|
||||||
|
;;
|
||||||
|
-hiux*)
|
||||||
|
os=-hiuxwe2
|
||||||
|
;;
|
||||||
|
-sco4)
|
||||||
|
os=-sco3.2v4
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||||
|
;;
|
||||||
|
-sco3.2.[4-9]*)
|
||||||
|
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||||
|
;;
|
||||||
|
-sco3.2v[4-9]*)
|
||||||
|
# Don't forget version if it is 3.2v4 or newer.
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||||
|
;;
|
||||||
|
-sco*)
|
||||||
|
os=-sco3.2v2
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||||
|
;;
|
||||||
|
-isc)
|
||||||
|
os=-isc2.2
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||||
|
;;
|
||||||
|
-clix*)
|
||||||
|
basic_machine=clipper-intergraph
|
||||||
|
;;
|
||||||
|
-isc*)
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||||
|
;;
|
||||||
|
-lynx*)
|
||||||
|
os=-lynxos
|
||||||
|
;;
|
||||||
|
-ptx*)
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
|
||||||
|
;;
|
||||||
|
-windowsnt*)
|
||||||
|
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Decode aliases for certain CPU-COMPANY combinations.
|
||||||
|
case $basic_machine in
|
||||||
|
# Recognize the basic CPU types without company name.
|
||||||
|
# Some are omitted here because they have special meanings below.
|
||||||
|
tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
|
||||||
|
| arme[lb] | pyramid \
|
||||||
|
| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
|
||||||
|
| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
|
||||||
|
| powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
|
||||||
|
| pdp11 | mips64el | mips64orion | mips64orionel \
|
||||||
|
| sparc)
|
||||||
|
basic_machine=$basic_machine-unknown
|
||||||
|
;;
|
||||||
|
# Object if more than one company name word.
|
||||||
|
*-*-*)
|
||||||
|
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
# Recognize the basic CPU types with company name.
|
||||||
|
vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
|
||||||
|
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
|
||||||
|
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
|
||||||
|
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
|
||||||
|
| hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
|
||||||
|
| pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
|
||||||
|
| pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
|
||||||
|
| mips64el-* | mips64orion-* | mips64orionel-*)
|
||||||
|
;;
|
||||||
|
# Recognize the various machine names and aliases which stand
|
||||||
|
# for a CPU type and a company and sometimes even an OS.
|
||||||
|
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||||
|
basic_machine=m68000-att
|
||||||
|
;;
|
||||||
|
3b*)
|
||||||
|
basic_machine=we32k-att
|
||||||
|
;;
|
||||||
|
alliant | fx80)
|
||||||
|
basic_machine=fx80-alliant
|
||||||
|
;;
|
||||||
|
altos | altos3068)
|
||||||
|
basic_machine=m68k-altos
|
||||||
|
;;
|
||||||
|
am29k)
|
||||||
|
basic_machine=a29k-none
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
amdahl)
|
||||||
|
basic_machine=580-amdahl
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
amiga | amiga-*)
|
||||||
|
basic_machine=m68k-cbm
|
||||||
|
;;
|
||||||
|
amigados)
|
||||||
|
basic_machine=m68k-cbm
|
||||||
|
os=-amigados
|
||||||
|
;;
|
||||||
|
amigaunix | amix)
|
||||||
|
basic_machine=m68k-cbm
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
|
apollo68)
|
||||||
|
basic_machine=m68k-apollo
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
balance)
|
||||||
|
basic_machine=ns32k-sequent
|
||||||
|
os=-dynix
|
||||||
|
;;
|
||||||
|
convex-c1)
|
||||||
|
basic_machine=c1-convex
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
convex-c2)
|
||||||
|
basic_machine=c2-convex
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
convex-c32)
|
||||||
|
basic_machine=c32-convex
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
convex-c34)
|
||||||
|
basic_machine=c34-convex
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
convex-c38)
|
||||||
|
basic_machine=c38-convex
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
cray | ymp)
|
||||||
|
basic_machine=ymp-cray
|
||||||
|
os=-unicos
|
||||||
|
;;
|
||||||
|
cray2)
|
||||||
|
basic_machine=cray2-cray
|
||||||
|
os=-unicos
|
||||||
|
;;
|
||||||
|
crds | unos)
|
||||||
|
basic_machine=m68k-crds
|
||||||
|
;;
|
||||||
|
da30 | da30-*)
|
||||||
|
basic_machine=m68k-da30
|
||||||
|
;;
|
||||||
|
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
|
||||||
|
basic_machine=mips-dec
|
||||||
|
;;
|
||||||
|
delta | 3300 | motorola-3300 | motorola-delta \
|
||||||
|
| 3300-motorola | delta-motorola)
|
||||||
|
basic_machine=m68k-motorola
|
||||||
|
;;
|
||||||
|
delta88)
|
||||||
|
basic_machine=m88k-motorola
|
||||||
|
os=-sysv3
|
||||||
|
;;
|
||||||
|
dpx20 | dpx20-*)
|
||||||
|
basic_machine=rs6000-bull
|
||||||
|
os=-bosx
|
||||||
|
;;
|
||||||
|
dpx2* | dpx2*-bull)
|
||||||
|
basic_machine=m68k-bull
|
||||||
|
os=-sysv3
|
||||||
|
;;
|
||||||
|
ebmon29k)
|
||||||
|
basic_machine=a29k-amd
|
||||||
|
os=-ebmon
|
||||||
|
;;
|
||||||
|
elxsi)
|
||||||
|
basic_machine=elxsi-elxsi
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
encore | umax | mmax)
|
||||||
|
basic_machine=ns32k-encore
|
||||||
|
;;
|
||||||
|
fx2800)
|
||||||
|
basic_machine=i860-alliant
|
||||||
|
;;
|
||||||
|
genix)
|
||||||
|
basic_machine=ns32k-ns
|
||||||
|
;;
|
||||||
|
gmicro)
|
||||||
|
basic_machine=tron-gmicro
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
h3050r* | hiux*)
|
||||||
|
basic_machine=hppa1.1-hitachi
|
||||||
|
os=-hiuxwe2
|
||||||
|
;;
|
||||||
|
h8300hms)
|
||||||
|
basic_machine=h8300-hitachi
|
||||||
|
os=-hms
|
||||||
|
;;
|
||||||
|
harris)
|
||||||
|
basic_machine=m88k-harris
|
||||||
|
os=-sysv3
|
||||||
|
;;
|
||||||
|
hp300-*)
|
||||||
|
basic_machine=m68k-hp
|
||||||
|
;;
|
||||||
|
hp300bsd)
|
||||||
|
basic_machine=m68k-hp
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
hp300hpux)
|
||||||
|
basic_machine=m68k-hp
|
||||||
|
os=-hpux
|
||||||
|
;;
|
||||||
|
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||||
|
basic_machine=m68000-hp
|
||||||
|
;;
|
||||||
|
hp9k3[2-9][0-9])
|
||||||
|
basic_machine=m68k-hp
|
||||||
|
;;
|
||||||
|
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||||
|
basic_machine=hppa1.1-hp
|
||||||
|
;;
|
||||||
|
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||||
|
basic_machine=hppa1.0-hp
|
||||||
|
;;
|
||||||
|
i370-ibm* | ibm*)
|
||||||
|
basic_machine=i370-ibm
|
||||||
|
os=-mvs
|
||||||
|
;;
|
||||||
|
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||||
|
i[345]86v32)
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||||
|
os=-sysv32
|
||||||
|
;;
|
||||||
|
i[345]86v4*)
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
|
i[345]86v)
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
i[345]86sol2)
|
||||||
|
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||||
|
os=-solaris2
|
||||||
|
;;
|
||||||
|
iris | iris4d)
|
||||||
|
basic_machine=mips-sgi
|
||||||
|
case $os in
|
||||||
|
-irix*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
os=-irix4
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
isi68 | isi)
|
||||||
|
basic_machine=m68k-isi
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
m88k-omron*)
|
||||||
|
basic_machine=m88k-omron
|
||||||
|
;;
|
||||||
|
magnum | m3230)
|
||||||
|
basic_machine=mips-mips
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
merlin)
|
||||||
|
basic_machine=ns32k-utek
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
miniframe)
|
||||||
|
basic_machine=m68000-convergent
|
||||||
|
;;
|
||||||
|
mips3*-*)
|
||||||
|
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
|
||||||
|
;;
|
||||||
|
mips3*)
|
||||||
|
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||||
|
;;
|
||||||
|
ncr3000)
|
||||||
|
basic_machine=i486-ncr
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
|
news | news700 | news800 | news900)
|
||||||
|
basic_machine=m68k-sony
|
||||||
|
os=-newsos
|
||||||
|
;;
|
||||||
|
news1000)
|
||||||
|
basic_machine=m68030-sony
|
||||||
|
os=-newsos
|
||||||
|
;;
|
||||||
|
news-3600 | risc-news)
|
||||||
|
basic_machine=mips-sony
|
||||||
|
os=-newsos
|
||||||
|
;;
|
||||||
|
next | m*-next )
|
||||||
|
basic_machine=m68k-next
|
||||||
|
case $os in
|
||||||
|
-nextstep* )
|
||||||
|
;;
|
||||||
|
-ns2*)
|
||||||
|
os=-nextstep2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
os=-nextstep3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
nh3000)
|
||||||
|
basic_machine=m68k-harris
|
||||||
|
os=-cxux
|
||||||
|
;;
|
||||||
|
nh[45]000)
|
||||||
|
basic_machine=m88k-harris
|
||||||
|
os=-cxux
|
||||||
|
;;
|
||||||
|
nindy960)
|
||||||
|
basic_machine=i960-intel
|
||||||
|
os=-nindy
|
||||||
|
;;
|
||||||
|
np1)
|
||||||
|
basic_machine=np1-gould
|
||||||
|
;;
|
||||||
|
pa-hitachi)
|
||||||
|
basic_machine=hppa1.1-hitachi
|
||||||
|
os=-hiuxwe2
|
||||||
|
;;
|
||||||
|
paragon)
|
||||||
|
basic_machine=i860-intel
|
||||||
|
os=-osf
|
||||||
|
;;
|
||||||
|
pbd)
|
||||||
|
basic_machine=sparc-tti
|
||||||
|
;;
|
||||||
|
pbb)
|
||||||
|
basic_machine=m68k-tti
|
||||||
|
;;
|
||||||
|
pc532 | pc532-*)
|
||||||
|
basic_machine=ns32k-pc532
|
||||||
|
;;
|
||||||
|
pentium | p5 | p6)
|
||||||
|
# We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
|
||||||
|
basic_machine=i586-intel
|
||||||
|
;;
|
||||||
|
pentium-* | p5-* | p6-*)
|
||||||
|
# We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
|
||||||
|
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
k5)
|
||||||
|
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||||
|
basic_machine=i586-amd
|
||||||
|
;;
|
||||||
|
nexen)
|
||||||
|
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
||||||
|
basic_machine=i586-nexgen
|
||||||
|
;;
|
||||||
|
pn)
|
||||||
|
basic_machine=pn-gould
|
||||||
|
;;
|
||||||
|
power) basic_machine=rs6000-ibm
|
||||||
|
;;
|
||||||
|
ppc) basic_machine=powerpc-unknown
|
||||||
|
;;
|
||||||
|
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
ppcle | powerpclittle | ppc-le | powerpc-little)
|
||||||
|
basic_machine=powerpcle-unknown
|
||||||
|
;;
|
||||||
|
ppcle-* | powerpclittle-*)
|
||||||
|
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||||
|
;;
|
||||||
|
ps2)
|
||||||
|
basic_machine=i386-ibm
|
||||||
|
;;
|
||||||
|
rm[46]00)
|
||||||
|
basic_machine=mips-siemens
|
||||||
|
;;
|
||||||
|
rtpc | rtpc-*)
|
||||||
|
basic_machine=romp-ibm
|
||||||
|
;;
|
||||||
|
sequent)
|
||||||
|
basic_machine=i386-sequent
|
||||||
|
;;
|
||||||
|
sh)
|
||||||
|
basic_machine=sh-hitachi
|
||||||
|
os=-hms
|
||||||
|
;;
|
||||||
|
sps7)
|
||||||
|
basic_machine=m68k-bull
|
||||||
|
os=-sysv2
|
||||||
|
;;
|
||||||
|
spur)
|
||||||
|
basic_machine=spur-unknown
|
||||||
|
;;
|
||||||
|
sun2)
|
||||||
|
basic_machine=m68000-sun
|
||||||
|
;;
|
||||||
|
sun2os3)
|
||||||
|
basic_machine=m68000-sun
|
||||||
|
os=-sunos3
|
||||||
|
;;
|
||||||
|
sun2os4)
|
||||||
|
basic_machine=m68000-sun
|
||||||
|
os=-sunos4
|
||||||
|
;;
|
||||||
|
sun3os3)
|
||||||
|
basic_machine=m68k-sun
|
||||||
|
os=-sunos3
|
||||||
|
;;
|
||||||
|
sun3os4)
|
||||||
|
basic_machine=m68k-sun
|
||||||
|
os=-sunos4
|
||||||
|
;;
|
||||||
|
sun4os3)
|
||||||
|
basic_machine=sparc-sun
|
||||||
|
os=-sunos3
|
||||||
|
;;
|
||||||
|
sun4os4)
|
||||||
|
basic_machine=sparc-sun
|
||||||
|
os=-sunos4
|
||||||
|
;;
|
||||||
|
sun4sol2)
|
||||||
|
basic_machine=sparc-sun
|
||||||
|
os=-solaris2
|
||||||
|
;;
|
||||||
|
sun3 | sun3-*)
|
||||||
|
basic_machine=m68k-sun
|
||||||
|
;;
|
||||||
|
sun4)
|
||||||
|
basic_machine=sparc-sun
|
||||||
|
;;
|
||||||
|
sun386 | sun386i | roadrunner)
|
||||||
|
basic_machine=i386-sun
|
||||||
|
;;
|
||||||
|
symmetry)
|
||||||
|
basic_machine=i386-sequent
|
||||||
|
os=-dynix
|
||||||
|
;;
|
||||||
|
tower | tower-32)
|
||||||
|
basic_machine=m68k-ncr
|
||||||
|
;;
|
||||||
|
udi29k)
|
||||||
|
basic_machine=a29k-amd
|
||||||
|
os=-udi
|
||||||
|
;;
|
||||||
|
ultra3)
|
||||||
|
basic_machine=a29k-nyu
|
||||||
|
os=-sym1
|
||||||
|
;;
|
||||||
|
vaxv)
|
||||||
|
basic_machine=vax-dec
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
vms)
|
||||||
|
basic_machine=vax-dec
|
||||||
|
os=-vms
|
||||||
|
;;
|
||||||
|
vxworks960)
|
||||||
|
basic_machine=i960-wrs
|
||||||
|
os=-vxworks
|
||||||
|
;;
|
||||||
|
vxworks68)
|
||||||
|
basic_machine=m68k-wrs
|
||||||
|
os=-vxworks
|
||||||
|
;;
|
||||||
|
vxworks29k)
|
||||||
|
basic_machine=a29k-wrs
|
||||||
|
os=-vxworks
|
||||||
|
;;
|
||||||
|
xmp)
|
||||||
|
basic_machine=xmp-cray
|
||||||
|
os=-unicos
|
||||||
|
;;
|
||||||
|
xps | xps100)
|
||||||
|
basic_machine=xps100-honeywell
|
||||||
|
;;
|
||||||
|
none)
|
||||||
|
basic_machine=none-none
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
|
|
||||||
|
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||||
|
# some cases the only manufacturer, in others, it is the most popular.
|
||||||
|
mips)
|
||||||
|
basic_machine=mips-mips
|
||||||
|
;;
|
||||||
|
romp)
|
||||||
|
basic_machine=romp-ibm
|
||||||
|
;;
|
||||||
|
rs6000)
|
||||||
|
basic_machine=rs6000-ibm
|
||||||
|
;;
|
||||||
|
vax)
|
||||||
|
basic_machine=vax-dec
|
||||||
|
;;
|
||||||
|
pdp11)
|
||||||
|
basic_machine=pdp11-dec
|
||||||
|
;;
|
||||||
|
we32k)
|
||||||
|
basic_machine=we32k-att
|
||||||
|
;;
|
||||||
|
sparc)
|
||||||
|
basic_machine=sparc-sun
|
||||||
|
;;
|
||||||
|
cydra)
|
||||||
|
basic_machine=cydra-cydrome
|
||||||
|
;;
|
||||||
|
orion)
|
||||||
|
basic_machine=orion-highlevel
|
||||||
|
;;
|
||||||
|
orion105)
|
||||||
|
basic_machine=clipper-highlevel
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Here we canonicalize certain aliases for manufacturers.
|
||||||
|
case $basic_machine in
|
||||||
|
*-digital*)
|
||||||
|
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
|
||||||
|
;;
|
||||||
|
*-commodore*)
|
||||||
|
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Decode manufacturer-specific aliases for certain operating systems.
|
||||||
|
|
||||||
|
if [ x"$os" != x"" ]
|
||||||
|
then
|
||||||
|
case $os in
|
||||||
|
# -solaris* is a basic system type, with this one exception.
|
||||||
|
-solaris1 | -solaris1.*)
|
||||||
|
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||||
|
;;
|
||||||
|
-solaris)
|
||||||
|
os=-solaris2
|
||||||
|
;;
|
||||||
|
-unixware* | svr4*)
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
|
-gnu/linux*)
|
||||||
|
os=`echo $os | sed -e 's|gnu/linux|linux|'`
|
||||||
|
;;
|
||||||
|
# First accept the basic system types.
|
||||||
|
# The portable systems comes first.
|
||||||
|
# Each alternative MUST END IN A *, to match a version number.
|
||||||
|
# -sysv* is not here because it comes later, after sysvr4.
|
||||||
|
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||||
|
| -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
|
||||||
|
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||||
|
| -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
|
||||||
|
| -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
|
||||||
|
| -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||||
|
| -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
|
||||||
|
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||||
|
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||||
|
| -udi* | -eabi* | -lites* )
|
||||||
|
# Remember, each alternative MUST END IN *, to match a version number.
|
||||||
|
;;
|
||||||
|
-sunos5*)
|
||||||
|
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||||
|
;;
|
||||||
|
-sunos6*)
|
||||||
|
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||||
|
;;
|
||||||
|
-osfrose*)
|
||||||
|
os=-osfrose
|
||||||
|
;;
|
||||||
|
-osf*)
|
||||||
|
os=-osf
|
||||||
|
;;
|
||||||
|
-utek*)
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
-dynix*)
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
-acis*)
|
||||||
|
os=-aos
|
||||||
|
;;
|
||||||
|
-ctix* | -uts*)
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
# Preserve the version number of sinix5.
|
||||||
|
-sinix5.*)
|
||||||
|
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||||
|
;;
|
||||||
|
-sinix*)
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
|
-triton*)
|
||||||
|
os=-sysv3
|
||||||
|
;;
|
||||||
|
-oss*)
|
||||||
|
os=-sysv3
|
||||||
|
;;
|
||||||
|
-svr4)
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
|
-svr3)
|
||||||
|
os=-sysv3
|
||||||
|
;;
|
||||||
|
-sysvr4)
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
|
# This must come after -sysvr4.
|
||||||
|
-sysv*)
|
||||||
|
;;
|
||||||
|
-xenix)
|
||||||
|
os=-xenix
|
||||||
|
;;
|
||||||
|
-none)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Get rid of the `-' at the beginning of $os.
|
||||||
|
os=`echo $os | sed 's/[^-]*-//'`
|
||||||
|
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
|
||||||
|
# Here we handle the default operating systems that come with various machines.
|
||||||
|
# The value should be what the vendor currently ships out the door with their
|
||||||
|
# machine or put another way, the most popular os provided with the machine.
|
||||||
|
|
||||||
|
# Note that if you're going to try to match "-MANUFACTURER" here (say,
|
||||||
|
# "-sun"), then you have to tell the case statement up towards the top
|
||||||
|
# that MANUFACTURER isn't an operating system. Otherwise, code above
|
||||||
|
# will signal an error saying that MANUFACTURER isn't an operating
|
||||||
|
# system, and we'll never get to this point.
|
||||||
|
|
||||||
|
case $basic_machine in
|
||||||
|
*-acorn)
|
||||||
|
os=-riscix1.2
|
||||||
|
;;
|
||||||
|
arm*-semi)
|
||||||
|
os=-aout
|
||||||
|
;;
|
||||||
|
pdp11-*)
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
|
*-dec | vax-*)
|
||||||
|
os=-ultrix4.2
|
||||||
|
;;
|
||||||
|
m68*-apollo)
|
||||||
|
os=-domain
|
||||||
|
;;
|
||||||
|
i386-sun)
|
||||||
|
os=-sunos4.0.2
|
||||||
|
;;
|
||||||
|
m68000-sun)
|
||||||
|
os=-sunos3
|
||||||
|
# This also exists in the configure program, but was not the
|
||||||
|
# default.
|
||||||
|
# os=-sunos4
|
||||||
|
;;
|
||||||
|
*-tti) # must be before sparc entry or we get the wrong os.
|
||||||
|
os=-sysv3
|
||||||
|
;;
|
||||||
|
sparc-* | *-sun)
|
||||||
|
os=-sunos4.1.1
|
||||||
|
;;
|
||||||
|
*-ibm)
|
||||||
|
os=-aix
|
||||||
|
;;
|
||||||
|
*-hp)
|
||||||
|
os=-hpux
|
||||||
|
;;
|
||||||
|
*-hitachi)
|
||||||
|
os=-hiux
|
||||||
|
;;
|
||||||
|
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
*-cbm)
|
||||||
|
os=-amigados
|
||||||
|
;;
|
||||||
|
*-dg)
|
||||||
|
os=-dgux
|
||||||
|
;;
|
||||||
|
*-dolphin)
|
||||||
|
os=-sysv3
|
||||||
|
;;
|
||||||
|
m68k-ccur)
|
||||||
|
os=-rtu
|
||||||
|
;;
|
||||||
|
m88k-omron*)
|
||||||
|
os=-luna
|
||||||
|
;;
|
||||||
|
*-sequent)
|
||||||
|
os=-ptx
|
||||||
|
;;
|
||||||
|
*-crds)
|
||||||
|
os=-unos
|
||||||
|
;;
|
||||||
|
*-ns)
|
||||||
|
os=-genix
|
||||||
|
;;
|
||||||
|
i370-*)
|
||||||
|
os=-mvs
|
||||||
|
;;
|
||||||
|
*-next)
|
||||||
|
os=-nextstep3
|
||||||
|
;;
|
||||||
|
*-gould)
|
||||||
|
os=-sysv
|
||||||
|
;;
|
||||||
|
*-highlevel)
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
*-encore)
|
||||||
|
os=-bsd
|
||||||
|
;;
|
||||||
|
*-sgi)
|
||||||
|
os=-irix
|
||||||
|
;;
|
||||||
|
*-siemens)
|
||||||
|
os=-sysv4
|
||||||
|
;;
|
||||||
|
*-masscomp)
|
||||||
|
os=-rtu
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
os=-none
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Here we handle the case where we know the os, and the CPU type, but not the
|
||||||
|
# manufacturer. We pick the logical manufacturer.
|
||||||
|
vendor=unknown
|
||||||
|
case $basic_machine in
|
||||||
|
*-unknown)
|
||||||
|
case $os in
|
||||||
|
-riscix*)
|
||||||
|
vendor=acorn
|
||||||
|
;;
|
||||||
|
-sunos*)
|
||||||
|
vendor=sun
|
||||||
|
;;
|
||||||
|
-lynxos*)
|
||||||
|
vendor=lynx
|
||||||
|
;;
|
||||||
|
-aix*)
|
||||||
|
vendor=ibm
|
||||||
|
;;
|
||||||
|
-hpux*)
|
||||||
|
vendor=hp
|
||||||
|
;;
|
||||||
|
-hiux*)
|
||||||
|
vendor=hitachi
|
||||||
|
;;
|
||||||
|
-unos*)
|
||||||
|
vendor=crds
|
||||||
|
;;
|
||||||
|
-dgux*)
|
||||||
|
vendor=dg
|
||||||
|
;;
|
||||||
|
-luna*)
|
||||||
|
vendor=omron
|
||||||
|
;;
|
||||||
|
-genix*)
|
||||||
|
vendor=ns
|
||||||
|
;;
|
||||||
|
-mvs*)
|
||||||
|
vendor=ibm
|
||||||
|
;;
|
||||||
|
-ptx*)
|
||||||
|
vendor=sequent
|
||||||
|
;;
|
||||||
|
-vxworks*)
|
||||||
|
vendor=wrs
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo $basic_machine$os
|
393
configure.in
Executable file
393
configure.in
Executable file
@ -0,0 +1,393 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
|
AC_INIT(src/mosaic.h)
|
||||||
|
AC_CONFIG_HEADER(config.h)
|
||||||
|
|
||||||
|
AC_DEFINE(PRERELEASE)
|
||||||
|
AC_DEFINE(XMOSAIC)
|
||||||
|
|
||||||
|
dnl Checks for programs.
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
AC_PROG_MAKE_SET
|
||||||
|
AC_PROG_RANLIB
|
||||||
|
AC_CHECK_PROG(AR, ar, ar)
|
||||||
|
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for machine dependent stuff)
|
||||||
|
echo ""
|
||||||
|
dnl Get system information and then set some flags based on that info
|
||||||
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
|
machine=''
|
||||||
|
case "${host}" in
|
||||||
|
*-linux* )
|
||||||
|
machine=linux
|
||||||
|
AC_DEFINE(LINUX)
|
||||||
|
LIBS="-L/usr/X11R6/lib ${LIBS}"
|
||||||
|
;;
|
||||||
|
|
||||||
|
alpha-*-* )
|
||||||
|
machine=alpha
|
||||||
|
;;
|
||||||
|
|
||||||
|
*-bsdi* )
|
||||||
|
;;
|
||||||
|
|
||||||
|
*-dec-ultrix* )
|
||||||
|
machine=dec
|
||||||
|
AC_DEFINE(BROKEN_MOTIF)
|
||||||
|
;;
|
||||||
|
|
||||||
|
*-dg-dgux* )
|
||||||
|
machine=dgux
|
||||||
|
AC_DEFINE(DGUX)
|
||||||
|
AC_DEFINE(SVR4)
|
||||||
|
;;
|
||||||
|
|
||||||
|
*-hp-hpux* )
|
||||||
|
machine=hp
|
||||||
|
AC_DEFINE(_HPUX_SOURCE)
|
||||||
|
syslibs=-Aa
|
||||||
|
;;
|
||||||
|
|
||||||
|
*-ibm-aix* )
|
||||||
|
machine=ibm
|
||||||
|
AC_DEFINE(_BSD)
|
||||||
|
;;
|
||||||
|
|
||||||
|
*-sgi-irix5* )
|
||||||
|
machine=sgi
|
||||||
|
AC_DEFINE(MO_IRIX5)
|
||||||
|
;;
|
||||||
|
|
||||||
|
sparc-sun-solaris23 | m68*-sun-solaris23 )
|
||||||
|
machine=solaris
|
||||||
|
AC_DEFINE(SVR4)
|
||||||
|
AC_DEFINE(SOLARIS23)
|
||||||
|
;;
|
||||||
|
|
||||||
|
sparc-sun-solaris24 | m68-sun-solaris24 )
|
||||||
|
machine=solaris
|
||||||
|
AC_DEFINE(SVR4)
|
||||||
|
AC_DEFINE(SOLARIS24)
|
||||||
|
;;
|
||||||
|
|
||||||
|
i[345]86-sun-solaris-2* )
|
||||||
|
machine=solaris
|
||||||
|
AC_DEFINE(SVR4)
|
||||||
|
AC_DEFINE(SOLARIS24X86)
|
||||||
|
;;
|
||||||
|
|
||||||
|
*-sun-sunos* )
|
||||||
|
machine=sun
|
||||||
|
AC_DEFINE(SUN)
|
||||||
|
AC_DEFINE(SVR4)
|
||||||
|
AC_DEFINE(BROKEN_MOTIF)
|
||||||
|
;;
|
||||||
|
|
||||||
|
*-next-* )
|
||||||
|
machine=next
|
||||||
|
AC_DEFINE(NEXT)
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
dnl Checks for header files.
|
||||||
|
AC_PATH_X
|
||||||
|
AC_HEADER_DIRENT
|
||||||
|
AC_HEADER_STDC
|
||||||
|
AC_HEADER_SYS_WAIT
|
||||||
|
AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/ioctl.h sys/time.h termio.h unistd.h)
|
||||||
|
|
||||||
|
dnl Check for regular libs
|
||||||
|
AC_CHECK_LIB(m, pow)
|
||||||
|
AC_CHECK_LIB(nsl, gethostname)
|
||||||
|
AC_CHECK_LIB(gen, regex)
|
||||||
|
AC_CHECK_LIB(socket, getsockopt)
|
||||||
|
AC_CHECK_LIB(PW, Freeend)
|
||||||
|
AC_CHECK_LIB(ipc, ipc_chains)
|
||||||
|
|
||||||
|
dnl Checks for X11 libraries.
|
||||||
|
AC_CHECK_LIB(X11, XSendEvent)
|
||||||
|
AC_CHECK_LIB(Xpm, _XpmFreeXpmImage)
|
||||||
|
AC_CHECK_LIB(ICE, IceProcessMessages)
|
||||||
|
AC_CHECK_LIB(SM, SmcCloseConnection)
|
||||||
|
AC_CHECK_LIB(Xext, XShapeQueryExtension)
|
||||||
|
AC_CHECK_LIB(Xt, XtAppMainLoop)
|
||||||
|
AC_CHECK_LIB(Xmu, _XEditResCheckMessages)
|
||||||
|
AC_CHECK_LIB(Xm, XmCreatePushButton, [
|
||||||
|
AC_DEFINE(MOTIF)
|
||||||
|
LIBS="-lXm ${LIBS}"
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
AC_C_CONST
|
||||||
|
AC_TYPE_OFF_T
|
||||||
|
AC_TYPE_PID_T
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
AC_HEADER_TIME
|
||||||
|
AC_STRUCT_TM
|
||||||
|
AC_TYPE_UID_T
|
||||||
|
|
||||||
|
dnl Checks for library functions.
|
||||||
|
AC_TYPE_GETGROUPS
|
||||||
|
AC_PROG_GCC_TRADITIONAL
|
||||||
|
AC_TYPE_SIGNAL
|
||||||
|
AC_FUNC_VFORK
|
||||||
|
AC_FUNC_VPRINTF
|
||||||
|
AC_FUNC_WAIT3
|
||||||
|
AC_CHECK_FUNCS(gethostname gethostbyname mkdir socket strftime strstr uname)
|
||||||
|
|
||||||
|
dnl Now we try to set up all the external software mosaic uses
|
||||||
|
dnl as smartly as possible.
|
||||||
|
AC_MSG_CHECKING(for external software)
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for jpeg software)
|
||||||
|
AC_ARG_WITH(jpegdir,
|
||||||
|
[ --with-jpegdir=DIR the directory where the built jpeg library resides ],
|
||||||
|
[
|
||||||
|
dnl We got a dir make sure we got the header and library
|
||||||
|
|
||||||
|
if test -d ${withval} ; then
|
||||||
|
if test -r ${withval}/libjpeg.a ; then
|
||||||
|
LIBS="${withval}/libjpeg.a ${LIBS}"
|
||||||
|
else
|
||||||
|
if test -r ${withval}/lib/libjpeg.a ; then
|
||||||
|
LIBS="${withval}/lib/libjpeg.a ${LIBS}"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR(Could not find libjpeg.a in ${withval})
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -r ${withval}/jpeglib.h ; then
|
||||||
|
CPPFLAGS="${CPPFLAGS} -I${withval}"
|
||||||
|
else
|
||||||
|
if test -r ${withval}/include/jpeglib.h ; then
|
||||||
|
CPPFLAGS="${CPPFLAGS} -I${withval}/include"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR(Could not find jpeglib.h in ${withval})
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(not)
|
||||||
|
AC_MSG_ERROR(Couldn't find the specified jpeg dir: ${withval})
|
||||||
|
fi
|
||||||
|
dnl Now we think we got it so lets check
|
||||||
|
AC_TRY_LINK([#include<stdio.h>
|
||||||
|
#include "jpeglib.h"],
|
||||||
|
[jpeg_read_raw_data(NULL, NULL, 0)],
|
||||||
|
[AC_DEFINE(HAVE_JPEG)
|
||||||
|
AC_MSG_RESULT(found)],
|
||||||
|
[AC_MSG_RESULT(not found)
|
||||||
|
AC_MSG_ERROR(Couldn't find jpeg stuff in ${withval})])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
echo ""
|
||||||
|
echo "Uh oh, you didn't include jpeg. Doing this will greatly"
|
||||||
|
echo "increase your surfing pleasure. You can get it from these places:"
|
||||||
|
echo "ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6a.tar.gz"
|
||||||
|
echo "ftp://ftp.cs.wisc.edu/pub/ghost/jpegsrc.v6a.tar.gz"
|
||||||
|
echo ""
|
||||||
|
echo "If you go get it and build it, putting it into mosaic"
|
||||||
|
echo "is as simple as doing this: "
|
||||||
|
echo "./configure --with-jpegdir=/dir/where/you/installed/jpeg"
|
||||||
|
echo ""
|
||||||
|
echo "or take a look at the config script and edit the jpegdir field."
|
||||||
|
echo "Then you just run:"
|
||||||
|
echo "./config"
|
||||||
|
echo ""
|
||||||
|
echo "Would you like to configure to stop now so you can go get jpeg?"
|
||||||
|
echo "(yes or no)"
|
||||||
|
read ans
|
||||||
|
|
||||||
|
case "${ans}" in
|
||||||
|
"y" | "ye" | "yes")
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl Before we check for png lets make sure we can find libz
|
||||||
|
AC_MSG_CHECKING(for libz)
|
||||||
|
|
||||||
|
dnl We need libz after libpng in the link line but we have to check it
|
||||||
|
dnl before we check libpng, this variable does the magic
|
||||||
|
lib_save=${LIBS}
|
||||||
|
|
||||||
|
AC_ARG_WITH(zdir,
|
||||||
|
[ --with-zdir=DIR the directory where the built z library resides ],
|
||||||
|
[
|
||||||
|
dnl We got a dir make sure we got the library
|
||||||
|
if test -d ${withval} ; then
|
||||||
|
if test -r ${withval}/libz.a ; then
|
||||||
|
LIBS="${withval}/libz.a ${LIBS}"
|
||||||
|
libz="${withval}/libz.a"
|
||||||
|
else
|
||||||
|
if test -r ${withval}/lib/libz.a ; then
|
||||||
|
LIBS="${withval}/lib/libz.a ${LIBS}"
|
||||||
|
libz="${withval}/lib/libz.a"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR(Could not find libz.a in ${withval})
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR(Couldn't find the specified zlib dir: ${withval})
|
||||||
|
fi
|
||||||
|
dnl Now we think we got it so lets check
|
||||||
|
AC_TRY_LINK([#include<stdio.h>],
|
||||||
|
[inflate();],
|
||||||
|
[AC_DEFINE(HAVE_PNG)
|
||||||
|
AC_MSG_RESULT(got it)
|
||||||
|
have_z="yes"],
|
||||||
|
[AC_MSG_RESULT(not found)
|
||||||
|
AC_MSG_ERROR(Couldn't find png stuff in ${withval})])
|
||||||
|
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_MSG_RESULT(not)
|
||||||
|
])
|
||||||
|
|
||||||
|
LIBS=${lib_save}
|
||||||
|
|
||||||
|
if test "${have_z}" = "yes" ; then
|
||||||
|
AC_MSG_CHECKING(for png)
|
||||||
|
AC_ARG_WITH(pngdir,
|
||||||
|
[ --with-pngdir=DIR the directory where the built png library resides ],
|
||||||
|
[
|
||||||
|
dnl We got a dir make sure we got the header and library
|
||||||
|
if test -d ${withval} ; then
|
||||||
|
if test -r ${withval}/libpng.a ; then
|
||||||
|
LIBS="${withval}/libpng.a ${libz} ${LIBS}"
|
||||||
|
else
|
||||||
|
if test -r ${withval}/lib/libpng.a ; then
|
||||||
|
LIBS="${withval}/lib/libpng.a ${libz} ${LIBS}"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR(Could not find libpng.a in ${withval})
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -r ${withval}/png.h ; then
|
||||||
|
CPPFLAGS="$CPPFLAGS -I${withval}"
|
||||||
|
else
|
||||||
|
if test -r ${withval}/include/png.h ; then
|
||||||
|
CPPFLAGS="$CPPFLAGS -I${withval}/include"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR(Could not find png.h in ${withval})
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(not found)
|
||||||
|
AC_MSG_ERROR(Couldn't find the specified png dir: ${withval})
|
||||||
|
fi
|
||||||
|
dnl Now we think we got it so lets check
|
||||||
|
AC_TRY_LINK([#include<stdio.h>
|
||||||
|
#include "png.h"],
|
||||||
|
[png_read_data(NULL, NULL, 0)],
|
||||||
|
[AC_DEFINE(HAVE_PNG)
|
||||||
|
AC_MSG_RESULT(got it)
|
||||||
|
have_png="yes"],
|
||||||
|
[AC_MSG_RESULT(not found)
|
||||||
|
AC_MSG_ERROR(Couldn't find png stuff in ${withval})])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_MSG_RESULT(not found)
|
||||||
|
have_png='no'
|
||||||
|
])
|
||||||
|
else
|
||||||
|
have_png='no'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "${have_png}" = "no" ; then
|
||||||
|
echo ""
|
||||||
|
echo "Uh oh, you didn't include png. This will allow Mosaic to "
|
||||||
|
echo "view png images. You can get it here:"
|
||||||
|
echo "ftp://ftp.uu.net/graphics/png/src"
|
||||||
|
echo "Before you run out and get it you will also need libz which can be"
|
||||||
|
echo "found in the same place."
|
||||||
|
echo ""
|
||||||
|
echo "If you go get and build these things, putting png support into mosaic"
|
||||||
|
echo "is as simple as doing this: "
|
||||||
|
echo "./configure --with-pngdir=/where/you/installed/png --with-zdir=/where/you/installed/zlib"
|
||||||
|
echo ""
|
||||||
|
echo "Or you can just fill in the appropriate fields in the config script"
|
||||||
|
echo "and to this:"
|
||||||
|
echo "./config"
|
||||||
|
echo ""
|
||||||
|
echo "Would you like to configure to stop now so you can go get png/zlib?"
|
||||||
|
echo "(yes or no)"
|
||||||
|
|
||||||
|
read ans
|
||||||
|
|
||||||
|
case "${ans}" in
|
||||||
|
"y" | "ye" | "yes")
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
dnl AC_ARG_WITH(waisdir,
|
||||||
|
dnl [ --with-waisdir=DIR the directory where the built wais library resides dnl ],
|
||||||
|
dnl [ ],
|
||||||
|
dnl [ ])
|
||||||
|
|
||||||
|
dnl AC_ARG_WITH(hdfdir,
|
||||||
|
dnl [ --with-hdfdir=DIR the directory where the built hdf library resides ],
|
||||||
|
dnl [ ],
|
||||||
|
dnl [ ])
|
||||||
|
|
||||||
|
|
||||||
|
dnl dtm support switches
|
||||||
|
AC_ARG_ENABLE(dtm,
|
||||||
|
[ --enable-dtm Used to enable dtm support ],
|
||||||
|
[
|
||||||
|
if test "${withval}" = "yes" ; then
|
||||||
|
dtmdirs='libdtm libnet'
|
||||||
|
else
|
||||||
|
dtmdirs=''
|
||||||
|
fi
|
||||||
|
],
|
||||||
|
[ dtmdirs='' ])
|
||||||
|
|
||||||
|
|
||||||
|
dnl Figure out what version of Motif we have (XMosaic sucks)
|
||||||
|
dnl AC_TRY_LINK(
|
||||||
|
dnl [
|
||||||
|
dnl ],
|
||||||
|
dnl [
|
||||||
|
dnl ],
|
||||||
|
dnl [
|
||||||
|
dnl It worked
|
||||||
|
dnl AC_DEFINE(MOTIF2_0)
|
||||||
|
dnl ],
|
||||||
|
dnl [
|
||||||
|
AC_TRY_LINK(
|
||||||
|
[
|
||||||
|
#include<XmStrDefs.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
int dummy=XmNpositionIndex;
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_DEFINE(MOTIF1_2)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AC_DEFINE(MOTIF1_1)
|
||||||
|
])
|
||||||
|
dnl ])
|
||||||
|
|
||||||
|
AC_SUBST(dtmdirs)
|
||||||
|
|
||||||
|
for i in libwww2 libhtmlw src libnut libXmx libdtm libnet
|
||||||
|
do
|
||||||
|
cd ${i}
|
||||||
|
if test -f Makefile ; then
|
||||||
|
cp Makefile Makefile.bak
|
||||||
|
echo "cp Makefile Makefile.bak"
|
||||||
|
fi
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
|
||||||
|
AC_OUTPUT(Makefile src/Makefile libhtmlw/Makefile libnut/Makefile libwww2/Makefile libXmx/Makefile)
|
609
docs/resources.html
Normal file
609
docs/resources.html
Normal file
@ -0,0 +1,609 @@
|
|||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<I>NCSA Mosaic for the X Window System</I><HR>
|
||||||
|
|
||||||
|
<TITLE>NCSA Mosaic X Resources</TITLE>
|
||||||
|
<owner_name="Mitch Kutzko, mitch@ncsa.uiuc.edu">
|
||||||
|
<LINK REV="made" HREF="mailto:webmaster@ncsa.uiuc.edu">
|
||||||
|
</HEAD>
|
||||||
|
|
||||||
|
<BODY>
|
||||||
|
|
||||||
|
<H1>NCSA Mosaic X Resources</H1>
|
||||||
|
|
||||||
|
The class name for Mosaic for X is <I>Mosaic.</I> If you are unfamiliar
|
||||||
|
with X resources, here is a bit of information on <A
|
||||||
|
HREF="http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/d2-setting-resources.html">how
|
||||||
|
to set X resources.</A> <P>
|
||||||
|
|
||||||
|
Note that for each of the resources listed below, the class name is the
|
||||||
|
same as the resource name except that the first character is capitalized.
|
||||||
|
<P>
|
||||||
|
|
||||||
|
<H2>Functional Resources</H2>
|
||||||
|
|
||||||
|
<DL>
|
||||||
|
<DT> <b><A NAME="annotationsOnTop">annotationsOnTop</A></b>: <i>Boolean</i>
|
||||||
|
<DD> Flag to indicate whether inlined document annotation hyperlinks
|
||||||
|
are prepended to the document (if true) or postpended (if false).
|
||||||
|
Default is false.
|
||||||
|
|
||||||
|
<DT> <b>annotationServer</b>: <i>string</i>
|
||||||
|
<dd> Used for <A HREF="http://www.ncsa.uiuc.edu/SDG/Software/XMosaic/Annotations/overview.html">group annotation support</a>. This resource is the URL of your
|
||||||
|
CGI annotation server.
|
||||||
|
|
||||||
|
<DT> <b>autoPlaceWindows</b>: <i>Boolean</i>
|
||||||
|
<DD> If set to false, new Document
|
||||||
|
View windows will not be automatically positioned by the
|
||||||
|
program itself (but it's still up to your window manager just how
|
||||||
|
they're placed). Default is true.
|
||||||
|
|
||||||
|
|
||||||
|
<DT> <b><A NAME="catchPriorAndNext">catchPriorAndNext</A></b>: <i>Boolean</i>
|
||||||
|
<DD> This resource controls whether use of the keys Prior and Next
|
||||||
|
(Page Up and Page Down on most keyboards) are explicitly caught
|
||||||
|
in the <A NAME=18 HREF="help-on-docview-window.html">Document
|
||||||
|
View</A> window and passed to the vertical scrollbar or whether
|
||||||
|
the normal Motif scrolled window mechanism is relied upon to do
|
||||||
|
that automatically. Default is false, since that's how things
|
||||||
|
are supposed to work, but if you find that Page Up/Page Down
|
||||||
|
aren't doing their jobs for you, set this resource to true.
|
||||||
|
(See also <A NAME=19
|
||||||
|
HREF="docview-viewing-area.html#hotkeys">information on
|
||||||
|
hotkeys</A>.)
|
||||||
|
|
||||||
|
<DT> <b><A NAME="cciPort">cciPort</A></b>: <i>integer</i>
|
||||||
|
<DD> This resource sets the port which Mosaic listens to for <A HREF="CCI/cci-spec.html">CCI</A> instructions.
|
||||||
|
|
||||||
|
<DT> <B>confirmDeleteAnnotation</B>: <I>Boolean</I>
|
||||||
|
<DD> If false, deleting annotations will not be confirmed via a
|
||||||
|
confirmation dialog box. Default is true.
|
||||||
|
|
||||||
|
<DT> <b>confirmExit</b>: <i>Boolean</i>
|
||||||
|
<DD> Whether NCSA Mosaic will pop up a dialog box to confirm
|
||||||
|
exiting the program
|
||||||
|
when the 'Exit Program' menu option is chosen. Default is true.
|
||||||
|
|
||||||
|
<DT> <b>defaultAuthorName</b>: <i>string</i>
|
||||||
|
<DD> String to use as your fullname (e.g., John Q. Public). Your fullname
|
||||||
|
is normally stored in the system password file, and Mosaic will extract
|
||||||
|
it from that if this resource is NULL; else the value of this resource
|
||||||
|
will be used. Default is NULL.
|
||||||
|
|
||||||
|
<DT> <b>defaultHeight</b>: <i>integer</i>
|
||||||
|
<DD> Default height in pixels for a Document View window. Default is 680.
|
||||||
|
|
||||||
|
<DT> <b><A NAME="hotlist-file">defaultHotlistFile</A></b>: <i>string</i>
|
||||||
|
<DD> Name of file to store the
|
||||||
|
<A NAME=6 HREF="help-on-hotlist-view.html">default hotlist</A>
|
||||||
|
(or list of bookmarks).
|
||||||
|
Default is ".mosaic-hotlist-default"; the value
|
||||||
|
of the environment variable $HOME will be prepended to this string.
|
||||||
|
|
||||||
|
<DT> <b>defaultWidth</b>: <i>integer</i>
|
||||||
|
<DD> Default width in pixels for a Document View window. Default is 620.
|
||||||
|
<a name="dil">
|
||||||
|
<DT> <B>delayImageLoads</B>: <I>Boolean</I> </a>
|
||||||
|
<DD> Delayed image loading is for users with slow network connections. If
|
||||||
|
true, Mosaic substitutes a small icon for inlined-images, plus an arrow
|
||||||
|
icon for inlined-images which also act as hyperlinks.
|
||||||
|
<I>Clicking</I> on an icon tells Mosaic to load that inlined-image, while
|
||||||
|
<I>clicking</I> on the arrow is equivalent to following the associated
|
||||||
|
hyperlink. Selecting <I>Load Images in Current</I> from Mosaic's
|
||||||
|
<CODE>Options</CODE> menu loads and displays all of the inlined-images in
|
||||||
|
the current document. Delayed image loading can also be selected with
|
||||||
|
the '-dil' command-line flag, or on a per-window basis from Mosaic's
|
||||||
|
<CODE>Options</CODE> menu. Default is false.
|
||||||
|
|
||||||
|
<DT> <b>displayURLsNotTitles</b>: <i>Boolean</i>
|
||||||
|
<DD> If true, URL's will be displayed everywhere document titles are
|
||||||
|
usually displayed. Default is false.
|
||||||
|
|
||||||
|
<DT> <B>DocsDirectory</B>: <I>string</I>
|
||||||
|
<DD> Can be used to override the location of the help documents. Default is
|
||||||
|
NULL.
|
||||||
|
|
||||||
|
<DT> <B>documentsMenuSpecfile</B>: <I>string</I>
|
||||||
|
<DD> Name of file which holds an optional "Documents Menu Specfile," to allow
|
||||||
|
sites to add their own <CODE>Documents</CODE> menu to Mosaic's menu bar.
|
||||||
|
For more information, see <A HREF="faq-documents-menu.html"> information
|
||||||
|
on creating a configurable <CODE>Documents</CODE> menu.</A> Default is
|
||||||
|
"/usr/local/lib/mosaic/documents.menu"
|
||||||
|
|
||||||
|
<DT> <B>editCommand</B>: <I>string</I>
|
||||||
|
<DD> Name of the editor to load when using the <I>File-Edit Source</I> option.
|
||||||
|
This editor is loaded in an xterm, specified by the
|
||||||
|
<code>xtermCommand</code> resource. Default is vi.
|
||||||
|
|
||||||
|
<DT> <B>editCommandUseXterm</B>: <I>Boolean</I>
|
||||||
|
<DD> This resource specifies that a user's editor requires an xterm before it
|
||||||
|
can be executed. Default is true.
|
||||||
|
|
||||||
|
<DT> <b>fancySelections</b>: <i>Boolean</i>
|
||||||
|
<DD> If true, cut and paste from the Document View window will be done
|
||||||
|
with fancy selections enabled in the HTML widget, which will result
|
||||||
|
in underlined headers, bulleted lists, and so on. If false, normal
|
||||||
|
selection behavior will be used. Default is false. (Note that this
|
||||||
|
can be changed, per window, on the fly.)
|
||||||
|
|
||||||
|
<DT> <B>fullHostname</B>: <I>string</I>
|
||||||
|
<DD> This resource allows explicit setting of the fully qualified hostname
|
||||||
|
for machines that crash on a call to <CODE>gethostbyname().</CODE>
|
||||||
|
The <CODE>fullHostname</CODE> resource should only be used if
|
||||||
|
necessary, in conjunction with <CODE>gethostbynameIsEvil</CODE>.
|
||||||
|
|
||||||
|
<DT> <b><A NAME="ghbnie">gethostbynameIsEvil</A></b>: <i>Boolean</i>
|
||||||
|
<DD> If you are running on a Sun set up such that, when it tries to find
|
||||||
|
out it's own full hostname via gethostbyname(), it coredumps,
|
||||||
|
then you should set this resource to true. Default is false.
|
||||||
|
|
||||||
|
<DT> <B>globalExtensionMap</B>: <I>string</I>
|
||||||
|
<DD> Can be set to the location of the system-wide <A
|
||||||
|
HREF="extension-map.html">extension map</A> config file of your choice.
|
||||||
|
Default is "/usr/local/lib/mosaic/mime.types"
|
||||||
|
|
||||||
|
<DT> <b>globalHistoryFile</b>: <i>string</i>
|
||||||
|
<DD> Name of file to store the global history of all documents visited
|
||||||
|
from session to session. Default is ".mosaic-global-history"; the value
|
||||||
|
of the environment variable $HOME will be prepended to this string.
|
||||||
|
<DT> <B>globalTypeMap</B>: <I>string</I>
|
||||||
|
<DD> Can be set to the location of the system-wide <A
|
||||||
|
HREF="mailcap.html">mailcap</A> (type map config) file of your choice.
|
||||||
|
Default is "/usr/local/lib/mosaic/mailcap"
|
||||||
|
|
||||||
|
<DT> <b>gunzipCommand</b>: <i>string</i>
|
||||||
|
<DD> Command Mosaic uses to uncompress gzip'd files (files with an
|
||||||
|
extension of '.z'). Default is "gunzip -n -f", which requires version
|
||||||
|
1.2.4 of <I>gzip</I>. (Gunzip can be obtained from <A NAME=13
|
||||||
|
HREF="ftp://boole.stanford.edu/pub/">boole.stanford.edu/pub/</A>.)
|
||||||
|
|
||||||
|
<DT> <B>hdfMaxImageDimension</B>: <I>integer</I>
|
||||||
|
<DD>
|
||||||
|
Maximum height and/or width of an <A
|
||||||
|
HREF="http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/hdf-browsing.html">
|
||||||
|
HDF</A> inlined image in pixels. Default is 400.
|
||||||
|
|
||||||
|
<DT> <B>hdfMaxDisplayedDatasets</B>: <I>integer</I>
|
||||||
|
<DD>
|
||||||
|
Maximum number of displayed datasets while browsing <A
|
||||||
|
HREF="http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/hdf-browsing.html">
|
||||||
|
HDF</A> files. Default is 15. If more than the maximum exist in an HDF
|
||||||
|
file, Mosaic will display the HDF file in "brief mode."
|
||||||
|
|
||||||
|
<DT> <B>hdfMaxDisplayedAttributes</B>: <I>integer</I>
|
||||||
|
<DD>
|
||||||
|
Maximum number of displayed attributes while browsing <A
|
||||||
|
HREF="http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/hdf-browsing.html">
|
||||||
|
HDF</A> files. Default is 10. If more than the max exist in an HDF file,
|
||||||
|
Mosaic will display the HDF file in "brief mode."
|
||||||
|
|
||||||
|
<DT> <B>hdfPowerUser</B>: <I>Boolean</I>
|
||||||
|
<DD> If true, most of the supporting text in an HDF file will be removed.
|
||||||
|
Default is false.
|
||||||
|
|
||||||
|
<DT> <b>homeDocument</b>: <i>string</i>
|
||||||
|
<DD> Document to access on program startup. Default is
|
||||||
|
"http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/NCSAMosaicHome.html".
|
||||||
|
See also
|
||||||
|
<A NAME=7 HREF="specifying-home.html">information on specifying your
|
||||||
|
home document</A>.
|
||||||
|
<a name="ics">
|
||||||
|
<DT> <B>imageCacheSize</B>: <I>integer</I> </a>
|
||||||
|
<DD> Used to set the size of the inlined-image cache in kilobytes. The '-ics'
|
||||||
|
command-line flag can also be used. Default is 2048.
|
||||||
|
<UL>
|
||||||
|
<LI> All of the images in a given document will be (temporarily) cached
|
||||||
|
while on that page regardless of the value of imageCacheSize.
|
||||||
|
<LI> Cache flushes <i>least recently viewed</i>.
|
||||||
|
</UL>
|
||||||
|
|
||||||
|
<DT> <b>initialWindowIconic</b>: <i>Boolean</i>
|
||||||
|
<DD> If set to true, the first Document View window opened (when the
|
||||||
|
program starts) will be iconified. Default is false.
|
||||||
|
|
||||||
|
<DT> <b>kiosk</b>: <i>Boolean</i>
|
||||||
|
<DD> If set, this removes the menubar and all control bar options except
|
||||||
|
<i>back, forward, home, and close</i>. Default is false.
|
||||||
|
|
||||||
|
<DT> <b>kioskNoExit</b>: <i>Boolean</i>
|
||||||
|
<DD> If <code>kiosk</code> is true, and this resource is true, then this
|
||||||
|
removes the close button. When true, the user has no way to exit
|
||||||
|
Mosaic (without a window manager or a keyboard). Default is false.
|
||||||
|
|
||||||
|
<DT> <B>maxNumCCIConnect</B>: <I>integer</I>
|
||||||
|
<DD> Controls the maximum number of cci clients communicating with the browser.
|
||||||
|
Default is no limit.
|
||||||
|
|
||||||
|
<DT> <B>maxWaisResponses</B>: <I>integer</I>
|
||||||
|
<DD> Controls maximum number of matches Mosaic gets from a WAIS server.
|
||||||
|
Default is 200.
|
||||||
|
|
||||||
|
<DT> <b><A NAME="personalAnnotationDirectory">personalAnnotationDirectory</A></b>:
|
||||||
|
<i>string</i>
|
||||||
|
<DD> Name of directory in which to store personal annotations (as well
|
||||||
|
as the log file of all personal annotations currently in existence).
|
||||||
|
Default is ".mosaic-personal-annotations"; the value
|
||||||
|
of the environment variable $HOME will be prepended to this string.
|
||||||
|
(If the directory so named does not exist, it will be created;
|
||||||
|
however, intermediate directories, if any are named,
|
||||||
|
will not be created.)
|
||||||
|
|
||||||
|
<DT> <B>personalExtensionMap</B>: <I>string</I>
|
||||||
|
<DD> Can be set to the location of the personal <A
|
||||||
|
HREF="extension-map.html">extension map</A> config file of
|
||||||
|
your choice -- the value of the environment variable HOME is prepended to
|
||||||
|
this. Default is ".mime.types"
|
||||||
|
|
||||||
|
|
||||||
|
<DT> <B>personalTypeMap</B>: <I>string</I>
|
||||||
|
<DD> Can be set to the location of the personal <A
|
||||||
|
HREF="mailcap.html">mailcap</A> file of your choice -- the value of the
|
||||||
|
environment variable <CODE>HOME</CODE> is prepended to this. Default is
|
||||||
|
".mailcap"
|
||||||
|
|
||||||
|
<DT> <b>printCommand</b>: <i>string</i>
|
||||||
|
<DD> Name of command used (by default) for the 'Print' menu option.
|
||||||
|
This command is expected to accept a single argument -- the name
|
||||||
|
of the file to print. Default is "lpr". (Note that this can be
|
||||||
|
changed on the fly via the 'Print' option's dialog box.)
|
||||||
|
|
||||||
|
<DT> <b><A NAME="recordCommandLocation">recordCommandLocation</A></b>: <i>string</i>
|
||||||
|
<DD> Location (full path name) of the command used to record audio
|
||||||
|
annotations (on Sun, SGI, and HP platforms). Default is
|
||||||
|
"/usr/sbin/recordaiff" on SGI, "/usr/demo/SOUND/record" on
|
||||||
|
Sun, and "/usr/audio/bin/srecorder" on HP. If the named
|
||||||
|
command does not exist when Mosaic is started, audio
|
||||||
|
annotations will be disabled (the menu entry will be made
|
||||||
|
insensitive).
|
||||||
|
<DT> <b><A NAME="recordCommand">recordCommand</A></b>: <i>string</i>
|
||||||
|
<DD> Command used to record audio annotations -- this is the full
|
||||||
|
command, using the command named in recordCommandLocation as
|
||||||
|
the first word. Default is "recordaiff -n 1 -s 8 -r 8000" on
|
||||||
|
SGI, "record" on Sun, "srecorder -au" on HP. The command thus
|
||||||
|
named is expected to accept a single additional argument</b>: the
|
||||||
|
filename of the new audio file; the command is also expected
|
||||||
|
to correctly terminate recording when sent a SIGINT.
|
||||||
|
|
||||||
|
<DT> <B>reloadPragmaNoCache</B>: <I>Boolean</I>
|
||||||
|
<DD> If true, Mosaic will send additional header info to notify a proxy
|
||||||
|
not to use cache. This only works with caching proxy servers.
|
||||||
|
Default is false.
|
||||||
|
|
||||||
|
<DT> <B>reloadReloadsImages</B>: <I>Boolean</I>
|
||||||
|
<DD> If true, the <I>Reload</I> option will clear out cached image data for
|
||||||
|
the current document before reloading the document, thus causing the
|
||||||
|
images to be reloaded also. This is most useful for HTML authors using
|
||||||
|
Mosaic to view their work. Default is false.
|
||||||
|
|
||||||
|
<A NAME="sendmail">
|
||||||
|
<DT> <B>sendmailCommand</B>: <I>string</I> </A>
|
||||||
|
<DD> Points to the <CODE>sendmail</CODE> binary. The assumption is made that
|
||||||
|
this program accepts command-line arguments specifying addresses to which
|
||||||
|
messages should be mailed, and accepts other headers and message text from
|
||||||
|
stdin. Default is "/usr/lib/sendmail"
|
||||||
|
|
||||||
|
<A NAME="signature">
|
||||||
|
<DT> <B>signature</B>: <I>string</I> </A>
|
||||||
|
<DD> Points to the signature file used when posting articles to newsgroups. This
|
||||||
|
file will be included whenever you post or followup. Default is no signature.
|
||||||
|
|
||||||
|
<DT> <B>simpleInterface</B>: <I>Boolean</I>
|
||||||
|
<DD> Allows Mosaic's menu bar and bottom button configuration to be
|
||||||
|
considerably pared down (default is false).
|
||||||
|
|
||||||
|
<DT> <b><A NAME="tmpDirectory">tmpDirectory</A></b>: <i>string</i>
|
||||||
|
<DD> Name of directory in which to store temporary files generated by
|
||||||
|
Mosaic. This directory should have plenty of space, ideally
|
||||||
|
at least 10 or 20 megabytes, in case you happen to pull down a
|
||||||
|
very large data file. Setting this resource is equivalent to
|
||||||
|
using the command-line flag <A
|
||||||
|
HREF="command-line-flags.html#tmpdir">-tmpdir</A> or setting
|
||||||
|
the environment variable <code>TMPDIR</code>.
|
||||||
|
|
||||||
|
<DT> <B>trackFullURLs</B>: <I>Boolean</I>
|
||||||
|
<DD> If set to false, enables prototypical smart display of "where you're
|
||||||
|
going" during mouse tracking, including format divination. Default is
|
||||||
|
true.
|
||||||
|
|
||||||
|
<DT> <B>trackPointerMotion</B>: <I>Boolean</I>
|
||||||
|
<DD> If set to false, the mouse pointer will not be tracked so that URLs
|
||||||
|
are visible on the lower status line. Default is true.
|
||||||
|
|
||||||
|
<a name="trackvisited">
|
||||||
|
<DT> <b>trackVisitedAnchors</b>: <i>Boolean</i></a>
|
||||||
|
<DD> If true, visited anchors (anchors pointing to documents that have
|
||||||
|
previously been viewed) will be displayed with a different style
|
||||||
|
than anchors that have not yet been visited. Default is true.
|
||||||
|
(On slow machines, changing this resource to false may
|
||||||
|
substantially improve Mosaic's performance.)
|
||||||
|
|
||||||
|
<DT> <B>tweakGopherTypes</B>: <I>Boolean</I>
|
||||||
|
<DD> When false, Mosaic will interpret Gopher documents strictly by the
|
||||||
|
Gopher typing system. When true, Mosaic will use its own mechanism
|
||||||
|
to determine the file types of Gopher documents. Default is true.
|
||||||
|
|
||||||
|
<DT> <B>twirlIncrement</B>: <I>integer</I>
|
||||||
|
<DD> Indicates how many bytes (minimum) are transferred between updates
|
||||||
|
of the twirling transfer icon for normal (FTP, Gopher, HTTP) transfers.
|
||||||
|
Default is 4096.
|
||||||
|
|
||||||
|
<DT> <b>twirlingTransferIcon</b>: <I>Boolean</I>
|
||||||
|
<DD> Can be set to false to turn off the twirling NCSA logo during document
|
||||||
|
transfers. <I>Clicking</I> the icon will still interrupt a transfer.
|
||||||
|
Default is true.
|
||||||
|
|
||||||
|
<DT> <b>uncompressCommand</b>: <i>string</i>
|
||||||
|
<DD> Command to use to uncompress compressed files (files with an
|
||||||
|
extension of '.Z'). Default is "uncompress"
|
||||||
|
|
||||||
|
<DT> <B>useDefaultExtensionMap</B>: <I>Boolean</I>
|
||||||
|
<DD> Can be set to false to keep Mosaic from having any default <A
|
||||||
|
HREF="extension-map.html">file-extension-to-MIME-type mappings</A>. <I>
|
||||||
|
We strongly recommend that this resource be left true;</I> simply
|
||||||
|
overridden as necessary. Default is true.
|
||||||
|
|
||||||
|
<DT> <B>useDefaultTypeMap</B>: <I>Boolean</I>
|
||||||
|
<DD> Can be set to false to keep Mosaic from having any default <A
|
||||||
|
HREF="mailcap.html">MIME-type-to-external-viewer mappings</A>. <I>We
|
||||||
|
strongly recommend that this resource be left true</I>; simply overridden
|
||||||
|
as necessary. Default is true.
|
||||||
|
|
||||||
|
<DT> <b>useGlobalHistory</b>: <i>Boolean</i>
|
||||||
|
<DD> If true, a global history of everywhere you visit is automatically
|
||||||
|
stored. (This history is used to
|
||||||
|
shade anchors different colors based on whether you've visited the
|
||||||
|
corresponding documents or not, if resource trackVisitedAnchors
|
||||||
|
is set to true) Default is true.
|
||||||
|
|
||||||
|
|
||||||
|
<DT> <b>xtermCommand</b>: <i>string</i>
|
||||||
|
<DD> Name of command used to start a terminal window for a telnet
|
||||||
|
session. Default is "xterm" on most platforms; "aixterm -v" on IBM
|
||||||
|
AIX 3.x systems.
|
||||||
|
|
||||||
|
</DL>
|
||||||
|
|
||||||
|
<H2>Visual Resources</H2>
|
||||||
|
|
||||||
|
The following resources actually belong to the <A NAME=22
|
||||||
|
HREF="htmlwidget.html">HTML widget</A> used in the Document View window, so <A
|
||||||
|
NAME="widget-resources-note">you should specify them</A> in your
|
||||||
|
<CODE>.Xdefaults</CODE> file as follows:
|
||||||
|
|
||||||
|
<XMP>
|
||||||
|
Mosaic*anchorColor: cyan
|
||||||
|
</XMP>
|
||||||
|
|
||||||
|
<DL>
|
||||||
|
<DT> <b>Background</b>: <i>color</i>
|
||||||
|
<DD> Color for main background. Default is grey.
|
||||||
|
<DT> <b>Foreground</b>: <i>color</i>
|
||||||
|
<DD> Color for normal text. Default is black.
|
||||||
|
<DT> <b>anchorColor</b>: <i>color</i>
|
||||||
|
<DD> Color to shade anchors whose corresponding documents haven't been previously visited. Default is blue3.
|
||||||
|
<DT> <b>visitedAnchorColor</b>: <i>color</i>
|
||||||
|
<DD> Color to shade anchors whose corresponding documents have been previously visited. Default is violetred4.
|
||||||
|
<DT> <b>activeAnchorFG</b>: <i>color</i>
|
||||||
|
<DD> Color to shade anchors that are in the process of being activated. Default is red.
|
||||||
|
<DT> <b>activeAnchorBG</b>: <i>color</i>
|
||||||
|
<DD> Color to shade the background of anchors that are in the
|
||||||
|
process of being activated. Default is grey80 (the same
|
||||||
|
color as the application's background).
|
||||||
|
<DT> <b>anchorUnderlines</b>: <i>integer</i>
|
||||||
|
<DD> This can be one of {0, 1, 2, 3}, and indicates the number
|
||||||
|
of lines to draw underneath unvisited anchors. Default is 1.
|
||||||
|
<DT> <b>visitedAnchorUnderlines</b>: <i>integer</i>
|
||||||
|
<DD> This can be one of {0, 1, 2, 3}, and indicates the number
|
||||||
|
of lines to draw underneath visited anchors. Default is 1.
|
||||||
|
<DT> <b>dashedAnchorUnderlines</b>: <i>Boolean</i>
|
||||||
|
<DD> If true, lines drawn under unvisited anchors will be dashed.
|
||||||
|
Default is false.
|
||||||
|
<DT> <b>dashedVisitedAnchorUnderlines</b>: <i>Boolean</i>
|
||||||
|
<DD> If true, lines drawn under visited anchors will be dashed.
|
||||||
|
Default is true.
|
||||||
|
|
||||||
|
<DT> <b>colorsPerInlinedImage</b>: <i>integer</i>
|
||||||
|
<DD> Number of unique colors to allocate per
|
||||||
|
<A NAME=10 HREF="inlined-images.html">inlined-image</A>;
|
||||||
|
default is 50. Note that this has no bearing on images that
|
||||||
|
are displayed externally to NCSA Mosaic, e.g. GIF images passed
|
||||||
|
to an external viewer.
|
||||||
|
<DT> <b>percentVerticalSpace</b>: <i>integer</i>
|
||||||
|
<DD> The height of vertical space between paragraphs, between headers
|
||||||
|
and paragraphs, etc., expressed as a percentage of the normal
|
||||||
|
line height. Default is 90.
|
||||||
|
|
||||||
|
<DT> <B>reverseInlinedBitmapColors</B>: <I>Boolean</I>
|
||||||
|
<DD> If true, reverses foreground and background colors in inlined XBM
|
||||||
|
bitmaps. Default is false.
|
||||||
|
|
||||||
|
<DT> <B>verticalScrollOnRight</B>: <I>Boolean</I>
|
||||||
|
<DD> If false, the Document View window will place its scroll bar on the
|
||||||
|
left side. Default is true.
|
||||||
|
|
||||||
|
</DL>
|
||||||
|
|
||||||
|
<a name="font">
|
||||||
|
<H2>Font Resources</H2></a>
|
||||||
|
|
||||||
|
Font resources are also resources that belong to the HTML widget, so
|
||||||
|
the <A NAME=8 HREF="#widget-resources-note">above note</A> applies
|
||||||
|
here too. Note that fonts can be changed dynamically from the
|
||||||
|
<b>Options</b> menu</A>.
|
||||||
|
|
||||||
|
<DL>
|
||||||
|
<DT> <b>defaultFontChoice</b>: <i>string</i>
|
||||||
|
<DD> Sets the default font choice for X. <i>string</i> is a string similar
|
||||||
|
to any of the font choices in the Options-Font menu. For example.
|
||||||
|
<LISTING>Mosaic*defaultFontChoice: New Century Large</LISTING>
|
||||||
|
<DT> <b>font</b>: <i>font</i>
|
||||||
|
<DD> Font used in normal formatted text.
|
||||||
|
Default is "-adobe-times-medium-r-normal-*-17-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>italicFont</b>: <i>font</i>
|
||||||
|
<DD> Font used in italic formatted text.
|
||||||
|
Default is "-adobe-times-medium-i-normal-*-17-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>boldFont</b>: <i>font</i>
|
||||||
|
<DD> Font used in bold formatted text.
|
||||||
|
Default is "-adobe-times-bold-r-normal-*-17-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>fixedFont</b>: <i>font</i>
|
||||||
|
<DD> Font used in fixed (typewriter style) formatted text.
|
||||||
|
Default is "-adobe-courier-medium-r-normal-*-17-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>header1Font</b>: <i>font</i>
|
||||||
|
<DD> Font used in level 1 headers.
|
||||||
|
Default is "-adobe-times-bold-r-normal-*-24-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>header2Font</b>: <i>font</i>
|
||||||
|
<DD> Font used in level 2 headers.
|
||||||
|
Default is "-adobe-times-bold-r-normal-*-18-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>header3Font</b>: <i>font</i>
|
||||||
|
<DD> Font used in level 3 headers.
|
||||||
|
Default is "-adobe-times-bold-r-normal-*-17-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>header4Font</b>: <i>font</i>
|
||||||
|
<DD> Font used in level 4 headers.
|
||||||
|
Default is "-adobe-times-bold-r-normal-*-14-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>header5Font</b>: <i>font</i>
|
||||||
|
<DD> Font used in level 5 headers.
|
||||||
|
Default is "-adobe-times-bold-r-normal-*-12-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>header6Font</b>: <i>font</i>
|
||||||
|
<DD> Font used in level 6 headers.
|
||||||
|
Default is "-adobe-times-bold-r-normal-*-10-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>addressFont</b>: <i>font</i>
|
||||||
|
<DD> Font used in addresses.
|
||||||
|
Default is "-adobe-times-medium-i-normal-*-17-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>plainFont</b>: <i>font</i>
|
||||||
|
<DD> Font used in plaintext regions or preformatted documents.
|
||||||
|
Default is "-adobe-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>listingFont</b>: <i>font</i>
|
||||||
|
<DD> Font used in listing regions. Default is "-adobe-courier-medium-r-normal-*-12-*-*-*-*-*-iso8859-1".
|
||||||
|
<DT> <b>fixedboldFont</b>: <I>font</I>
|
||||||
|
<DD> Font used for bold in fixed (typewriter style) formatted text
|
||||||
|
<DT> <b>fixeditalicFont</b>: <I>font</I>
|
||||||
|
<DD> Font used for italic in fixed (typewriter style) formatted text
|
||||||
|
<DT> <b>plainboldFont</b>: <I>font</I>
|
||||||
|
<DD> Font used for bold in plaintext regions or preformatted documents
|
||||||
|
<DT> <b>plainitalicFont</b>: <I>font</I>
|
||||||
|
<DD> Font used for italic in plaintext regions or preformatted documents
|
||||||
|
|
||||||
|
<DT> <b>supsubFont</b>: <I>font</I>
|
||||||
|
<DD> Font used for superscript and subscript fonts.
|
||||||
|
|
||||||
|
</DL>
|
||||||
|
|
||||||
|
<H2>Proxy Gateway Resources</H2>
|
||||||
|
|
||||||
|
Support for Proxy Gateways is still considered experimental.
|
||||||
|
The following resources are assumed to be pointers to <A
|
||||||
|
HREF="http://www.w3.org/hypertext/WWW/Daemon/User/Proxies/Proxies.html">
|
||||||
|
Proxy Gateways</A>, for example:
|
||||||
|
|
||||||
|
<XMP>
|
||||||
|
Mosaic*httpProxy: http://www.cern.ch:911/
|
||||||
|
</XMP>
|
||||||
|
|
||||||
|
Here are more <A
|
||||||
|
HREF="http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/proxy-gateways.html">
|
||||||
|
details on Proxy Gateway Support in NCSA Mosaic for X.</A>
|
||||||
|
|
||||||
|
<DL>
|
||||||
|
|
||||||
|
<DT> <B>ftpProxy</B>: <I>String</I>
|
||||||
|
<DD> Proxy for ftp URLs.
|
||||||
|
|
||||||
|
<DT> <B>gopherProxy</B>: <I>String</I>
|
||||||
|
<DD> Proxy for gopher URLs.
|
||||||
|
|
||||||
|
<DT> <B>httpProxy</B>: <I>String</I>
|
||||||
|
<DD> Proxy for http URLs.
|
||||||
|
|
||||||
|
<DT> <B>newsProxy</B>: <I>String</I>
|
||||||
|
<DD> Proxy for news URLs.
|
||||||
|
|
||||||
|
<DT> <B>waisProxy</B>: <I>String</I>
|
||||||
|
<DD> Proxy for wais URLs.
|
||||||
|
|
||||||
|
<DT> <B>ProxyGateway:</B> <I>String</I>
|
||||||
|
<DD> Proxy to be used for all access methods.
|
||||||
|
|
||||||
|
</DL>
|
||||||
|
|
||||||
|
<H2>PGP/PEM Encryption Resources</H2>
|
||||||
|
|
||||||
|
PGP/PEM encryption is still considered an experimental feature of NCSA
|
||||||
|
Mosaic. Here is <A
|
||||||
|
HREF="http://hoohoo.ncsa.uiuc.edu/docs/PEMPGP.html">more information on
|
||||||
|
PGP/PEM encryption with NCSA Mosaic.</a>
|
||||||
|
|
||||||
|
<DL>
|
||||||
|
<DT> <B>pemEncrypt</B>: <I>string</I>
|
||||||
|
<DD> The executable Mosaic will run to perform PEM encryption.
|
||||||
|
|
||||||
|
<DT> <B>pemDecrypt</B>: <I>string</I>
|
||||||
|
<DD> The executable Mosaic will run to perform PEM decryption.
|
||||||
|
|
||||||
|
<DT> <B>pemEntity</B>: <I>string</I>
|
||||||
|
<DD> The user's PEM entity name, which should be the same as the key name
|
||||||
|
given to server maintainers.
|
||||||
|
|
||||||
|
<DT> <B>pgpEncrypt</B>: <I>string</I>
|
||||||
|
<DD> The executable Mosaic will run to perform PGP encryption.
|
||||||
|
|
||||||
|
<DT> <B>pgpDecrypt</B>: <I>string</I>
|
||||||
|
<DD> The executable Mosaic will run to perform PGP decryption.
|
||||||
|
|
||||||
|
<DT> <B>pgpEntity</B>: <I>string</I>
|
||||||
|
<DD> The user's PGP entity name, which should be the same as the key name
|
||||||
|
given to server maintainers.
|
||||||
|
|
||||||
|
</DL>
|
||||||
|
|
||||||
|
<H2>Obsolete Resources</H2>
|
||||||
|
|
||||||
|
The following resources once did something, but not anymore. <P>
|
||||||
|
|
||||||
|
<DL>
|
||||||
|
<DT> <b>binaryTransferMode</b>: <i>Boolean</i>
|
||||||
|
<DD> Removed in version 2.0, use <I>Load to Local Disk</I> from
|
||||||
|
<CODE>Options</CODE> menu if necessary.
|
||||||
|
|
||||||
|
<DT> <b>mailCommand</b>: <i>string</i>
|
||||||
|
<DD> Replaced in version 2.0 with <A HREF="#sendmail">sendmailCommand</A>
|
||||||
|
resource.
|
||||||
|
|
||||||
|
<DT> <b><A NAME="warpPointerForIndex">warpPointerForIndex</A></b>:
|
||||||
|
<i>Boolean</i>
|
||||||
|
<DD> Removed in version 2.0. This is a much-requested feature, and will
|
||||||
|
be re-worked eventually.
|
||||||
|
|
||||||
|
<DT> <b>windowPerDocument</b>: <i>Boolean</i>
|
||||||
|
<DD> Removed in version 2.0. New windows can be created by
|
||||||
|
<I>clicking</I> on hyperlinks with the middle mouse button rather than
|
||||||
|
the left one.
|
||||||
|
|
||||||
|
</DL>
|
||||||
|
|
||||||
|
|
||||||
|
<EM>The following notices were important for users upgrading from a 1.x
|
||||||
|
version of Mosaic to a 2.x version:</EM>
|
||||||
|
|
||||||
|
<UL>
|
||||||
|
<LI> The class name has been changed from <i>XMosaic</i> to <i>Mosaic</i>.
|
||||||
|
Existing Mosaic 1.2 X resources and application defaults files should be
|
||||||
|
modified accordingly.
|
||||||
|
<LI> Information on <A HREF="faq-broken.html#11">the removal of version 1.2
|
||||||
|
multimedia X resources.</A>
|
||||||
|
</UL>
|
||||||
|
|
||||||
|
|
||||||
|
<A HREF="mosaic-docs.html"><IMG SRC="up.xbm"> Back to top level Documentation
|
||||||
|
Index</A>
|
||||||
|
<P>
|
||||||
|
|
||||||
|
Last Modified: 9 July 1995 <BR>
|
||||||
|
<ADDRESS>
|
||||||
|
<A HREF="http://www.ncsa.uiuc.edu/General/NCSAHome.html">
|
||||||
|
National Center for Supercomputing Applications</A>
|
||||||
|
</ADDRESS>
|
||||||
|
<ADDRESS><A HREF="mailto:webmaster@ncsa.uiuc.edu">webmaster@ncsa.uiuc.edu</A></ADDRESS>
|
||||||
|
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
||||||
|
|
18
documents.menu
Normal file
18
documents.menu
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
NCSA Mosaic Resources: Multimedia
|
||||||
|
http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/resources.html#multimedia
|
||||||
|
Unsupported versions of Mosaic
|
||||||
|
http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/faq-machines.html#contribs
|
||||||
|
Questions regarding font errors
|
||||||
|
http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/faq-interface.html
|
||||||
|
----
|
||||||
|
A LaTeX to HTML Translator
|
||||||
|
http://cbl.leeds.ac.uk/nikos/tex2html/doc/latex2html/latex2html.html
|
||||||
|
The Ohio State HTML converters
|
||||||
|
http://www.cis.ohio-state.edu:80/hypertext/about_this_cobweb.html
|
||||||
|
An RTF to HTML converter
|
||||||
|
ftp://ftp.primate.wisc.edu/pub/RTF
|
||||||
|
The Motif FAQ
|
||||||
|
http://www.cis.ohio-state.edu:80/hypertext/faq/usenet/motif-faq/top.html
|
||||||
|
The HTML Widget Docs
|
||||||
|
http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/htmlwidget.html
|
||||||
|
|
238
install-sh
Normal file
238
install-sh
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# install - install a program, script, or datafile
|
||||||
|
# This comes from X11R5.
|
||||||
|
#
|
||||||
|
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||||
|
# `make' implicit rules from creating a file called install from it
|
||||||
|
# when there is no Makefile.
|
||||||
|
#
|
||||||
|
# This script is compatible with the BSD install script, but was written
|
||||||
|
# from scratch.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# set DOITPROG to echo to test this script
|
||||||
|
|
||||||
|
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||||
|
doit="${DOITPROG-}"
|
||||||
|
|
||||||
|
|
||||||
|
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||||
|
|
||||||
|
mvprog="${MVPROG-mv}"
|
||||||
|
cpprog="${CPPROG-cp}"
|
||||||
|
chmodprog="${CHMODPROG-chmod}"
|
||||||
|
chownprog="${CHOWNPROG-chown}"
|
||||||
|
chgrpprog="${CHGRPPROG-chgrp}"
|
||||||
|
stripprog="${STRIPPROG-strip}"
|
||||||
|
rmprog="${RMPROG-rm}"
|
||||||
|
mkdirprog="${MKDIRPROG-mkdir}"
|
||||||
|
|
||||||
|
tranformbasename=""
|
||||||
|
transform_arg=""
|
||||||
|
instcmd="$mvprog"
|
||||||
|
chmodcmd="$chmodprog 0755"
|
||||||
|
chowncmd=""
|
||||||
|
chgrpcmd=""
|
||||||
|
stripcmd=""
|
||||||
|
rmcmd="$rmprog -f"
|
||||||
|
mvcmd="$mvprog"
|
||||||
|
src=""
|
||||||
|
dst=""
|
||||||
|
dir_arg=""
|
||||||
|
|
||||||
|
while [ x"$1" != x ]; do
|
||||||
|
case $1 in
|
||||||
|
-c) instcmd="$cpprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-d) dir_arg=true
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-m) chmodcmd="$chmodprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-o) chowncmd="$chownprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-g) chgrpcmd="$chgrpprog $2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-s) stripcmd="$stripprog"
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
|
||||||
|
*) if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
src=$1
|
||||||
|
else
|
||||||
|
# this colon is to work around a 386BSD /bin/sh bug
|
||||||
|
:
|
||||||
|
dst=$1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
continue;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ x"$src" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no input file specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]; then
|
||||||
|
dst=$src
|
||||||
|
src=""
|
||||||
|
|
||||||
|
if [ -d $dst ]; then
|
||||||
|
instcmd=:
|
||||||
|
else
|
||||||
|
instcmd=mkdir
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||||
|
# might cause directories to be created, which would be especially bad
|
||||||
|
# if $src (and thus $dsttmp) contains '*'.
|
||||||
|
|
||||||
|
if [ -f $src -o -d $src ]
|
||||||
|
then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "install: $src does not exist"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dst" = x ]
|
||||||
|
then
|
||||||
|
echo "install: no destination specified"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If destination is a directory, append the input filename; if your system
|
||||||
|
# does not like double slashes in filenames, you may need to add some logic
|
||||||
|
|
||||||
|
if [ -d $dst ]
|
||||||
|
then
|
||||||
|
dst="$dst"/`basename $src`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## this sed command emulates the dirname command
|
||||||
|
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||||
|
|
||||||
|
# Make sure that the destination directory exists.
|
||||||
|
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||||
|
|
||||||
|
# Skip lots of stat calls in the usual case.
|
||||||
|
if [ ! -d "$dstdir" ]; then
|
||||||
|
defaultIFS='
|
||||||
|
'
|
||||||
|
IFS="${IFS-${defaultIFS}}"
|
||||||
|
|
||||||
|
oIFS="${IFS}"
|
||||||
|
# Some sh's can't handle IFS=/ for some reason.
|
||||||
|
IFS='%'
|
||||||
|
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||||
|
IFS="${oIFS}"
|
||||||
|
|
||||||
|
pathcomp=''
|
||||||
|
|
||||||
|
while [ $# -ne 0 ] ; do
|
||||||
|
pathcomp="${pathcomp}${1}"
|
||||||
|
shift
|
||||||
|
|
||||||
|
if [ ! -d "${pathcomp}" ] ;
|
||||||
|
then
|
||||||
|
$mkdirprog "${pathcomp}"
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
pathcomp="${pathcomp}/"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$dir_arg" != x ]
|
||||||
|
then
|
||||||
|
$doit $instcmd $dst &&
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||||
|
else
|
||||||
|
|
||||||
|
# If we're going to rename the final executable, determine the name now.
|
||||||
|
|
||||||
|
if [ x"$transformarg" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
dstfile=`basename $dst $transformbasename |
|
||||||
|
sed $transformarg`$transformbasename
|
||||||
|
fi
|
||||||
|
|
||||||
|
# don't allow the sed command to completely eliminate the filename
|
||||||
|
|
||||||
|
if [ x"$dstfile" = x ]
|
||||||
|
then
|
||||||
|
dstfile=`basename $dst`
|
||||||
|
else
|
||||||
|
true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make a temp file name in the proper directory.
|
||||||
|
|
||||||
|
dsttmp=$dstdir/#inst.$$#
|
||||||
|
|
||||||
|
# Move or copy the file name to the temp name
|
||||||
|
|
||||||
|
$doit $instcmd $src $dsttmp &&
|
||||||
|
|
||||||
|
trap "rm -f ${dsttmp}" 0 &&
|
||||||
|
|
||||||
|
# and set any options; do chmod last to preserve setuid bits
|
||||||
|
|
||||||
|
# If any of these fail, we abort the whole thing. If we want to
|
||||||
|
# ignore errors from any of these, just make sure not to ignore
|
||||||
|
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||||
|
|
||||||
|
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||||
|
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||||
|
|
||||||
|
# Now rename the file to the real destination.
|
||||||
|
|
||||||
|
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||||
|
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||||
|
|
||||||
|
fi &&
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
22
libXmx/Makefile
Normal file
22
libXmx/Makefile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# You shouldn't need to edit below here.
|
||||||
|
|
||||||
|
LIBTARGET = libXmx.a
|
||||||
|
|
||||||
|
all: $(LIBTARGET)
|
||||||
|
|
||||||
|
CFILES = Xmx.c Xmx2.c
|
||||||
|
|
||||||
|
OBJS = $(CFILES:.c=.o)
|
||||||
|
|
||||||
|
$(LIBTARGET): $(OBJS)
|
||||||
|
-rm -f $(LIBTARGET)
|
||||||
|
ar rv $(LIBTARGET) $(OBJS)
|
||||||
|
$(RANLIB) $(LIBTARGET)
|
||||||
|
|
||||||
|
Xmx.o: Xmx.c Xmx.h XmxP.h
|
||||||
|
Xmx2.o: Xmx2.c Xmx.h XmxP.h
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm $(LIBTARGET) *.o
|
||||||
|
tags:
|
||||||
|
etags -t *.[ch]
|
33
libXmx/Makefile.in
Normal file
33
libXmx/Makefile.in
Normal 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@
|
||||||
|
|
||||||
|
# You shouldn't need to edit below here.
|
||||||
|
|
||||||
|
LIBTARGET = libXmx.a
|
||||||
|
|
||||||
|
all: $(LIBTARGET)
|
||||||
|
|
||||||
|
CFILES = Xmx.c Xmx2.c
|
||||||
|
|
||||||
|
OBJS = $(CFILES:.c=.o)
|
||||||
|
|
||||||
|
$(LIBTARGET): $(OBJS)
|
||||||
|
-rm -f $(LIBTARGET)
|
||||||
|
ar rv $(LIBTARGET) $(OBJS)
|
||||||
|
$(RANLIB) $(LIBTARGET)
|
||||||
|
|
||||||
|
Xmx.o: Xmx.c Xmx.h XmxP.h
|
||||||
|
Xmx2.o: Xmx2.c Xmx.h XmxP.h
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm $(LIBTARGET) *.o
|
||||||
|
tags:
|
||||||
|
etags -t *.[ch]
|
22
libXmx/Makefile.orig
Normal file
22
libXmx/Makefile.orig
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# You shouldn't need to edit below here.
|
||||||
|
|
||||||
|
LIBTARGET = libXmx.a
|
||||||
|
|
||||||
|
all: $(LIBTARGET)
|
||||||
|
|
||||||
|
CFILES = Xmx.c Xmx2.c
|
||||||
|
|
||||||
|
OBJS = $(CFILES:.c=.o)
|
||||||
|
|
||||||
|
$(LIBTARGET): $(OBJS)
|
||||||
|
-rm -f $(LIBTARGET)
|
||||||
|
ar rv $(LIBTARGET) $(OBJS)
|
||||||
|
$(RANLIB) $(LIBTARGET)
|
||||||
|
|
||||||
|
Xmx.o: Xmx.c Xmx.h XmxP.h
|
||||||
|
Xmx2.o: Xmx2.c Xmx.h XmxP.h
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm $(LIBTARGET) *.o
|
||||||
|
tags:
|
||||||
|
etags -t *.[ch]
|
2025
libXmx/Xmx.c
Normal file
2025
libXmx/Xmx.c
Normal file
File diff suppressed because it is too large
Load Diff
364
libXmx/Xmx.h
Normal file
364
libXmx/Xmx.h
Normal file
@ -0,0 +1,364 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* 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 __XMX_H__
|
||||||
|
#define __XMX_H__
|
||||||
|
|
||||||
|
/* --------------------------- SYSTEM INCLUDES ---------------------------- */
|
||||||
|
|
||||||
|
/* Generic X11/Xt/Xm includes. */
|
||||||
|
#include <X11/Intrinsic.h>
|
||||||
|
#include <X11/StringDefs.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
#include <X11/cursorfont.h>
|
||||||
|
#include <Xm/Xm.h>
|
||||||
|
|
||||||
|
#if (XmVERSION == 1)&&(XmREVISION >= 2)
|
||||||
|
#ifndef MOTIF1_2
|
||||||
|
#define MOTIF1_2
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef VMS
|
||||||
|
/* VMS does not permit > 31 char names, so to avoid compilation warnings ... */
|
||||||
|
#define XmxMakeFormAndTwoButtonsSqueezed XmxMakeFormAndTwoButtonsSqueeze
|
||||||
|
#define XmxMakeFormAndThreeButtonsSqueezed XmxMakeFormAndThreeButtonsSquee
|
||||||
|
#if (XmVERSION == 1)&&(XmREVISION >= 2)
|
||||||
|
#include <X11/Reptype.h>
|
||||||
|
#endif
|
||||||
|
#endif /* VMS, BSN */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
#ifdef __sgi
|
||||||
|
/* Fast malloc. */
|
||||||
|
#include <malloc.h>
|
||||||
|
/* For GLXconfig type. */
|
||||||
|
#include <X11/Xirisw/GlxMDraw.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _IBMR2
|
||||||
|
/* nothing that I know of */
|
||||||
|
#endif /* _IBMR2 */
|
||||||
|
|
||||||
|
#endif /* if 0 */
|
||||||
|
|
||||||
|
/* --------------------------- INTERNAL DEFINES --------------------------- */
|
||||||
|
|
||||||
|
/* Maximum number of resource args usable --- should be large
|
||||||
|
since applications also can add resources. */
|
||||||
|
#define XmxMaxNumArgs 30
|
||||||
|
|
||||||
|
/* ------------------------------ VARIABLES ------------------------------- */
|
||||||
|
|
||||||
|
/* These three will also be used from application code. */
|
||||||
|
extern int Xmx_n;
|
||||||
|
extern Arg Xmx_wargs[];
|
||||||
|
extern Widget Xmx_w;
|
||||||
|
|
||||||
|
/* This probably won't be needed to be accessed
|
||||||
|
directly by an application; if not, it should be
|
||||||
|
moved to XmxP.h. */
|
||||||
|
extern int Xmx_uniqid;
|
||||||
|
|
||||||
|
/* ------------------------------ CONSTANTS ------------------------------- */
|
||||||
|
|
||||||
|
/* These probably shouldn't be necessary, since we use
|
||||||
|
Gadgets whenever possible. */
|
||||||
|
#define XmxWidget 0
|
||||||
|
#define XmxGadget 1
|
||||||
|
|
||||||
|
/* XmxFrame types. */
|
||||||
|
#define XmxShadowIn 0
|
||||||
|
#define XmxShadowOut 1
|
||||||
|
#define XmxShadowEtchedIn 2
|
||||||
|
#define XmxShadowEtchedOut 3
|
||||||
|
|
||||||
|
/* Currently unused. */
|
||||||
|
#define XmxLeft XmALIGNMENT_BEGINNING
|
||||||
|
#define XmxCenter XmALIGNMENT_CENTER
|
||||||
|
#define XmxRight XmALIGNMENT_END
|
||||||
|
|
||||||
|
/* Null values for some arguments. */
|
||||||
|
#define XmxNotDisplayed -99999
|
||||||
|
#define XmxNoPosition -99999
|
||||||
|
#define XmxNoOffset -99999
|
||||||
|
|
||||||
|
/* States for togglebuttons. */
|
||||||
|
#define XmxUnset 0
|
||||||
|
#define XmxNotSet XmxUnset
|
||||||
|
#define XmxSet 1
|
||||||
|
|
||||||
|
/* Sensitivity states. */
|
||||||
|
#define XmxUnsensitive 0
|
||||||
|
#define XmxNotSensitive XmxUnsensitive
|
||||||
|
#define XmxSensitive 1
|
||||||
|
|
||||||
|
/* Types of togglebuttons. */
|
||||||
|
#define XmxOneOfMany 0
|
||||||
|
#define XmxNOfMany 1
|
||||||
|
|
||||||
|
/* Constraint possibilities. */
|
||||||
|
#define XmxCwidget XmATTACH_WIDGET
|
||||||
|
#define XmxCform XmATTACH_FORM
|
||||||
|
#define XmxCnone XmATTACH_NONE
|
||||||
|
|
||||||
|
/* ---------------------------- MENU TYPEDEFS ----------------------------- */
|
||||||
|
|
||||||
|
/* Struct used by app when loading option menu. The 'set_state'
|
||||||
|
parameter is used to indicate menu history for the option menu;
|
||||||
|
the entry with 'XmxSet' is used. */
|
||||||
|
typedef struct _XmxOptionMenuStruct
|
||||||
|
{
|
||||||
|
String namestr;
|
||||||
|
int data;
|
||||||
|
int set_state;
|
||||||
|
} XmxOptionMenuStruct;
|
||||||
|
|
||||||
|
/* Toggle menu and option menu accept same struct. */
|
||||||
|
typedef XmxOptionMenuStruct XmxToggleMenuStruct;
|
||||||
|
|
||||||
|
/* Menubar uses a recursive struct. */
|
||||||
|
typedef struct _XmxMenubarStruct
|
||||||
|
{
|
||||||
|
String namestr;
|
||||||
|
char mnemonic;
|
||||||
|
void (*func)();
|
||||||
|
int data;
|
||||||
|
struct _XmxMenubarStruct *sub_menu;
|
||||||
|
} XmxMenubarStruct;
|
||||||
|
|
||||||
|
/* --------------------------- RECORD TYPEDEFS ---------------------------- */
|
||||||
|
|
||||||
|
/* These typedefs, while public, are not guaranteed to remain static
|
||||||
|
and should not be actually used by an application. */
|
||||||
|
|
||||||
|
/* A single entry in a menu (menubar, toggle menu, or option menu),
|
||||||
|
tagged by the integer token used as callback_data. */
|
||||||
|
typedef struct _XmxMenuEntry
|
||||||
|
{
|
||||||
|
Widget w;
|
||||||
|
int token;
|
||||||
|
struct _XmxMenuEntry *next;
|
||||||
|
} XmxMenuEntry;
|
||||||
|
|
||||||
|
/* A menu (menubar, toggle menu, or option menu). */
|
||||||
|
typedef struct _XmxMenuRecord
|
||||||
|
{
|
||||||
|
Widget base;
|
||||||
|
XmxMenuEntry *first_entry;
|
||||||
|
} XmxMenuRecord;
|
||||||
|
|
||||||
|
/* -------------------------------- MACROS -------------------------------- */
|
||||||
|
|
||||||
|
/* Callback definitions and prototypes. */
|
||||||
|
#define XmxCallback(name) \
|
||||||
|
void name (Widget w, XtPointer client_data, XtPointer call_data)
|
||||||
|
#define XmxCallbackPrototype(name) \
|
||||||
|
extern void name (Widget, XtPointer, XtPointer)
|
||||||
|
|
||||||
|
/* Event handler functions and prototypes. */
|
||||||
|
#define XmxEventHandler(name) \
|
||||||
|
void name (Widget w, XtPointer client_data, XEvent *event, Boolean *cont)
|
||||||
|
#define XmxEventHandlerPrototype(name) \
|
||||||
|
extern void name (Widget, XtPointer, XEvent *, Boolean *)
|
||||||
|
|
||||||
|
/* Shortcut for XtAppInitialize --- of dubious value. */
|
||||||
|
#define XmxInit() \
|
||||||
|
XtAppInitialize (&app_context, "XmxApplication", NULL, 0, &argc, argv, \
|
||||||
|
NULL, Xmx_wargs, Xmx_n);
|
||||||
|
|
||||||
|
/* ------------------------------ PROTOTYPES ------------------------------ */
|
||||||
|
|
||||||
|
/* Xmx.c */
|
||||||
|
extern int XmxMakeNewUniqid (void);
|
||||||
|
extern void XmxSetUniqid (int);
|
||||||
|
extern void XmxZeroUniqid (void);
|
||||||
|
extern int XmxExtractUniqid (int);
|
||||||
|
extern int XmxExtractToken (int);
|
||||||
|
|
||||||
|
extern void XmxAddCallback (Widget, String, XtCallbackProc, int);
|
||||||
|
extern void XmxAddEventHandler (Widget, EventMask, XtEventHandler, int);
|
||||||
|
extern void XmxRemoveEventHandler (Widget, EventMask, XtEventHandler, int);
|
||||||
|
|
||||||
|
extern void XmxStartup (void);
|
||||||
|
extern void XmxSetArg (String, XtArgVal);
|
||||||
|
extern void XmxSetValues (Widget);
|
||||||
|
extern void XmxManageRemanage (Widget);
|
||||||
|
extern void XmxSetSensitive (Widget, int);
|
||||||
|
|
||||||
|
extern Widget XmxMakePushButton (Widget, String, XtCallbackProc, int);
|
||||||
|
extern Widget XmxMakeNamedPushButton (Widget, String, String, XtCallbackProc, int);
|
||||||
|
extern Widget XmxMakeBlankButton (Widget, XtCallbackProc, int);
|
||||||
|
extern Widget XmxMakeCommand (Widget, String, XtCallbackProc, int);
|
||||||
|
extern Widget XmxMakeScrolledList (Widget, XtCallbackProc, int);
|
||||||
|
extern Widget XmxMakeDrawingArea (Widget, int, int);
|
||||||
|
extern Widget XmxMakeRadioBox (Widget);
|
||||||
|
extern Widget XmxMakeOptionBox (Widget);
|
||||||
|
extern Widget XmxMakeToggleButton (Widget, String, XtCallbackProc, int);
|
||||||
|
extern void XmxSetToggleButton (Widget button, int set_state);
|
||||||
|
extern Widget XmxMakeScale (Widget, XtCallbackProc, int, String,
|
||||||
|
int, int, int, int);
|
||||||
|
extern void XmxAdjustScale (Widget, int);
|
||||||
|
extern Widget XmxMakeFrame (Widget, int);
|
||||||
|
extern Widget XmxMakeForm (Widget);
|
||||||
|
extern void XmxSetPositions (Widget, int, int, int, int);
|
||||||
|
extern void XmxSetOffsets (Widget, int, int, int, int);
|
||||||
|
extern void XmxSetConstraints (Widget, int, int, int, int, Widget, Widget,
|
||||||
|
Widget, Widget);
|
||||||
|
extern Widget XmxMakeVerticalRowColumn (Widget);
|
||||||
|
extern Widget XmxMakeHorizontalRowColumn (Widget);
|
||||||
|
extern Widget XmxMakeNColumnRowColumn (Widget, int);
|
||||||
|
extern Widget XmxMakeVerticalBboard (Widget);
|
||||||
|
extern Widget XmxMakeVerticalBboardWithFont (Widget, String);
|
||||||
|
extern Widget XmxMakeHorizontalBboard (Widget);
|
||||||
|
#ifdef NONWORKING_CENTERING
|
||||||
|
extern Widget XmxMakeCenteringBboard (Widget, XtAppContext);
|
||||||
|
#endif
|
||||||
|
extern void XmxAdjustLabelText (Widget, String);
|
||||||
|
extern Widget XmxMakeLabel (Widget, String);
|
||||||
|
extern Widget XmxMakeNamedLabel (Widget, String, String);
|
||||||
|
extern Widget XmxMakeBlankLabel (Widget);
|
||||||
|
extern Widget XmxMakeErrorDialog (Widget, String, String);
|
||||||
|
extern Widget XmxMakeInfoDialog (Widget, String, String);
|
||||||
|
extern Widget XmxMakeQuestionDialog (Widget, String, String, XtCallbackProc,
|
||||||
|
int, int);
|
||||||
|
extern XmString XmxMakeXmstrFromFile (String);
|
||||||
|
extern XmString XmxMakeXmstrFromString (String);
|
||||||
|
extern Widget XmxMakeBboardDialog (Widget, String);
|
||||||
|
extern Widget XmxMakeFormDialog (Widget, String);
|
||||||
|
extern Widget XmxMakeFileSBDialog (Widget, String, String, XtCallbackProc,
|
||||||
|
int);
|
||||||
|
extern Widget XmxMakeHelpDialog (Widget, XmString, String);
|
||||||
|
extern Widget XmxMakeHelpTextDialog (Widget, String, String, Widget *);
|
||||||
|
extern void XmxAdjustHelpDialogText (Widget, XmString, String);
|
||||||
|
extern void XmxAdjustDialogTitle (Widget, String);
|
||||||
|
extern Widget XmxMakeHorizontalSeparator (Widget);
|
||||||
|
extern Widget XmxMakeHorizontalSpacer (Widget);
|
||||||
|
extern Widget XmxMakeHorizontalBoundary (Widget);
|
||||||
|
extern Widget XmxMakeScrolledText (Widget);
|
||||||
|
extern Widget XmxMakeText (Widget);
|
||||||
|
extern Widget XmxMakeTextField (Widget);
|
||||||
|
extern void XmxTextSetString (Widget, String);
|
||||||
|
extern void XmxTextInsertString (Widget, String);
|
||||||
|
extern String XmxTextGetString (Widget);
|
||||||
|
extern void XmxAddCallbackToText (Widget, XtCallbackProc, int);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
#ifdef __sgi
|
||||||
|
extern Widget XmxMakeDrawingVolume
|
||||||
|
(Widget, int, int, GLXconfig *, XtCallbackProc, XtCallbackProc,
|
||||||
|
XtCallbackProc);
|
||||||
|
extern void XmxInstallColormaps (Widget, Widget);
|
||||||
|
extern void XmxInstallColormapsWithOverlay (Widget, Widget);
|
||||||
|
extern void XmxWinset (Widget);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _IBMR2
|
||||||
|
extern Widget XmxMakeDrawingVolume
|
||||||
|
(Widget, int, int, XtCallbackProc, XtCallbackProc,
|
||||||
|
XtCallbackProc);
|
||||||
|
extern void XmxInstallColormaps (Widget, Widget);
|
||||||
|
extern void XmxWinset (Widget);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* if 0 */
|
||||||
|
|
||||||
|
extern void XmxApplyBitmapToLabelWidget (Widget, String, unsigned int,
|
||||||
|
unsigned int);
|
||||||
|
extern Pixmap XmxCreatePixmapFromBitmap (Widget, String, unsigned int,
|
||||||
|
unsigned int);
|
||||||
|
extern void XmxApplyPixmapToLabelWidget (Widget, Pixmap);
|
||||||
|
|
||||||
|
extern Widget XmxMakeFormAndOneButton (Widget, XtCallbackProc, String, int);
|
||||||
|
extern Widget XmxMakeFormAndTwoButtons (Widget, XtCallbackProc, String,
|
||||||
|
String, int, int);
|
||||||
|
extern Widget XmxMakeFormAndTwoButtonsSqueezed (Widget, XtCallbackProc, String,
|
||||||
|
String, int, int);
|
||||||
|
extern Widget XmxMakeFormAndThreeButtons (Widget, XtCallbackProc, String,
|
||||||
|
String, String, int, int, int);
|
||||||
|
extern Widget XmxMakeFormAndThreeButtonsSqueezed (Widget, XtCallbackProc, String,
|
||||||
|
String, String, int, int, int);
|
||||||
|
extern Widget XmxMakeFormAndFourButtons (Widget, XtCallbackProc, String,
|
||||||
|
String, String, String, int, int, int, int);
|
||||||
|
extern Widget XmxMakeFormAndFiveButtons (Widget, XtCallbackProc, String,
|
||||||
|
String, String, String, String,
|
||||||
|
int, int, int, int, int);
|
||||||
|
|
||||||
|
extern int XmxModalYesOrNo (Widget parent, XtAppContext app,
|
||||||
|
char *questionstr, char *yesstr,
|
||||||
|
char *nostr);
|
||||||
|
extern char *XmxModalPromptForString (Widget parent, XtAppContext app,
|
||||||
|
char *questionstr, char *yesstr,
|
||||||
|
char *nostr);
|
||||||
|
extern char *XmxModalPromptForPassword (Widget parent, XtAppContext app,
|
||||||
|
char *questionstr, char *yesstr,
|
||||||
|
char *nostr);
|
||||||
|
|
||||||
|
/* Xmx2.c */
|
||||||
|
extern void XmxRSetSensitive (XmxMenuRecord *, int, int);
|
||||||
|
extern void XmxRSetToggleState (XmxMenuRecord *, int, int);
|
||||||
|
extern void XmxRUnsetAllToggles (XmxMenuRecord *);
|
||||||
|
extern void XmxRSetOptionMenuHistory (XmxMenuRecord *, int);
|
||||||
|
extern void XmxRSetValues (XmxMenuRecord *, int);
|
||||||
|
extern Widget XmxRGetWidget (XmxMenuRecord *, int);
|
||||||
|
|
||||||
|
extern XmxMenuRecord *XmxRMakeOptionMenu (Widget, String, XtCallbackProc,
|
||||||
|
XmxOptionMenuStruct *);
|
||||||
|
extern XmxMenuRecord *XmxRMakeToggleMenu (Widget, int, XtCallbackProc,
|
||||||
|
XmxToggleMenuStruct *);
|
||||||
|
extern XmxMenuRecord *XmxRMakeMenubar (Widget, XmxMenubarStruct *);
|
||||||
|
|
||||||
|
#endif /* __XMX_H__ */
|
497
libXmx/Xmx2.c
Normal file
497
libXmx/Xmx2.c
Normal file
@ -0,0 +1,497 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* 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 "XmxP.h"
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
/* --------------------------- PRIVATE ROUTINES --------------------------- */
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/* ----------------------- _XmxMenuAddEntryToRecord ----------------------- */
|
||||||
|
|
||||||
|
/* Create a new MenuEntry and add it to the head of a MenuRecord list. */
|
||||||
|
private void
|
||||||
|
_XmxMenuAddEntryToRecord (XmxMenuRecord *rec, Widget w, int token)
|
||||||
|
{
|
||||||
|
XmxMenuEntry *_ent;
|
||||||
|
|
||||||
|
/* Create new menu entry. */
|
||||||
|
_ent = (XmxMenuEntry *)malloc (sizeof (XmxMenuEntry));
|
||||||
|
_ent->w = w;
|
||||||
|
_ent->token = token;
|
||||||
|
|
||||||
|
/* Add rest of list to tail of this entry. */
|
||||||
|
_ent->next = rec->first_entry;
|
||||||
|
|
||||||
|
/* Make this entry head of list. */
|
||||||
|
rec->first_entry = _ent;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------- _XmxMenuGetEntryFromRecord ---------------------- */
|
||||||
|
|
||||||
|
private XmxMenuEntry *
|
||||||
|
_XmxMenuGetEntryFromRecord (XmxMenuRecord *rec, int token)
|
||||||
|
{
|
||||||
|
/* Given token, fetch the corresponding entry. */
|
||||||
|
XmxMenuEntry *_ent = NULL;
|
||||||
|
int _done;
|
||||||
|
|
||||||
|
/* Search the linked list. */
|
||||||
|
_ent = rec->first_entry;
|
||||||
|
_done = 0;
|
||||||
|
while (_ent != NULL && !_done)
|
||||||
|
{
|
||||||
|
if (_ent->token == token)
|
||||||
|
_done = 1;
|
||||||
|
else
|
||||||
|
_ent = _ent->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Punish the application for asking for a nonexistent entry. */
|
||||||
|
/* assert (_done); */
|
||||||
|
return _ent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------- _XmxMenuCreateRecord ------------------------- */
|
||||||
|
|
||||||
|
/* Create a new MenuRecord and clear out its list. */
|
||||||
|
private XmxMenuRecord *
|
||||||
|
_XmxMenuCreateRecord (Widget base)
|
||||||
|
{
|
||||||
|
XmxMenuRecord *_rec;
|
||||||
|
|
||||||
|
/* Create the new XmxMenuRecord. */
|
||||||
|
_rec = (XmxMenuRecord *)malloc (sizeof (XmxMenuRecord));
|
||||||
|
_rec->base = base;
|
||||||
|
_rec->first_entry = NULL;
|
||||||
|
|
||||||
|
return _rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
/* --------------------------- PUBLIC ROUTINES ---------------------------- */
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/* --------------------------- XmxRSetSensitive --------------------------- */
|
||||||
|
|
||||||
|
/* args NOT used on Widget */
|
||||||
|
public void
|
||||||
|
XmxRSetSensitive (XmxMenuRecord *rec, int token, int state)
|
||||||
|
{
|
||||||
|
XmxMenuEntry *_entry;
|
||||||
|
|
||||||
|
assert (state == XmxSensitive || state == XmxUnsensitive);
|
||||||
|
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
|
||||||
|
/* XtSetSensitive propagates down Widget hierarchy. */
|
||||||
|
if (_entry)
|
||||||
|
XtSetSensitive (_entry->w, (state == XmxSensitive) ? True : False);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------- XmxRSetToggleState -------------------------- */
|
||||||
|
|
||||||
|
/* args not used */
|
||||||
|
public void
|
||||||
|
XmxRSetToggleState (XmxMenuRecord *rec, int token, int state)
|
||||||
|
{
|
||||||
|
XmxMenuEntry *_entry;
|
||||||
|
|
||||||
|
assert (state == XmxSet || state == XmxUnset);
|
||||||
|
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
|
||||||
|
if (_entry)
|
||||||
|
XmToggleButtonGadgetSetState
|
||||||
|
(_entry->w, (state == XmxSet) ? True : False, False);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------- XmxRUnsetAllToggles -------------------------- */
|
||||||
|
|
||||||
|
/* args not used */
|
||||||
|
public void
|
||||||
|
XmxRUnsetAllToggles (XmxMenuRecord *rec)
|
||||||
|
{
|
||||||
|
XmxMenuEntry *_ent;
|
||||||
|
|
||||||
|
for (_ent = rec->first_entry; _ent != NULL; _ent = _ent->next)
|
||||||
|
XmToggleButtonGadgetSetState
|
||||||
|
(_ent->w, False, False);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------------- XmxRSetOptionMenuHistory ----------------------- */
|
||||||
|
|
||||||
|
/* args used on Widget */
|
||||||
|
public void
|
||||||
|
XmxRSetOptionMenuHistory (XmxMenuRecord *rec, int token)
|
||||||
|
{
|
||||||
|
XmxMenuEntry *_entry;
|
||||||
|
|
||||||
|
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
|
||||||
|
if (_entry)
|
||||||
|
{
|
||||||
|
XmxSetArg (XmNmenuHistory, (XtArgVal)(_entry->w));
|
||||||
|
XtSetValues (rec->base, Xmx_wargs, Xmx_n);
|
||||||
|
}
|
||||||
|
|
||||||
|
Xmx_n = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------- XmxRSetValues ----------------------------- */
|
||||||
|
|
||||||
|
/* args used on Widget */
|
||||||
|
public void
|
||||||
|
XmxRSetValues (XmxMenuRecord *rec, int token)
|
||||||
|
{
|
||||||
|
XmxMenuEntry *_entry;
|
||||||
|
|
||||||
|
/* Strip out uniqid, if present. */
|
||||||
|
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
|
||||||
|
if (_entry)
|
||||||
|
XtSetValues (_entry->w, Xmx_wargs, Xmx_n);
|
||||||
|
|
||||||
|
Xmx_n = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------- XmxRGetWidget ----------------------------- */
|
||||||
|
|
||||||
|
/* args irrelevant */
|
||||||
|
public Widget
|
||||||
|
XmxRGetWidget (XmxMenuRecord *rec, int token)
|
||||||
|
{
|
||||||
|
XmxMenuEntry *_entry;
|
||||||
|
|
||||||
|
/* Strip out uniqid, if present. */
|
||||||
|
_entry = _XmxMenuGetEntryFromRecord (rec, XmxExtractToken (token));
|
||||||
|
|
||||||
|
if (_entry)
|
||||||
|
return _entry->w;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------- XmxRMakeOptionMenu -------------------------- */
|
||||||
|
|
||||||
|
/* args apply to pulldown menu */
|
||||||
|
public XmxMenuRecord *
|
||||||
|
XmxRMakeOptionMenu (Widget parent, String name, XtCallbackProc cb,
|
||||||
|
XmxOptionMenuStruct *opts)
|
||||||
|
{
|
||||||
|
XmxMenuRecord *_rec;
|
||||||
|
Widget _pulldown, _button, _menuhist = (Widget)NULL;
|
||||||
|
int _i;
|
||||||
|
|
||||||
|
/* Create a pulldown menupane to attach to the option menu;
|
||||||
|
preloaded wargs affect this. */
|
||||||
|
_pulldown = XmCreatePulldownMenu (parent, "pulldownmenu", Xmx_wargs, Xmx_n);
|
||||||
|
|
||||||
|
/* menuHistory will not be applied to _pulldown, so we'll modify
|
||||||
|
_rec directly after creating the option menu. */
|
||||||
|
_rec = _XmxMenuCreateRecord (_pulldown);
|
||||||
|
|
||||||
|
/* Create pushbutton gadgets as childen of the pulldown menu. */
|
||||||
|
_i = 0;
|
||||||
|
while (opts[_i].namestr)
|
||||||
|
{
|
||||||
|
Xmx_n = 0;
|
||||||
|
XmxSetArg (XmNlabelString,
|
||||||
|
(XtArgVal)XmStringCreateLtoR (opts[_i].namestr,
|
||||||
|
XmSTRING_DEFAULT_CHARSET));
|
||||||
|
_button = XmCreatePushButtonGadget (_pulldown, "pushbutton",
|
||||||
|
Xmx_wargs, Xmx_n);
|
||||||
|
XtManageChild (_button);
|
||||||
|
XtAddCallback (_button, XmNactivateCallback, cb,
|
||||||
|
(XtPointer)_XmxMakeClientData (opts[_i].data));
|
||||||
|
if (opts[_i].set_state == XmxSet)
|
||||||
|
_menuhist = _button;
|
||||||
|
|
||||||
|
_XmxMenuAddEntryToRecord (_rec, _button, opts[_i].data);
|
||||||
|
|
||||||
|
_i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create the option menu itself; tie in the pulldown menu. */
|
||||||
|
Xmx_n = 0;
|
||||||
|
XmxSetArg (XmNsubMenuId, (XtArgVal)_pulldown);
|
||||||
|
if (_menuhist != (Widget)NULL)
|
||||||
|
XmxSetArg (XmNmenuHistory, (XtArgVal)_menuhist);
|
||||||
|
Xmx_w = XmCreateOptionMenu (parent, "optionmenu", Xmx_wargs, Xmx_n);
|
||||||
|
XtManageChild (Xmx_w);
|
||||||
|
|
||||||
|
XmxSetArg (XmNalignment, (XtArgVal)XmALIGNMENT_BEGINNING);
|
||||||
|
XmxSetValues (XmOptionButtonGadget (Xmx_w));
|
||||||
|
|
||||||
|
if (name)
|
||||||
|
{
|
||||||
|
XmxSetArg (XmNlabelString,
|
||||||
|
(XtArgVal)XmStringCreateLtoR (name, XmSTRING_DEFAULT_CHARSET));
|
||||||
|
XmxSetValues (XmOptionLabelGadget (Xmx_w));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmxSetArg (XmNspacing, (XtArgVal)0);
|
||||||
|
XmxSetArg (XmNmarginWidth, (XtArgVal)0);
|
||||||
|
XmxSetValues (Xmx_w);
|
||||||
|
XmxSetArg (XmNlabelString, (XtArgVal)NULL);
|
||||||
|
XmxSetValues (XmOptionLabelGadget (Xmx_w));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Explicitly set base Widget of record. */
|
||||||
|
_rec->base = Xmx_w;
|
||||||
|
|
||||||
|
Xmx_n = 0;
|
||||||
|
return _rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------- XmxRMakeToggleMenu -------------------------- */
|
||||||
|
|
||||||
|
/* args apply to radiobox or optionbox */
|
||||||
|
public XmxMenuRecord *
|
||||||
|
XmxRMakeToggleMenu (Widget parent, int behavior, XtCallbackProc cb,
|
||||||
|
XmxToggleMenuStruct *opts)
|
||||||
|
{
|
||||||
|
XmxMenuRecord *_rec;
|
||||||
|
Widget _box;
|
||||||
|
int _i;
|
||||||
|
|
||||||
|
assert (behavior == XmxOneOfMany || behavior == XmxNOfMany);
|
||||||
|
switch (behavior)
|
||||||
|
{
|
||||||
|
case XmxOneOfMany:
|
||||||
|
_box = XmxMakeRadioBox (parent);
|
||||||
|
break;
|
||||||
|
case XmxNOfMany:
|
||||||
|
_box = XmxMakeOptionBox (parent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_rec = _XmxMenuCreateRecord (_box);
|
||||||
|
|
||||||
|
_i = 0;
|
||||||
|
while (opts[_i].namestr)
|
||||||
|
{
|
||||||
|
XmxMakeToggleButton (_box, opts[_i].namestr, cb, opts[_i].data);
|
||||||
|
XmxSetToggleButton (Xmx_w, opts[_i].set_state);
|
||||||
|
_XmxMenuAddEntryToRecord (_rec, Xmx_w, opts[_i].data);
|
||||||
|
|
||||||
|
_i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Xmx_w = _box;
|
||||||
|
|
||||||
|
Xmx_n = 0;
|
||||||
|
return _rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------- _XmxRCreateMenubar -------------------------- */
|
||||||
|
|
||||||
|
/* Possible deficiency: will not be able to grey out a submenu
|
||||||
|
(cascade button). */
|
||||||
|
private void
|
||||||
|
_XmxRCreateMenubar (Widget menu, XmxMenubarStruct *menulist,
|
||||||
|
XmxMenuRecord *rec)
|
||||||
|
{
|
||||||
|
int _i;
|
||||||
|
Widget *_buttons;
|
||||||
|
int _separators = 0, _nitems;
|
||||||
|
|
||||||
|
_nitems = 0;
|
||||||
|
while (menulist[_nitems].namestr)
|
||||||
|
_nitems++;
|
||||||
|
|
||||||
|
_buttons = (Widget *)XtMalloc (_nitems * sizeof (Widget));
|
||||||
|
|
||||||
|
for (_i = 0; _i < _nitems; _i++)
|
||||||
|
{
|
||||||
|
/* Name of "----" means make a separator. */
|
||||||
|
if (strcmp(menulist[_i].namestr, "----") == 0)
|
||||||
|
{
|
||||||
|
XtCreateManagedWidget ("separator", xmSeparatorGadgetClass,
|
||||||
|
menu, NULL, 0);
|
||||||
|
_separators++;
|
||||||
|
}
|
||||||
|
/* A function means it's an ordinary entry with callback. */
|
||||||
|
else if (menulist[_i].func)
|
||||||
|
{
|
||||||
|
Xmx_n = 0;
|
||||||
|
if (menulist[_i].mnemonic)
|
||||||
|
XmxSetArg (XmNmnemonic, (XtArgVal)(menulist[_i].mnemonic));
|
||||||
|
if (menulist[_i].namestr[0] == '#' ||
|
||||||
|
menulist[_i].namestr[0] == '<') /* option/toggle button */
|
||||||
|
{
|
||||||
|
XmString xmstr;
|
||||||
|
|
||||||
|
/* A toggle button is diamond-shaped. */
|
||||||
|
if (menulist[_i].namestr[0] == '<')
|
||||||
|
XmxSetArg (XmNindicatorType, (XtArgVal)XmONE_OF_MANY);
|
||||||
|
|
||||||
|
/* Make sure the button shows up even when toggled off. */
|
||||||
|
if (menulist[_i].namestr[0] == '#')
|
||||||
|
XmxSetArg (XmNvisibleWhenOff, (XtArgVal)True);
|
||||||
|
|
||||||
|
/* Ignore first character of label. */
|
||||||
|
xmstr = XmxMakeXmstrFromString (&(menulist[_i].namestr[1]));
|
||||||
|
XmxSetArg (XmNlabelString, (XtArgVal)xmstr);
|
||||||
|
_buttons[_i - _separators] = XtCreateManagedWidget
|
||||||
|
("togglebutton", xmToggleButtonGadgetClass,
|
||||||
|
menu, Xmx_wargs, Xmx_n);
|
||||||
|
XmStringFree (xmstr);
|
||||||
|
|
||||||
|
XtAddCallback
|
||||||
|
(_buttons[_i - _separators], XmNvalueChangedCallback,
|
||||||
|
menulist[_i].func,
|
||||||
|
(XtPointer)_XmxMakeClientData (menulist[_i].data));
|
||||||
|
|
||||||
|
/* Add thie button to the menu record. */
|
||||||
|
_XmxMenuAddEntryToRecord
|
||||||
|
(rec, _buttons[_i - _separators], menulist[_i].data);
|
||||||
|
}
|
||||||
|
else /* regular button */
|
||||||
|
{
|
||||||
|
XmString xmstr =
|
||||||
|
XmStringCreateLtoR
|
||||||
|
(menulist[_i].namestr, XmSTRING_DEFAULT_CHARSET);
|
||||||
|
XmxSetArg (XmNlabelString, (XtArgVal)xmstr);
|
||||||
|
_buttons[_i - _separators] = XtCreateManagedWidget
|
||||||
|
("pushbutton", xmPushButtonGadgetClass,
|
||||||
|
menu, Xmx_wargs, Xmx_n);
|
||||||
|
XmStringFree (xmstr);
|
||||||
|
XtAddCallback
|
||||||
|
(_buttons[_i - _separators], XmNactivateCallback,
|
||||||
|
menulist[_i].func,
|
||||||
|
(XtPointer)_XmxMakeClientData (menulist[_i].data));
|
||||||
|
|
||||||
|
/* Add thie button to the menu record. */
|
||||||
|
_XmxMenuAddEntryToRecord
|
||||||
|
(rec, _buttons[_i - _separators], menulist[_i].data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* No function and no submenu entry means it's just a label. */
|
||||||
|
else if (menulist[_i].sub_menu == (XmxMenubarStruct *)NULL)
|
||||||
|
{
|
||||||
|
Xmx_n = 0;
|
||||||
|
XmxSetArg (XmNlabelString, (XtArgVal)XmStringCreateLtoR
|
||||||
|
(menulist[_i].namestr, XmSTRING_DEFAULT_CHARSET));
|
||||||
|
_buttons[_i - _separators] = XtCreateManagedWidget
|
||||||
|
("label", xmLabelGadgetClass, menu, Xmx_wargs, Xmx_n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If all else fails, it's a submenu. */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmString xmstr;
|
||||||
|
Widget _sub_menu;
|
||||||
|
_sub_menu = XmCreatePulldownMenu (menu, "pulldownmenu", NULL, 0);
|
||||||
|
|
||||||
|
Xmx_n = 0;
|
||||||
|
XmxSetArg (XmNsubMenuId, (XtArgVal)_sub_menu);
|
||||||
|
if (menulist[_i].mnemonic)
|
||||||
|
XmxSetArg (XmNmnemonic, (XtArgVal)(menulist[_i].mnemonic));
|
||||||
|
xmstr = XmStringCreateLtoR
|
||||||
|
(menulist[_i].namestr, XmSTRING_DEFAULT_CHARSET);
|
||||||
|
XmxSetArg (XmNlabelString, (XtArgVal)xmstr);
|
||||||
|
_buttons[_i - _separators] = XtCreateWidget
|
||||||
|
("cascadebutton", xmCascadeButtonGadgetClass,
|
||||||
|
menu, Xmx_wargs, Xmx_n);
|
||||||
|
XmStringFree (xmstr);
|
||||||
|
|
||||||
|
/* If name is "Help", put on far right. */
|
||||||
|
if (strcmp (menulist[_i].namestr, "Help") == 0)
|
||||||
|
{
|
||||||
|
Xmx_n = 0;
|
||||||
|
XmxSetArg (XmNmenuHelpWidget, (XtArgVal)_buttons[_i - _separators]);
|
||||||
|
XtSetValues (menu, Xmx_wargs, Xmx_n);
|
||||||
|
}
|
||||||
|
/* Recursively create new submenu. */
|
||||||
|
_XmxRCreateMenubar (_sub_menu, menulist[_i].sub_menu, rec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XtManageChildren (_buttons, _nitems - _separators);
|
||||||
|
|
||||||
|
XtFree ((char *)_buttons);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------- XmxRMakeMenubar ---------------------------- */
|
||||||
|
|
||||||
|
/* args apply to menubar */
|
||||||
|
public XmxMenuRecord *
|
||||||
|
XmxRMakeMenubar (Widget parent, XmxMenubarStruct *mainmenu)
|
||||||
|
{
|
||||||
|
Widget _menubar;
|
||||||
|
XmxMenuRecord *_rec;
|
||||||
|
|
||||||
|
/* Preset resources applied to main menubar only. */
|
||||||
|
_menubar = XmCreateMenuBar (parent, "menubar", Xmx_wargs, Xmx_n);
|
||||||
|
XtManageChild (_menubar);
|
||||||
|
|
||||||
|
/* Create the new XmxMenuRecord. */
|
||||||
|
_rec = _XmxMenuCreateRecord (_menubar);
|
||||||
|
|
||||||
|
Xmx_n = 0;
|
||||||
|
_XmxRCreateMenubar (_menubar, mainmenu, _rec);
|
||||||
|
|
||||||
|
Xmx_n = 0;
|
||||||
|
Xmx_w = _menubar;
|
||||||
|
return _rec;
|
||||||
|
}
|
143
libXmx/XmxP.h
Normal file
143
libXmx/XmxP.h
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
* 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 __XMXP_H__
|
||||||
|
#define __XMXP_H__
|
||||||
|
|
||||||
|
/* System includes. */
|
||||||
|
|
||||||
|
/* Here are some nasty ifdef's to make SGI's weird header files happy -DXP */
|
||||||
|
|
||||||
|
#ifdef __sgi
|
||||||
|
#ifndef _SVR4_SOURCE
|
||||||
|
#define _SVR4_SOURCE
|
||||||
|
#include <stdio.h>
|
||||||
|
#undef _SVR4_SOURCE
|
||||||
|
#else
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __sgi
|
||||||
|
#ifndef _SVR4_SOURCE
|
||||||
|
#define _SVR4_SOURCE
|
||||||
|
#include <string.h>
|
||||||
|
#undef _SVR4_SOURCE
|
||||||
|
#else
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <string.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __DECC
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif /* DECC, GEC for MPJZ and PGE */
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
/* Main Xmx include (also X11 includes and Xm.h). */
|
||||||
|
#include "Xmx.h"
|
||||||
|
|
||||||
|
/* Motif Widget-specific includes. */
|
||||||
|
#include <Xm/BulletinB.h>
|
||||||
|
#include <Xm/CascadeBG.h>
|
||||||
|
#include <Xm/Command.h>
|
||||||
|
#include <Xm/DialogS.h>
|
||||||
|
#include <Xm/DrawingA.h>
|
||||||
|
#include <Xm/FileSB.h>
|
||||||
|
#include <Xm/Form.h>
|
||||||
|
#include <Xm/Frame.h>
|
||||||
|
#include <Xm/Label.h>
|
||||||
|
#include <Xm/LabelG.h>
|
||||||
|
#include <Xm/List.h>
|
||||||
|
#include <Xm/MenuShell.h>
|
||||||
|
#include <Xm/MessageB.h>
|
||||||
|
#include <Xm/PushB.h>
|
||||||
|
#include <Xm/PushBG.h>
|
||||||
|
#include <Xm/RowColumn.h>
|
||||||
|
#include <Xm/Scale.h>
|
||||||
|
#include <Xm/ScrollBar.h>
|
||||||
|
#include <Xm/SelectioB.h>
|
||||||
|
#include <Xm/SeparatoG.h>
|
||||||
|
#include <Xm/Text.h>
|
||||||
|
#include <Xm/TextF.h>
|
||||||
|
#include <Xm/ToggleBG.h>
|
||||||
|
#include <Xm/ToggleB.h>
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
/* SGI-specific GL Widget inclues. */
|
||||||
|
#ifdef __sgi
|
||||||
|
#include <X11/Xirisw/GlxMDraw.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _IBMR2
|
||||||
|
#include "/usr/lpp/GL/utilities/inc/Glib.h"
|
||||||
|
#endif /* _IBMR2 */
|
||||||
|
|
||||||
|
#endif /* if 0 */
|
||||||
|
|
||||||
|
/* Prototypes for internal routines found in Xmx.c. */
|
||||||
|
extern int _XmxMakeClientData (int);
|
||||||
|
|
||||||
|
/* Marc's defines. */
|
||||||
|
#undef private
|
||||||
|
#define private static
|
||||||
|
#undef public
|
||||||
|
#define public
|
||||||
|
|
||||||
|
#endif /* __XMXP_H__ */
|
87
libXmx/descrip.mms
Executable file
87
libXmx/descrip.mms
Executable file
@ -0,0 +1,87 @@
|
|||||||
|
! MMS description file for LIBXMX
|
||||||
|
! 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
|
||||||
|
! Add a DEBUG=1 MACRO when debugging.
|
||||||
|
! Add a DECC=1 MACRO when compiling with DEC C.
|
||||||
|
! Add a MOTIF1_2=1 MACRO when compiling with Motif 1.2
|
||||||
|
!
|
||||||
|
! 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)libxmx.olb
|
||||||
|
|
||||||
|
.IFDEF DECC
|
||||||
|
.IFDEF PATHWAY
|
||||||
|
.INCLUDE [-.TWG]DECC_PREFIX_RULES.MMS
|
||||||
|
CQUALC=/DECC $(CC_PREFIX_NO_SIN)
|
||||||
|
.ELSE
|
||||||
|
.IFDEF MULTINET
|
||||||
|
CQUALC=/DECC/Prefix=ANSI
|
||||||
|
.ELSE
|
||||||
|
CQUALC=/DECC/Prefix=ALL
|
||||||
|
.ENDIF
|
||||||
|
.ENDIF
|
||||||
|
.ELSE ! Not DEC C
|
||||||
|
.IFDEF DECCVAXC
|
||||||
|
CQUALC=/VAXC
|
||||||
|
.ELSE
|
||||||
|
CQUALC=
|
||||||
|
.ENDIF
|
||||||
|
.ENDIF
|
||||||
|
|
||||||
|
.IFDEF MOTIF1_2
|
||||||
|
MOTIF = MOTIF1_2
|
||||||
|
.ELSE
|
||||||
|
MOTIF = MOTIF1_1
|
||||||
|
.ENDIF
|
||||||
|
|
||||||
|
.IFDEF MULTINET
|
||||||
|
TCPIP = ,MULTINET
|
||||||
|
.ELSE
|
||||||
|
.IFDEF PATHWAY
|
||||||
|
TCPIP = ,WIN_TCP
|
||||||
|
.ELSE
|
||||||
|
TCPIP =
|
||||||
|
.ENDIF
|
||||||
|
.ENDIF
|
||||||
|
|
||||||
|
.IFDEF DEBUG
|
||||||
|
CFLAGS = $(CQUALC)/Define=($(MOTIF)$(TCPIP))/NoOpt/Debug
|
||||||
|
.ELSE
|
||||||
|
CFLAGS = $(CQUALC)/Define=($(MOTIF)$(TCPIP))
|
||||||
|
.ENDIF
|
||||||
|
|
||||||
|
OBJECTS = Odir:xmx.obj Odir:xmx2.obj
|
||||||
|
|
||||||
|
.FIRST
|
||||||
|
@ If F$Search("$(LIBTARGET)") .EQS. "" Then Library/Create $(LIBTARGET)
|
||||||
|
@ Define/NoLog Odir $(WDIR)
|
||||||
|
.IFDEF PATHWAY
|
||||||
|
@ @[-.TWG]def
|
||||||
|
.ENDIF
|
||||||
|
|
||||||
|
$(LIBTARGET) : $(LIBTARGET)($(OBJECTS))
|
||||||
|
@ Write SYS$Output "Library libXmx.olb built."
|
||||||
|
|
||||||
|
Odir:xmx.obj : xmx.c
|
||||||
|
Odir:xmx2.obj : xmx2.c
|
||||||
|
|
||||||
|
.c.obj :
|
||||||
|
$(CC)$(CFLAGS)/OBJECT=$@ $<
|
||||||
|
|
||||||
|
.obj.olb
|
||||||
|
$(LIBR) $(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE)
|
||||||
|
|
||||||
|
clean :
|
||||||
|
Delete/Log $(WDIR)*.OBJ;*
|
||||||
|
Delete/Log $(LIBTARGET);*
|
||||||
|
|
171
libdtm/Makefile
Normal file
171
libdtm/Makefile
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
#
|
||||||
|
# Makefile for libdtm
|
||||||
|
#
|
||||||
|
# USAGE:
|
||||||
|
# make all - if you have the $ARCH variable set
|
||||||
|
# setenv ARCH .`arch`
|
||||||
|
# make sun - if you want to build for the sun
|
||||||
|
# make XXX - for any machine in particular
|
||||||
|
# make spec - to build a version libdtmXXX.a where XXX is $ARCH
|
||||||
|
#
|
||||||
|
|
||||||
|
.SUFFIXES: $(ARCH).o
|
||||||
|
|
||||||
|
DTMINC = .
|
||||||
|
|
||||||
|
LIBDTM=libdtm.a
|
||||||
|
|
||||||
|
OBJ=dtminit.o dtm.o dtmmisc.o socket.o rwrtns.o fatal.o sds.o sdl.o ris.o \
|
||||||
|
dtmnserv.o ninit.o nmsg.o callback.o vdata.o
|
||||||
|
|
||||||
|
OBJ_SPEC=dtminit$(ARCH).o dtm$(ARCH).o dtmmisc$(ARCH).o socket$(ARCH).o \
|
||||||
|
rwrtns$(ARCH).o fatal$(ARCH).o sds$(ARCH).o sdl$(ARCH).o ris$(ARCH).o \
|
||||||
|
dtmnserv$(ARCH).o ninit$(ARCH).o nmsg$(ARCH).o callback$(ARCH).o
|
||||||
|
|
||||||
|
DEPENDS = make.depend
|
||||||
|
|
||||||
|
CFT = cft77
|
||||||
|
FOBJS = dtmf77.o crayinit.o
|
||||||
|
|
||||||
|
|
||||||
|
dtmlib : dtm_$(ARCH)
|
||||||
|
all : dtm_$(ARCH)
|
||||||
|
spec : $(ARCH)
|
||||||
|
all_spec: $(ARCH)
|
||||||
|
|
||||||
|
dtm_.sun4 : sun
|
||||||
|
dtm_.alpha : alpha
|
||||||
|
dtm_.sgi : sgi
|
||||||
|
dtm_.next : next
|
||||||
|
dtm_.cray : cray
|
||||||
|
dtm_.ibm : ibm
|
||||||
|
dtm_.convex : convex
|
||||||
|
dtm_.dec : dec
|
||||||
|
dtm_.vax : vax
|
||||||
|
dtm_.hp : hp
|
||||||
|
|
||||||
|
|
||||||
|
dtm_ ::
|
||||||
|
@echo Either set up the ARCH environment or specify a machine type
|
||||||
|
@echo " ex: make sun"
|
||||||
|
|
||||||
|
solaris :
|
||||||
|
make internal "CC=$(CC)" "CFLAGS = -DSUN -DSOLARIS" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = /bin/true libdtm.a"
|
||||||
|
|
||||||
|
solarisx86 :
|
||||||
|
make internal "CC=$(CC)" "CFLAGS = -DSUN -DSOLARIS" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = /bin/true libdtm.a"
|
||||||
|
|
||||||
|
alpha :
|
||||||
|
make internal "CFLAGS = -DOSF1 -target $(TARGET_ARCH:-%=%)" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
|
||||||
|
linux :
|
||||||
|
make internal "CFLAGS = -DLINUX" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
|
||||||
|
sun4 : sun
|
||||||
|
sun :
|
||||||
|
make internal "CFLAGS = -DSUN -target $(TARGET_ARCH:-%=%)" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
.sun4 :
|
||||||
|
make internal_spec "CFLAGS = -g -DSUN -target $(TARGET_ARCH:-%=%)" \
|
||||||
|
"OBJECTS = $(OBJ_SPEC) convert$(ARCH).o mdd$(ARCH).o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm$(ARCH).a"
|
||||||
|
next :
|
||||||
|
make internal "CFLAGS = -DNEXT " \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
|
||||||
|
sgi :
|
||||||
|
make internal "CFLAGS = -DSGI -cckr -I/usr/include/sun -I/usr/include/bsd" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
|
||||||
|
indy: $(OBJ) convert.o
|
||||||
|
ar cr libdtm.a $(OBJ)
|
||||||
|
|
||||||
|
.sgi :
|
||||||
|
make internal_spec "CFLAGS = -DSGI -I/usr/include/sun -I/usr/include/bsd" \
|
||||||
|
"OBJECTS = $(OBJ_SPEC) convert$(ARCH).o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
|
||||||
|
cray :
|
||||||
|
make internal "CFLAGS = -DCRAY" "CFT = cft77" \
|
||||||
|
"OBJECTS = $(OBJ) craycvt.o crayrtns.o" \
|
||||||
|
"ARCHIVE = bld q" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
make libdtmf77.a "CFLAGS = -DCRAY" "CFT = cft77" \
|
||||||
|
"OBJECTS = $(OBJ) craycvt.o crayrtns.o sdsF.o" \
|
||||||
|
"ARCHIVE = bld q"
|
||||||
|
convex :
|
||||||
|
make internal "CFLAGS = -DCONVEX -fi" \
|
||||||
|
"OBJECTS = $(OBJ) mdd.o convert.o" "ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
ibm :
|
||||||
|
make internal "CFLAGS = -DRS6000" "OBJECTS = $(OBJ) mdd.o convert.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
hp :
|
||||||
|
make internal "CFLAGS = -Aa -D_HPUX_SOURCE" "OBJECTS = $(OBJ) mdd.o convert.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
dec :
|
||||||
|
make internal "CFLAGS = -DDEC" "OBJECTS = $(OBJ) mdd.o deccvt.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ar ts libdtm.a"
|
||||||
|
vax :
|
||||||
|
make internal "CFLAGS = -DVAX" "OBJECTS = $(OBJ) mdd.o vaxcvt.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
|
||||||
|
%$(ARCH).o: %.c
|
||||||
|
$(CC) $(CFLAGS) $(DTMCFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
internal : $(LIBDTM)
|
||||||
|
|
||||||
|
$(LIBDTM): $(OBJECTS)
|
||||||
|
$(ARCHIVE) libdtm.a $(OBJECTS)
|
||||||
|
$(RANLIB_CMD)
|
||||||
|
|
||||||
|
internal_spec : $(OBJECTS)
|
||||||
|
$(ARCHIVE) libdtm$(ARCH).a $(OBJECTS)
|
||||||
|
$(RANLIB_CMD)
|
||||||
|
|
||||||
|
libdtmf77.a : $(OBJECTS) $(FOBJS)
|
||||||
|
$(ARCHIVE) libdtmf77.a $(OBJECTS) $(FOBJS)
|
||||||
|
|
||||||
|
depend::
|
||||||
|
makedepend -f $(DEPENDS) -I$(DTMINC) *.c *.f
|
||||||
|
sed -e "s/\.o/$(ARCH).o/1w .depend.temp" -e "d" < $(DEPENDS)
|
||||||
|
cat .depend.temp >> $(DEPENDS)
|
||||||
|
|
||||||
|
clean::
|
||||||
|
-rm -f *.o *.a
|
||||||
|
|
||||||
|
install::
|
||||||
|
-mv $(DIR)/lib/libdtm.a $(DIR)/lib/libdtm.bak
|
||||||
|
cp *.a $(DIR)/lib
|
||||||
|
-ranlib $(DIR)/lib/libdtm.a
|
||||||
|
-rm -f $(DIR)/include/dtm.h $(DIR)/include/sds.h
|
||||||
|
-rm -f $(DIR)/include/ris.h $(DIR)/include/db.h
|
||||||
|
-rm -f $(DIR)/include/mdd.h $(DIR)/include/sdl.h
|
||||||
|
-rm -f $(DIR)/include/debug.h $(DIR)/include/arch.h
|
||||||
|
cp dtm.h debug.h sds.h ris.h db.h mdd.h sdl.h arch.h $(DIR)/include
|
||||||
|
|
||||||
|
include $(DEPENDS)
|
171
libdtm/Makefile.orig
Normal file
171
libdtm/Makefile.orig
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
#
|
||||||
|
# Makefile for libdtm
|
||||||
|
#
|
||||||
|
# USAGE:
|
||||||
|
# make all - if you have the $ARCH variable set
|
||||||
|
# setenv ARCH .`arch`
|
||||||
|
# make sun - if you want to build for the sun
|
||||||
|
# make XXX - for any machine in particular
|
||||||
|
# make spec - to build a version libdtmXXX.a where XXX is $ARCH
|
||||||
|
#
|
||||||
|
|
||||||
|
.SUFFIXES: $(ARCH).o
|
||||||
|
|
||||||
|
DTMINC = .
|
||||||
|
|
||||||
|
LIBDTM=libdtm.a
|
||||||
|
|
||||||
|
OBJ=dtminit.o dtm.o dtmmisc.o socket.o rwrtns.o fatal.o sds.o sdl.o ris.o \
|
||||||
|
dtmnserv.o ninit.o nmsg.o callback.o vdata.o
|
||||||
|
|
||||||
|
OBJ_SPEC=dtminit$(ARCH).o dtm$(ARCH).o dtmmisc$(ARCH).o socket$(ARCH).o \
|
||||||
|
rwrtns$(ARCH).o fatal$(ARCH).o sds$(ARCH).o sdl$(ARCH).o ris$(ARCH).o \
|
||||||
|
dtmnserv$(ARCH).o ninit$(ARCH).o nmsg$(ARCH).o callback$(ARCH).o
|
||||||
|
|
||||||
|
DEPENDS = make.depend
|
||||||
|
|
||||||
|
CFT = cft77
|
||||||
|
FOBJS = dtmf77.o crayinit.o
|
||||||
|
|
||||||
|
|
||||||
|
dtmlib : dtm_$(ARCH)
|
||||||
|
all : dtm_$(ARCH)
|
||||||
|
spec : $(ARCH)
|
||||||
|
all_spec: $(ARCH)
|
||||||
|
|
||||||
|
dtm_.sun4 : sun
|
||||||
|
dtm_.alpha : alpha
|
||||||
|
dtm_.sgi : sgi
|
||||||
|
dtm_.next : next
|
||||||
|
dtm_.cray : cray
|
||||||
|
dtm_.ibm : ibm
|
||||||
|
dtm_.convex : convex
|
||||||
|
dtm_.dec : dec
|
||||||
|
dtm_.vax : vax
|
||||||
|
dtm_.hp : hp
|
||||||
|
|
||||||
|
|
||||||
|
dtm_ ::
|
||||||
|
@echo Either set up the ARCH environment or specify a machine type
|
||||||
|
@echo " ex: make sun"
|
||||||
|
|
||||||
|
solaris :
|
||||||
|
make internal "CC=$(CC)" "CFLAGS = -DSUN -DSOLARIS" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = /bin/true libdtm.a"
|
||||||
|
|
||||||
|
solarisx86 :
|
||||||
|
make internal "CC=$(CC)" "CFLAGS = -DSUN -DSOLARIS" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = /bin/true libdtm.a"
|
||||||
|
|
||||||
|
alpha :
|
||||||
|
make internal "CFLAGS = -DOSF1 -target $(TARGET_ARCH:-%=%)" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
|
||||||
|
linux :
|
||||||
|
make internal "CFLAGS = -DLINUX" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
|
||||||
|
sun4 : sun
|
||||||
|
sun :
|
||||||
|
make internal "CFLAGS = -DSUN -target $(TARGET_ARCH:-%=%)" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
.sun4 :
|
||||||
|
make internal_spec "CFLAGS = -g -DSUN -target $(TARGET_ARCH:-%=%)" \
|
||||||
|
"OBJECTS = $(OBJ_SPEC) convert$(ARCH).o mdd$(ARCH).o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm$(ARCH).a"
|
||||||
|
next :
|
||||||
|
make internal "CFLAGS = -DNEXT " \
|
||||||
|
"OBJECTS = $(OBJ) convert.o mdd.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
|
||||||
|
sgi :
|
||||||
|
make internal "CFLAGS = -DSGI -cckr -I/usr/include/sun -I/usr/include/bsd" \
|
||||||
|
"OBJECTS = $(OBJ) convert.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
|
||||||
|
indy: $(OBJ) convert.o
|
||||||
|
ar cr libdtm.a $(OBJ)
|
||||||
|
|
||||||
|
.sgi :
|
||||||
|
make internal_spec "CFLAGS = -DSGI -I/usr/include/sun -I/usr/include/bsd" \
|
||||||
|
"OBJECTS = $(OBJ_SPEC) convert$(ARCH).o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
|
||||||
|
cray :
|
||||||
|
make internal "CFLAGS = -DCRAY" "CFT = cft77" \
|
||||||
|
"OBJECTS = $(OBJ) craycvt.o crayrtns.o" \
|
||||||
|
"ARCHIVE = bld q" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
make libdtmf77.a "CFLAGS = -DCRAY" "CFT = cft77" \
|
||||||
|
"OBJECTS = $(OBJ) craycvt.o crayrtns.o sdsF.o" \
|
||||||
|
"ARCHIVE = bld q"
|
||||||
|
convex :
|
||||||
|
make internal "CFLAGS = -DCONVEX -fi" \
|
||||||
|
"OBJECTS = $(OBJ) mdd.o convert.o" "ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
ibm :
|
||||||
|
make internal "CFLAGS = -DRS6000" "OBJECTS = $(OBJ) mdd.o convert.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ranlib libdtm.a"
|
||||||
|
hp :
|
||||||
|
make internal "CFLAGS = -Aa -D_HPUX_SOURCE" "OBJECTS = $(OBJ) mdd.o convert.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
dec :
|
||||||
|
make internal "CFLAGS = -DDEC" "OBJECTS = $(OBJ) mdd.o deccvt.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = ar ts libdtm.a"
|
||||||
|
vax :
|
||||||
|
make internal "CFLAGS = -DVAX" "OBJECTS = $(OBJ) mdd.o vaxcvt.o" \
|
||||||
|
"ARCHIVE = ar rv" \
|
||||||
|
"RANLIB_CMD = "
|
||||||
|
|
||||||
|
%$(ARCH).o: %.c
|
||||||
|
$(CC) $(CFLAGS) $(DTMCFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
internal : $(LIBDTM)
|
||||||
|
|
||||||
|
$(LIBDTM): $(OBJECTS)
|
||||||
|
$(ARCHIVE) libdtm.a $(OBJECTS)
|
||||||
|
$(RANLIB_CMD)
|
||||||
|
|
||||||
|
internal_spec : $(OBJECTS)
|
||||||
|
$(ARCHIVE) libdtm$(ARCH).a $(OBJECTS)
|
||||||
|
$(RANLIB_CMD)
|
||||||
|
|
||||||
|
libdtmf77.a : $(OBJECTS) $(FOBJS)
|
||||||
|
$(ARCHIVE) libdtmf77.a $(OBJECTS) $(FOBJS)
|
||||||
|
|
||||||
|
depend::
|
||||||
|
makedepend -f $(DEPENDS) -I$(DTMINC) *.c *.f
|
||||||
|
sed -e "s/\.o/$(ARCH).o/1w .depend.temp" -e "d" < $(DEPENDS)
|
||||||
|
cat .depend.temp >> $(DEPENDS)
|
||||||
|
|
||||||
|
clean::
|
||||||
|
-rm -f *.o *.a
|
||||||
|
|
||||||
|
install::
|
||||||
|
-mv $(DIR)/lib/libdtm.a $(DIR)/lib/libdtm.bak
|
||||||
|
cp *.a $(DIR)/lib
|
||||||
|
-ranlib $(DIR)/lib/libdtm.a
|
||||||
|
-rm -f $(DIR)/include/dtm.h $(DIR)/include/sds.h
|
||||||
|
-rm -f $(DIR)/include/ris.h $(DIR)/include/db.h
|
||||||
|
-rm -f $(DIR)/include/mdd.h $(DIR)/include/sdl.h
|
||||||
|
-rm -f $(DIR)/include/debug.h $(DIR)/include/arch.h
|
||||||
|
cp dtm.h debug.h sds.h ris.h db.h mdd.h sdl.h arch.h $(DIR)/include
|
||||||
|
|
||||||
|
include $(DEPENDS)
|
6
libdtm/README
Normal file
6
libdtm/README
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
This is version 2.3r2 of NCSA DTM.
|
||||||
|
|
||||||
|
See Makefile for build instructions; e.g.
|
||||||
|
make sgi
|
||||||
|
make sun
|
||||||
|
|
52
libdtm/anim.h
Normal file
52
libdtm/anim.h
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#define ANIMclass "ANIM"
|
||||||
|
#define ANIMtag "ANIMATION"
|
||||||
|
#define ANIMtitle "TTL"
|
||||||
|
#define ANIMframeNumber "FRN"
|
||||||
|
#define ANIMfunc "FNC"
|
||||||
|
#define ANIMid "ID"
|
||||||
|
#define ANIMskip "SKIP"
|
||||||
|
#define ANIMRunType "RType"
|
||||||
|
#define ANIMExpandX "XEXPAND"
|
||||||
|
#define ANIMExpandY "YEXPAND"
|
||||||
|
|
||||||
|
#define ANIM_FUNC_STOP 1
|
||||||
|
#define ANIM_FUNC_FPLAY 2 /* forward play */
|
||||||
|
#define ANIM_FUNC_RPLAY 3 /* reverse play */
|
||||||
|
|
||||||
|
#define ANIM_RUN_TYPE_SINGLE 1 /* single play */
|
||||||
|
#define ANIM_RUN_TYPE_CONT 2 /* continuous play in one direction*/
|
||||||
|
#define ANIM_RUN_TYPE_BOUNCE 3 /* continuous play alternating direction*/
|
||||||
|
|
||||||
|
#define ANIMsetClass(h) dtm_set_class(h,ANIMclass)
|
||||||
|
#define ANIMcompareClass(h) dtm_compare_class(h,ANIMclass)
|
||||||
|
|
||||||
|
#define ANIMsetTitle dtm_set_title
|
||||||
|
#define ANIMgetTitle dtm_get_title
|
||||||
|
|
||||||
|
#define ANIMsetID(h,s) dtm_set_char(h,ANIMid,s)
|
||||||
|
#define ANIMgetID(h,s,l) dtm_get_char(h,ANIMid,s,l)
|
||||||
|
|
||||||
|
#define ANIMsetFunc(h,i) dtm_set_int(h,ANIMfunc,i)
|
||||||
|
#define ANIMgetFunc(h,i) dtm_get_int(h,ANIMfunc,i)
|
||||||
|
|
||||||
|
#define ANIMsetRunType(h,i) dtm_set_int(h,ANIMRunType,i)
|
||||||
|
#define ANIMgetRunType(h,i) dtm_get_int(h,ANIMRunType,i)
|
||||||
|
|
||||||
|
#define ANIMsetFrame(h,i) dtm_set_int(h,ANIMframeNumber,i)
|
||||||
|
#define ANIMgetFrame(h,i) dtm_get_int(h,ANIMframeNumber,i)
|
||||||
|
|
||||||
|
#define ANIMsetFrameSkip(h,i) dtm_set_int(h,ANIMskip,i)
|
||||||
|
#define ANIMgetFrameSkip(h,i) dtm_get_int(h,ANIMskip,i)
|
||||||
|
|
||||||
|
/* used to mark SDS as animation frame */
|
||||||
|
#define ANIMmarkAnimation(h) dtm_set_int(h,ANIMtag,1)
|
||||||
|
#define ANIMisAnimation(h,i) ((dtm_get_int(h,ANIMtag,&(i)) == -1)?0:1)
|
||||||
|
|
||||||
|
#define ANIMsetExpansion(h,x,y) {dtm_set_float(h,ANIMExpandX,x); \
|
||||||
|
dtm_set_float(h,ANIMExpandY,y); }
|
||||||
|
|
||||||
|
#define ANIMgetExpansion(h,x,y) {if (-1 == dtm_get_float(h,ANIMExpandX,x)) \
|
||||||
|
{ (*(x)) = 1.0; (*(y)) = 1.0;} \
|
||||||
|
if (-1 == dtm_get_float(h,ANIMExpandY,y)) \
|
||||||
|
{ (*(x)) = 1.0; (*(y)) = 1.0;} \
|
||||||
|
}
|
341
libdtm/arch.h
Normal file
341
libdtm/arch.h
Normal file
@ -0,0 +1,341 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/arch.h,v 1.5 1996/06/06 19:47:12 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#ifndef ARCH_INC
|
||||||
|
#define ARCH_INC
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.2 1993/10/29 03:46:43 marca
|
||||||
|
* Tweaks.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:16 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.3 1993/04/18 05:51:45 marca
|
||||||
|
* Tweaks.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1993/01/23 15:30:18 marca
|
||||||
|
* Fixed define typo.
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:00 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.7 92/04/30 20:27:05 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.6 1992/04/14 22:59:57 jefft
|
||||||
|
* included sys/limits.h instead of sys/limit.h
|
||||||
|
*
|
||||||
|
* Revision 1.5 1992/04/13 16:07:10 jplevyak
|
||||||
|
* Changes for DEC and RS6000.
|
||||||
|
*
|
||||||
|
* Revision 1.4 92/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.3 1992/03/10 16:52:43 jefft
|
||||||
|
* modified convex define to __convex__
|
||||||
|
*
|
||||||
|
* Revision 1.2 1992/01/14 16:35:22 creiman
|
||||||
|
* Added _ARCH_PROTO to applec
|
||||||
|
*
|
||||||
|
* Revision 1.1 1991/12/17 23:50:49 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
The intent of this file is to provide a standard set of
|
||||||
|
architecturally descriptive preprocessor definitions by
|
||||||
|
examining the preprocessor identifiers that are defined
|
||||||
|
in the native compiler running in the default mode.
|
||||||
|
|
||||||
|
Please feel free to add to or correct this file.
|
||||||
|
If you are feeling particularly generous, it would be
|
||||||
|
appreciated if you would send you changes to:
|
||||||
|
jplevyak@ncsa.uiuc.edu
|
||||||
|
so that I may update my version.
|
||||||
|
|
||||||
|
Definitions are of the form:
|
||||||
|
|
||||||
|
_ARCH_xxxx where xxxx is:
|
||||||
|
General Manufacturer
|
||||||
|
SUN - generally any machine by Sun Microsystems
|
||||||
|
SGI - Silicon Graphics
|
||||||
|
CRAY - Cray Research
|
||||||
|
CONVEX - Convex
|
||||||
|
CM - Connection Machine
|
||||||
|
IBM
|
||||||
|
APPLE
|
||||||
|
HP
|
||||||
|
DEC
|
||||||
|
COMMODORE
|
||||||
|
General OS
|
||||||
|
DOS
|
||||||
|
UNIX
|
||||||
|
MACOS
|
||||||
|
AMIGA
|
||||||
|
VMS
|
||||||
|
OS2
|
||||||
|
General Processor
|
||||||
|
SPARC
|
||||||
|
MIPS
|
||||||
|
68000
|
||||||
|
8086
|
||||||
|
80286
|
||||||
|
80386
|
||||||
|
VAX
|
||||||
|
PA - HP Percision Architecture
|
||||||
|
RS6000
|
||||||
|
Specific Interesting Qualities
|
||||||
|
BIG_ENDIAN
|
||||||
|
LITTLE_ENDIAN
|
||||||
|
WORD_SIZE - values include 16, 32, 64 (bits)
|
||||||
|
SYSV
|
||||||
|
BSD
|
||||||
|
PROTO - Compiler supports prototypes
|
||||||
|
|
||||||
|
( possible interesting definitions )
|
||||||
|
mc68k unix unixpc (hp 68k ?)
|
||||||
|
mc68000
|
||||||
|
_I386 i386 AIX _AIX (PS2 running AIX)
|
||||||
|
alliant (68000 unix)
|
||||||
|
vax mc68k32 PORTAR (altos? 30068)
|
||||||
|
apollo aegis unix (??) (apollo)
|
||||||
|
i80386 (compac?) BSD
|
||||||
|
convex unix (32 bit)
|
||||||
|
__convex_c1__
|
||||||
|
__convex_c2__
|
||||||
|
__MIPSEL __R3000 __SYSTYPE_BSD __bsd4_2 __host_mips __mips
|
||||||
|
__ultrix __unix, same without __ prefix, Dec Station
|
||||||
|
ns32000 n16 ns16000 ns32332 unix (encore)
|
||||||
|
tahoe unix hcx (harris tahoe)
|
||||||
|
mc68000 mc68010 hp200 unix (hp is BSD)
|
||||||
|
mc68020
|
||||||
|
_HPUX_SOURCE hp9000s300 hp9000s200 PWB hpux unix (68000)
|
||||||
|
hp9000 (BSD)
|
||||||
|
unix M_UNIX M_I386 M_COFF M_WORDSWAP (ESIX Unix System V)
|
||||||
|
- Iteractive Unix is like system V
|
||||||
|
- SCO same as ESIX
|
||||||
|
SCO_UNIX
|
||||||
|
i860 (generic) (32 bit)
|
||||||
|
unix mips sgi SVR3 MIPSEB SYSTYPE_SYSV (IRIS)
|
||||||
|
r3000 MISPEB SYSTYPE_BSD sony_news unix (mips sony)
|
||||||
|
mc68000 mc68020 news800 bsd43 (68k sony)
|
||||||
|
NeXT unix __MACH__ mc68000 (BSD ??)
|
||||||
|
ns32000 unix (generic) (not big-endian) (32 bit)
|
||||||
|
pyr unix (Pyramid) (not big-endian) (32 bit)
|
||||||
|
sequent unix i386
|
||||||
|
sequent unix ns32000
|
||||||
|
spur (32 bit machine) (not big or little endian)
|
||||||
|
sun386 i386 sun unix
|
||||||
|
mc68000 sun sun3 unix MACH CMU MTXINU BIT_MSF BYTE_MSF (??)
|
||||||
|
tahoe (generic)
|
||||||
|
unix tower32 (68k) (NCR Tower running Sys V release 3)
|
||||||
|
ultrix bsd4_2 vax unix __vax (you guessed it)
|
||||||
|
vax unix (generic) (not big endian)
|
||||||
|
vax vms VMS
|
||||||
|
__TURBOC__
|
||||||
|
OS2_MC - microsoft C for os2
|
||||||
|
AMIGA
|
||||||
|
USG (as indicator or SYSV or SYS_V)
|
||||||
|
MS_DOS (as general indicator)
|
||||||
|
applec (MPW)
|
||||||
|
THINK_C
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined( __hpux )
|
||||||
|
# define _ARCH_HP
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# define _ARCH_SYSV
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
#elif defined( __sgi )
|
||||||
|
# define _ARCH_SGI
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# define _ARCH_SYSV
|
||||||
|
# define _ARCH_MIPS
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
# define _ARCH_PROTO
|
||||||
|
#elif defined( sun )
|
||||||
|
# define _ARCH_SUN
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# define _ARCH_BSD
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
# if defined(sparc)
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# define _ARCH_SPARC
|
||||||
|
# elif defined( i386 )
|
||||||
|
# define _ARCH_LITTLE_ENDIAN
|
||||||
|
# define _ARCH_80386
|
||||||
|
# else
|
||||||
|
/* assume */
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# define _ARCH_68000
|
||||||
|
# endif
|
||||||
|
#elif defined( NEXT )
|
||||||
|
# define _ARCH_NEXT
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# define _ARCH_BSD
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# define _ARCH_68000
|
||||||
|
#elif defined( cray )
|
||||||
|
# define _ARCH_CRAY
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# define _ARCH_SYSV /* A rough approximation */
|
||||||
|
# define _ARCH_BIG_ENDIAN /* ?? */
|
||||||
|
# define _ARCH_WORD_SIZE 64
|
||||||
|
#elif defined(vax)
|
||||||
|
# define _ARCH_DEC
|
||||||
|
# define _ARCH_VAX
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
# define _ARCH_LITTLE_ENDIAN
|
||||||
|
# if defined( vmx )
|
||||||
|
# define _ARCH_VMX
|
||||||
|
# elif defined( unix )
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# define _ARCH_BSD
|
||||||
|
# endif
|
||||||
|
#elif defined( __ultrix ) && defined( __mips )
|
||||||
|
#define _ARCH_DEC
|
||||||
|
#define _ARCH_DEC_STATION
|
||||||
|
#define _ARCH_MIPS
|
||||||
|
#define _ARCH_BSD
|
||||||
|
#define _ARCH_WORD_SIZE 32
|
||||||
|
#define _ARCH_LITTLE_ENDIAN
|
||||||
|
#define _ARCH_PROTO
|
||||||
|
#elif defined( _IBMR2 )
|
||||||
|
#define _ARCH_IBM
|
||||||
|
#define _ARCH_RS6000
|
||||||
|
#elif defined( AMIGA )
|
||||||
|
/* incomplete */
|
||||||
|
# define _ARCH_COMMODORE
|
||||||
|
# define _ARCH_AMIGA
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# define _ARCH_68000
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
#elif defined ( MS_DOS ) || defined(__TURBOC__)
|
||||||
|
# define _ARCH_MSDOS
|
||||||
|
# define _ARCH_8086
|
||||||
|
# define _ARCH_LITTLE_ENDIAN
|
||||||
|
# define _ARCH_WORD_SIZE 16
|
||||||
|
# define _ARCH_PROTO
|
||||||
|
#elif defined ( OS2_MC )
|
||||||
|
# define _ARCH_OS2
|
||||||
|
# define _ARCH_80286
|
||||||
|
# define _ARCH_LITTLE_ENDIAN
|
||||||
|
# define _ARCH_WORD_SIZE 16
|
||||||
|
# define _ARCH_MSDOS
|
||||||
|
# define _ARCH_PROTO
|
||||||
|
#elif defined ( THINK_C ) || defined( applec )
|
||||||
|
# define _ARCH_APPLE
|
||||||
|
# define _ARCH_MACOS
|
||||||
|
# define _ARCH_68000
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
# define _ARCH_PROTO
|
||||||
|
#elif defined( alliant )
|
||||||
|
/* ?? */
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# define _ARCH_68000
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
#elif defined( __convex__ ) || defined( __convex_c1__ ) || defined( __convex_c2__ )
|
||||||
|
/* ?? */
|
||||||
|
# define _ARCH_CONVEX
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
Make best guess from environment.
|
||||||
|
*/
|
||||||
|
#if !defined( _ARCH_UNIX ) && !defined( _ARCH_MSDOS ) && !defined( _ARCH_VMS ) \
|
||||||
|
&& !defined( _ARCH_MACOS ) && !defined( _ARCH_AMIGA ) && !defined( _ARCH_OS2)
|
||||||
|
# if defined( unix )
|
||||||
|
# define _ARCH_UNIX
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined( _ARCH_BSD ) && !defined( _ARCH_SYSV ) && defined( _ARCH_UNIX )
|
||||||
|
# if defined( USG )
|
||||||
|
# define _ARCH_SYSV
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined( _ARCH_68000 )
|
||||||
|
# if defined( mc68k ) || defined( mc68000 ) || defined( mc68k32 ) \
|
||||||
|
|| defined( mc68020 ) || defined( mc68010 )
|
||||||
|
# define _ARCH_68000
|
||||||
|
# if !defined( _ARCH_BIG_ENDIAN )
|
||||||
|
# define _ARCH_BIG_ENDIAN
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined( _ARCH_PROTO )
|
||||||
|
# if defined( _STDC_ ) || defined( __STDC__ )
|
||||||
|
#if !defined(__hpux) && !defined(LINUX)
|
||||||
|
# define _ARCH_PROTO
|
||||||
|
#endif /* not __hpux && not LINUX */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined( _ARCH_WORD_SIZE )
|
||||||
|
# if !defined( INT_MAX )
|
||||||
|
# ifdef _ARCH_MSDOS
|
||||||
|
# include <limits.h>
|
||||||
|
# else
|
||||||
|
# ifdef _ARCH_NEXT
|
||||||
|
# include <ansi/limits.h>
|
||||||
|
# else
|
||||||
|
# ifdef LINUX
|
||||||
|
# include <limits.h>
|
||||||
|
# else
|
||||||
|
# include <sys/limits.h>
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if INT_MAX == 0x7FFF
|
||||||
|
# define _ARCH_WORD_SIZE 16
|
||||||
|
# endif
|
||||||
|
# if !defined( _ARCH_WORD_SIZE )
|
||||||
|
# if INT_MAX == 0x7FFFFFFF
|
||||||
|
# define _ARCH_WORD_SIZE 32
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if !defined( _ARCH_WORD_SIZE )
|
||||||
|
# if INT_MAX == 0x7FFFFFFFFFFFFFFF
|
||||||
|
# define _ARCH_WORD_SIZE 64
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
163
libdtm/callback.c
Normal file
163
libdtm/callback.c
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#if !defined(NEXT) && !defined(_ARCH_MSDOS)
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef __hpux
|
||||||
|
#include <termio.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#ifdef _ARCH_BSD
|
||||||
|
#include <sys/filio.h>
|
||||||
|
#endif
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
# include <signal.h>
|
||||||
|
#else
|
||||||
|
# include <sys/signal.h>
|
||||||
|
#endif
|
||||||
|
#include <sys/file.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static void DTMsigioHandler(int sig,int code,struct sigcontext *scp,char *addr )
|
||||||
|
#else
|
||||||
|
static void DTMsigioHandler( sig, code, scp, addr )
|
||||||
|
int sig;
|
||||||
|
int code;
|
||||||
|
struct sigcontext *scp;
|
||||||
|
char *addr;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Unfortunately, not one of the parameters listed above
|
||||||
|
provides even the slightest help in determinine WHICH
|
||||||
|
port is now ready for input, and any system calls
|
||||||
|
screw up any other system calls in progress.
|
||||||
|
*/
|
||||||
|
reg int i;
|
||||||
|
|
||||||
|
/* DBGMSG2( "DTMsigioHandler enter %X %X\n", code, addr); */
|
||||||
|
|
||||||
|
for ( i = 0 ; i < DTMptCount ; i++ ) {
|
||||||
|
int port;
|
||||||
|
int ready;
|
||||||
|
if ( !DTMpt[i] ) continue;
|
||||||
|
if ( !DTMpt[i]->callback ) continue;
|
||||||
|
port = i;
|
||||||
|
dtm_map_port_external(&port);
|
||||||
|
#if 0
|
||||||
|
if ((ready = DTMavailRead( port ))== DTMERROR) continue;
|
||||||
|
if ( ready == DTM_PORT_READY ) {
|
||||||
|
DBGMSG( "DTMsigioHandler calling user routine\n" );
|
||||||
|
#endif
|
||||||
|
(*DTMpt[i]->callback)();
|
||||||
|
#if 0
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
/* DBGMSG( "DTMsigioHandler exit\n" ); */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_sigio( int fd )
|
||||||
|
#else
|
||||||
|
int dtm_sigio( fd )
|
||||||
|
int fd;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int flags;
|
||||||
|
int pid=getpid();
|
||||||
|
int sigio_on=1;
|
||||||
|
DBGMSG1( "dtm_sigio on fd %d\n", fd );
|
||||||
|
#ifdef __hpux
|
||||||
|
if (flags = ioctl( fd, FIOSSAIOOWN, &pid) == -1 ) {
|
||||||
|
#else
|
||||||
|
if (flags = fcntl( fd, F_SETOWN, getpid()) == -1 ) {
|
||||||
|
#endif
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
#ifdef __hpux
|
||||||
|
if (flags = ioctl( fd, FIOSSAIOSTAT, &sigio_on ) == -1 ) {
|
||||||
|
#else
|
||||||
|
if (flags = fcntl( fd, F_SETFL, FASYNC ) == -1 ) {
|
||||||
|
#endif
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMreadReady( int port, void (*pfn)() )
|
||||||
|
#else
|
||||||
|
int DTMreadReady( port, pfn )
|
||||||
|
int32 port;
|
||||||
|
void (*pfn)();
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
DTMPORT * pp;
|
||||||
|
|
||||||
|
DBGMSG1( "DTMreadReady on port %d\n", port );
|
||||||
|
CHECK_ERR( port = dtm_map_port_internal( port ));
|
||||||
|
pp = DTMpt[port];
|
||||||
|
|
||||||
|
/*
|
||||||
|
Just replace the function
|
||||||
|
*/
|
||||||
|
if ( pp->callback ) {
|
||||||
|
pp->callback = pfn;
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pp->porttype != INPORTTYPE ) {
|
||||||
|
DTMerrno = DTMBADPORT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
DBGMSG1( "DTMreadReady port has sockfd %d\n", pp->sockfd );
|
||||||
|
#ifndef _ARCH_MSDOS
|
||||||
|
if ( (int)signal( SIGIO, DTMsigioHandler) == -1 ) {
|
||||||
|
DBGMSG( "DTMreadReady signal failed\n" );
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
pp->callback = pfn;
|
||||||
|
{
|
||||||
|
reg Inport *inp;
|
||||||
|
if( dtm_sigio( pp->sockfd )== DTMERROR) {
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
FOR_EACH_IN_PORT( inp, pp ) {
|
||||||
|
if (dtm_sigio( inp->fd )== DTMERROR) {
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
62
libdtm/col.h
Normal file
62
libdtm/col.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#define COL_TRIPLET DTM_TRIPLET
|
||||||
|
|
||||||
|
#define COLclass "COL"
|
||||||
|
#define COLtitle "TTL"
|
||||||
|
#define COLdims "DIM"
|
||||||
|
#define COLwidth "WTH"
|
||||||
|
#define COLfunc "FNC"
|
||||||
|
#define COLsel "SEL"
|
||||||
|
#define COLid "ID"
|
||||||
|
#define COLviewType "ViewType"
|
||||||
|
#define COLassociated "ASSOCIATED"
|
||||||
|
|
||||||
|
#define COL_POINT 1
|
||||||
|
#define COL_LINE 2
|
||||||
|
#define COL_AREA 3
|
||||||
|
#define COL_DOODLE_CONT 4
|
||||||
|
#define COL_DOODLE_DISC 5
|
||||||
|
|
||||||
|
#ifndef V_RASTER
|
||||||
|
# define V_RASTER 1
|
||||||
|
# define V_WHITEBOARD 2
|
||||||
|
# define V_SHEET 3
|
||||||
|
# define V_TEXT 4
|
||||||
|
#endif /* ! V_RASTER */
|
||||||
|
|
||||||
|
#ifdef DTM1
|
||||||
|
#define COLsetClass(h) DTMsetClass(h,COLclass)
|
||||||
|
#define COLcompareClass(h) DTMcompareClass(h,COLclass)
|
||||||
|
#else
|
||||||
|
#define COLsetClass(h) dtm_set_class(h,COLclass)
|
||||||
|
#define COLcompareClass(h) dtm_compare_class(h,COLclass)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DTM1
|
||||||
|
#define COLsetTitle DTMsetTitle
|
||||||
|
#define COLgetTitle DTMgetTitle
|
||||||
|
#else
|
||||||
|
#define COLsetTitle dtm_set_title
|
||||||
|
#define COLgetTitle dtm_get_title
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define COLsetID(h,i) dtm_set_char(h,COLid,i)
|
||||||
|
#define COLgetID(h,s,l) dtm_get_char(h,COLid,s,l)
|
||||||
|
|
||||||
|
#define COLsetFunc(h,f,s) { dtm_set_char(h,COLfunc,f); \
|
||||||
|
dtm_set_int(h,COLsel,s); }
|
||||||
|
|
||||||
|
/* COLgetFunc(char *header, char *function, int length, int *selType) */
|
||||||
|
#define COLgetFunc(h,f,l,i) ( dtm_get_char(h,COLfunc,f,l) || \
|
||||||
|
dtm_get_int(h,COLsel,i) )
|
||||||
|
|
||||||
|
#define COLsetDimension(h,i) dtm_set_int(h,COLdims,i)
|
||||||
|
#define COLgetDimension(h,i) dtm_get_int(h,COLdims,i)
|
||||||
|
|
||||||
|
#define COLsetWidth(h,i) dtm_set_int(h,COLwidth,i)
|
||||||
|
#define COLgetWidth(h,i) dtm_get_int(h,COLwidth,i)
|
||||||
|
|
||||||
|
#define COLsetView(h, v) dtm_set_int((h), COLviewType, (v))
|
||||||
|
#define COLgetView(h, v) (*(v) = 0, dtm_get_int((h), COLviewType, (v)))
|
||||||
|
|
||||||
|
#define COLsetAssoc(h, a) dtm_set_char(h, COLassociated, a)
|
||||||
|
#define COLgetAssoc(h, a, l) dtm_get_char(h, COLassociated, a, l)
|
16
libdtm/com.h
Normal file
16
libdtm/com.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#define COMclass "COM"
|
||||||
|
#define COMid "ID"
|
||||||
|
#define COMdomain "COMDOMAIN"
|
||||||
|
#define COMmesg "COMMAND"
|
||||||
|
|
||||||
|
#define COMsetClass(h) dtm_set_class(h,COMclass)
|
||||||
|
#define COMcompareClass(h) dtm_compare_class(h,COMclass)
|
||||||
|
|
||||||
|
#define COMsetID(h,s) dtm_set_char(h,COMid,s)
|
||||||
|
#define COMgetID(h,s,l) dtm_get_char(h,COMid,s,l)
|
||||||
|
|
||||||
|
#define COMsetDomain(h,s) dtm_set_char(h,COMdomain,s)
|
||||||
|
#define COMgetDomain(h,s,l) dtm_get_char(h,COMdomain,s,l)
|
||||||
|
|
||||||
|
#define COMsetMesg(h,s) dtm_set_char(h,COMmesg,s)
|
||||||
|
#define COMgetMesg(h,s,l) dtm_get_char(h,COMmesg,s,l)
|
154
libdtm/convert.c
Normal file
154
libdtm/convert.c
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
/******************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/convert.c,v 1.2 1995/10/13 06:33:03 spowers Exp $
|
||||||
|
**
|
||||||
|
******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: convert.c,v $
|
||||||
|
Revision 1.2 1995/10/13 06:33:03 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:02:56 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:39:19 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:30 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:09 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:05 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.3 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/06/11 15:21:13 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:28:46 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_char(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
DBGFLOW("# dtm_char called.\n");
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_short(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
DBGFLOW("# dtm_short called.\n");
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 2) : (size * 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_int(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_int called.\n");
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 4) : (size * 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_float(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_float called.\n");
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 4) : (size * 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_double(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_flt64 called.\n");
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 8) : (size * 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_complex(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_complex called.\n");
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 8) : (size * 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_triplet(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_triplet called.\n");
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 16) : (size * 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* conversion routine function table */
|
||||||
|
int (*DTMconvertRtns[])() = {
|
||||||
|
dtm_char,
|
||||||
|
dtm_short,
|
||||||
|
dtm_int,
|
||||||
|
dtm_float,
|
||||||
|
dtm_double,
|
||||||
|
dtm_complex,
|
||||||
|
dtm_triplet
|
||||||
|
};
|
216
libdtm/craycvt.c
Normal file
216
libdtm/craycvt.c
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/craycvt.c,v 1.1.1.1 1995/01/11 00:02:57 alanb Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: craycvt.c,v $
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:02:57 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:39:21 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:30 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:09 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:06 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.4 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/06/11 15:21:41 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/01/31 17:08:16 jefft
|
||||||
|
* Added 'icheck' variable to force checking of floating point values and
|
||||||
|
* changing to 0 on underflow.
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:29:13 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_char(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
DBGFLOW("# dtm_char called.\n");
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dtm_short(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
DBGFLOW("# dtm_short called.\n");
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 2) : (size * 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dtm_int(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_int called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) {
|
||||||
|
|
||||||
|
if (buf != NULL) {
|
||||||
|
int tmp;
|
||||||
|
tmp = size / 4;
|
||||||
|
|
||||||
|
DTMSCI(buf, buf, &tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (size / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
if (buf != NULL)
|
||||||
|
DTMCSI(buf, buf, &size);
|
||||||
|
return (size * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_float(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
int icheck = 1;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_float called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) {
|
||||||
|
|
||||||
|
if (buf != NULL) {
|
||||||
|
int tmp;
|
||||||
|
tmp = size / 4;
|
||||||
|
|
||||||
|
DTMSCF(buf, buf, &tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (size / 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
if (buf != NULL)
|
||||||
|
DTMCSF(buf, buf, &size, &icheck);
|
||||||
|
return (size * 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_double(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_flt64 called.\n");
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 8) : (size * 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_complex(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
int icheck = 1;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_complex called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) {
|
||||||
|
|
||||||
|
if (buf != NULL) {
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
tmp = size / 8;
|
||||||
|
DTMSCF(buf, buf, &tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (size / 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
if (buf != NULL)
|
||||||
|
DTMCSF(buf, buf, &size, &icheck);
|
||||||
|
return (size * 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_triplet(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
VOIDPTR buf;
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_triplet called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) {
|
||||||
|
if (buf != NULL) {
|
||||||
|
int tmp;
|
||||||
|
|
||||||
|
tmp = size / 16;
|
||||||
|
DTMSCT(buf, buf, &tmp);
|
||||||
|
}
|
||||||
|
return (size / 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
if (buf != NULL)
|
||||||
|
DTMCST(buf, buf, &size);
|
||||||
|
return (size * 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* conversion routine function table */
|
||||||
|
int (*DTMconvertRtns[])() = {
|
||||||
|
dtm_char,
|
||||||
|
dtm_short,
|
||||||
|
dtm_int,
|
||||||
|
dtm_float,
|
||||||
|
dtm_double,
|
||||||
|
dtm_complex,
|
||||||
|
dtm_triplet
|
||||||
|
};
|
77
libdtm/crayinit.f
Normal file
77
libdtm/crayinit.f
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
C NCSA DTM version 2.0
|
||||||
|
C June 10, 1991
|
||||||
|
C
|
||||||
|
C NCSA DTM Version 2.0 source code and documentation are in the public
|
||||||
|
C domain. Specifically, we give to the public domain all rights for future
|
||||||
|
C licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
C
|
||||||
|
C We ask, but do not require, that the following message be included in all
|
||||||
|
C derived works:
|
||||||
|
C
|
||||||
|
C Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
C the University of Illinois at Urbana-Champaign.
|
||||||
|
C
|
||||||
|
C THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
C SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
C WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
C
|
||||||
|
|
||||||
|
C $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/crayinit.f,v 1.1.1.1 1995/01/11 00:02:57 alanb Exp $
|
||||||
|
|
||||||
|
C $Log: crayinit.f,v $
|
||||||
|
C Revision 1.1.1.1 1995/01/11 00:02:57 alanb
|
||||||
|
C New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
C
|
||||||
|
c Revision 2.5 1994/12/29 23:39:23 alanb
|
||||||
|
c I'm committing with a new symbolic revision number.
|
||||||
|
c
|
||||||
|
c Revision 1.1.1.1 1994/12/28 21:37:30 alanb
|
||||||
|
c
|
||||||
|
c Revision 1.1.1.1 1993/07/04 00:03:09 marca
|
||||||
|
c Mosaic for X version 2 distribution
|
||||||
|
c
|
||||||
|
c Revision 1.1 1993/01/18 21:50:07 marca
|
||||||
|
c I think I got it now.
|
||||||
|
c
|
||||||
|
c Revision 1.2 1993/01/18 21:46:45 marca
|
||||||
|
c Plugging DTM in...
|
||||||
|
c
|
||||||
|
c Revision 1.3 91/06/13 21:23:57 jefft
|
||||||
|
c added type of function to prevent returning of a float
|
||||||
|
c
|
||||||
|
c Revision 1.2 1991/06/11 15:21:54 sreedhar
|
||||||
|
c disclaimer added
|
||||||
|
c
|
||||||
|
c Revision 1.1 1990/11/08 16:29:43 jefft
|
||||||
|
c Initial revision
|
||||||
|
c
|
||||||
|
|
||||||
|
integer function DTMINIT()
|
||||||
|
integer i, tmp, pcnt
|
||||||
|
integer DTMMIP, DTMMOP
|
||||||
|
character*64 portname
|
||||||
|
|
||||||
|
pcnt = 0
|
||||||
|
|
||||||
|
do 10 i = 1, iargc()
|
||||||
|
|
||||||
|
call getarg(i, portname)
|
||||||
|
if (index(portname, '-DTMIN') .NE. 0) then
|
||||||
|
call getarg(i+1, portname)
|
||||||
|
tmp = DTMMIP(portname)
|
||||||
|
pcnt = pcnt + 1
|
||||||
|
elseif (index(portname, '-DTMOUT') .NE. 0) then
|
||||||
|
call getarg(i+1, portname)
|
||||||
|
tmp = DTMMOP(portname)
|
||||||
|
pcnt = pcnt + 1
|
||||||
|
elseif (index(portname, '-DTM') .NE. 0) then
|
||||||
|
call getarg(i+1, portname)
|
||||||
|
tmp = DTMMOP(portname)
|
||||||
|
pcnt = pcnt + 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
10 continue
|
||||||
|
|
||||||
|
DTMINIT = pcnt
|
||||||
|
return
|
||||||
|
end
|
269
libdtm/crayrtns.f
Normal file
269
libdtm/crayrtns.f
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
C NCSA DTM version 2.0
|
||||||
|
C June 10, 1991
|
||||||
|
C
|
||||||
|
C NCSA DTM Version 2.0 source code and documentation are in the public
|
||||||
|
C domain. Specifically, we give to the public domain all rights for future
|
||||||
|
C licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
C
|
||||||
|
C We ask, but do not require, that the following message be included in all
|
||||||
|
C derived works:
|
||||||
|
C
|
||||||
|
C Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
C the University of Illinois at Urbana-Champaign.
|
||||||
|
C
|
||||||
|
C THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
C SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
C WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
C
|
||||||
|
|
||||||
|
C $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/crayrtns.f,v 1.1.1.1 1995/01/11 00:02:57 alanb Exp $
|
||||||
|
|
||||||
|
C $Log: crayrtns.f,v $
|
||||||
|
C Revision 1.1.1.1 1995/01/11 00:02:57 alanb
|
||||||
|
C New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
C
|
||||||
|
c Revision 2.5 1994/12/29 23:39:27 alanb
|
||||||
|
c I'm committing with a new symbolic revision number.
|
||||||
|
c
|
||||||
|
c Revision 1.1.1.1 1994/12/28 21:37:30 alanb
|
||||||
|
c
|
||||||
|
c Revision 1.1.1.1 1993/07/04 00:03:09 marca
|
||||||
|
c Mosaic for X version 2 distribution
|
||||||
|
c
|
||||||
|
c Revision 1.1 1993/01/18 21:50:08 marca
|
||||||
|
c I think I got it now.
|
||||||
|
c
|
||||||
|
c Revision 1.2 1993/01/18 21:46:47 marca
|
||||||
|
c Plugging DTM in...
|
||||||
|
c
|
||||||
|
c Revision 1.4 91/06/11 15:21:47 sreedhar
|
||||||
|
c disclaimer added
|
||||||
|
c
|
||||||
|
c Revision 1.3 1991/05/16 04:40:13 jefft
|
||||||
|
c Fixed bugs in TRIPLET conversion
|
||||||
|
c
|
||||||
|
c Revision 1.2 1991/01/31 17:06:05 jefft
|
||||||
|
c Fixed bug in Cray floating point conversion routines.
|
||||||
|
c
|
||||||
|
c Revision 1.1 90/11/08 16:30:17 jefft
|
||||||
|
c Initial revision
|
||||||
|
c
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
C Cray_to_Sun_32-bit_floating-point (with packing) conversion routine.
|
||||||
|
C USAGE: call cspk32 (carray, sarray, size)
|
||||||
|
C WHERE carray is the array of Cray floating point numbers
|
||||||
|
C (64 bit) to be converted to 32-bit IEEE format
|
||||||
|
C reals and packed 2 to 1 (high to low order) in sarray.
|
||||||
|
C Size is the dimension of the input carray.
|
||||||
|
C (sarray is assumed to be (size+1)/2 )
|
||||||
|
C Icheck, if 1, provides checking for over/underflow
|
||||||
|
C and writes the appropriate "infinity" pattern.
|
||||||
|
C
|
||||||
|
subroutine DTMCSF (carray,sarray,size,icheck)
|
||||||
|
integer size,carray(0:size-1),sarray(0:(size+1)/2-1)
|
||||||
|
integer stemp1,stemp2,exp1,exp2,mant1,mant2
|
||||||
|
if (icheck.eq.1) goto 30
|
||||||
|
do 20 i=0,(size+1)/2-1
|
||||||
|
sign1=and(carray(2*i),x'8000000000000000')
|
||||||
|
sign2=and(carray(2*i+1),x'8000000000000000')
|
||||||
|
exp1=shiftr(and(carray(2*i),x'7fff000000000000'),48)-16258
|
||||||
|
exp2=shiftr(and(carray(2*i+1),x'7fff000000000000'),48)-16258
|
||||||
|
mant1=shiftr(and(carray(2*i),x'00007fffff000000'),24)
|
||||||
|
& +shiftr(and(carray(2*i),x'0000000000800000'),23)
|
||||||
|
mant2=shiftr(and(carray(2*i+1),x'00007fffff000000'),24)
|
||||||
|
& +shiftr(and(carray(2*i+1),x'0000000000800000'),23)
|
||||||
|
stemp1=or(sign1, (shiftl(exp1,55) + shiftl(mant1,32)) )
|
||||||
|
stemp2=or(sign2, (shiftl(exp2,55) + shiftl(mant2,32)) )
|
||||||
|
stemp1=cvmgn(stemp1,0,carray(2*i))
|
||||||
|
stemp2=cvmgn(stemp2,0,carray(2*i+1))
|
||||||
|
sarray(i)=or(stemp1,shiftr(stemp2,32))
|
||||||
|
20 continue
|
||||||
|
return
|
||||||
|
30 continue
|
||||||
|
do 10 i=0,(size+1)/2-1
|
||||||
|
sign1=and(carray(2*i),x'8000000000000000')
|
||||||
|
sign2=and(carray(2*i+1),x'8000000000000000')
|
||||||
|
exp1=shiftr(and(carray(2*i),x'7fff000000000000'),48)-16258
|
||||||
|
exp2=shiftr(and(carray(2*i+1),x'7fff000000000000'),48)-16258
|
||||||
|
mant1=shiftr(and(carray(2*i),x'00007fffff000000'),24)
|
||||||
|
& +shiftr(and(carray(2*i),x'0000000000800000'),23)
|
||||||
|
mant2=shiftr(and(carray(2*i+1),x'00007fffff000000'),24)
|
||||||
|
& +shiftr(and(carray(2*i+1),x'0000000000800000'),23)
|
||||||
|
stemp1=or(sign1, (shiftl(exp1,55) + shiftl(mant1,32)) )
|
||||||
|
stemp2=or(sign2, (shiftl(exp2,55) + shiftl(mant2,32)) )
|
||||||
|
stemp1=cvmgm(or(sign1,x'7f80000000000000'),stemp1,254-exp1)
|
||||||
|
stemp2=cvmgm(or(sign2,x'7f80000000000000'),stemp2,254-exp2)
|
||||||
|
stemp1=cvmgn(stemp1,0,carray(2*i))
|
||||||
|
stemp2=cvmgn(stemp2,0,carray(2*i+1))
|
||||||
|
stemp1=cvmgm(0,stemp1,exp1-1)
|
||||||
|
stemp2=cvmgm(0,stemp2,exp2-1)
|
||||||
|
sarray(i)=or(stemp1,shiftr(stemp2,32))
|
||||||
|
10 continue
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
C Sun_to_Cray_32-bit_Floating-point (with unpacking) conversion routine.
|
||||||
|
C USAGE: call scup32 (sarray, carray, size)
|
||||||
|
C WHERE sarray is the array of 32-bit IEEE floating-point numbers
|
||||||
|
C (packed 2 per word) to be converted 64-bit Cray format
|
||||||
|
C and stored in carray. Size is the dimension
|
||||||
|
C of the output carray. (sarray is assumed to be (size+1)/2 ).
|
||||||
|
C Icheck is not used.
|
||||||
|
C
|
||||||
|
subroutine DTMSCF (sarray,carray,size,icheck)
|
||||||
|
integer size,sarray(0:(size+1)/2-1),carray(0:size-1),temp
|
||||||
|
cdir$ ivdep
|
||||||
|
do 40 i=(size+1)/2-1,0,-1
|
||||||
|
carray(2*i)=and(sarray(i),x'ffffffff00000000')
|
||||||
|
carray(2*i+1)=shiftl(sarray(i),32)
|
||||||
|
40 continue
|
||||||
|
do 50 i=0, size-1
|
||||||
|
temp=carray(i)
|
||||||
|
CARRAY(I)=OR(OR(AND(carray(I),X'8000000000000000'),SHIFTR
|
||||||
|
& (AND(carray(I),X'7F80000000000000'),7)+shiftl(16258,48)),or(
|
||||||
|
&shiftr(AND(carray(I),X'007FFFFF00000000'),8),X'0000800000000000'))
|
||||||
|
carray(i)=cvmgn(carray(i),0,shiftl(temp,1))
|
||||||
|
50 continue
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
C
|
||||||
|
C Integer_Cray_to_Sun_32-bit (with packing) conversion routine.
|
||||||
|
C USAGE: call icspk32 (carray, sarray, size)
|
||||||
|
C WHERE carray is the array of 64-bit signed integers to be
|
||||||
|
C into 32-bit integers packed 2 per word and stored in
|
||||||
|
C sarray. Size is the dimension of the input carray,
|
||||||
|
C Sarray is assumed to be (size+1)/2.
|
||||||
|
C
|
||||||
|
subroutine DTMCSI (sarray,carray,size)
|
||||||
|
integer size,sarray(0:(size+1)/2-1),carray(0:size-1),temp
|
||||||
|
cdir$ ivdep
|
||||||
|
do 60 i=0, (size+1)/2-1
|
||||||
|
sarray(i)=or(
|
||||||
|
& and(shiftl(carray(2*i),32),x'ffffffff00000000'),
|
||||||
|
& and(carray(2*i+1), x'00000000ffffffff'))
|
||||||
|
60 continue
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
C
|
||||||
|
C Integer_Sun_32-bit_to_Cray_64-bit with unpacking conversion routine.
|
||||||
|
C USAGE: call iscup32 (sarray, carray, size)
|
||||||
|
C WHERE sarray is the array of 32-bit signed integers packed 2
|
||||||
|
C per word to be converted to 64 bit Cray integers and
|
||||||
|
C stored in carray. Size is the dimension of the output
|
||||||
|
C carray. (sarray is assumed to be (size+1)/2 ).
|
||||||
|
C
|
||||||
|
subroutine DTMSCI (sarray,carray,size)
|
||||||
|
integer size,sarray(0:(size+1)/2-1),carray(0:size-1),temp
|
||||||
|
cdir$ ivdep
|
||||||
|
do 80 i=(size+1)/2-1,0,-1
|
||||||
|
carray(2*i) = shiftr(sarray(i), 32)
|
||||||
|
carray(2*i+1)=and(sarray(i),x'ffffffff')
|
||||||
|
80 continue
|
||||||
|
do 90 i=0, size-1
|
||||||
|
carray(i) = or(carray(i), cvmgz(0, x'ffffffff00000000',
|
||||||
|
& and(carray(i), x'80000000')))
|
||||||
|
90 continue
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
C
|
||||||
|
C Cray to Sun Triplet (with packing) conversion routine.
|
||||||
|
C USAGE: call DTMCST (carray, sarray, size)
|
||||||
|
C WHERE carray is the array of DTM triplet structures
|
||||||
|
C (cray format) to be converted into standard format
|
||||||
|
C and packed into sarray.
|
||||||
|
C size is the dimension of the input carray,
|
||||||
|
C sarray is assumed to be size/2.
|
||||||
|
C
|
||||||
|
subroutine DTMCST (sarray,carray,size)
|
||||||
|
integer size,sarray(0:size*2-1),carray(0:size*4-1)
|
||||||
|
integer stemp1,stemp2,exp1,exp2,mant1,mant2
|
||||||
|
cdir$ ivdep
|
||||||
|
do 100 i=0, size*2-1, 2
|
||||||
|
sign2=and(carray(2*i+1),x'8000000000000000')
|
||||||
|
exp2=shiftr(and(carray(2*i+1),x'7fff000000000000'),48)-16258
|
||||||
|
mant2=shiftr(and(carray(2*i+1),x'00007fffff000000'),24)
|
||||||
|
& +shiftr(and(carray(2*i+1),x'0000000000800000'),23)
|
||||||
|
stemp2=or(sign2, (shiftl(exp2,55) + shiftl(mant2,32)) )
|
||||||
|
stemp2=cvmgm(or(sign2,x'7f80000000000000'),stemp2,254-exp2)
|
||||||
|
stemp2=cvmgn(stemp2,0,carray(2*i+1))
|
||||||
|
stemp2=cvmgm(0,stemp2,exp2-1)
|
||||||
|
sarray(i)=or(and(shiftl(carray(2*i),32),x'ffffffff00000000'),
|
||||||
|
& shiftr(stemp2,32))
|
||||||
|
|
||||||
|
sign1=and(carray(2*i+2),x'8000000000000000')
|
||||||
|
sign2=and(carray(2*i+3),x'8000000000000000')
|
||||||
|
exp1=shiftr(and(carray(2*i+2),x'7fff000000000000'),48)-16258
|
||||||
|
exp2=shiftr(and(carray(2*i+3),x'7fff000000000000'),48)-16258
|
||||||
|
mant1=shiftr(and(carray(2*i+2),x'00007fffff000000'),24)
|
||||||
|
& +shiftr(and(carray(2*i+2),x'0000000000800000'),23)
|
||||||
|
mant2=shiftr(and(carray(2*i+3),x'00007fffff000000'),24)
|
||||||
|
& +shiftr(and(carray(2*i+3),x'0000000000800000'),23)
|
||||||
|
stemp1=or(sign1, (shiftl(exp1,55) + shiftl(mant1,32)) )
|
||||||
|
stemp2=or(sign2, (shiftl(exp2,55) + shiftl(mant2,32)) )
|
||||||
|
stemp1=cvmgm(or(sign1,x'7f80000000000000'),stemp1,254-exp1)
|
||||||
|
stemp2=cvmgm(or(sign2,x'7f80000000000000'),stemp2,254-exp2)
|
||||||
|
stemp1=cvmgn(stemp1,0,carray(2*i+2))
|
||||||
|
stemp2=cvmgn(stemp2,0,carray(2*i+3))
|
||||||
|
stemp1=cvmgm(0,stemp1,exp1-1)
|
||||||
|
stemp2=cvmgm(0,stemp2,exp2-1)
|
||||||
|
sarray(i+1)=or(stemp1,shiftr(stemp2,32))
|
||||||
|
100 continue
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
C
|
||||||
|
C Sun to Cray Triplet with unpacking conversion routine.
|
||||||
|
C USAGE: call DTMSCT (sarray, carray, size)
|
||||||
|
C WHERE sarray is the array of 32-bit signed integers packed 2
|
||||||
|
C per word to be converted to 64 bit Cray integers and
|
||||||
|
C stored in carray. Size is the dimension of the output
|
||||||
|
C carray. (sarray is assumed to be (size+1)/2 ).
|
||||||
|
C
|
||||||
|
subroutine DTMSCT (sarray,carray,size)
|
||||||
|
integer size,sarray(0:size*2-1),carray(0:size*4-1),temp
|
||||||
|
cdir$ ivdep
|
||||||
|
do 110 i=size*2-1, 0, -1
|
||||||
|
carray(2*i)=and(sarray(i),x'ffffffff00000000')
|
||||||
|
carray(2*i+1)=shiftl(sarray(i),32)
|
||||||
|
110 continue
|
||||||
|
do 120 i=0, size-1, 4
|
||||||
|
|
||||||
|
C convert tag
|
||||||
|
carray(i) = or(carray(i), cvmgz(0, x'ffffffff00000000',
|
||||||
|
& and(carray(i), x'80000000')))
|
||||||
|
|
||||||
|
C convert 1st float
|
||||||
|
temp=carray(i+1)
|
||||||
|
CARRAY(I+1)=OR(OR(AND(carray(I+1),X'8000000000000000'),
|
||||||
|
& SHIFTR(AND(carray(I+1),X'7F80000000000000'),7)+
|
||||||
|
& shiftl(16258,48)),or(shiftr(AND(carray(I+1),
|
||||||
|
& X'007FFFFF00000000'),8),X'0000800000000000'))
|
||||||
|
carray(i+1)=cvmgn(carray(i+1),0,shiftl(temp,1))
|
||||||
|
|
||||||
|
C convert 2nd float
|
||||||
|
temp=carray(i+2)
|
||||||
|
CARRAY(I+2)=OR(OR(AND(carray(I+2),X'8000000000000000'),
|
||||||
|
& SHIFTR(AND(carray(I+2),X'7F80000000000000'),7)+
|
||||||
|
& shiftl(16258,48)),or(shiftr(AND(carray(I+2),
|
||||||
|
& X'007FFFFF00000000'),8),X'0000800000000000'))
|
||||||
|
carray(i+2)=cvmgn(carray(i+2),0,shiftl(temp,1))
|
||||||
|
|
||||||
|
C convert 3rd float
|
||||||
|
temp=carray(i+3)
|
||||||
|
CARRAY(I+3)=OR(OR(AND(carray(I+3),X'8000000000000000'),
|
||||||
|
& SHIFTR(AND(carray(I+3),X'7F80000000000000'),7)+
|
||||||
|
& shiftl(16258,48)),or(shiftr(AND(carray(I+3),
|
||||||
|
& X'007FFFFF00000000'),8),X'0000800000000000'))
|
||||||
|
carray(i+3)=cvmgn(carray(i+3),0,shiftl(temp,1))
|
||||||
|
|
||||||
|
120 continue
|
||||||
|
end
|
||||||
|
|
68
libdtm/db.h
Normal file
68
libdtm/db.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Database Message Headers
|
||||||
|
**
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DBclass "DB"
|
||||||
|
#define DBsize 1024
|
||||||
|
|
||||||
|
#define DBfile "DBF"
|
||||||
|
#define DBauthor "AUTH"
|
||||||
|
#define DBscience "SCI"
|
||||||
|
#define DBtitle "TITLE"
|
||||||
|
#define DBdatatype "DT"
|
||||||
|
#define DBkeywords "KEYS"
|
||||||
|
|
||||||
|
#define DBrecsize "RS"
|
||||||
|
#define DBmatch "MATCH"
|
||||||
|
|
||||||
|
|
||||||
|
#define DBsetClass(h) DTMsetClass(h, DBclass)
|
||||||
|
#define DBcompareClass(h) DTMcompareClass(h, DBclass)
|
||||||
|
|
||||||
|
#define DBsetDB(h, s) dtm_set_char(h, DBfile, s)
|
||||||
|
#define DBgetDB(h, s, l) dtm_get_char(h, DBfile, s, l)
|
||||||
|
|
||||||
|
#define DBsetAuthor(h, s) dtm_set_char(h, DBauthor, s)
|
||||||
|
#define DBgetAuthor(h, s, l) dtm_get_char(h, DBauthor, s, l)
|
||||||
|
|
||||||
|
#define DBsetTitle(h, s) dtm_set_char(h, DBtitle, s)
|
||||||
|
#define DBgetTitle(h, s, l) dtm_get_char(h, DBtitle, s, l)
|
||||||
|
|
||||||
|
#define DBsetScience(h, s) dtm_set_char(h, DBscience, s)
|
||||||
|
#define DBgetScience(h, s, l) dtm_get_char(h, DBscience, s, l)
|
||||||
|
|
||||||
|
#define DBsetKeywords(h, s) dtm_set_char(h, DBkeywords, s)
|
||||||
|
#define DBgetKeywords(h, s, l) dtm_get_char(h, DBkeywords, s, l)
|
||||||
|
|
||||||
|
#define DBsetDatatype(h, s) dtm_set_char(h, DBdatatype, s)
|
||||||
|
#define DBgetDatatype(h, s, l) dtm_get_char(h, DBdatatype, s, l)
|
||||||
|
|
||||||
|
#define DBsetRecordSize(h, i) dtm_set_int(h, DBrecsize, i)
|
||||||
|
#define DBgetRecordSize(h, ip) dtm_get_int(h, DBrecsize, ip)
|
||||||
|
|
||||||
|
#define DBsetMatches(h, i) dtm_set_int(h, DBmatch, i)
|
||||||
|
#define DBgetMatches(h, ip) dtm_get_int(h, DBmatch, ip)
|
98
libdtm/debug.h
Normal file
98
libdtm/debug.h
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
**
|
||||||
|
** DEBUG macro routines
|
||||||
|
**
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/debug.h,v 1.3 1995/01/12 02:33:31 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:10 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:11 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.8 92/04/30 20:27:05 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.7 1991/11/15 19:42:34 jplevyak
|
||||||
|
* Removed dependancy on dtmint.h
|
||||||
|
*
|
||||||
|
* Revision 1.6 1991/10/29 22:52:43 jplevyak
|
||||||
|
* Added debugging test before printing DTMERR messages.
|
||||||
|
*
|
||||||
|
* Revision 1.5 1991/10/10 14:21:33 jplevyak
|
||||||
|
* Added new macros for DBGMSG2 DBGMSG3.
|
||||||
|
*
|
||||||
|
* Revision 1.4 91/09/26 20:13:12 jplevyak
|
||||||
|
* Changed to allow setting of debug flags at run time.
|
||||||
|
*
|
||||||
|
* Revision 1.3 91/08/15 19:10:25 sreedhar
|
||||||
|
* Changes for logical portname version
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/06/11 15:22:30 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:30:41 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DEBUG_INC
|
||||||
|
#define DEBUG_INC
|
||||||
|
|
||||||
|
#define DBGFLOW(s) if (uDTMdbg & DTM_DBG_MSG) fprintf(stderr, s)
|
||||||
|
|
||||||
|
#define DBGINT(s, i) if (uDTMdbg & DTM_DBG_MSG) fprintf(stderr, s, i)
|
||||||
|
#define DBGFLT(s, f) if (uDTMdbg & DTM_DBG_MSG) fprintf(stderr, s, f)
|
||||||
|
#define DBGSTR(s, str) if (uDTMdbg & DTM_DBG_MSG) fprintf(stderr, s, str)
|
||||||
|
#define DBGPTR(s, p) if (uDTMdbg & DTM_DBG_MSG) fprintf(stderr, s, (int)p)
|
||||||
|
|
||||||
|
/*
|
||||||
|
The new method will be to use
|
||||||
|
DBGXXX for 0 argument debugging message of class XXXS
|
||||||
|
DBGXXXN for N argument debugging messages of calss XXX including MSG
|
||||||
|
|
||||||
|
MSG is the general class
|
||||||
|
*/
|
||||||
|
#define DBGMSG(s) if (uDTMdbg & DTM_DBG_MSG) fprintf(stderr, s)
|
||||||
|
#define DBGMSG1(s, arg1 ) if (uDTMdbg & DTM_DBG_MSG) fprintf(stderr, s, arg1 )
|
||||||
|
#define DBGMSG2(s, arg1, arg2 ) if (uDTMdbg & DTM_DBG_MSG) \
|
||||||
|
fprintf(stderr, s, arg1, arg2 )
|
||||||
|
#define DBGMSG3(s, arg1, arg2, arg3 ) if (uDTMdbg & DTM_DBG_MSG) \
|
||||||
|
fprintf(stderr, s, arg1, arg2, arg3 )
|
||||||
|
|
||||||
|
|
||||||
|
#define DTMERR(x) if (uDTMdbg & DTM_DBG_MSG) fprintf( stderr, "%s\n", x )
|
||||||
|
|
||||||
|
|
||||||
|
#define DTM_DBG_MSG 0x0001
|
||||||
|
extern unsigned int uDTMdbg;
|
||||||
|
|
||||||
|
#endif /* DEBUG_INC */
|
223
libdtm/deccvt.c
Normal file
223
libdtm/deccvt.c
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/deccvt.c,v 1.1.1.1 1995/01/11 00:02:58 alanb Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: deccvt.c,v $
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:02:58 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:39:34 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:30 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:10 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:12 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.4 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.3 1992/04/03 18:25:50 jplevyak
|
||||||
|
* Fixed indice computation problem.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/06/11 15:22:22 sreedhar
|
||||||
|
* diclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.1 1991/05/30 15:52:54 sreedhar
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
* Revision 1.2 1990/11/08 16:48:12 jefft
|
||||||
|
* Fixed dtm_triplet and dtm_complex conversion routines. 'size' is set
|
||||||
|
* first instead of only on return.
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:40:06 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define swap(x,y) x ^= y; y ^= x; x ^= y
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_char(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
DBGFLOW("# dtm_char called.\n");
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int dtm_short(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
int nShorts, i;
|
||||||
|
DBGFLOW("# dtm_short called.\n");
|
||||||
|
|
||||||
|
nShorts = (mode == DTMLOCAL) ? (size / 2) : size;
|
||||||
|
if (buf)
|
||||||
|
for ( i = 0; i < nShorts ; i++ ) {
|
||||||
|
swap(*buf, *(buf+1));
|
||||||
|
buf += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 2) : (size * 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_int(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
int nWords, i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_int called.\n");
|
||||||
|
|
||||||
|
nWords = (mode == DTMLOCAL) ? (size / 4) : size;
|
||||||
|
size = ((mode == DTMLOCAL) ? (size / 4) : (size * 4));
|
||||||
|
|
||||||
|
if (buf)
|
||||||
|
for ( i=0 ; i < nWords ; i++ ) {
|
||||||
|
swap( *buf, *(buf+3) );
|
||||||
|
swap( *(buf+1), *(buf+2) );
|
||||||
|
buf += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_float(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
int nWords, i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_float called.\n");
|
||||||
|
|
||||||
|
nWords = (mode == DTMLOCAL) ? (size / 4) : size;
|
||||||
|
size = ((mode == DTMLOCAL) ? (size / 4) : (size * 4));
|
||||||
|
|
||||||
|
if (buf)
|
||||||
|
for ( i=0 ; i < nWords ; i++ ) {
|
||||||
|
swap( *buf, *(buf+3) );
|
||||||
|
swap( *(buf+1), *(buf+2) );
|
||||||
|
buf += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_double(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
int nWords, i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_flt64 called.\n");
|
||||||
|
|
||||||
|
nWords = (mode == DTMLOCAL) ? (size / 4) : size * 2;
|
||||||
|
if (buf)
|
||||||
|
for ( i=0 ; i < nWords ; i++ ) {
|
||||||
|
swap( *buf, *(buf+3) );
|
||||||
|
swap( *(buf+1), *(buf+2) );
|
||||||
|
buf += 4;
|
||||||
|
}
|
||||||
|
return ((mode == DTMLOCAL) ? (size / 8) : (size * 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_complex(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
int nWords, i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_complex called.\n");
|
||||||
|
|
||||||
|
nWords = (mode == DTMLOCAL) ? (size / 4) : size * 2;
|
||||||
|
size = ((mode == DTMLOCAL) ? (size / 8) : (size * 8));
|
||||||
|
|
||||||
|
if (buf)
|
||||||
|
for ( i=0 ; i < nWords ; i++ ) {
|
||||||
|
swap( *buf, *(buf+3) );
|
||||||
|
swap( *(buf+1), *(buf+2) );
|
||||||
|
buf += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int dtm_triplet(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
int nWords, i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_triplet called.\n");
|
||||||
|
|
||||||
|
nWords = (mode == DTMLOCAL) ? (size / 4) : size * 4;
|
||||||
|
size = ((mode == DTMLOCAL) ? (size / 16) : (size * 16));
|
||||||
|
|
||||||
|
if (buf)
|
||||||
|
for ( i=0 ; i < nWords ; i++ ) {
|
||||||
|
swap( *buf, *(buf+3) );
|
||||||
|
swap( *(buf+1), *(buf+2) );
|
||||||
|
buf += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* conversion routine function table */
|
||||||
|
int (*DTMconvertRtns[])() = {
|
||||||
|
dtm_char,
|
||||||
|
dtm_short,
|
||||||
|
dtm_int,
|
||||||
|
dtm_float,
|
||||||
|
dtm_double,
|
||||||
|
dtm_complex,
|
||||||
|
dtm_triplet
|
||||||
|
};
|
1834
libdtm/dtm.c
Normal file
1834
libdtm/dtm.c
Normal file
File diff suppressed because it is too large
Load Diff
371
libdtm/dtm.h
Normal file
371
libdtm/dtm.h
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
**
|
||||||
|
** dtm.h -
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/dtm.h,v 1.4 1996/02/18 23:40:11 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:11 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:15 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.32 92/05/06 16:40:17 jefft
|
||||||
|
* Modified prototype on DTMaddInput
|
||||||
|
*
|
||||||
|
* Revision 1.31 1992/04/30 20:27:05 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.30 1992/04/29 21:56:53 jplevyak
|
||||||
|
* Add prototypes for DTMgetConnectionCount and DTMaddInput. Remove
|
||||||
|
* Cray #define for VOIDPTR since they have fixed their compiler.
|
||||||
|
*
|
||||||
|
* Revision 1.29 92/03/20 21:14:40 jplevyak
|
||||||
|
* Add DTMgetPortAddr and remove DTMgetPortName
|
||||||
|
*
|
||||||
|
* Revision 1.28 1992/03/13 18:20:31 jefft
|
||||||
|
* dtm.h depended on TRUE being defined before it was included. This word
|
||||||
|
* TRUE was changed to 1 and FALSE to 0
|
||||||
|
*
|
||||||
|
* Revision 1.27 1992/02/27 23:43:34 jplevyak
|
||||||
|
* New prototype DTMgetReturnPortName.
|
||||||
|
*
|
||||||
|
* Revision 1.26 1992/02/21 13:46:12 dweber
|
||||||
|
* Fixed prototype problems in dtm_get_type.
|
||||||
|
*
|
||||||
|
* Revision 1.25 92/02/18 14:02:36 jplevyak
|
||||||
|
* Added prototype for DTMaddInPortSocket.
|
||||||
|
*
|
||||||
|
* Revision 1.24 92/01/30 19:28:24 jplevyak
|
||||||
|
* add prototypes
|
||||||
|
*
|
||||||
|
* Revision 1.23 1992/01/02 16:31:56 dweber
|
||||||
|
* Reorganized the DTM class and MSG class
|
||||||
|
*
|
||||||
|
* Revision 1.22 91/12/13 22:34:48 jefft
|
||||||
|
* Removed DTMtitle and DTMtype constants. Added dtm_(sg)et_address macros.
|
||||||
|
* Added MSG(sg)etString macros.
|
||||||
|
*
|
||||||
|
* Revision 1.21 91/12/13 15:37:55 dweber
|
||||||
|
* Fixed DTMHL bugs and re-ordered some macros for clarification
|
||||||
|
*
|
||||||
|
* Revision 1.20 91/12/12 22:55:27 jefft
|
||||||
|
* Add numbers to the comments beside the DTM errors
|
||||||
|
*
|
||||||
|
* Revision 1.19 1991/12/10 22:15:56 jefft
|
||||||
|
* fixed DTMgetAddress macro (it was calling dtm_set_char).
|
||||||
|
*
|
||||||
|
* Revision 1.18 1991/12/09 18:36:18 jplevyak
|
||||||
|
* Added support for Callback ( DTMreadReady ).
|
||||||
|
* Use arch.h as a general architecture definition header.
|
||||||
|
*
|
||||||
|
* Revision 1.17 1991/10/29 23:48:17 jefft
|
||||||
|
* move environmental variables definition from dtmnserv.h to dtm.h
|
||||||
|
*
|
||||||
|
* Revision 1.16 1991/10/16 23:23:56 jplevyak
|
||||||
|
* Added new error message and more parameters to DTMsendRoute
|
||||||
|
*
|
||||||
|
* Revision 1.15 91/10/11 20:23:31 jplevyak
|
||||||
|
* Added prototype for DTMcheckRoute,
|
||||||
|
* Changed DTMSYNC, DTMNOSYNC to DTM_SYNC, DTM_ASYNC.
|
||||||
|
*
|
||||||
|
* Revision 1.14 1991/10/10 14:23:43 jplevyak
|
||||||
|
* All prototypes are now included and tested.
|
||||||
|
*
|
||||||
|
* Revision 1.13 1991/09/26 20:13:54 jplevyak
|
||||||
|
* Added many prototypes. Moved some internal function out to dtmint.h
|
||||||
|
*
|
||||||
|
* Revision 1.12 91/09/18 15:27:54 jplevyak
|
||||||
|
* Added extern definition for DTMinit()
|
||||||
|
*
|
||||||
|
* Revision 1.11 91/09/13 17:36:05 sreedhar
|
||||||
|
* DTMSYNC, DTMNOSYNC added
|
||||||
|
*
|
||||||
|
* Revision 1.10 1991/09/13 15:31:45 jefft
|
||||||
|
* fixed DTMHL macro, it should not have taken an arguement.
|
||||||
|
*
|
||||||
|
* Revision 1.9 1991/09/11 21:09:20 jplevyak
|
||||||
|
* Fixed typeo dtm_set_type -> dtm_get_type.
|
||||||
|
*
|
||||||
|
* Revision 1.8 1991/09/10 15:06:08 jefft
|
||||||
|
* cleaned-up message class macros and added standard macros for passing
|
||||||
|
* port address (DTMsetAddress and DTMgetAddress).
|
||||||
|
*
|
||||||
|
* Revision 1.7 1991/08/15 19:10:39 sreedhar
|
||||||
|
* Changes for logical portname version
|
||||||
|
*
|
||||||
|
* Revision 1.5 1991/06/11 15:22:39 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.4 1991/06/07 16:04:51 sreedhar
|
||||||
|
* Changes for "Sequence start" message
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/05/30 15:43:27 sreedhar
|
||||||
|
* recvDataset, sendDataset replaced by readDataset/writeDataset
|
||||||
|
*
|
||||||
|
* Revision 1.2 1990/11/16 16:04:32 jefft
|
||||||
|
* fixed typecast problem with DTMgetType
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:31:19 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DTM_INC
|
||||||
|
#define DTM_INC
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#ifndef ARCH_INC
|
||||||
|
#include "arch.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined( _ARCH_PROTO )
|
||||||
|
#define DTM_PROTOTYPES
|
||||||
|
#define DTM_PROTO(x) x
|
||||||
|
#else
|
||||||
|
#define DTM_PROTO(x) ()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DTM constants */
|
||||||
|
#define DTM_WAIT_TIMEOUT 30 /* Seconds */
|
||||||
|
#define DTM_MAX_HEADER 1024 /* Max. header length */
|
||||||
|
|
||||||
|
/* general macros used by other message classes */
|
||||||
|
#define dtm_set_class(h, c) (strcpy((h), (c)), strcat((h), " "))
|
||||||
|
#define dtm_compare_class(h, c) !strncmp((h), (c), strlen(c))
|
||||||
|
|
||||||
|
#define dtm_header_length(h) (strlen(h)+1)
|
||||||
|
|
||||||
|
#define dtm_set_type(h, t) dtm_set_int((h), "DT", (t))
|
||||||
|
#define dtm_get_type(h, t) ((*(t)=(int)DTM_FLOAT), \
|
||||||
|
(dtm_get_int((h), "DT",((int *)t))))
|
||||||
|
|
||||||
|
#define dtm_set_title(h, c) dtm_set_char((h), "TTL", (c))
|
||||||
|
#define dtm_get_title(h, c, l) dtm_get_char((h), "TTL", (c), (l))
|
||||||
|
|
||||||
|
#define dtm_set_address(h, c) dtm_set_char((h), "PORT", (c))
|
||||||
|
#define dtm_get_address(h, c, l) dtm_get_char((h), "PORT", (c), (l))
|
||||||
|
|
||||||
|
|
||||||
|
/* standard types supported by DTM */
|
||||||
|
typedef enum {
|
||||||
|
DTM_CHAR = 0,
|
||||||
|
DTM_SHORT,
|
||||||
|
DTM_INT,
|
||||||
|
DTM_FLOAT,
|
||||||
|
DTM_DOUBLE,
|
||||||
|
DTM_COMPLEX,
|
||||||
|
DTM_TRIPLET
|
||||||
|
} DTMTYPE;
|
||||||
|
|
||||||
|
|
||||||
|
/* DTM triplet type */
|
||||||
|
struct DTM_TRIPLET {
|
||||||
|
int tag;
|
||||||
|
float x, y, z;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define DTM_DEFAULT DTM_SYNC
|
||||||
|
typedef enum {
|
||||||
|
DTM_SYNC=0,
|
||||||
|
DTM_ASYNC
|
||||||
|
} DTMqserv ;
|
||||||
|
|
||||||
|
/* Environmental variables used by DTM name server */
|
||||||
|
#define DTM_NAMESERVER "_DTM_NAMESERVER"
|
||||||
|
#define DTM_REFNAME "_DTM_REFNAME"
|
||||||
|
|
||||||
|
|
||||||
|
/* commands supported for groups */
|
||||||
|
typedef enum {
|
||||||
|
DTM_NEW = 1,
|
||||||
|
DTM_APPEND,
|
||||||
|
DTM_DELETE,
|
||||||
|
DTM_DONE
|
||||||
|
} DTMCMD;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
NOTE: the strings that describe the errors in DTMerr
|
||||||
|
are located in fatal.c. Any changes to this list
|
||||||
|
must be accompanied by a corresponding change there.
|
||||||
|
*/
|
||||||
|
#define DTMERROR -1
|
||||||
|
#define DTM_OK DTMNOERR
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DTMNOERR=0, /* no error */
|
||||||
|
DTMMEM, /* (1) Out of memory */
|
||||||
|
DTMHUH, /* (2) Unknown port definition */
|
||||||
|
DTMNOPORT, /* (3) No DTM ports available */
|
||||||
|
DTMPORTINIT, /* (4) DTM port not initialized */
|
||||||
|
DTMCALL, /* (5) calling routines in wrong order */
|
||||||
|
DTMEOF, /* (6) EOF error */
|
||||||
|
DTMSOCK, /* (7) Socket error */
|
||||||
|
DTMHOST, /* (8) That hostname is not found/bad */
|
||||||
|
DTMTIMEOUT, /* (9) Timeout waiting for connection */
|
||||||
|
DTMCCONN, /* (10) DTM cannot connect (network down?) */
|
||||||
|
DTMREAD, /* (11) error returned from system read */
|
||||||
|
DTMWRITE, /* (12) error returned from system write(v) */
|
||||||
|
DTMHEADER, /* (13) Header to long for buffer */
|
||||||
|
DTMSDS, /* (14) SDS error */
|
||||||
|
DTMSELECT, /* (15) Select call error */
|
||||||
|
DTMENV, /* (16) Environment not setup */
|
||||||
|
DTMBUFOVR, /* (17) User buffer overflow */
|
||||||
|
DTMCORPT, /* (18) Port table corrupted */
|
||||||
|
DTMBADPORT, /* (19) Port identifier is bad/corrupt/stale */
|
||||||
|
DTMBADACK, /* (20) Bad ack to internal flow control */
|
||||||
|
DTMADDR, /* (21) Bad address */
|
||||||
|
DTMSERVER /* (22) Problem communicating with the server */
|
||||||
|
} DTMerr;
|
||||||
|
|
||||||
|
typedef struct Dtm_set {
|
||||||
|
int port ;
|
||||||
|
int status ;
|
||||||
|
} Dtm_set ;
|
||||||
|
|
||||||
|
typedef struct Sock_set {
|
||||||
|
int sockfd ;
|
||||||
|
int status ;
|
||||||
|
} Sock_set ;
|
||||||
|
|
||||||
|
typedef void * VOIDPTR;
|
||||||
|
|
||||||
|
|
||||||
|
/* function definitions and extern references */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int DTMmakeInPort DTM_PROTO((char * portname, int qservice));
|
||||||
|
extern int DTMaddInPortSocket DTM_PROTO((int port, int socket ));
|
||||||
|
extern int DTMmakeOutPort DTM_PROTO((char * portname, int qservice));
|
||||||
|
#define DTM_PORT_READY 1
|
||||||
|
#define DTM_PORT_NOT_READY 0
|
||||||
|
extern int DTMavailWrite DTM_PROTO(( int port ));
|
||||||
|
extern int DTMavailRead DTM_PROTO(( int port ));
|
||||||
|
extern int DTMbeginRead DTM_PROTO(( int port, VOIDPTR header, int size));
|
||||||
|
extern int DTMbeginWrite DTM_PROTO(( int port, VOIDPTR header, int size));
|
||||||
|
extern int DTMreadDataset DTM_PROTO(( int p, VOIDPTR ds, int size, DTMTYPE type));
|
||||||
|
extern int DTMwriteDataset DTM_PROTO(( int p, VOIDPTR ds, int size, DTMTYPE type));
|
||||||
|
extern int DTMendRead DTM_PROTO(( int port ));
|
||||||
|
extern int DTMendWrite DTM_PROTO(( int port ));
|
||||||
|
extern int DTMreadMsg DTM_PROTO(( int p, char *hdr, int hdrsize,
|
||||||
|
VOIDPTR data, int datasize, int datatype ));
|
||||||
|
extern int DTMdestroyPort DTM_PROTO(( int port));
|
||||||
|
extern char *DTMerrmsg();
|
||||||
|
extern int DTMgetPortAddr DTM_PROTO(( int port, char * addr, int length ));
|
||||||
|
extern int DTMgetReturnPortName DTM_PROTO(( int port, char *** addrs,
|
||||||
|
int * n_addrs));
|
||||||
|
extern int DTMselectRead DTM_PROTO(( Dtm_set *dtmset, int dtmnum,
|
||||||
|
Sock_set *sockset, int socknum, int period ));
|
||||||
|
extern void DTMsetGroup DTM_PROTO(( char * header, DTMCMD cmd, char * parent,
|
||||||
|
char * self ));
|
||||||
|
extern int DTMgetGroup DTM_PROTO(( char * header, DTMCMD cmd, char * parent,
|
||||||
|
char * self ));
|
||||||
|
extern int DTMsendRoute DTM_PROTO(( int fd, char * sendto_addr, int addcount,
|
||||||
|
char **add_addresses, int delcount,
|
||||||
|
char **del_addresses ));
|
||||||
|
extern int DTMcheckRoute DTM_PROTO(( int port ));
|
||||||
|
/* Not implemented Yet */
|
||||||
|
extern int DTMrecvServerMsg DTM_PROTO(( int fd, int len, void * buffer ));
|
||||||
|
extern int DTMreadReady DTM_PROTO(( int port, void (*func)() ));
|
||||||
|
|
||||||
|
extern int DTMgetConnectionCount DTM_PROTO(( int port, int * n_connects ));
|
||||||
|
|
||||||
|
/* If you do not have X included you are not likely to use this function */
|
||||||
|
typedef (*DTMfuncPtr)();
|
||||||
|
#ifdef _XtIntrinsic_h
|
||||||
|
extern int DTMaddInput DTM_PROTO(( int port, long condition,
|
||||||
|
XtInputCallbackProc proc, caddr_t client_data));
|
||||||
|
#else
|
||||||
|
extern int DTMaddInput DTM_PROTO(( int port, long condition,
|
||||||
|
DTMfuncPtr proc, caddr_t client_data));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern DTMerr DTMerrno;
|
||||||
|
|
||||||
|
extern char *dtm_find_tag DTM_PROTO(( char * h, char * tag ));
|
||||||
|
extern void dtm_set_char DTM_PROTO(( char * h, char * tag, char * s));
|
||||||
|
extern int dtm_get_char DTM_PROTO(( char * h, char * tag,
|
||||||
|
char * destination, int length ));
|
||||||
|
extern void dtm_set_int DTM_PROTO(( char * h, char * tag, int i ));
|
||||||
|
extern int dtm_get_int DTM_PROTO(( char * h, char * tag, int *x));
|
||||||
|
extern void dtm_set_float DTM_PROTO(( char * h, char * tag, float f));
|
||||||
|
extern int dtm_get_float DTM_PROTO(( char * h, char * tag, float *f));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The following macros are defined for the specific DTM class. They are
|
||||||
|
* included to provide a standard framework for other classes to emulate.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DTM class specific macros
|
||||||
|
*/
|
||||||
|
#define DTMclass "DTM"
|
||||||
|
|
||||||
|
#define DTMsetClass(h) dtm_set_class((h), DTMclass)
|
||||||
|
#define DTMcompareClass(h) dtm_compare_class((h), DTMclass)
|
||||||
|
|
||||||
|
#define DTMheaderLength dtm_header_length
|
||||||
|
#define DTMHL dtm_header_length
|
||||||
|
|
||||||
|
#define DTMsetAddress dtm_set_address
|
||||||
|
#define DTMgetAddress dtm_get_address
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MSG class specific macros
|
||||||
|
*/
|
||||||
|
#define MSGclass "MSG"
|
||||||
|
|
||||||
|
#define MSGsetClass(h) dtm_set_class((h), MSGclass)
|
||||||
|
#define MSGcompareClass(h) dtm_compare_class((h), MSGclass)
|
||||||
|
|
||||||
|
#define MSGsetString(h, s) dtm_set_char((h), "STR", (s))
|
||||||
|
#define MSGgetString(h, s, l) dtm_get_char((h), "STR", (s), (l))
|
||||||
|
|
||||||
|
#define MSGheaderLength dtm_header_length
|
||||||
|
#define MSGHL dtm_header_length
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* DTM_INC */
|
233
libdtm/dtmf77.c
Normal file
233
libdtm/dtmf77.c
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: dtmf77.c,v $
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:02:59 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:39:40 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:31 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:11 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:16 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.7 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.6 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.5 1991/11/15 23:01:21 jefft
|
||||||
|
* Added quality of service options to DTMMOP and DTMMIP
|
||||||
|
*
|
||||||
|
* Revision 1.4 1991/06/11 15:22:00 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/05/30 15:53:35 sreedhar
|
||||||
|
* Changes for readMsg/writeMsg internal release
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/02/01 10:41:40 jefft
|
||||||
|
* Fixed bug with DTMBR, the _cptofcd was not used correctly.
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:31:46 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fortran.h>
|
||||||
|
#include "dtm.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMMIP(_fcd s)
|
||||||
|
#else
|
||||||
|
int DTMMIP(s)
|
||||||
|
_fcd s;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char portname[128];
|
||||||
|
|
||||||
|
len = _fcdlen(s);
|
||||||
|
strncpy(portname, _fcdtocp(s), len);
|
||||||
|
portname[len] = '\0';
|
||||||
|
|
||||||
|
return DTMmakeInPort(portname, DTM_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMMOP(_fcd s)
|
||||||
|
#else
|
||||||
|
int DTMMOP(s)
|
||||||
|
_fcd s;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char portname[128];
|
||||||
|
|
||||||
|
len = _fcdlen(s);
|
||||||
|
strncpy(portname, _fcdtocp(s), len);
|
||||||
|
portname[len] = '\0';
|
||||||
|
|
||||||
|
return DTMmakeOutPort(portname, DTM_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMGPA(int *p,_fcd s,int *len)
|
||||||
|
#else
|
||||||
|
int DTMGPA(p, s, len)
|
||||||
|
int *p, *len;
|
||||||
|
_fcd s;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char portaddr[128];
|
||||||
|
|
||||||
|
|
||||||
|
if (DTMgetPortAddr(*p, portaddr, sizeof portaddr) == DTMERROR)
|
||||||
|
return DTMERROR;
|
||||||
|
|
||||||
|
if (strlen(portaddr) > *len) {
|
||||||
|
strncpy(_fcdtocp(s), portaddr, *len);
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
strncpy(_fcdtocp(s), portaddr, strlen(portaddr));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMAR(int *p)
|
||||||
|
#else
|
||||||
|
int DTMAR(p)
|
||||||
|
int *p;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return DTMavailRead(*p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMBR(int *p,_fcd header,int *size)
|
||||||
|
#else
|
||||||
|
int DTMBR(p, header, size)
|
||||||
|
int *p, *size;
|
||||||
|
_fcd header;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
return DTMbeginRead(*p, _fcdtocp(header), *size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMRD(int *p,char *ds,int *size,DTMTYPE type)
|
||||||
|
#else
|
||||||
|
int DTMRD(p, ds, size, type)
|
||||||
|
int *p, *size;
|
||||||
|
char *ds;
|
||||||
|
DTMTYPE *type;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return DTMreadDataset(*p, ds, *size, *type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMER(int *p)
|
||||||
|
#else
|
||||||
|
int DTMER(p)
|
||||||
|
int *p;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return DTMendRead(*p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMAW(int *p)
|
||||||
|
#else
|
||||||
|
int DTMAW(p)
|
||||||
|
int *p;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return DTMavailWrite(*p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMBW(int *p,_fcd header,int *size)
|
||||||
|
#else
|
||||||
|
int DTMBW(p, header, size)
|
||||||
|
int *p, *size;
|
||||||
|
_fcd header;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
char buffer[DTM_MAX_HEADER];
|
||||||
|
|
||||||
|
len = _fcdlen(header);
|
||||||
|
strncpy(buffer, _fcdtocp(header), len);
|
||||||
|
buffer[len] = '\0';
|
||||||
|
|
||||||
|
return DTMbeginWrite(*p, buffer, len+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMSD(int *p,char *ds,int *size,DTMTYPE type)
|
||||||
|
#else
|
||||||
|
int DTMSD(p, ds, size, type)
|
||||||
|
int *p, *size;
|
||||||
|
char *ds;
|
||||||
|
DTMTYPE *type;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return DTMwriteDataset(*p, ds, *size, *type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMEW(int *p)
|
||||||
|
#else
|
||||||
|
int DTMEW(p)
|
||||||
|
int *p;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
return DTMendWrite(*p);
|
||||||
|
}
|
755
libdtm/dtminit.c
Normal file
755
libdtm/dtminit.c
Normal file
@ -0,0 +1,755 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
**
|
||||||
|
** dtminit.c - contains routines to initialize the dtm routines
|
||||||
|
** based on command line options.
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $Log: dtminit.c,v $
|
||||||
|
* Revision 1.4 1996/02/18 23:40:12 spowers
|
||||||
|
* PROTO -> DTM_PROTO
|
||||||
|
*
|
||||||
|
* Revision 1.3 1995/10/14 22:07:25 spowers
|
||||||
|
* Bzero and Bcopy removed...memset memcpy used instead.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1995/10/13 06:33:07 spowers
|
||||||
|
* Solaris support added.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1995/01/11 00:02:59 alanb
|
||||||
|
* New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
*
|
||||||
|
* Revision 2.5 1994/12/29 23:39:43 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:31 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:16 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.3 1993/04/18 05:51:46 marca
|
||||||
|
* Tweaks.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1993/02/26 05:21:53 marca
|
||||||
|
* Unknown change.
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:18 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.33 92/05/05 22:27:50 jplevyak
|
||||||
|
* Corrected X interface code.
|
||||||
|
*
|
||||||
|
* Revision 1.32 1992/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.31 1992/04/29 21:57:46 jplevyak
|
||||||
|
* Initialize the new DTMPORT structure elements used for DTMaddInput.
|
||||||
|
*
|
||||||
|
* Revision 1.30 1992/04/06 15:58:25 jplevyak
|
||||||
|
* Fixed minor problems for machines little Endian machines.
|
||||||
|
*
|
||||||
|
* Revision 1.29 92/03/20 21:14:40 jplevyak
|
||||||
|
* Remove comments about DTMgetPortName
|
||||||
|
*
|
||||||
|
* Revision 1.28 1992/03/16 20:38:36 creiman
|
||||||
|
* Added #include "arch.h"
|
||||||
|
*
|
||||||
|
* Revision 1.27 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.26 1992/02/27 23:44:07 jplevyak
|
||||||
|
* New function DTMgetRemotePortAddr.
|
||||||
|
*
|
||||||
|
* Revision 1.25 1992/02/18 14:03:16 jplevyak
|
||||||
|
* Used _ARCH_MACOS instead of macintosh.
|
||||||
|
*
|
||||||
|
* Revision 1.24 1992/01/14 19:37:50 creiman
|
||||||
|
* Removed malloc.h from mac version
|
||||||
|
*
|
||||||
|
* Revision 1.23 1992/01/14 16:31:40 creiman
|
||||||
|
* Removed mac #include
|
||||||
|
*
|
||||||
|
* Revision 1.22 1991/12/09 18:36:18 jplevyak
|
||||||
|
* Added support for Callback ( DTMreadReady ).
|
||||||
|
*
|
||||||
|
* Revision 1.21 1991/12/02 11:14:53 dweber
|
||||||
|
* Deleted DTMgetPortName function
|
||||||
|
*
|
||||||
|
* Revision 1.20 91/11/22 21:31:00 jplevyak
|
||||||
|
* Added initialization for fDiscard (fGotList and fLastWasSuccessfull...)
|
||||||
|
*
|
||||||
|
* Revision 1.19 1991/10/29 22:05:53 sreedhar
|
||||||
|
* <sys/malloc.h> for CONVEX
|
||||||
|
*
|
||||||
|
* Revision 1.18 1991/10/16 23:24:40 jplevyak
|
||||||
|
* Added new error message.
|
||||||
|
*
|
||||||
|
* Revision 1.17 1991/10/14 16:47:48 jplevyak
|
||||||
|
* Fix bug in physical port addressing.
|
||||||
|
*
|
||||||
|
* Revision 1.16 1991/10/11 20:43:55 jplevyak
|
||||||
|
* Fixed bug in dtm_get_naddr, incorrect error handling.
|
||||||
|
*
|
||||||
|
* Revision 1.15 1991/10/10 14:25:07 jplevyak
|
||||||
|
* Finished fixing naming convensions. Added code to handle multiple
|
||||||
|
* open read sockets on a single DTM socket.
|
||||||
|
*
|
||||||
|
* Revision 1.14 91/09/26 20:14:58 jplevyak
|
||||||
|
* Major reorganization. Dynamically allocate port table. Encode a
|
||||||
|
* key in the external ports to detect stale ports. Rename and
|
||||||
|
* comment functions.
|
||||||
|
*
|
||||||
|
* Revision 1.13 91/09/18 15:28:11 jplevyak
|
||||||
|
* Added some external definitions for shared functions.
|
||||||
|
*
|
||||||
|
* Revision 1.12 91/09/16 11:25:37 jplevyak
|
||||||
|
* Fix bug, use of uninitialized register variable in function
|
||||||
|
* DTMdestroyPort
|
||||||
|
*
|
||||||
|
* Revision 1.11 91/09/13 20:09:31 sreedhar
|
||||||
|
* supporting :9900, absence of env variable
|
||||||
|
*
|
||||||
|
* Revision 1.10 1991/09/13 18:57:13 sreedhar
|
||||||
|
* removed DTMinit() fn., added qservice in some places
|
||||||
|
*
|
||||||
|
* Revision 1.9 1991/08/15 18:56:19 sreedhar
|
||||||
|
* Changes for logical portname version
|
||||||
|
*
|
||||||
|
* Revision 1.7 1991/06/11 15:34:15 sreedhar
|
||||||
|
* quality of service parameter for future use
|
||||||
|
*
|
||||||
|
* Revision 1.6 1991/06/11 15:18:36 sreedhar
|
||||||
|
* disclaimer added, availwrite/seqstart flags inited.
|
||||||
|
*
|
||||||
|
* Revision 1.5 1991/06/07 16:05:21 sreedhar
|
||||||
|
* *colon = '\0' removed, it writes into user buffer
|
||||||
|
*
|
||||||
|
* Revision 1.4 1991/01/09 16:50:34 jefft
|
||||||
|
* added include sys/include.h
|
||||||
|
*
|
||||||
|
* Revision 1.3 91/01/09 14:10:04 jefft
|
||||||
|
* Now ignoring SIGPIPE signals.
|
||||||
|
*
|
||||||
|
* Revision 1.2 90/11/21 10:53:08 jefft
|
||||||
|
* Modified DTMgetPortAddr to return IP address instead of hostname.
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:21:54 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "arch.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifndef _ARCH_MACOS
|
||||||
|
# include <sys/signal.h>
|
||||||
|
#endif
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#ifndef _ARCH_MACOS
|
||||||
|
# if defined(CONVEX) || defined(NEXT)
|
||||||
|
# include <sys/malloc.h>
|
||||||
|
# else
|
||||||
|
# include <malloc.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dtm.h"
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
CONTENTS
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
|
||||||
|
init_port() - initialize DTM port.
|
||||||
|
grow_ports() - enlarge the DTM port table
|
||||||
|
initialize() - initialize DTM library
|
||||||
|
get_init_port() - find a new port and initialize it
|
||||||
|
set_out_port_address() - set a physical out port adress
|
||||||
|
free_port() - free the internal port structure
|
||||||
|
register_port() - register a logical port with the server
|
||||||
|
|
||||||
|
IN-LIBRARY GLOBAL
|
||||||
|
|
||||||
|
dtm_map_port_internal() - map external port ID to internal port number
|
||||||
|
dtm_map_port_external() - map internal port number to external port ID
|
||||||
|
|
||||||
|
EXTERNALLY GLOBAL
|
||||||
|
|
||||||
|
DTMmakeInPort() - make a DTM input port
|
||||||
|
DTMmakeOutPort() - make a DTM output port
|
||||||
|
DTMdestroyPort() - close and free a DTM port
|
||||||
|
DTMgetPortAddr() - returns the main port address
|
||||||
|
|
||||||
|
END CONTENTS */
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
/*
|
||||||
|
STATIC FUNCTION PROTOTYPES
|
||||||
|
*/
|
||||||
|
static int init_port DTM_PROTO((int ,int ,int ));
|
||||||
|
static int grow_ports DTM_PROTO((VOID ));
|
||||||
|
static int initialize DTM_PROTO((VOID ));
|
||||||
|
static int get_init_port DTM_PROTO((char *,int ,int ));
|
||||||
|
static int set_out_port_address DTM_PROTO((int ,S_ADDR ));
|
||||||
|
static int free_port DTM_PROTO((int ));
|
||||||
|
static int register_port DTM_PROTO((int ));
|
||||||
|
static char *dtm_addr_to_a DTM_PROTO((S_ADDR addr));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
STATIC FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
init_port()
|
||||||
|
Allocate and intialize port p.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int init_port(int port,int porttype,int qservice )
|
||||||
|
#else
|
||||||
|
static int init_port( port, porttype, qservice )
|
||||||
|
int port;
|
||||||
|
int porttype ;
|
||||||
|
int qservice ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
register DTMPORT *pp ;
|
||||||
|
|
||||||
|
DBGFLOW( "init_port called\n" );
|
||||||
|
|
||||||
|
/* allocate port structure */
|
||||||
|
|
||||||
|
if( (pp = DTMpt[port] = (DTMPORT *)malloc(sizeof (DTMPORT))) == NULL ) {
|
||||||
|
DTMerrno = DTMMEM;
|
||||||
|
DBGFLOW("init_port: could not allocate DTMPORT structure.");
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
memset(pp,0,sizeof(DTMPORT));
|
||||||
|
/*
|
||||||
|
#ifdef SOLARIS
|
||||||
|
memset(pp,0,sizeof(DTMPORT));
|
||||||
|
#else
|
||||||
|
bzero( pp, sizeof( DTMPORT ) );
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
pp->porttype = porttype ;
|
||||||
|
pp->qservice = qservice ;
|
||||||
|
pp->Xcallback_data = NULL;
|
||||||
|
pp->Xcallback = NULL;
|
||||||
|
pp->XaddInput = NULL;
|
||||||
|
|
||||||
|
/* Input port data init */
|
||||||
|
|
||||||
|
pp->in = NULL;
|
||||||
|
pp->nextToRead = NULL;
|
||||||
|
pp->callback = NULL;
|
||||||
|
|
||||||
|
/* Output port data init */
|
||||||
|
|
||||||
|
pp->out = NULL ;
|
||||||
|
pp->fLastWasSuccessfulAvailWrite = FALSE;
|
||||||
|
pp->fGotList = FALSE;
|
||||||
|
pp->fDiscard = FALSE;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
grow_ports()
|
||||||
|
Extend the size of the port table by DTM_PORTS_GROW ports.
|
||||||
|
*/
|
||||||
|
static int grow_ports( VOID )
|
||||||
|
{
|
||||||
|
if ( ( DTMpt = (DTMPORT **) realloc( (void *) DTMpt, (DTMptCount +
|
||||||
|
DTM_PORTS_GROW) * sizeof(DTMPORT))) == NULL ) {
|
||||||
|
DTMerrno = DTMMEM;
|
||||||
|
DTMERR("initialize: insufficient memory for port table.");
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
memset( (char *)&DTMpt[DTMptCount],0,DTM_PORTS_GROW * sizeof(DTMPORT));
|
||||||
|
/*
|
||||||
|
#ifdef SOLARIS
|
||||||
|
memset( (char *)&DTMpt[DTMptCount],0,DTM_PORTS_GROW * sizeof(DTMPORT));
|
||||||
|
#else
|
||||||
|
bzero( (char *)&DTMpt[DTMptCount], DTM_PORTS_GROW * sizeof(DTMPORT));
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
DTMptCount += DTM_PORTS_GROW;
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
initialize()
|
||||||
|
Initailized DTM by allocating memory for dtm_discard
|
||||||
|
and DTMpt ( the port table ).
|
||||||
|
*/
|
||||||
|
static int initialize( VOID )
|
||||||
|
{
|
||||||
|
/* get the debug option flag */
|
||||||
|
if ( getenv( "DTMDEBUG" ) ) uDTMdbg = -1;
|
||||||
|
|
||||||
|
/* create discard buffer */
|
||||||
|
if ((dtm_discard = (char *)malloc(DISCARDSIZE)) == NULL) {
|
||||||
|
DTMerrno = DTMMEM;
|
||||||
|
DTMERR("initialize: insufficient memory for dicard buffer.");
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((DTMpt = (DTMPORT **)calloc(DTM_PORTS_INITIAL, sizeof(DTMPORT)))
|
||||||
|
== NULL) {
|
||||||
|
DTMerrno = DTMMEM;
|
||||||
|
DTMERR("initialize: insufficient memory for port table.");
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
DTMptCount = DTM_PORTS_INITIAL;
|
||||||
|
|
||||||
|
#if !defined(_ARCH_MACOS) & !defined(_ARCH_MSDOS)
|
||||||
|
/* ignore SIGPIPE signals, handled by dtm_write call */
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
get_init_port()
|
||||||
|
Get and initialize a new port. Setting the porttype, qservice
|
||||||
|
and key fields. Remember to build the external port
|
||||||
|
name before returning it to the user!
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int get_init_port(char *portname,int porttype,int qservice )
|
||||||
|
#else
|
||||||
|
static int get_init_port( portname, porttype, qservice )
|
||||||
|
char *portname ;
|
||||||
|
int porttype ;
|
||||||
|
int qservice ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int tries = 2;
|
||||||
|
int port ;
|
||||||
|
|
||||||
|
DBGFLOW("get_init_port called.\n");
|
||||||
|
|
||||||
|
/* check for library initialization */
|
||||||
|
if( !DTM_INITIALIZED ) CHECK_ERR( initialize());
|
||||||
|
|
||||||
|
/* find first open DTM port */
|
||||||
|
while ( tries-- ) {
|
||||||
|
for (port=0; port < DTMptCount; port+=1) {
|
||||||
|
if (DTMpt[port] == NULL) {
|
||||||
|
CHECK_ERR(init_port( port, porttype, qservice ));
|
||||||
|
strncpy( DTMpt[port]->portname, portname, (PNAMELEN - 1) );
|
||||||
|
DTMpt[ port ]->portname[ PNAMELEN - 1 ] = '\0' ;
|
||||||
|
DTMpt[ port ]->key = DTMportSequenceNumber++;
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
grow_ports();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we should never get here */
|
||||||
|
DTMerrno = DTMNOPORT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
set_out_port_address()
|
||||||
|
Set the single out port address of a DTMPORT with a physical
|
||||||
|
specification.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int set_out_port_address(int port,S_ADDR addr )
|
||||||
|
#else
|
||||||
|
static int set_out_port_address( port, addr )
|
||||||
|
int port;
|
||||||
|
S_ADDR addr;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Port aPort ;
|
||||||
|
Outport *outp ;
|
||||||
|
|
||||||
|
DBGINT( "set_out_port_address: Physical TCP portname - %x ",
|
||||||
|
ntohl( addr.sin_addr.s_addr ));
|
||||||
|
DBGINT( "%d\n", ntohs( addr.sin_port ));
|
||||||
|
|
||||||
|
aPort.portid = addr.sin_port ;
|
||||||
|
aPort.nethostid = addr.sin_addr.s_addr ;
|
||||||
|
CHECK_ERR( outp = dtm_new_out_port( &aPort ));
|
||||||
|
|
||||||
|
DTMpt[port]->out = outp ;
|
||||||
|
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int free_port(int port )
|
||||||
|
#else
|
||||||
|
static int free_port( port )
|
||||||
|
int port;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Outport * outport = DTMpt[ port ]->out;
|
||||||
|
Outport * tempPort;
|
||||||
|
int returnValue = DTM_OK;
|
||||||
|
|
||||||
|
while ( outport != NULL ) {
|
||||||
|
tempPort = outport->next;
|
||||||
|
#ifdef FREE_RETURNS_INT
|
||||||
|
if ( free( outport ) != 0 ) {
|
||||||
|
DTMerrno = DTMCORPT;
|
||||||
|
returnValue = DTMERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
free( outport );
|
||||||
|
#endif
|
||||||
|
outport = tempPort;
|
||||||
|
}
|
||||||
|
#ifdef FREE_RETURNS_INT
|
||||||
|
if ( free( DTMpt[ port ] ) != 0 ) {
|
||||||
|
DTMerrno = DTMCORPT;
|
||||||
|
returnValue = DTMERROR;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
free( DTMpt[ port ] );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DTMpt[port] = NULL;
|
||||||
|
return DTM_OK ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
register_port()
|
||||||
|
Attempt to register the logical port with the name server.
|
||||||
|
On failure, destroy the port.
|
||||||
|
returns: DTM_OK and DTMERROR.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int register_port(int port )
|
||||||
|
#else
|
||||||
|
static int register_port( port )
|
||||||
|
int port;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int fd ;
|
||||||
|
S_ADDR addr ;
|
||||||
|
char *naddr ;
|
||||||
|
|
||||||
|
CHECK_ERR( naddr = dtm_get_naddr( &addr, &fd ));
|
||||||
|
if(dtm_nsend_sockaddr(fd, naddr, dtm_get_refname(), DTMpt[port]->portname,
|
||||||
|
&DTMpt[ port ]->sockaddr ) < 0 ) {
|
||||||
|
DTMdestroyPort( DTMpt[port]->sockfd ) ;
|
||||||
|
DTMerrno = DTMTIMEOUT;
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
IN-LIBRARY GLOBAL FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_map_port_internal()
|
||||||
|
This function takes a pointer to a port and then validates
|
||||||
|
that port. If the validation passes, the port is converted
|
||||||
|
to the internal representation (which is an index into the
|
||||||
|
port table DTMpt).
|
||||||
|
returns: DTMERROR, DTM_OK sets error codes DTMBADPORT
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_map_port_internal( int32 port )
|
||||||
|
#else
|
||||||
|
int dtm_map_port_internal( port )
|
||||||
|
int32 port;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int32 thePort = port & DTM_PORT_MASK;
|
||||||
|
|
||||||
|
if ( ( thePort ) >= DTMptCount ) {
|
||||||
|
DTMerrno = DTMBADPORT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
if ( DTMpt[ thePort ] == NULL ) {
|
||||||
|
DTMerrno = DTMBADPORT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
if ( ( port >> DTM_PORT_KEY_SHIFT ) != DTMpt[ thePort ]->key ) {
|
||||||
|
DTMerrno = DTMBADPORT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
return thePort;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void dtm_map_port_external(int32 *port )
|
||||||
|
#else
|
||||||
|
void dtm_map_port_external( port )
|
||||||
|
int32 *port;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
*port = *port | (DTMpt[ *port ]->key << DTM_PORT_KEY_SHIFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
EXTERNALLY GLOBAL FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
DTMmakeInPort()
|
||||||
|
Create and initialize a new port.
|
||||||
|
portname may be a logical or a physical port.
|
||||||
|
qservice is reserved for future use.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMmakeInPort(char *portname,int qservice )
|
||||||
|
#else
|
||||||
|
int DTMmakeInPort(portname, qservice )
|
||||||
|
char *portname;
|
||||||
|
int qservice ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int port;
|
||||||
|
int fLogicalName = FALSE;
|
||||||
|
|
||||||
|
DBGFLOW("DTMmakeInPort called.\n");
|
||||||
|
|
||||||
|
CHECK_ERR(port = get_init_port(portname, INPORTTYPE, qservice ));
|
||||||
|
DBGMSG2("DTMmakeInPort port %d addr %X\n", port, DTMpt[port] );
|
||||||
|
CHECK_ERR(dtm_init_sockaddr( &DTMpt[ port ]->sockaddr,
|
||||||
|
DTMpt[ port ]->portname, &fLogicalName ));
|
||||||
|
DTMpt[port]->fLogical = fLogicalName;
|
||||||
|
|
||||||
|
if ((DTMpt[port]->sockfd = dtm_socket_init( &DTMpt[port]->sockaddr,
|
||||||
|
INPORTTYPE, fLogicalName )) == DTMERROR ) {
|
||||||
|
free_port(port);
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBGMSG1( "DTMmakeInPort: sockfd = %d\n", DTMpt[ port ]->sockfd );
|
||||||
|
|
||||||
|
if( fLogicalName ) CHECK_ERR( register_port( port ));
|
||||||
|
|
||||||
|
dtm_map_port_external( &port ) ;
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
DTMmakeOutPort()
|
||||||
|
Create and initialze a new port.
|
||||||
|
portname may be a logical or a physical port.
|
||||||
|
qservice is reserved for future use.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMmakeOutPort(char *portname,int qservice )
|
||||||
|
#else
|
||||||
|
int DTMmakeOutPort(portname, qservice )
|
||||||
|
char *portname;
|
||||||
|
int qservice ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int port;
|
||||||
|
int fLogicalName = TRUE;
|
||||||
|
S_ADDR addr;
|
||||||
|
|
||||||
|
DBGFLOW("DTMmakeOutPort called.\n");
|
||||||
|
|
||||||
|
CHECK_ERR( (port = get_init_port( portname, OUTPORTTYPE, qservice)));
|
||||||
|
CHECK_ERR((dtm_init_sockaddr(&addr, DTMpt[port]->portname,&fLogicalName)));
|
||||||
|
DTMpt[port]->fLogical = fLogicalName;
|
||||||
|
|
||||||
|
if( !fLogicalName ) CHECK_ERR( set_out_port_address( port, addr ));
|
||||||
|
|
||||||
|
if( (DTMpt[port] -> sockfd = dtm_socket_init( &DTMpt[port] -> sockaddr,
|
||||||
|
OUTPORTTYPE, fLogicalName )) == DTMERROR ) {
|
||||||
|
DTMdestroyPort( port );
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fLogicalName ) CHECK_ERR( register_port( port ));
|
||||||
|
|
||||||
|
dtm_map_port_external( &port ) ;
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
DTMdestroyPort()
|
||||||
|
Close all connections attached to this port then free up the memory
|
||||||
|
that it uses.
|
||||||
|
returns: DTMERROR, DTM_OK
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMdestroyPort(int port)
|
||||||
|
#else
|
||||||
|
int DTMdestroyPort(port)
|
||||||
|
int port;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
reg DTMPORT *pp ;
|
||||||
|
|
||||||
|
DBGFLOW("DTMdestroyPort called.\n");
|
||||||
|
|
||||||
|
CHECK_ERR( port = dtm_map_port_internal( port ));
|
||||||
|
|
||||||
|
/* close main socket */
|
||||||
|
|
||||||
|
pp = DTMpt[port];
|
||||||
|
if (pp->sockfd != -1) {
|
||||||
|
if ( pp->XinputId ) pp->XremoveInput( pp->XinputId );
|
||||||
|
close(pp->sockfd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close connections */
|
||||||
|
|
||||||
|
if( pp -> porttype == INPORTTYPE ) {
|
||||||
|
register Inport *pcur ;
|
||||||
|
FOR_EACH_IN_PORT( pcur, pp ) {
|
||||||
|
if( pcur->fd != DTM_NO_CONNECTION ) {
|
||||||
|
if ( pp->Xcallback ) pp->XremoveInput( pcur->XinputId );
|
||||||
|
close( pcur->fd ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
register Outport *pcur ;
|
||||||
|
|
||||||
|
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||||
|
if( pcur->connfd != DTM_NO_CONNECTION ) close( pcur->connfd ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* free space allocated for port */
|
||||||
|
|
||||||
|
free_port( port );
|
||||||
|
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DTMgetPortAddr()
|
||||||
|
Copies the physical address of the port into the given
|
||||||
|
buffer up the the length.
|
||||||
|
returns: DTMERROR, DTM_OK.
|
||||||
|
|
||||||
|
BUGS: does not check the length until adding the port.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMgetPortAddr(int port,char *addr,int length)
|
||||||
|
#else
|
||||||
|
int DTMgetPortAddr(port, addr, length)
|
||||||
|
int port;
|
||||||
|
int length;
|
||||||
|
char *addr;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char pnum[10];
|
||||||
|
|
||||||
|
DBGFLOW("DTMgetPortAddr called.\n");
|
||||||
|
|
||||||
|
CHECK_ERR( port = dtm_map_port_internal( port ));
|
||||||
|
|
||||||
|
if (dtm_get_ipaddr(addr) == 0) {
|
||||||
|
DTMerrno = DTMHOST;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(pnum, ":%d", ntohs( DTMpt[port]->sockaddr.sin_port ) );
|
||||||
|
if ( strlen( pnum ) + strlen( addr ) + 1 > length ) {
|
||||||
|
DTMerrno = DTMBUFOVR;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
strcat(addr, pnum);
|
||||||
|
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static char * dtm_addr_to_a(S_ADDR addr )
|
||||||
|
#else
|
||||||
|
static char * dtm_addr_to_a( addr )
|
||||||
|
S_ADDR addr;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
static char addr_buf[32];
|
||||||
|
uint32 hnum = addr.sin_addr.s_addr;
|
||||||
|
unsigned char * p_hnum = (unsigned char *) &hnum;
|
||||||
|
|
||||||
|
sprintf(addr_buf, "%d.%d.%d.%d:%d",
|
||||||
|
p_hnum[0], p_hnum[1], p_hnum[2], p_hnum[3], ntohs( addr.sin_port ));
|
||||||
|
return addr_buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DTMgetRemotePortAddr
|
||||||
|
Returns:
|
||||||
|
Pointer to a malloc'ed array of pointers to strings.
|
||||||
|
Number of strings in the array.
|
||||||
|
Up to the user to free the list.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMgetRemotePortAddr(int port,char ***addrs,int *n_addrs)
|
||||||
|
#else
|
||||||
|
int DTMgetRemotePortAddr(port, addrs, n_addrs)
|
||||||
|
int port;
|
||||||
|
char *** addrs;
|
||||||
|
int * n_addrs;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
int count = 0;
|
||||||
|
reg Outport * pcur;
|
||||||
|
reg DTMPORT * pp;
|
||||||
|
char * strings;
|
||||||
|
|
||||||
|
CHECK_ERR( port = dtm_map_port_internal( port ));
|
||||||
|
pp = DTMpt[port];
|
||||||
|
|
||||||
|
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||||
|
count++;
|
||||||
|
size += strlen( dtm_addr_to_a( pcur->sockaddr )) + 1 + 4;
|
||||||
|
}
|
||||||
|
*n_addrs = count;
|
||||||
|
*addrs = (char **) malloc( size );
|
||||||
|
if ( !*addrs ) {
|
||||||
|
DTMerrno = DTMMEM;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
strings = (char *) *addrs;
|
||||||
|
strings += 4 * count;
|
||||||
|
FOR_EACH_OUT_PORT( pcur, pp ) {
|
||||||
|
(*addrs)[--count] = strings;
|
||||||
|
strcpy( strings, dtm_addr_to_a( pcur->sockaddr ));
|
||||||
|
strings += strlen(strings) + 1;
|
||||||
|
}
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
477
libdtm/dtmint.h
Normal file
477
libdtm/dtmint.h
Normal file
@ -0,0 +1,477 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/dtmint.h,v 1.5 1996/02/18 23:40:13 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.2 1993/10/06 06:16:06 ebina
|
||||||
|
* Fix stupid cont annoyance
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:11 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:19 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.28 92/05/05 22:27:50 jplevyak
|
||||||
|
* Corrected X interface code.
|
||||||
|
*
|
||||||
|
* Revision 1.27 1992/04/30 20:27:05 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.26 1992/04/29 21:58:54 jplevyak
|
||||||
|
* Add new structure elements to DTMPORT to support DTMaddInput.
|
||||||
|
* Add prototypes for dtm_accept_read_connections and
|
||||||
|
* dtm_set_Xcallback
|
||||||
|
*
|
||||||
|
* Revision 1.25 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.24 1992/03/02 18:29:41 jplevyak
|
||||||
|
* Fixed bug in EAGAIN handling.
|
||||||
|
*
|
||||||
|
* Revision 1.23 1992/03/02 17:20:14 jplevyak
|
||||||
|
* Temporary back out.
|
||||||
|
*
|
||||||
|
* Revision 1.21 1992/02/28 03:40:24 jplevyak
|
||||||
|
* int/long confict fix (no diff on workstations)
|
||||||
|
* ,
|
||||||
|
*
|
||||||
|
* Revision 1.20 92/02/27 23:59:56 jplevyak
|
||||||
|
* Fixup prototype problems.
|
||||||
|
*
|
||||||
|
* Revision 1.19 1992/01/30 19:28:50 jplevyak
|
||||||
|
* Add support for c++ type external definitions.
|
||||||
|
*
|
||||||
|
* Revision 1.18 92/01/24 18:45:50 jefft
|
||||||
|
* Removed prototypes for dtm_set_<type> and dtm_get_<type>, added them to dtm.h
|
||||||
|
*
|
||||||
|
* Revision 1.17 1991/12/16 19:44:04 jefft
|
||||||
|
* Fixed bug with defining of NULL macro
|
||||||
|
*
|
||||||
|
* Revision 1.16 1991/12/09 18:36:18 jplevyak
|
||||||
|
* Added support for Callback ( DTMreadReady ).
|
||||||
|
*
|
||||||
|
* Revision 1.15 1991/11/22 21:31:37 jplevyak
|
||||||
|
* Added fDiscard to port structure. Removed prototype for dtm_get_nlist
|
||||||
|
* and dtm_check_server.
|
||||||
|
*
|
||||||
|
* Revision 1.14 1991/10/16 11:25:23 jplevyak
|
||||||
|
* ifdef around a duplicated include that was giving the SGIs trouble.
|
||||||
|
*
|
||||||
|
* Revision 1.13 1991/10/14 16:48:21 jplevyak
|
||||||
|
* Add flag in DTMPORT indicating whether or not the address is
|
||||||
|
* logical.
|
||||||
|
*
|
||||||
|
* Revision 1.12 1991/10/11 20:24:11 jplevyak
|
||||||
|
* Changed DTMSendCTSAhead default to be 0 (no chance of deadlock) as
|
||||||
|
* default.
|
||||||
|
*
|
||||||
|
* Revision 1.11 1991/10/10 14:26:16 jplevyak
|
||||||
|
* Finished fixing naming convensions. All prototypes are now included.
|
||||||
|
*
|
||||||
|
* Revision 1.10 91/09/26 20:16:46 jplevyak
|
||||||
|
* Major reorganization. Made this file compatible with dtm.h. Moved
|
||||||
|
* redundant out. Added several configuration parameters, added
|
||||||
|
* prototypes for internally global functions.
|
||||||
|
*
|
||||||
|
* Revision 1.9 91/09/18 15:28:50 jplevyak
|
||||||
|
* Added some external definitions for shared functions.
|
||||||
|
*
|
||||||
|
* Revision 1.8 91/09/13 17:37:37 sreedhar
|
||||||
|
* MAX132 instead of MAXBUFSIZE
|
||||||
|
*
|
||||||
|
* Revision 1.7 1991/08/15 19:10:53 sreedhar
|
||||||
|
* Changes for logical portname version
|
||||||
|
*
|
||||||
|
* Revision 1.6 1991/06/11 15:22:46 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.5 1991/06/07 16:06:03 sreedhar
|
||||||
|
* Changes for sequence start message
|
||||||
|
*
|
||||||
|
* Revision 1.4 1991/05/30 15:50:58 sreedhar
|
||||||
|
* Changes for readMsg/writeMsg internal release
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/03/14 23:26:55 jefft
|
||||||
|
* removed call to dtm_fatal when errors occur.
|
||||||
|
*
|
||||||
|
* Revision 1.2 90/11/21 12:35:44 jefft
|
||||||
|
* Removed trailing comma from DTM error enum type.
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:32:03 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DTMINT_INC
|
||||||
|
#define DTMINT_INC
|
||||||
|
|
||||||
|
#ifndef DTM_INC
|
||||||
|
#include "dtm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef u_char /* it is not clear if we can count on __sys_types_h */
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
#ifndef IPPROTO_IP
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
# include <nmpcip.h>
|
||||||
|
#else
|
||||||
|
# include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Added to shut up the SGI compiler which quotes ANSI regulations at
|
||||||
|
you.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
struct sockaddr;
|
||||||
|
struct timeval;
|
||||||
|
struct iovec;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MAIN
|
||||||
|
#define global
|
||||||
|
#define INIT(x) = x
|
||||||
|
#else
|
||||||
|
#define global extern
|
||||||
|
#define INIT(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define reg register
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
MACHINE SPECIFIC #defines
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
These at least work on a 68k architecture....
|
||||||
|
*/
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
typedef unsigned int uint16;
|
||||||
|
typedef unsigned long uint32;
|
||||||
|
typedef int int16;
|
||||||
|
typedef long int32;
|
||||||
|
#else /* _ARCH_MSDOS */
|
||||||
|
typedef unsigned short uint16;
|
||||||
|
typedef unsigned int uint32;
|
||||||
|
typedef short int16;
|
||||||
|
typedef int int32;
|
||||||
|
#endif /* _ARCH_MSDOS */
|
||||||
|
|
||||||
|
#ifdef SUN
|
||||||
|
#define BSD
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CRAY
|
||||||
|
# define STDINT(x) (x <<= 32)
|
||||||
|
# define LOCALINT(x) (x >>= 32)
|
||||||
|
#else
|
||||||
|
# define STDINT(x) x = htonl(x)
|
||||||
|
# define LOCALINT(x) x = ntohl(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
The SGI compiler does not like to see true floats in prototypes
|
||||||
|
*/
|
||||||
|
#ifdef SGI
|
||||||
|
#define FLOAT double
|
||||||
|
#else
|
||||||
|
#define FLOAT float
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BSD) && !defined(NEXT) && !defined(SOLARIS)
|
||||||
|
#define FREE_RETURNS_INT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DTM_VERSION "2.3"
|
||||||
|
|
||||||
|
#if defined(_STDC_) || defined(__STDC__)
|
||||||
|
#define VOID void
|
||||||
|
#else
|
||||||
|
#define VOID
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
GENERIC #defines
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#define CHECK_ERR(X) if (((long)(X)) == DTMERROR) return DTMERROR
|
||||||
|
#else
|
||||||
|
#define CHECK_ERR(X) if (((int)(X)) == DTMERROR) return DTMERROR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FALSE
|
||||||
|
# define FALSE 0
|
||||||
|
# define TRUE !FALSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DTM_BUFF_SIZE 32768
|
||||||
|
#define DTM_REFUSE_LIMIT 120
|
||||||
|
#define DTM_NO_CONNECTION -1
|
||||||
|
|
||||||
|
/*
|
||||||
|
Perhaps we should distinguish these
|
||||||
|
*/
|
||||||
|
#define DTM_CTS 0
|
||||||
|
#define DTM_RTS 0
|
||||||
|
#define DTM_EOT 0
|
||||||
|
|
||||||
|
#if !defined(_ARCH_MACOS) && !defined(_ARCH_MSDOS)
|
||||||
|
# define DISCARDSIZE 32768
|
||||||
|
#else
|
||||||
|
# define DISCARDSIZE 4096
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DTMSTD 0
|
||||||
|
#define DTMLOCAL 1
|
||||||
|
#define INPORTTYPE 0 /* input port type */
|
||||||
|
#define OUTPORTTYPE 1 /* output port type */
|
||||||
|
#define PNAMELEN 64 /* max length of portname */
|
||||||
|
#define REFNAMELEN 32 /* max length of reference name given by
|
||||||
|
nameserver.
|
||||||
|
*/
|
||||||
|
#define MAX132 132 /* max space of 132 */
|
||||||
|
#define SEP " " /* blank as separator */
|
||||||
|
#define COLON ":" /* colon as separator */
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
# if defined( _STDC_ ) || defined( __STDC__ )
|
||||||
|
# define NULL ((void *)0)
|
||||||
|
# else
|
||||||
|
# define NULL 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FOR_EACH_OUT_PORT( pcur, pp ) \
|
||||||
|
for ( pcur = pp->out; pcur != NULL ; pcur = pcur->next )
|
||||||
|
#define FOR_EACH_IN_PORT( inp, pp ) \
|
||||||
|
for ( inp = pp->in; inp != NULL ; inp = inp->next )
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
PORT STRUCTURES
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct sockaddr_in S_ADDR;
|
||||||
|
|
||||||
|
typedef struct Port
|
||||||
|
{
|
||||||
|
uint32 nethostid ;
|
||||||
|
uint16 portid ;
|
||||||
|
} Port ;
|
||||||
|
|
||||||
|
typedef struct Outport
|
||||||
|
{
|
||||||
|
S_ADDR sockaddr ; /* Socket family, netid/hostid, portid */
|
||||||
|
int32 connfd ; /* connection fd */
|
||||||
|
int availwrite ; /* port availability for write */
|
||||||
|
int seqstart ; /* "Sequence start" message sent or not */
|
||||||
|
struct Outport * next; /* link to next outport */
|
||||||
|
} Outport ;
|
||||||
|
|
||||||
|
#define DTM_NEW_DATASET -1
|
||||||
|
typedef struct Inport {
|
||||||
|
int32 fd; /* connection fds */
|
||||||
|
int32 blocklen; /* records no. of bytes read */
|
||||||
|
/*
|
||||||
|
Perhaps we should make these sequence, enums... that
|
||||||
|
would allow > < comparisions
|
||||||
|
*/
|
||||||
|
int fCTSsent; /* CTS already sent */
|
||||||
|
int fGotHeader; /* Already got the header */
|
||||||
|
#ifdef _XtIntrinsic_h
|
||||||
|
#ifdef __STDC__
|
||||||
|
#if sizeof( XtInputId ) != sizeof( int )
|
||||||
|
Balk - The following structure definition needs to be repaired
|
||||||
|
to restore the assertion
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
XtInputId XinputId;
|
||||||
|
#else
|
||||||
|
int XinputId;
|
||||||
|
#endif
|
||||||
|
struct Inport * next;
|
||||||
|
} Inport;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
S_ADDR sockaddr ;
|
||||||
|
/* Socket family, netid/hostid, portid */
|
||||||
|
int32 sockfd ; /* Main socket of port
|
||||||
|
Outport - UDP socket
|
||||||
|
Inport - TCP socket
|
||||||
|
*/
|
||||||
|
#ifdef _XtIntrinsic_h
|
||||||
|
XtInputId XinputId;
|
||||||
|
#else
|
||||||
|
int XinputId;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int fLogical;
|
||||||
|
char portname[ PNAMELEN ] ; /* Logical portname */
|
||||||
|
|
||||||
|
int porttype ; /* Input or Output port */
|
||||||
|
int qservice ; /* Quality of service - actually qserv enum */
|
||||||
|
int32 key ; /* unique value used to catch stale port access */
|
||||||
|
|
||||||
|
char * Xcallback_data;
|
||||||
|
void (*Xcallback)();
|
||||||
|
#ifdef _XtIntrinsic_h
|
||||||
|
XtInputCallbackProc XaddInput;
|
||||||
|
XtInputCallbackProc XremoveInput;
|
||||||
|
#else
|
||||||
|
int (*XaddInput)();
|
||||||
|
int (*XremoveInput)();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Input port specific data */
|
||||||
|
|
||||||
|
Inport *in;
|
||||||
|
Inport *nextToRead;
|
||||||
|
void (*callback)();
|
||||||
|
|
||||||
|
/* Output port specific data */
|
||||||
|
|
||||||
|
Outport *out ; /* Linked list of Out port specific structures */
|
||||||
|
/* If the last action on this port was a successful
|
||||||
|
availWrite, then when we do a beginWrite, we
|
||||||
|
will NOT check for new routing information */
|
||||||
|
int fLastWasSuccessfulAvailWrite;
|
||||||
|
int fGotList; /* initially false, TRUE after any list is read */
|
||||||
|
int fDiscard; /* initially false, TRUE means /dev/null output */
|
||||||
|
} DTMPORT ;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
GLOBAL VARIABLES
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DTM_INITIALIZED (DTMpt != NULL)
|
||||||
|
#define DTM_PORTS_INITIAL 20
|
||||||
|
#define DTM_PORTS_GROW 20
|
||||||
|
global DTMPORT **DTMpt INIT( NULL );
|
||||||
|
global int32 DTMptCount INIT( 0 );
|
||||||
|
global int32 DTMportSequenceNumber INIT( 1 );
|
||||||
|
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <errno.h>
|
||||||
|
#else
|
||||||
|
extern int errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
global DTMerr DTMerrno INIT( DTM_OK );
|
||||||
|
global char * dtm_discard INIT( NULL );
|
||||||
|
|
||||||
|
extern int (*DTMconvertRtns[]) DTM_PROTO(( int, VOIDPTR, int ));
|
||||||
|
|
||||||
|
/* global options */
|
||||||
|
|
||||||
|
/*
|
||||||
|
NOTE: setting this value to anything other than 0 can result
|
||||||
|
in deadlock. However, in correctly configure graphs, this should
|
||||||
|
not occure and performance is considerably better with values > 0.
|
||||||
|
DO NOT SET THIS VALUE TO SOME ARBITRARILY LARGE NUMBER.
|
||||||
|
*/
|
||||||
|
global int DTMSendCTSAhead INIT( 0 );
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
FUNCTION PROTOTYPES
|
||||||
|
*/
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NOT_LOGICAL_NAME FALSE
|
||||||
|
#define LOGICAL_NAME TRUE
|
||||||
|
extern char * dtm_get_refname DTM_PROTO(( VOID ));
|
||||||
|
extern char * dtm_get_refname DTM_PROTO(( VOID ));
|
||||||
|
extern int dtm_nsend_ackroute DTM_PROTO(( char * portname ));
|
||||||
|
extern int dtm_nsend_sockaddr DTM_PROTO(( int fd, char * sendto_addr,
|
||||||
|
char * refname, char * portname, S_ADDR * sockaddr ));
|
||||||
|
extern Outport * dtm_new_out_port DTM_PROTO(( Port * port ));
|
||||||
|
#define DTM_PORT_MASK 0xFFFF
|
||||||
|
#define DTM_PORT_KEY_SHIFT 16
|
||||||
|
extern int dtm_map_port_internal DTM_PROTO(( int32 port ));
|
||||||
|
extern void dtm_map_port_external DTM_PROTO(( int32 * port ));
|
||||||
|
#define DTM_WAIT TRUE
|
||||||
|
#define DTM_DONT_WAIT FALSE
|
||||||
|
extern int dtm_check_server DTM_PROTO(( DTMPORT *pp, int fWait ));
|
||||||
|
extern int dtm_send_ack DTM_PROTO(( int fd, int32 ack ));
|
||||||
|
extern int dtm_recv_ack DTM_PROTO(( int fd, int32 * ack ));
|
||||||
|
|
||||||
|
extern int dtm_destroy_in_port DTM_PROTO(( Inport * inp, DTMPORT * pp ));
|
||||||
|
extern int dtm_writev_buffer DTM_PROTO(( int fd, struct iovec *iov,
|
||||||
|
int32 iovlen, int32 iovsize,
|
||||||
|
struct sockaddr * addr, int addrlen ));
|
||||||
|
extern int dtm_read_buffer DTM_PROTO(( int d, int32 * blocklen,
|
||||||
|
void * buffer, int length ));
|
||||||
|
extern int dtm_recv_header DTM_PROTO((int fd , void * header,
|
||||||
|
int length));
|
||||||
|
extern int dtm_read_header DTM_PROTO((int fd , void * header,
|
||||||
|
int length));
|
||||||
|
extern int dtm_parse_ipaddr DTM_PROTO(( char * source,
|
||||||
|
unsigned long * dest ));
|
||||||
|
extern int dtm_quick_select DTM_PROTO(( int socket, int32 * count ));
|
||||||
|
extern int dtm_select DTM_PROTO(( int fd, int32 * count,
|
||||||
|
int32 time ));
|
||||||
|
extern int dtm_accept DTM_PROTO(( int fd, S_ADDR * sn,
|
||||||
|
struct timeval * timeout ));
|
||||||
|
extern int dtm_connect DTM_PROTO(( S_ADDR * sn, int * sockret ));
|
||||||
|
extern int dtm_quick_connect DTM_PROTO(( S_ADDR * sn, int * sockret ));
|
||||||
|
extern int dmt_end_connect DTM_PROTO(( int32 socket ));
|
||||||
|
extern unsigned long dtm_get_ipaddr DTM_PROTO(( char * ipaddrstr ));
|
||||||
|
extern int dtm_socket_init DTM_PROTO(( S_ADDR * sockaddr, int porttype,
|
||||||
|
int fLogicalName ));
|
||||||
|
extern int dtm_init_sockaddr DTM_PROTO(( S_ADDR * sockaddr,
|
||||||
|
char * portname,
|
||||||
|
int * pfLogicalName ));
|
||||||
|
extern int dtm_ninit DTM_PROTO(( void ));
|
||||||
|
extern char * dtm_get_naddr DTM_PROTO(( S_ADDR * addr, int * sockfd ));
|
||||||
|
extern void dtm_version DTM_PROTO(( void ));
|
||||||
|
extern int dtm_sigio DTM_PROTO(( int ));
|
||||||
|
extern char * dtm_find_tag DTM_PROTO(( char *, char *));
|
||||||
|
extern int dtm_accept_read_connections DTM_PROTO(( DTMPORT *pp,int fWait ));
|
||||||
|
extern void dtm_set_Xcallback DTM_PROTO(( DTMPORT *pp, Inport * inp ));
|
||||||
|
#ifdef _XtIntrinsic_h
|
||||||
|
extern void dtm_handle_in DTM_PROTO(( caddr_t client_data,
|
||||||
|
int * fd, XtInputId * in ));
|
||||||
|
#else
|
||||||
|
extern void dtm_handle_in DTM_PROTO(( caddr_t client_data,
|
||||||
|
int * fd, void * in ));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* DTMINT_INC */
|
358
libdtm/dtmmisc.c
Normal file
358
libdtm/dtmmisc.c
Normal file
@ -0,0 +1,358 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/dtmmisc.c,v 1.2 1995/10/13 06:33:11 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: dtmmisc.c,v $
|
||||||
|
Revision 1.2 1995/10/13 06:33:11 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:02:59 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:39:48 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:31 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:11 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:20 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.8 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.7 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.6 1991/10/10 14:29:30 jplevyak
|
||||||
|
* Included "string.h" instead of declaring externs atoi atof().
|
||||||
|
*
|
||||||
|
* Revision 1.5 91/09/26 20:24:21 jplevyak
|
||||||
|
* Added debug.h as include file.
|
||||||
|
*
|
||||||
|
* Revision 1.4 1991/06/11 15:19:36 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/05/14 14:13:48 jefft
|
||||||
|
* modified dtm_set_char to delimit string with "'"
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/04/29 16:44:56 jefft
|
||||||
|
* increased length of num array in dtm_set_float
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:32:18 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#else
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#ifndef min
|
||||||
|
#define min(a, b) (((a) <= (b)) ? (a) : (b))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
**
|
||||||
|
** Header Utilitiy Functions
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void dtm_set_char(char *h,char *tag,char *s)
|
||||||
|
#else
|
||||||
|
void dtm_set_char(h, tag, s)
|
||||||
|
char *h, *tag, *s;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
strcat(h, tag); strcat(h, " '");
|
||||||
|
strcat(h, s); strcat(h, "' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void dtm_set_int(char *h,char *tag,int x)
|
||||||
|
#else
|
||||||
|
void dtm_set_int(h, tag, x)
|
||||||
|
char *h, *tag;
|
||||||
|
int x;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[8];
|
||||||
|
|
||||||
|
strcat(h, tag); strcat(h, " ");
|
||||||
|
|
||||||
|
sprintf(num, "%d ", x);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void dtm_set_float( char * h, char * tag, float x)
|
||||||
|
#else
|
||||||
|
void dtm_set_float(h, tag, x)
|
||||||
|
char *h, *tag;
|
||||||
|
float x;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[20];
|
||||||
|
|
||||||
|
strcat(h, tag); strcat(h, " ");
|
||||||
|
|
||||||
|
sprintf(num, "%f ", x);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
char *dtm_find_tag(char *h,char *tag)
|
||||||
|
#else
|
||||||
|
char *dtm_find_tag(h, tag)
|
||||||
|
char *h, *tag;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
len = strlen(tag);
|
||||||
|
|
||||||
|
while ((h = strchr(h, ' ')) != NULL) {
|
||||||
|
h++;
|
||||||
|
if (!strncmp(h, tag, len) && *(h+len) == ' ')
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_get_char(char *h,char *tag,char *s,int l)
|
||||||
|
#else
|
||||||
|
int dtm_get_char(h, tag, s, l)
|
||||||
|
char *h, *tag, *s;
|
||||||
|
int l;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
/* set NULL string incase tag does not exist */
|
||||||
|
*s = '\0';
|
||||||
|
|
||||||
|
/* decrement length to save space for final NUL */
|
||||||
|
l -= 1;
|
||||||
|
|
||||||
|
/* no tag return error */
|
||||||
|
if ((h = dtm_find_tag(h, tag)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
|
||||||
|
/* no field available, return error */
|
||||||
|
if ((h = strchr(h, '\'')) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h += 1;
|
||||||
|
|
||||||
|
if ((tag = strchr(h, '\'')) == NULL) {
|
||||||
|
strncpy(s, h, min(strlen(h)+1, l));
|
||||||
|
*(s+min(strlen(h)+1, l)) = '\0';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
strncpy(s, h, min(tag-h, l));
|
||||||
|
*(s+min(tag-h, l)) = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_get_int(char *h,char *tag,int *x)
|
||||||
|
#else
|
||||||
|
int dtm_get_int(h, tag, x)
|
||||||
|
char *h, *tag;
|
||||||
|
int *x;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
/* no tag return error */
|
||||||
|
if ((h = dtm_find_tag(h, tag)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
|
||||||
|
/* no field available, return error */
|
||||||
|
if ((h = strchr(h, ' ')) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h += 1;
|
||||||
|
|
||||||
|
*x = atoi(h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_get_float(char *h,char *tag,float *x)
|
||||||
|
#else
|
||||||
|
int dtm_get_float(h, tag, x)
|
||||||
|
char *h, *tag;
|
||||||
|
float *x;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
/* no tag return error */
|
||||||
|
if ((h = dtm_find_tag(h, tag)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
|
||||||
|
/* no field available, return error */
|
||||||
|
if ((h = strchr(h, ' ')) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h += 1;
|
||||||
|
|
||||||
|
*x = atof(h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NONO
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void DTMsetType(char *h,DTMTYPE type)
|
||||||
|
#else
|
||||||
|
void DTMsetType(h, type)
|
||||||
|
char *h;
|
||||||
|
DTMTYPE type;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[8];
|
||||||
|
|
||||||
|
strcat(h, DTMtype); strcat(h, " ");
|
||||||
|
|
||||||
|
sprintf(num, "%d ", type);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
DTMTYPE DTMgetType(char *h)
|
||||||
|
#else
|
||||||
|
DTMTYPE DTMgetType(h)
|
||||||
|
char *h;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char *f;
|
||||||
|
|
||||||
|
if ((f = dtm_find_tag(h, DTMtype)) != NULL)
|
||||||
|
return (DTMTYPE)atoi(f);
|
||||||
|
else
|
||||||
|
return DTM_FLOAT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void DTMsetGroup(char *h,DTMCMD cmd,char *parent,char *self)
|
||||||
|
#else
|
||||||
|
void DTMsetGroup(h, cmd, parent, self)
|
||||||
|
char *h, *parent, *self;
|
||||||
|
DTMCMD cmd;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[12];
|
||||||
|
|
||||||
|
strcat(h, "GRP ");
|
||||||
|
sprintf(num, "%d ", (int)cmd);
|
||||||
|
strcat(h, num);
|
||||||
|
if (parent != NULL)
|
||||||
|
strcat(h, parent);
|
||||||
|
strcat(h, " ");
|
||||||
|
if (self != NULL)
|
||||||
|
strcat(h, self);
|
||||||
|
strcat(h, " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMgetGroup(char *h,DTMCMD cmd,char *parent,char *self)
|
||||||
|
#else
|
||||||
|
int DTMgetGroup(h, cmd, parent, self)
|
||||||
|
char *h, *parent, *self;
|
||||||
|
DTMCMD *cmd;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
|
||||||
|
*self = *parent = '\0';
|
||||||
|
|
||||||
|
if ((h = dtm_find_tag(h, "GRP")) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
/* get DTM command */
|
||||||
|
*cmd = (DTMCMD)atoi(h);
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
/* get parent name */
|
||||||
|
if (*h != ' ') {
|
||||||
|
len = strchr(h, ' ')-h;
|
||||||
|
strncpy(parent, h, len);
|
||||||
|
*(parent+len) = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*parent = '\0';
|
||||||
|
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
/* get self name */
|
||||||
|
if (*h != ' ') {
|
||||||
|
len = strchr(h, ' ')-h;
|
||||||
|
strncpy(self, h, len);
|
||||||
|
*(self+len) = '\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*self = '\0';
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
325
libdtm/dtmnserv.c
Normal file
325
libdtm/dtmnserv.c
Normal file
@ -0,0 +1,325 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/dtmnserv.c,v 1.4 1996/02/18 23:40:14 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: dtmnserv.c,v $
|
||||||
|
Revision 1.4 1996/02/18 23:40:14 spowers
|
||||||
|
PROTO -> DTM_PROTO
|
||||||
|
|
||||||
|
Revision 1.3 1995/10/14 22:07:27 spowers
|
||||||
|
Bzero and Bcopy removed...memset memcpy used instead.
|
||||||
|
|
||||||
|
Revision 1.2 1995/10/13 06:33:12 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:02:59 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:39:50 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:31 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:11 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:22 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.19 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Purpose : Functions to interact with name server.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "arch.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#include "uio.h"
|
||||||
|
#else
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <sys/uio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined _ARCH_MACOS & !defined NEXT
|
||||||
|
# ifdef CONVEX
|
||||||
|
# include <sys/malloc.h>
|
||||||
|
# else
|
||||||
|
# include <malloc.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "dtmnserv.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
STATIC FUNCTION PROTOTYPES
|
||||||
|
*/
|
||||||
|
static int init_refname DTM_PROTO(( char *refname, int len ));
|
||||||
|
static void del_nlist DTM_PROTO(( DTMPORT *pp, int count ));
|
||||||
|
static void add_nlist DTM_PROTO(( DTMPORT *pp, int count ));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to initialise self's reference name from environment
|
||||||
|
variable passed by nameserver.
|
||||||
|
|
||||||
|
Return value : 0 on success,
|
||||||
|
-1 on error.
|
||||||
|
|
||||||
|
Notes : Environment variable - DTM_REFNAME
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int init_refname(char *refname,int len )
|
||||||
|
#else
|
||||||
|
static int init_refname( refname, len )
|
||||||
|
char * refname;
|
||||||
|
int len;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char *p ;
|
||||||
|
|
||||||
|
DBGFLOW( "init_refname called\n" );
|
||||||
|
if( (p = getenv( DTM_REFNAME )) == NULL )
|
||||||
|
{
|
||||||
|
DTMerrno = DTMENV ;
|
||||||
|
DTMERR( "init_refname: Env not setup" );
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
strncpy( refname, p, (len - 1) );
|
||||||
|
refname[ len - 1 ] = '\0' ;
|
||||||
|
|
||||||
|
DBGINT( "init_refname: user process reference name is %s\n",
|
||||||
|
refname );
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to return process reference name.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
char *dtm_get_refname(void )
|
||||||
|
#else
|
||||||
|
char *dtm_get_refname()
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
static char refname[ REFNAMELEN ] = {0};
|
||||||
|
|
||||||
|
if( refname[0] == '\0' ) init_refname( refname, REFNAMELEN ) ;
|
||||||
|
return refname ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
I am not sure that this function still works, so it is
|
||||||
|
not in the header
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void dtm_display_buf(Outport *outp,char *portname )
|
||||||
|
#else
|
||||||
|
void dtm_display_buf( outp, portname )
|
||||||
|
Outport *outp ;
|
||||||
|
char *portname ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
DBGINT( "dtm_display_buf: Logical port %s\n", portname );
|
||||||
|
while ( outp != NULL );
|
||||||
|
{
|
||||||
|
DBGINT( "dtm_display_buf: Nethostid = %x\n",
|
||||||
|
ntohl( outp -> sockaddr.sin_addr.s_addr) );
|
||||||
|
DBGINT( "dtm_display_buf: Portid = %d\n",
|
||||||
|
ntohs( outp -> sockaddr.sin_port) );
|
||||||
|
outp = outp->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_new_out_port()
|
||||||
|
Allocate and initialize a new outport.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
Outport * dtm_new_out_port(Port *port )
|
||||||
|
#else
|
||||||
|
Outport * dtm_new_out_port( port )
|
||||||
|
Port * port;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Outport * p;
|
||||||
|
|
||||||
|
if ( (p = (Outport *) malloc( sizeof( Outport ))) == NULL ) {
|
||||||
|
DTMerrno = DTMMEM;
|
||||||
|
return (Outport *)DTMERROR;
|
||||||
|
}
|
||||||
|
memset(p,0,sizeof(Outport));
|
||||||
|
/*
|
||||||
|
#ifdef SOLARIS
|
||||||
|
memset(p,0,sizeof(Outport));
|
||||||
|
#else
|
||||||
|
bzero( p, sizeof( Outport ));
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
DBGFLOW( "dtm_new_out_port called\n" );
|
||||||
|
p -> sockaddr.sin_family = AF_INET ;
|
||||||
|
p -> sockaddr.sin_port = port -> portid ;
|
||||||
|
p -> sockaddr.sin_addr.s_addr = port -> nethostid ;
|
||||||
|
p -> connfd = DTM_NO_CONNECTION ;
|
||||||
|
p -> availwrite = FALSE ;
|
||||||
|
p -> seqstart = FALSE ;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static void del_nlist(DTMPORT *pp,int count )
|
||||||
|
#else
|
||||||
|
static void del_nlist( pp, count )
|
||||||
|
DTMPORT *pp;
|
||||||
|
int count;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Outport * outp, * outpLast, * outpNext;
|
||||||
|
Port port;
|
||||||
|
while( count-- ) {
|
||||||
|
port.nethostid = inet_addr( strtok( NULL, COLON) );
|
||||||
|
port.portid = (unsigned short)atol( strtok( NULL, SEP));
|
||||||
|
outpLast = NULL;
|
||||||
|
for ( outp = pp->out ; outp != NULL ; outp = outpNext ) {
|
||||||
|
outpNext = outp->next;
|
||||||
|
if ((outp->sockaddr.sin_port == port.portid ) &&
|
||||||
|
(outp-> sockaddr.sin_addr.s_addr == port.nethostid)) {
|
||||||
|
if ( outpLast==NULL ) pp->out = outp->next;
|
||||||
|
else outpLast->next = outp->next;
|
||||||
|
free( outp );
|
||||||
|
}
|
||||||
|
else outpLast = outp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static void add_nlist(DTMPORT *pp,int count )
|
||||||
|
#else
|
||||||
|
static void add_nlist( pp, count )
|
||||||
|
DTMPORT *pp;
|
||||||
|
int count;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Port port;
|
||||||
|
Outport * outp;
|
||||||
|
while( count-- ) {
|
||||||
|
port.nethostid = inet_addr( strtok(NULL, COLON));
|
||||||
|
port.portid = (unsigned short)atol( strtok( NULL, SEP));
|
||||||
|
outp = dtm_new_out_port( &port );
|
||||||
|
if ( pp->out != NULL ) outp->next = pp->out;
|
||||||
|
pp->out = outp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_check_server()
|
||||||
|
Service messages from the server, including the new route list.
|
||||||
|
We only wait if we were asked to and we have not gotten ANY list yet.
|
||||||
|
Returns the number of added ports.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_check_server( DTMPORT *pp,int fWait )
|
||||||
|
#else
|
||||||
|
int dtm_check_server( pp, fWait )
|
||||||
|
DTMPORT *pp;
|
||||||
|
int fWait;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char *portname = pp->portname;
|
||||||
|
int32 tmp;
|
||||||
|
char mbuf[MAX132];
|
||||||
|
int addcount;
|
||||||
|
|
||||||
|
/* If it is not a logical port is is not listed with the server */
|
||||||
|
|
||||||
|
if ( !pp->fLogical ) return DTM_OK;
|
||||||
|
|
||||||
|
/* Check for new or first routing list */
|
||||||
|
|
||||||
|
fWait = fWait && (pp->out == NULL);
|
||||||
|
if( dtm_select( pp->sockfd, &tmp, !fWait ? 0:DTM_WAIT_TIMEOUT ) ==FALSE){
|
||||||
|
if ( !fWait ) return 0;
|
||||||
|
DBGFLOW( "dtm_get_nlist: timeout waiting on server\n") ;
|
||||||
|
DTMerrno = DTMTIMEOUT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( dtm_select( pp->sockfd, &tmp, 0 ) ) {
|
||||||
|
|
||||||
|
/* Get the new server message */
|
||||||
|
|
||||||
|
if( dtm_recv_header( pp->sockfd, mbuf, MAX132 ) == DTMERROR ) {
|
||||||
|
DBGFLOW( "dtm_get_nlist: No Mport msg from name server\n") ;
|
||||||
|
DTMerrno = DTMPORTINIT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ack the route message */
|
||||||
|
#if 0
|
||||||
|
CHECK_ERR( dtm_nsend_ackroute( portname ));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Process the routing message */
|
||||||
|
|
||||||
|
{
|
||||||
|
char * msg_type = strtok( mbuf, SEP );
|
||||||
|
if (!strcmp( msg_type, MROUTEID)) {
|
||||||
|
int delcount = atoi( strtok( NULL, SEP ));
|
||||||
|
DBGMSG1( "dtm_get_nlist: got routing: %s\n", mbuf ) ;
|
||||||
|
addcount = atoi( strtok( NULL, SEP ));
|
||||||
|
del_nlist( pp, delcount );
|
||||||
|
add_nlist( pp, addcount );
|
||||||
|
pp->fGotList = TRUE;
|
||||||
|
return addcount;
|
||||||
|
} else if ( !strcmp( msg_type, MDISCARD ) ) {
|
||||||
|
pp->fDiscard = atoi( strtok( NULL, SEP));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
75
libdtm/dtmnserv.h
Normal file
75
libdtm/dtmnserv.h
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/dtmnserv.h,v 1.3 1995/01/12 02:33:34 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:12 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:23 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.5 92/04/30 20:27:05 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Purpose : Header file for name server interaction
|
||||||
|
Notes :
|
||||||
|
|
||||||
|
Message format:
|
||||||
|
|
||||||
|
Portid - nethostid:portid
|
||||||
|
Header - opcode
|
||||||
|
|
||||||
|
DTM to nameserver
|
||||||
|
|
||||||
|
Send message length.
|
||||||
|
|
||||||
|
Mreg - Header refname portname Portid
|
||||||
|
Mackroute - Header refname portname
|
||||||
|
|
||||||
|
Nameserver to DTM
|
||||||
|
|
||||||
|
Send message length.
|
||||||
|
|
||||||
|
Mroute - Header delcount addcount Portid1 Portid2 ...
|
||||||
|
|
||||||
|
Ports to be deleted should be before ports to be added.
|
||||||
|
|
||||||
|
Nethostid is in dotted decimal notation of internet.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MREGID "REGISTER"
|
||||||
|
#define MREG "%s %s %s %s:%d"
|
||||||
|
#define MROUTEID "ROUTE"
|
||||||
|
#define MROUTE "%s %d %d" /* %s:%d %s:%d .... */
|
||||||
|
#define MACKROUTEID "ROUTE_ACK"
|
||||||
|
#define MACKROUTE "%s %s %s"
|
||||||
|
#define MDISCARDID "DISCARD"
|
||||||
|
#define MDISCARD "%s %d"
|
60
libdtm/exec.h
Normal file
60
libdtm/exec.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#define EXECclass "EXEC"
|
||||||
|
#define EXECid "ID"
|
||||||
|
#define EXECtime "TIME"
|
||||||
|
#define EXECaddress "ADDRESS"
|
||||||
|
#define EXECauth "AUTHENTICATION"
|
||||||
|
#define EXECtype "TYPE"
|
||||||
|
|
||||||
|
#define EXEC_HOST_STATUS_QUERY 1
|
||||||
|
#define EXEC_HOST_STATUS_RETURN 2
|
||||||
|
#define EXEC_EXECUTE 3
|
||||||
|
#define EXEC_EXECUTE_RETURN 4
|
||||||
|
#define EXEC_PROC_STATUS_QUERY 5
|
||||||
|
#define EXEC_PROC_STATUS_RETURN 6
|
||||||
|
#define EXEC_FILE_PUT 7
|
||||||
|
#define EXEC_FILE_GET 8
|
||||||
|
|
||||||
|
#define EXEC_HS_LOAD1 "LOAD1"
|
||||||
|
#define EXEC_HS_LOAD5 "LOAD5"
|
||||||
|
#define EXEC_HS_LOAD15 "LOAD15"
|
||||||
|
#define EXEC_HS_NUM_USERS "NUMUSERS"
|
||||||
|
|
||||||
|
|
||||||
|
#define EXECsetClass(h) dtm_set_class(h,EXECclass)
|
||||||
|
#define EXECcompareClass(h) dtm_compare_class(h,EXECclass)
|
||||||
|
|
||||||
|
#define EXECsetID(h,s) dtm_set_char(h,EXECid,s)
|
||||||
|
#define EXECgetID(h,s,l) dtm_get_char(h,EXECid,s,l)
|
||||||
|
|
||||||
|
#define EXECsetAddress(h,s) dtm_set_char(h,EXECaddress,s)
|
||||||
|
#define EXECgetAddress(h,s,l) dtm_get_char(h,EXECaddress,s,l)
|
||||||
|
|
||||||
|
#define EXECsetTimeStamp(h,s) dtm_set_char(h,EXECtime,s)
|
||||||
|
#define EXECgetTimeStamp(h,s,l) dtm_get_char(h,EXECtime,s,l)
|
||||||
|
|
||||||
|
#define EXECsetAuthentication(h,s) dtm_set_char(h,EXECauth,s)
|
||||||
|
#define EXECgetAuthentication(h,s,l) dtm_get_char(h,EXECauth,s,l)
|
||||||
|
|
||||||
|
#define EXECsetType(h,i) dtm_set_int(h,EXECtype,i)
|
||||||
|
#define EXECgetType(h,i) dtm_get_int(h,EXECtype,i)
|
||||||
|
|
||||||
|
|
||||||
|
/*************************/
|
||||||
|
/* if type is EXEC_HOST_STATUS_RETURN */
|
||||||
|
|
||||||
|
#define EXECsetLoad1(h,f) dtm_set_float(h,EXEC_HS_LOAD1,f)
|
||||||
|
#define EXECgetLoad1(h,f) dtm_get_float(h,EXEC_HS_LOAD1,f)
|
||||||
|
|
||||||
|
#define EXECsetLoad5(h,f) dtm_set_float(h,EXEC_HS_LOAD5,f)
|
||||||
|
#define EXECgetLoad5(h,f) dtm_get_float(h,EXEC_HS_LOAD5,f)
|
||||||
|
|
||||||
|
#define EXECsetLoad15(h,f) dtm_set_float(h,EXEC_HS_LOAD15,f)
|
||||||
|
#define EXECgetLoad15(h,f) dtm_get_float(h,EXEC_HS_LOAD15,f)
|
||||||
|
|
||||||
|
#define EXECsetNumUsers(h,i) dtm_set_int(h,EXEC_HS_NUM_USERS,i)
|
||||||
|
#define EXECgetNumUsers(h,i) dtm_get_int(h,EXEC_HS_NUM_USERS,i)
|
||||||
|
|
||||||
|
/*************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
151
libdtm/fatal.c
Normal file
151
libdtm/fatal.c
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/fatal.c,v 1.2 1995/10/13 06:33:14 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: fatal.c,v $
|
||||||
|
Revision 1.2 1995/10/13 06:33:14 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:03:00 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:39:56 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:32 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:12 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:25 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.8 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.7 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.6 1991/10/16 23:25:00 jplevyak
|
||||||
|
* Added new error message.
|
||||||
|
*
|
||||||
|
* Revision 1.5 1991/10/10 14:31:48 jplevyak
|
||||||
|
* Added new error messages for "bad ack to internal flow control" and
|
||||||
|
* "Bad address". These may not end up as user error messages.
|
||||||
|
*
|
||||||
|
* Revision 1.4 91/09/26 20:19:14 jplevyak
|
||||||
|
* Added several new errors, changed the DTMerrmsg function to detect
|
||||||
|
* and return 'unknown error:' errors. Generally encorporated the
|
||||||
|
* good features of sherr (from the libtest directory).
|
||||||
|
*
|
||||||
|
* Revision 1.3 91/06/25 20:13:28 creiman
|
||||||
|
* Removed varargs and dtm_fatal.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/06/11 15:19:57 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:33:22 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#else
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
|
||||||
|
static char *err_msg[] = {
|
||||||
|
"No error",
|
||||||
|
"Out of memory - can not create port",
|
||||||
|
"Invalid port name - should be 'hostname:tcp port'",
|
||||||
|
"Out of DTM ports - 256 ports max",
|
||||||
|
"Couldn't initialize port",
|
||||||
|
"DTM routines called in wrong order",
|
||||||
|
"Encounted EOF",
|
||||||
|
"Error creating socket",
|
||||||
|
"Bad hostname",
|
||||||
|
"Timeout waiting for connection",
|
||||||
|
"Couldn't connect",
|
||||||
|
"DTM read error",
|
||||||
|
"DTM write error",
|
||||||
|
"DTM header to long for buffer",
|
||||||
|
"SDS error",
|
||||||
|
"Select call error",
|
||||||
|
"Environment not setup",
|
||||||
|
"User buffer overflow",
|
||||||
|
"Port table corrupted",
|
||||||
|
"Bad port supplied to library",
|
||||||
|
"Bad ack to internal flow control",
|
||||||
|
"Bad address",
|
||||||
|
"Problem communicating with server"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void dtm_version(void )
|
||||||
|
#else
|
||||||
|
void dtm_version()
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\nDTMlib version %s.\n", DTM_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
char *DTMerrmsg(int quiet)
|
||||||
|
#else
|
||||||
|
char *DTMerrmsg(quiet)
|
||||||
|
int quiet;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char * strUnknown = "unknown error: %d";
|
||||||
|
char strOut[60];
|
||||||
|
char * strErr;
|
||||||
|
|
||||||
|
if ( DTMerrno < (sizeof(err_msg)/sizeof(char *)))
|
||||||
|
strErr = err_msg[(int)DTMerrno];
|
||||||
|
else {
|
||||||
|
sprintf( strOut, strUnknown, DTMerrno);
|
||||||
|
strErr = strOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!quiet)
|
||||||
|
fprintf(stderr, "\nDTMerrno = %d: %s\n", DTMerrno,
|
||||||
|
strErr);
|
||||||
|
return strErr;
|
||||||
|
}
|
72
libdtm/linux-uio.h
Normal file
72
libdtm/linux-uio.h
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UIO_H
|
||||||
|
#define UIO_H
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
struct iovec {
|
||||||
|
caddr_t iov_base;
|
||||||
|
long int iov_len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uio {
|
||||||
|
struct iovec *uio_iov;
|
||||||
|
long int uio_iovcnt;
|
||||||
|
off_t uio_offset;
|
||||||
|
long int uio_segflg;
|
||||||
|
short uio_fmode;
|
||||||
|
int uio_resid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct msghdr {
|
||||||
|
caddr_t msg_name; /* optional address */
|
||||||
|
long int msg_namelen; /* size of address */
|
||||||
|
struct iovec *msg_iov; /* scatter/gather array */
|
||||||
|
long int msg_iovlen; /* # elements in msg_iov */
|
||||||
|
caddr_t msg_accrights; /* access rights sent/received */
|
||||||
|
long int msg_accrightslen;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef EFAULT
|
||||||
|
#define EFAULT 14 /* for UNIX compability */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum uio_rw { UIO_READ, UIO_WRITE };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Segment flag values (should be enum).
|
||||||
|
*/
|
||||||
|
#define UIO_USERSPACE 0 /* from user data space */
|
||||||
|
#define UIO_SYSSPACE 1 /* from system space */
|
||||||
|
#define UIO_USERISPACE 2 /* from user I space */
|
||||||
|
|
||||||
|
#if defined(__STDC__) | defined (_STDC_)
|
||||||
|
extern long int readv(int ,struct iovec *,int );
|
||||||
|
extern long int writev(int ,struct iovec *,int );
|
||||||
|
|
||||||
|
extern long int recvmsg(int ,struct msghdr *,int );
|
||||||
|
extern long int sendmsg(int ,struct msghdr *,int );
|
||||||
|
#endif /* defined(__STDC__) */
|
||||||
|
|
||||||
|
#endif /* UIO_H */
|
||||||
|
|
0
libdtm/make.depend
Normal file
0
libdtm/make.depend
Normal file
212
libdtm/mdd.c
Normal file
212
libdtm/mdd.c
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** mdd.c - Multi-Dimensional Data set routines
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/mdd.c,v 1.2 1995/10/13 06:33:17 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: mdd.c,v $
|
||||||
|
Revision 1.2 1995/10/13 06:33:17 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:03:00 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:40:02 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:32 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:12 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:29 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.5 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.4 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/09/26 20:24:51 jplevyak
|
||||||
|
* removed atoi() and atof() in favor of <stdlib.h>.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/06/11 15:22:06 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:37:13 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "mdd.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void MDDsetDimensions(char *h,int rank,int *dims)
|
||||||
|
#else
|
||||||
|
void MDDsetDimensions(h, rank, dims)
|
||||||
|
char *h;
|
||||||
|
int rank, *dims;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[8];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
sprintf(num, "%d ", rank);
|
||||||
|
strcat(h, MDDdims); strcat(h, " ");
|
||||||
|
strcat(h, num);
|
||||||
|
|
||||||
|
for (i=0; i<rank; i+=1) {
|
||||||
|
sprintf(num, "%d ", dims[i]);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int MDDgetDimensions(char *h,int *rank,int *dims,int len)
|
||||||
|
#else
|
||||||
|
int MDDgetDimensions(h, rank, dims, len)
|
||||||
|
char *h;
|
||||||
|
int *rank, *dims, len;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((h = dtm_find_tag(h, MDDdims)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
*rank = atoi(h);
|
||||||
|
|
||||||
|
for (i=0; i<*rank && i<len; i+=1)
|
||||||
|
if ((h = strchr(h, ' ')) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
dims[i] = atoi(++h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int MDDnumElements(int rank,int *dims)
|
||||||
|
#else
|
||||||
|
int MDDnumElements(rank, dims)
|
||||||
|
int rank, *dims;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
|
||||||
|
size = *dims++;
|
||||||
|
while (--rank > 0)
|
||||||
|
size *= *dims++;
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void MDDsetMinMax(char *h,float min,float max)
|
||||||
|
#else
|
||||||
|
void MDDsetMinMax(h, min, max)
|
||||||
|
char *h;
|
||||||
|
float min, max;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[12];
|
||||||
|
|
||||||
|
strcat(h, MDDminmax); strcat(h, " ");
|
||||||
|
|
||||||
|
sprintf(num, "%f ", min);
|
||||||
|
strcat(h, num);
|
||||||
|
|
||||||
|
sprintf(num, "%f ", max);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int MDDgetMinMax(char *h,float *min,float *max)
|
||||||
|
#else
|
||||||
|
int MDDgetMinMax(h, min, max)
|
||||||
|
char *h;
|
||||||
|
float *min, *max;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((h = dtm_find_tag(h, MDDminmax)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
|
||||||
|
*min = (float)atof(h);
|
||||||
|
|
||||||
|
h = strchr(h, ' ') + 1;
|
||||||
|
*max = (float)atof(h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void MDDfindMinMax(char *h,float *mdd,float *min,float *max)
|
||||||
|
#else
|
||||||
|
void MDDfindMinMax(h, mdd, min, max)
|
||||||
|
char *h;
|
||||||
|
float *mdd, *min, *max;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i, rank, dims[10];
|
||||||
|
|
||||||
|
MDDgetDimensions(h, &rank, dims, sizeof dims);
|
||||||
|
rank = MDDnumElements(rank, dims);
|
||||||
|
|
||||||
|
*min = *max = *mdd++;
|
||||||
|
for (i=1; i<rank; mdd+=1, i+=1)
|
||||||
|
if (*mdd < *min)
|
||||||
|
*min = *mdd;
|
||||||
|
if (*mdd > *max)
|
||||||
|
*max = *mdd;
|
||||||
|
}
|
112
libdtm/mdd.h
Normal file
112
libdtm/mdd.h
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Multi-Dimensional Data set include file - contains constants used
|
||||||
|
** with the MDD & PAL header type.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/mdd.h,v 1.4 1996/02/18 23:40:14 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:12 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:30 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.4 92/04/30 20:27:05 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.3 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/06/11 15:23:09 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:37:32 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define MDDclass "MDD"
|
||||||
|
#define MDDsize 256
|
||||||
|
|
||||||
|
#define PALclass "PAL"
|
||||||
|
#define PALsize 64
|
||||||
|
|
||||||
|
/* MDD specific tags */
|
||||||
|
#define MDDdims "DIM"
|
||||||
|
#define MDDminmax "MM"
|
||||||
|
|
||||||
|
|
||||||
|
/* MDD & PAL specific macros */
|
||||||
|
#define MDDsetClass(h) DTMsetClass(h, MDDclass)
|
||||||
|
#define MDDcompareClass(h) DTMcompareClass(h, MDDclass)
|
||||||
|
|
||||||
|
#define PALsetClass(h) DTMsetClass(h, PALclass)
|
||||||
|
#define PALcompareClass(h) DTMcompareClass(h, PALclass)
|
||||||
|
|
||||||
|
#define MDDsetPalette(h, t) dtm_set_char(h, PALclass, t)
|
||||||
|
#define MDDgetPalette(h, t, l) dtm_get_char(h, PALclass, t, l)
|
||||||
|
|
||||||
|
/* MDD & PAL rename macros */
|
||||||
|
#define MDDheaderLength DTMheaderLength
|
||||||
|
#define MDDHL DTMheaderLength
|
||||||
|
|
||||||
|
#define PALheaderLength DTMheaderLength
|
||||||
|
#define PALHL DTMheaderLength
|
||||||
|
|
||||||
|
#define MDDsetTitle DTMsetTitle
|
||||||
|
#define MDDgetTitle DTMgetTitle
|
||||||
|
|
||||||
|
#define PALsetTitle DTMsetTitle
|
||||||
|
#define PALgetTitle DTMgetTitle
|
||||||
|
|
||||||
|
#define MDDsetType DTMsetType
|
||||||
|
#define MDDgetType DTMgetType
|
||||||
|
|
||||||
|
|
||||||
|
/* MDD routines */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void MDDsetDimensions DTM_PROTO((char *h, int rank, int *dims));
|
||||||
|
extern int MDDgetDimensions DTM_PROTO((char *h, int *rank, int *dims, int len));
|
||||||
|
extern int MDDnumElements DTM_PROTO((int rank, int *dims));
|
||||||
|
extern void MDDsetMinMax DTM_PROTO((char *h, float min, float max));
|
||||||
|
extern int MDDgetMinMax DTM_PROTO((char *h, float *min, float *max));
|
||||||
|
extern void MDDfindMinMax DTM_PROTO((char *h, float *mdd, float *min, float *max));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif
|
166
libdtm/ninit.c
Normal file
166
libdtm/ninit.c
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/ninit.c,v 1.2 1995/10/13 06:33:18 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: ninit.c,v $
|
||||||
|
Revision 1.2 1995/10/13 06:33:18 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:03:01 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:40:06 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:32 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:13 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:31 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.7 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
|
||||||
|
Purpose : Functions to initialise name server address, fd and to
|
||||||
|
to return it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#else
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "dtmnserv.h"
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
static struct sockaddr_in nsaddr ; /* name server's address */
|
||||||
|
static int nssockfd = -1 ; /* name server's socket */
|
||||||
|
static char nameserver[ MAX132 ] ;
|
||||||
|
/*
|
||||||
|
name server address -
|
||||||
|
dotted decimal: port number
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to initialise the name server's address by
|
||||||
|
looking up the environment variable.
|
||||||
|
|
||||||
|
Return values : DTMERROR on error.
|
||||||
|
DTM_OK on success.
|
||||||
|
Notes :
|
||||||
|
Environment variable format :
|
||||||
|
|
||||||
|
DTM_NAMESERVER=nethostid:portid
|
||||||
|
|
||||||
|
e.g. DTM_NAMESERVER=141.142.221.66:9900
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_ninit(void )
|
||||||
|
#else
|
||||||
|
int dtm_ninit()
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char *p ;
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_ninit called\n" );
|
||||||
|
if( (p = getenv( DTM_NAMESERVER )) == NULL ) {
|
||||||
|
DTMerrno = DTMENV ;
|
||||||
|
DTMERR( "dtm_ninit: Env not setup" );
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialise name server's address, used in send() */
|
||||||
|
|
||||||
|
strncpy( nameserver, p, MAX132 );
|
||||||
|
|
||||||
|
DBGINT( "dtm_ninit: Nameserver is %s\n", nameserver );
|
||||||
|
|
||||||
|
nsaddr.sin_family = AF_INET ;
|
||||||
|
{
|
||||||
|
char *portstr;
|
||||||
|
|
||||||
|
portstr = strchr( p, ':' );
|
||||||
|
if ( portstr == NULL ) {
|
||||||
|
DTMerrno = DTMADDR;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
*portstr++ = '\0';
|
||||||
|
|
||||||
|
nsaddr.sin_addr.s_addr = inet_addr( p ) ;
|
||||||
|
nsaddr.sin_port = (unsigned short)atol( portstr ) ;
|
||||||
|
|
||||||
|
DBGMSG1("dtm_ninit: Nethostid = %x\n", ntohl( nsaddr.sin_addr.s_addr) );
|
||||||
|
DBGMSG1("dtm_ninit: Portid = %d\n", ntohs( nsaddr.sin_port) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Acquire socket to be used for sending to name server */
|
||||||
|
|
||||||
|
if( (nssockfd = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP )) == -1 ){
|
||||||
|
DTMerrno = DTMSOCK ;
|
||||||
|
DBGFLOW( "dtm_ninit: Socket call fails" );
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to return name server's address and associated socket fd.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
char *dtm_get_naddr(struct sockaddr_in *addr,int *sockfd )
|
||||||
|
#else
|
||||||
|
char *dtm_get_naddr( addr, sockfd )
|
||||||
|
struct sockaddr_in *addr ;
|
||||||
|
int *sockfd ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if( nssockfd < 0 ) if ( dtm_ninit() == DTMERROR)
|
||||||
|
return (char *) DTMERROR;
|
||||||
|
|
||||||
|
*addr = nsaddr ;
|
||||||
|
*sockfd = nssockfd ;
|
||||||
|
|
||||||
|
return (nssockfd < 0) ? NULL : nameserver ;
|
||||||
|
}
|
390
libdtm/nmsg.c
Normal file
390
libdtm/nmsg.c
Normal file
@ -0,0 +1,390 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/nmsg.c,v 1.3 1996/02/18 23:40:15 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: nmsg.c,v $
|
||||||
|
Revision 1.3 1996/02/18 23:40:15 spowers
|
||||||
|
PROTO -> DTM_PROTO
|
||||||
|
|
||||||
|
Revision 1.2 1995/10/13 06:33:20 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:03:01 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:40:08 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:33 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.2 1993/10/06 06:19:08 ebina
|
||||||
|
* Ditto const shit
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:13 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:33 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.15 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Purpose : Set of library calls for name server applications to use.
|
||||||
|
Notes :
|
||||||
|
This file contains functions to send and receive
|
||||||
|
DTM control messages such MREG, MROUTE etc.
|
||||||
|
|
||||||
|
The fd parameter should be removed from all calls
|
||||||
|
for portability.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include "uio.h"
|
||||||
|
#else
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <sys/uio.h>
|
||||||
|
#include <sys/errno.h>
|
||||||
|
#endif
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "dtmnserv.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
STATIC FUNCTION PROTOTYPES
|
||||||
|
*/
|
||||||
|
static int dtm_send_control DTM_PROTO(( int fd, char *msg, int msize,
|
||||||
|
char *sendto_addr ));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to send a DTM control message ( messages like MREG, MROUTE etc. )
|
||||||
|
Notes :
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_send_control(int fd,char *msg,int msize,char *sendto_addr )
|
||||||
|
#else
|
||||||
|
static int dtm_send_control( fd, msg, msize, sendto_addr )
|
||||||
|
int fd ;
|
||||||
|
char *msg ;
|
||||||
|
int msize ;
|
||||||
|
char *sendto_addr ; /* read-only */
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
S_ADDR sockaddr ; /* destination address */
|
||||||
|
struct iovec iov[ 1 ] ; /* message iovec */
|
||||||
|
int status ; /* return value from a call */
|
||||||
|
int32 tmp ; /* temporary */
|
||||||
|
char sendaddr[ MAX132 ] ;
|
||||||
|
int fLogical;
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_send_control called\n" );
|
||||||
|
DBGINT( "dtm_send_control: sendto_addr is '%s'\n", sendto_addr );
|
||||||
|
|
||||||
|
/* Get destination address in sockaddr_in structure */
|
||||||
|
|
||||||
|
strncpy( sendaddr, sendto_addr, (MAX132 - 1)) ;
|
||||||
|
sendaddr[ MAX132 - 1 ] = '\0' ;
|
||||||
|
|
||||||
|
sockaddr.sin_family = AF_INET ;
|
||||||
|
CHECK_ERR( dtm_init_sockaddr( &sockaddr, sendaddr, &fLogical));
|
||||||
|
|
||||||
|
/* Prepare iovec and send message length */
|
||||||
|
|
||||||
|
tmp = msize ;
|
||||||
|
STDINT( tmp );
|
||||||
|
iov[ 0 ].iov_base = (char *)&tmp ;
|
||||||
|
iov[ 0 ].iov_len = 4 ;
|
||||||
|
|
||||||
|
if((status = dtm_writev_buffer( fd, iov, 1, 4, (struct sockaddr *)&sockaddr,
|
||||||
|
sizeof( struct sockaddr_in ))) < 0 )
|
||||||
|
{
|
||||||
|
DBGFLOW( "dtm_send_control: message length send error\n" );
|
||||||
|
return status ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Prepare iovec and send message */
|
||||||
|
|
||||||
|
iov[ 0 ].iov_base = msg ;
|
||||||
|
iov[ 0 ].iov_len = msize ;
|
||||||
|
|
||||||
|
return dtm_writev_buffer( fd, iov, 1, msize, (struct sockaddr *)&sockaddr,
|
||||||
|
sizeof( struct sockaddr_in )) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DTMsendDiscard
|
||||||
|
Function to send a discard message setting the discard state.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMsendDiscard(int fd,char *sendto_addr,int set_or_clear )
|
||||||
|
#else
|
||||||
|
int DTMsendDiscard( fd, sendto_addr, set_or_clear )
|
||||||
|
int fd; /* output socket */
|
||||||
|
char *sendto_addr; /* destination address addr:port number */
|
||||||
|
int set_or_clear;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char mbuf[ MAX132 ]; /* buffer to build messages */
|
||||||
|
|
||||||
|
DBGFLOW( "DTMsendDiscard called\n" );
|
||||||
|
|
||||||
|
sprintf( mbuf, MDISCARD, MROUTEID, set_or_clear );
|
||||||
|
|
||||||
|
DBGFLOW( "DTMsendDiscard: Message:- " );
|
||||||
|
DBGFLOW( mbuf ); DBGFLOW( "\n" );
|
||||||
|
|
||||||
|
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to send a routing message to designated address.
|
||||||
|
Notes : delcount parameter to be added, currently
|
||||||
|
forced to zero.
|
||||||
|
Destination address, and array of addresses are in
|
||||||
|
format IPaddr( dotted decimal ):portid.
|
||||||
|
|
||||||
|
int fd; output socket
|
||||||
|
char *sendto_addr; destination address addr:port number
|
||||||
|
int addcount; number of addresses to connect to
|
||||||
|
char **add_addresses; array of addresses to connect to
|
||||||
|
int delcount; number of addresses to connect to
|
||||||
|
char **del_addresses; array of addresses to connect to
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMsendRoute(int fd,char *sendto_addr,int addcount,char **add_addresses,
|
||||||
|
int delcount, char **del_addresses )
|
||||||
|
#else
|
||||||
|
int DTMsendRoute( fd, sendto_addr, addcount, add_addresses,
|
||||||
|
delcount, del_addresses )
|
||||||
|
int fd; /* output socket */
|
||||||
|
char *sendto_addr; /* destination address addr:port number */
|
||||||
|
int addcount; /* number of addresses to connect to */
|
||||||
|
char **add_addresses;/* array of addresses to connect to */
|
||||||
|
int delcount; /* number of addresses to connect to */
|
||||||
|
char **del_addresses;/* array of addresses to connect to */
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char mbuf[ MAX132 ]; /* buffer to build messages */
|
||||||
|
|
||||||
|
DBGFLOW( "DTMsendRoute called\n" );
|
||||||
|
|
||||||
|
/* Prepare MROUTE message and send it */
|
||||||
|
|
||||||
|
sprintf( mbuf, MROUTE, MROUTEID, delcount, addcount ) ;
|
||||||
|
while( delcount-- ) {
|
||||||
|
strncat( mbuf, " ", (MAX132-1));
|
||||||
|
strncat( mbuf, del_addresses[ delcount ], (MAX132 - 1));
|
||||||
|
}
|
||||||
|
while( addcount-- ) {
|
||||||
|
strncat( mbuf, " ", (MAX132-1));
|
||||||
|
strncat( mbuf, add_addresses[ addcount ], (MAX132 - 1));
|
||||||
|
}
|
||||||
|
mbuf[ MAX132 - 1 ] = '\0' ;
|
||||||
|
|
||||||
|
DBGFLOW( "DTMsendRoute: Message:- " );
|
||||||
|
DBGFLOW( mbuf ); DBGFLOW( "\n" );
|
||||||
|
|
||||||
|
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to send ack to routing message to designated address.
|
||||||
|
NOTE: this function is not used yet as the name server has
|
||||||
|
not implemented the receive portion.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_nsend_ackroute( char *portname )
|
||||||
|
#else
|
||||||
|
int dtm_nsend_ackroute( portname )
|
||||||
|
char *portname ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int fd ;
|
||||||
|
S_ADDR addr;
|
||||||
|
char *sendto_addr ;
|
||||||
|
char *refname = dtm_get_refname() ;
|
||||||
|
char mbuf[ MAX132 ]; /* buffer to build messages */
|
||||||
|
|
||||||
|
CHECK_ERR( sendto_addr = dtm_get_naddr( &addr, &fd ));
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_nsend_ackroute called\n" );
|
||||||
|
|
||||||
|
/* Prepare Ackroute, send it */
|
||||||
|
|
||||||
|
sprintf( mbuf, MACKROUTE, MACKROUTEID, refname, portname );
|
||||||
|
mbuf[ MAX132 - 1 ] = '\0' ;
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_nsend_ackroute: Message:- " );
|
||||||
|
DBGFLOW( mbuf ); DBGFLOW( "\n" );
|
||||||
|
|
||||||
|
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to send self's socket address to name server process.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
dtm_nsend_sockaddr(int fd,char *sendto_addr,char *refname,char *portname,
|
||||||
|
S_ADDR *sockaddr )
|
||||||
|
#else
|
||||||
|
dtm_nsend_sockaddr( fd, sendto_addr, refname, portname, sockaddr )
|
||||||
|
int fd ;
|
||||||
|
char *sendto_addr ;
|
||||||
|
char *refname ;
|
||||||
|
char *portname ;
|
||||||
|
S_ADDR *sockaddr ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
struct in_addr inaddr ;
|
||||||
|
char mbuf[ MAX132 ]; /* buffer to build messages */
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_nsend_sockaddr called\n" );
|
||||||
|
|
||||||
|
/* Prepare MREG, send it */
|
||||||
|
|
||||||
|
inaddr.s_addr = sockaddr -> sin_addr.s_addr ;
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
sprintf( mbuf, MREG, MREGID, refname, portname,
|
||||||
|
inet_ntoa( inaddr.s_addr ), ntohs( sockaddr -> sin_port ) );
|
||||||
|
#else
|
||||||
|
sprintf( mbuf, MREG, MREGID, refname, portname,
|
||||||
|
inet_ntoa( inaddr ), ntohs( sockaddr -> sin_port ) );
|
||||||
|
#endif
|
||||||
|
mbuf[ MAX132 - 1 ] = '\0' ;
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_nsend_sockaddr: Message:- " ); DBGFLOW( mbuf ); DBGFLOW( "\n" );
|
||||||
|
|
||||||
|
return dtm_send_control( fd, mbuf, (strlen( mbuf ) + 1), sendto_addr );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to recieve registation messages from other processes.
|
||||||
|
Notes : does not block, return length is message
|
||||||
|
received, 0 otherwise
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMrecvRegistration(int fd,char *buffer,int len)
|
||||||
|
#else
|
||||||
|
int DTMrecvRegistration(fd, buffer, len)
|
||||||
|
int fd, len;
|
||||||
|
char *buffer;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int count;
|
||||||
|
|
||||||
|
if( dtm_quick_select(fd, &count) )
|
||||||
|
return dtm_recv_header(fd, buffer, len);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to create a nameserver port for receiving registration
|
||||||
|
messages and sending routing messages.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMmakeNameServerPort(char *portid)
|
||||||
|
#else
|
||||||
|
int DTMmakeNameServerPort(portid)
|
||||||
|
char *portid;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
struct sockaddr_in saddr;
|
||||||
|
|
||||||
|
|
||||||
|
saddr.sin_family = AF_INET;
|
||||||
|
saddr.sin_addr.s_addr = htonl(0);
|
||||||
|
saddr.sin_port = htons(0);
|
||||||
|
|
||||||
|
if (strcmp(portid, ":0") != 0)
|
||||||
|
saddr.sin_port = htons((unsigned short)atoi(strchr(portid, ':')+1));
|
||||||
|
|
||||||
|
return dtm_socket_init( &saddr, OUTPORTTYPE, NOT_LOGICAL_NAME );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Fucntion to get the port address of the name server port.
|
||||||
|
|
||||||
|
++++ should be a socket.c function that returns bound address of
|
||||||
|
socket file descriptor
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMgetNameServerAddr(int fd,char *name,int len)
|
||||||
|
#else
|
||||||
|
int DTMgetNameServerAddr(fd, name, len)
|
||||||
|
int fd, len;
|
||||||
|
char *name;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char pnum[8];
|
||||||
|
struct sockaddr_in saddr;
|
||||||
|
int saddr_size = sizeof (struct sockaddr_in);
|
||||||
|
|
||||||
|
if (dtm_get_ipaddr(name) == 0) {
|
||||||
|
DTMerrno = DTMHOST;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getsockname( fd, (struct sockaddr *)&saddr, &saddr_size ) < 0 ) {
|
||||||
|
#ifndef _ARCH_MSDOS
|
||||||
|
extern int errno ;
|
||||||
|
#endif
|
||||||
|
DBGINT( "dtm_socket_init: Unable to get sin_port, errno %d\n", errno );
|
||||||
|
DTMerrno = DTMSOCK ;
|
||||||
|
return -1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf(pnum, ":%d", (int)ntohs( saddr.sin_port ));
|
||||||
|
strcat(name, pnum);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
126
libdtm/ris.c
Normal file
126
libdtm/ris.c
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/ris.c,v 1.2 1995/10/13 06:33:21 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: ris.c,v $
|
||||||
|
Revision 1.2 1995/10/13 06:33:21 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:03:01 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:40:10 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:33 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:13 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:34 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.9 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.8 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.7 1992/02/18 16:18:43 dweber
|
||||||
|
* Deleted the old-style palette functions.
|
||||||
|
*
|
||||||
|
* Revision 1.6 92/01/24 19:12:55 dweber
|
||||||
|
* *** empty log message ***
|
||||||
|
*
|
||||||
|
* Revision 1.5 91/11/04 12:57:55 dweber
|
||||||
|
* Deleted (via comments) superfluous functions. Later to be removed.
|
||||||
|
*
|
||||||
|
* Revision 1.4 91/09/26 20:26:11 jplevyak
|
||||||
|
* Use dtminit.h for access to internally global functions.
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/06/11 15:21:05 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/05/30 15:53:16 sreedhar
|
||||||
|
* Changes for readMsg/writeMsg internal release
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:37:49 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "ris.h"
|
||||||
|
|
||||||
|
|
||||||
|
char PAL[] = "PAL ";
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void RISsetDimensions(char *h,int x,int y)
|
||||||
|
#else
|
||||||
|
void RISsetDimensions(h, x, y)
|
||||||
|
char *h;
|
||||||
|
int x, y;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char append[32];
|
||||||
|
|
||||||
|
sprintf(append, "%s 2 %d %d ", RISdims, x, y);
|
||||||
|
strcat(h, append);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int RISgetDimensions(char *h,int *x,int *y)
|
||||||
|
#else
|
||||||
|
int RISgetDimensions(h, x, y)
|
||||||
|
char *h;
|
||||||
|
int *x, *y;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((h = dtm_find_tag(h, RISdims)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
/* skip rank */
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
*x = atoi(h);
|
||||||
|
h = strchr(h, ' ') + 1;
|
||||||
|
*y = atoi(h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
134
libdtm/ris.h
Normal file
134
libdtm/ris.h
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/ris.h,v 1.3 1995/01/12 02:33:37 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:13 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:36 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.11 92/04/30 20:27:05 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.10 1992/02/21 13:48:04 dweber
|
||||||
|
* Fixed prototyping problem in RISgetType.
|
||||||
|
*
|
||||||
|
* Revision 1.9 92/02/18 16:22:04 dweber
|
||||||
|
* Added functions for setting/getting associated palette names.
|
||||||
|
* (RISsetPaletteName and RISgetPaletteName)
|
||||||
|
*
|
||||||
|
* Revision 1.8 92/01/24 19:12:55 dweber
|
||||||
|
* *** empty log message ***
|
||||||
|
*
|
||||||
|
* Revision 1.7 91/11/18 11:48:57 dweber
|
||||||
|
* Returned the RISsize definition and changed PALsize to PALelements for same reason
|
||||||
|
*
|
||||||
|
* Revision 1.6 91/11/04 15:06:08 dweber
|
||||||
|
* Added PAL size commands
|
||||||
|
*
|
||||||
|
* Revision 1.5 91/11/04 12:58:36 dweber
|
||||||
|
* Added RIS types and removed 8/24 bit distinction from class level.
|
||||||
|
*
|
||||||
|
* Revision 1.4 91/09/10 15:07:32 jefft
|
||||||
|
* cleaned-up message class macros.
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/06/11 15:23:04 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/03/14 23:39:38 jefft
|
||||||
|
* add dtm_compare_class calls
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:38:04 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PALETTE constants and macros
|
||||||
|
*/
|
||||||
|
#define PALclass "PAL"
|
||||||
|
#define PALelements "PE"
|
||||||
|
#define PALsize 128
|
||||||
|
|
||||||
|
#define PALsetClass(h) dtm_set_class(h, PALclass)
|
||||||
|
#define PALcompareClass(h) dtm_compare_class(h, PALclass)
|
||||||
|
|
||||||
|
#define PALsetSize(h, s) dtm_set_int((h), PALelements, (s))
|
||||||
|
#define PALgetSize(h, s) ((*(s)=(int)256), \
|
||||||
|
(dtm_get_int((h), PALelements, (s))))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PALETTE rename macros
|
||||||
|
*/
|
||||||
|
#define PALheaderLength dtm_header_length
|
||||||
|
#define PALHL dtm_header_length
|
||||||
|
|
||||||
|
#define PALsetTitle dtm_set_title
|
||||||
|
#define PALgetTitle dtm_get_title
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RASTER IMAGE constants and macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* standard image types: 8 bit colormap entries or 24-bit RGB entries.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
RIS8BIT = 0,
|
||||||
|
RIS24BIT
|
||||||
|
} RISTYPE;
|
||||||
|
|
||||||
|
#define RISclass "RIS"
|
||||||
|
#define RIStype "RT"
|
||||||
|
#define RISdims "DIM"
|
||||||
|
#define RISpalette "APN"
|
||||||
|
#define RISsize 256
|
||||||
|
|
||||||
|
#define RISsetClass(h) dtm_set_class(h, RISclass)
|
||||||
|
#define RIScompareClass(h) dtm_compare_class(h, RISclass)
|
||||||
|
|
||||||
|
#define RISsetType(h, t) ((dtm_set_int((h), RIStype, (t))), \
|
||||||
|
(dtm_set_type((h), DTM_CHAR)))
|
||||||
|
#define RISgetType(h, t) ((*(t)=(int)RIS24BIT), \
|
||||||
|
(dtm_get_int((h), RIStype, (int *)(t))))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* RIS rename macros
|
||||||
|
*/
|
||||||
|
#define RISheaderLength dtm_header_length
|
||||||
|
#define RISHL dtm_header_length
|
||||||
|
|
||||||
|
#define RISsetTitle dtm_set_title
|
||||||
|
#define RISgetTitle dtm_get_title
|
||||||
|
|
||||||
|
#define RISsetPaletteName(h, c) dtm_set_char((h), RISpalette, (c))
|
||||||
|
#define RISgetPaletteName(h, c, l) dtm_get_char((h), RISpalette, (c), (l))
|
680
libdtm/rwrtns.c
Normal file
680
libdtm/rwrtns.c
Normal file
@ -0,0 +1,680 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** rwrtns.c - provides very low level routines for reading and writing
|
||||||
|
** buffer. This code should be independent of communication
|
||||||
|
** channel as long as the descriptor will work with system
|
||||||
|
** read and write routines.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/rwrtns.c,v 1.5 1996/06/06 19:48:08 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: rwrtns.c,v $
|
||||||
|
Revision 1.5 1996/06/06 19:48:08 spowers
|
||||||
|
Linux is brain ded.
|
||||||
|
|
||||||
|
Revision 1.4 1996/02/18 23:40:16 spowers
|
||||||
|
PROTO -> DTM_PROTO
|
||||||
|
|
||||||
|
Revision 1.3 1995/11/10 12:03:32 spowers
|
||||||
|
dumb warning messages
|
||||||
|
|
||||||
|
Revision 1.2 1995/10/13 06:33:23 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:03:02 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:40:14 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:33 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.2 1993/10/29 03:46:49 marca
|
||||||
|
* Tweaks.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:13 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:37 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.19 92/05/14 19:27:48 jefft
|
||||||
|
* modified dtm_recv_reliable
|
||||||
|
*
|
||||||
|
* Revision 1.18 1992/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.17 1992/04/29 22:01:34 jplevyak
|
||||||
|
* Fix big with exact size buffers. Remove dead code.
|
||||||
|
*
|
||||||
|
* Revision 1.16 1992/04/13 16:07:10 jplevyak
|
||||||
|
* Changes for DEC and RS6000.
|
||||||
|
*
|
||||||
|
* Revision 1.15 92/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.14 1992/03/02 18:29:41 jplevyak
|
||||||
|
* Fixed bug in EAGAIN handling.
|
||||||
|
*
|
||||||
|
* Revision 1.13 1992/03/02 17:20:14 jplevyak
|
||||||
|
* Temporary back out.
|
||||||
|
*
|
||||||
|
* Revision 1.11 1992/02/27 23:44:31 jplevyak
|
||||||
|
* Surrounded writes by code intended to recover from signal interruptions.
|
||||||
|
*
|
||||||
|
* Revision 1.10 1992/01/14 16:31:40 creiman
|
||||||
|
* Removed mac #include
|
||||||
|
*
|
||||||
|
* Revision 1.9 1991/10/11 20:26:23 jplevyak
|
||||||
|
* Fixed incorrect #def use.
|
||||||
|
*
|
||||||
|
* Revision 1.8 1991/10/10 15:14:01 jplevyak
|
||||||
|
* Fixed naming convensions.
|
||||||
|
*
|
||||||
|
* Revision 1.7 91/08/20 15:56:06 sreedhar
|
||||||
|
* Removed unused functions - dtm_write_buffer, dtm_send, dtm_recv
|
||||||
|
*
|
||||||
|
* Revision 1.6 1991/08/15 18:56:52 sreedhar
|
||||||
|
* Changes for logical portname version
|
||||||
|
*
|
||||||
|
* Revision 1.4 1991/06/11 15:19:51 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/06/07 16:06:29 sreedhar
|
||||||
|
* sizeof( int ) replaced by 4 for message to be sent out
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/05/30 15:51:50 sreedhar
|
||||||
|
* Changes for readMsg/writeMsg internal release
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:38:13 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#if defined(_ARCH_MSDOS)
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include "uio.h"
|
||||||
|
#else
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#ifdef LINUX
|
||||||
|
#include "linux-uio.h"
|
||||||
|
#else
|
||||||
|
#include <sys/uio.h>
|
||||||
|
#endif
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#ifdef SOLARIS
|
||||||
|
#include <sys/filio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RS6000
|
||||||
|
#include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
CONTENTS
|
||||||
|
|
||||||
|
|
||||||
|
dtm_read_buffer() - attempts to fill the next dtm buffer.
|
||||||
|
dtm_recv_header() - Function to read header and return size.
|
||||||
|
dtm_recv_ack() - receive message ackowledgement
|
||||||
|
tm_send_ack() - send message acknowledgement
|
||||||
|
dtm_writev_buffer() - sends the buffers to receiving process.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
STATIC FUNCTION PROTOTYPES
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_recv_reliable DTM_PROTO((int ,char *,int ));
|
||||||
|
static int dtm_writev_failed DTM_PROTO((int ,struct msghdr *,int ));
|
||||||
|
static int dtm_send_some DTM_PROTO((int d, char *buf, int bufsize ));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int padding[] = {0, 3, 2, 1};
|
||||||
|
|
||||||
|
/* Technique from XlibInt.c
|
||||||
|
*/
|
||||||
|
#if defined(EAGAIN) && defined(EWOULDBLOCK)
|
||||||
|
#define ERRTEST(err) (err == EAGAIN || err == EWOULDBLOCK)
|
||||||
|
#else
|
||||||
|
#if defined(EAGAIN)
|
||||||
|
#define ERRTEST(err) (err == EAGAIN)
|
||||||
|
#else
|
||||||
|
#define ERRTEST(err) (err == EWOULDBLOCK)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int ready_bytes(int d, int length )
|
||||||
|
#else
|
||||||
|
static int ready_bytes( d, length )
|
||||||
|
int d, length;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
fd_set mask;
|
||||||
|
struct timeval timeout ;
|
||||||
|
|
||||||
|
|
||||||
|
/* set the select timeout value */
|
||||||
|
timeout.tv_sec = 2;
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
|
FD_ZERO(&mask);
|
||||||
|
FD_SET(d, &mask);
|
||||||
|
#ifdef __hpux
|
||||||
|
num = select(FD_SETSIZE, (int *)&mask, (int *)0, (int *)0, &timeout);
|
||||||
|
#else
|
||||||
|
num = select(FD_SETSIZE, &mask, (fd_set *)0, (fd_set *)0, &timeout);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (num < 0) {
|
||||||
|
DTMerrno = DTMSELECT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (num == 0) {
|
||||||
|
DTMerrno = DTMTIMEOUT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
ioctl(d, FIONREAD, &num);
|
||||||
|
if (num < length) {
|
||||||
|
DTMerrno = DTMTIMEOUT;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reliably read from a port in the face of signals and other
|
||||||
|
'errors' produced by the operating system.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_recv_reliable(int d,char *buffer,int length )
|
||||||
|
#else
|
||||||
|
int dtm_recv_reliable( d, buffer, length )
|
||||||
|
int d;
|
||||||
|
char * buffer;
|
||||||
|
int length;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int bytes_read;
|
||||||
|
while ( (bytes_read = recv( d, buffer, length, 0)) != length ) {
|
||||||
|
if ( bytes_read > 0) {
|
||||||
|
length -= bytes_read;
|
||||||
|
buffer += bytes_read;
|
||||||
|
} else if (ERRTEST(errno)) {
|
||||||
|
fd_set filedes;
|
||||||
|
int got;
|
||||||
|
|
||||||
|
/* FD_ZERO and FD_SET were moved into the select loop */
|
||||||
|
/* just in case the select is clearing filedes */
|
||||||
|
do {
|
||||||
|
FD_ZERO( &filedes );
|
||||||
|
FD_SET( d, &filedes );
|
||||||
|
#ifdef __hpux
|
||||||
|
got = select( d, (int *)&filedes, (int *)NULL, (int *)NULL,
|
||||||
|
#else
|
||||||
|
got = select( d, &filedes, (fd_set *)NULL, (fd_set *)NULL,
|
||||||
|
#endif
|
||||||
|
NULL );
|
||||||
|
if (got < 0 && errno != EINTR ) {
|
||||||
|
DTMerrno = DTMREAD;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
} while ( got <= 0 );
|
||||||
|
continue;
|
||||||
|
} else if (bytes_read == 0) {
|
||||||
|
DTMerrno = DTMEOF;
|
||||||
|
return DTMERROR;
|
||||||
|
} else if (errno != EINTR) {
|
||||||
|
DTMerrno = DTMREAD;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dtm_read_buffer() - attempts to fill the next dtm buffer. The
|
||||||
|
* blocklen variable must be set to DTM_NEW_DATASET after each dataset
|
||||||
|
* to force recv_buffer to move the next dataset.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_read_buffer(int d,int32 *blocklen,VOIDPTR buffer,int length)
|
||||||
|
#else
|
||||||
|
int dtm_read_buffer(d, blocklen, buffer, length)
|
||||||
|
int d, *blocklen;
|
||||||
|
VOIDPTR buffer;
|
||||||
|
int length;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
reg int tmp, readcnt, count = 0;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_read_buffer called.\n");
|
||||||
|
DBGMSG1("dtm_recv_buffer: attempting to read %d bytes.\n", length);
|
||||||
|
DBGMSG1("dtm_recv_buffer: initial blocklen = %d\n", *blocklen);
|
||||||
|
|
||||||
|
/* if block length is DTM_NEW_DATASET this is a new dataset
|
||||||
|
* get initial block count
|
||||||
|
*/
|
||||||
|
if (*blocklen == DTM_NEW_DATASET) {
|
||||||
|
CHECK_ERR(dtm_recv_reliable(d, (char *)blocklen, 4));
|
||||||
|
LOCALINT(*blocklen);
|
||||||
|
DBGINT("initial blocklen = %d\n", *blocklen);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* attempt to get a full buffer */
|
||||||
|
while (TRUE) {
|
||||||
|
|
||||||
|
/* if block length is 0, because last call to fill_buffer hit
|
||||||
|
* the EOS or because this dataset is zero length, return 0
|
||||||
|
* to indicate the end of dataset.
|
||||||
|
*/
|
||||||
|
if (*blocklen == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* if block length is greater than buffer size then... */
|
||||||
|
if (*blocklen >= length - count) {
|
||||||
|
|
||||||
|
readcnt = length - count;
|
||||||
|
CHECK_ERR( dtm_recv_reliable( d, ((char *)buffer) + length - readcnt,
|
||||||
|
readcnt));
|
||||||
|
|
||||||
|
/* decrement block length, if 0 get next block length */
|
||||||
|
*blocklen -= (length - count);
|
||||||
|
if (*blocklen == 0)
|
||||||
|
*blocklen = DTM_NEW_DATASET;
|
||||||
|
|
||||||
|
/* if block length is 0 now, the EOS will be returned on */
|
||||||
|
/* the next call to fill_buffer */
|
||||||
|
|
||||||
|
/* return full buffer count */
|
||||||
|
DBGINT("recv_buffer: buffer full, returning %d\n", length);
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* else block length is less than buffer size */
|
||||||
|
else {
|
||||||
|
|
||||||
|
readcnt = *blocklen;
|
||||||
|
CHECK_ERR( dtm_recv_reliable( d, (char *)buffer + count +
|
||||||
|
*blocklen - readcnt, readcnt));
|
||||||
|
|
||||||
|
/* increment count */
|
||||||
|
count += *blocklen;
|
||||||
|
|
||||||
|
/* get next block length */
|
||||||
|
CHECK_ERR( dtm_recv_reliable(d, (char *)blocklen, 4));
|
||||||
|
LOCALINT(*blocklen);
|
||||||
|
DBGINT("blocklen = %d\n", *blocklen);
|
||||||
|
|
||||||
|
/* if block length is 0 now, the correct count will be */
|
||||||
|
/* returned now, and EOS on the next call to fill_buffer */
|
||||||
|
if (*blocklen == 0)
|
||||||
|
return count;
|
||||||
|
|
||||||
|
}
|
||||||
|
} /* end while */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Replaces dtm_recv_header for nornal communication.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_read_header(int fd,void *buf,int buflen )
|
||||||
|
#else
|
||||||
|
int dtm_read_header( fd, buf, buflen )
|
||||||
|
int fd;
|
||||||
|
void * buf;
|
||||||
|
int buflen;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int32 hdrsize;
|
||||||
|
|
||||||
|
|
||||||
|
CHECK_ERR(ready_bytes(fd, 4));
|
||||||
|
|
||||||
|
CHECK_ERR( dtm_recv_reliable( fd, (char *)&hdrsize, 4 ));
|
||||||
|
LOCALINT(hdrsize);
|
||||||
|
if ( hdrsize <= buflen ) {
|
||||||
|
CHECK_ERR( dtm_recv_reliable( fd, buf, hdrsize ));
|
||||||
|
return hdrsize;
|
||||||
|
} else {
|
||||||
|
CHECK_ERR( dtm_recv_reliable( fd, buf, buflen ));
|
||||||
|
{
|
||||||
|
int left = hdrsize - buflen;
|
||||||
|
int readcnt = left % DISCARDSIZE;
|
||||||
|
if (!readcnt) readcnt = DISCARDSIZE;
|
||||||
|
while (left) {
|
||||||
|
CHECK_ERR(dtm_recv_reliable( fd, dtm_discard, readcnt ));
|
||||||
|
left -= readcnt;
|
||||||
|
readcnt = DISCARDSIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DTMerrno = DTMHEADER;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_recv_header()
|
||||||
|
Function to read header and return size.
|
||||||
|
|
||||||
|
Notes : If buffer is too small, dump remainder of header
|
||||||
|
and return error.
|
||||||
|
Actually, this is function to read length of data and
|
||||||
|
then to receive that much data - the data is called header
|
||||||
|
everywhere since that was the first usage of the function.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_recv_header(int d,VOIDPTR header,int length )
|
||||||
|
#else
|
||||||
|
int dtm_recv_header( d, header, length )
|
||||||
|
int d;
|
||||||
|
int length;
|
||||||
|
VOIDPTR header;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int readcnt, headerlen, tmp;
|
||||||
|
struct sockaddr_in from ;
|
||||||
|
int fromlen = sizeof( struct sockaddr_in ) ;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_recv_header called.\n");
|
||||||
|
DBGMSG1("dtm_recv_header: fd = %d.\n", d);
|
||||||
|
DBGMSG1("dtm_recv_header: buf length = %d.\n", length);
|
||||||
|
|
||||||
|
/* get header length */
|
||||||
|
|
||||||
|
if( (readcnt = recvfrom(d, (char *)&headerlen, 4, 0, ( struct sockaddr *)&from,
|
||||||
|
( int *)&fromlen)) != 4) {
|
||||||
|
/* somehow hit EOF, return DTMEOF instead */
|
||||||
|
|
||||||
|
if( readcnt == 0 ) {
|
||||||
|
DTMerrno = DTMEOF;
|
||||||
|
DBGMSG("dtm_recv_header: EOF1.\n");
|
||||||
|
return DTMERROR;
|
||||||
|
} else {
|
||||||
|
if( errno == ECONNRESET ) {
|
||||||
|
/* connection closed by writer, return EOF */
|
||||||
|
|
||||||
|
DBGMSG("dtm_recv_header: EOF2.\n");
|
||||||
|
DTMerrno = DTMEOF;
|
||||||
|
return DTMERROR;
|
||||||
|
} else {
|
||||||
|
/* don't know what the problem is, punt... */
|
||||||
|
DBGMSG("dtm_recv_header: EOF3.\n");
|
||||||
|
DTMerrno = DTMREAD;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOCALINT(headerlen);
|
||||||
|
DBGMSG("dtm_recv_header: got length.\n");
|
||||||
|
|
||||||
|
/* read the header */
|
||||||
|
|
||||||
|
readcnt = (length > headerlen) ? headerlen : length ;
|
||||||
|
header = (void *) (((char *) header) + readcnt);
|
||||||
|
|
||||||
|
while(readcnt) {
|
||||||
|
if( (tmp = recvfrom(d, ((char *)header) - readcnt, readcnt, 0,
|
||||||
|
( struct sockaddr *)&from, ( int *)&fromlen)) > 0)
|
||||||
|
readcnt -= tmp;
|
||||||
|
else {
|
||||||
|
DTMerrno = DTMREAD;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for header greater than buffer size provided */
|
||||||
|
|
||||||
|
if( length >= headerlen )
|
||||||
|
return headerlen;
|
||||||
|
else {
|
||||||
|
/* discard remaining header */
|
||||||
|
|
||||||
|
readcnt = headerlen - length;
|
||||||
|
while (readcnt) {
|
||||||
|
if ((tmp = recvfrom(d, dtm_discard, readcnt, 0,
|
||||||
|
(struct sockaddr *)&from, (int *)&fromlen)) > 0)
|
||||||
|
readcnt -= tmp;
|
||||||
|
else {
|
||||||
|
DTMerrno = DTMREAD;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DTMerrno = DTMHEADER;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_recv_ack() - receive message ackowledgement
|
||||||
|
|
||||||
|
Notes : Berkeley implementation returns 0 from recv
|
||||||
|
if socket connection breaks while waiting in
|
||||||
|
recv system call. System V returns -1 and
|
||||||
|
ECONNRESET in errno for same error.
|
||||||
|
|
||||||
|
For historical reasons, DTMEOF is returned when
|
||||||
|
socket connection breaks in middle instead of
|
||||||
|
say DTMFCONN ( DTM connection failed error )
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_recv_ack(int d,int *ack )
|
||||||
|
#else
|
||||||
|
int dtm_recv_ack( d, ack )
|
||||||
|
int d;
|
||||||
|
int *ack;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int tmp ;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_recv_ack called.\n");
|
||||||
|
|
||||||
|
/* there should be no possibility of blocking after this call */
|
||||||
|
CHECK_ERR(ready_bytes(d, 4));
|
||||||
|
|
||||||
|
if( (tmp = recv( d, (char *)ack, 4, 0 )) != 4 ) {
|
||||||
|
DBGINT( "Recv_ack errno = %d\n", errno ) ;
|
||||||
|
if( tmp == 0 )
|
||||||
|
/* Courtesy Berkeley */
|
||||||
|
|
||||||
|
DTMerrno = DTMEOF ;
|
||||||
|
else {
|
||||||
|
if( errno == ECONNRESET )
|
||||||
|
/* Courtesy system V */
|
||||||
|
|
||||||
|
DTMerrno = DTMEOF;
|
||||||
|
else
|
||||||
|
DTMerrno = DTMREAD;
|
||||||
|
}
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBGMSG1( "ack received, tmp = %d\n", tmp );
|
||||||
|
LOCALINT(*ack);
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_send_some(int d, char *buf, int bufsize )
|
||||||
|
#else
|
||||||
|
int dtm_send_some( d, buf, bufsize )
|
||||||
|
int d;
|
||||||
|
char * buf;
|
||||||
|
int bufsize;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int tmp ;
|
||||||
|
|
||||||
|
while (bufsize ) {
|
||||||
|
tmp = send(d, buf, bufsize, 0);
|
||||||
|
if ( tmp >= 0 ) {
|
||||||
|
bufsize -= tmp;
|
||||||
|
buf += tmp;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (errno == EPIPE) {
|
||||||
|
/* socket connection broke in middle */
|
||||||
|
DTMerrno = DTMEOF ;
|
||||||
|
return DTMERROR;
|
||||||
|
} else if ( ERRTEST( errno ) ) {
|
||||||
|
fd_set filedes;
|
||||||
|
int got;
|
||||||
|
|
||||||
|
FD_ZERO( &filedes );
|
||||||
|
FD_SET( d, &filedes );
|
||||||
|
do {
|
||||||
|
#ifdef __hpux
|
||||||
|
got = select( 32, (int *)&filedes, (int *)NULL, (int *)NULL,
|
||||||
|
#else
|
||||||
|
got = select( 32, &filedes, (fd_set *)NULL, (fd_set *)NULL,
|
||||||
|
#endif
|
||||||
|
NULL );
|
||||||
|
if (got < 0 && errno != EINTR ) {
|
||||||
|
DTMerrno = DTMWRITE;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
} while ( got <= 0 );
|
||||||
|
continue;
|
||||||
|
} else DTMerrno = DTMWRITE ;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dtm_send_ack() - send message acknowledgement
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_send_ack(int d, int32 ack)
|
||||||
|
#else
|
||||||
|
int dtm_send_ack(d, ack)
|
||||||
|
int d;
|
||||||
|
int32 ack;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
DBGFLOW("# dtm_send_ack called.\n");
|
||||||
|
|
||||||
|
STDINT(ack);
|
||||||
|
return dtm_send_some( d, (char *)&ack, 4 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_writev_failed(int fd,struct msghdr *msgbuf,int tmp )
|
||||||
|
#else
|
||||||
|
int dtm_writev_failed( fd, msgbuf, tmp )
|
||||||
|
int fd;
|
||||||
|
struct msghdr * msgbuf;
|
||||||
|
int tmp;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int done = tmp;
|
||||||
|
int i;
|
||||||
|
struct iovec * iov;
|
||||||
|
|
||||||
|
iov=msgbuf->msg_iov;
|
||||||
|
|
||||||
|
if ( tmp < 0 ) done = 0;
|
||||||
|
for ( i = 0; i < msgbuf->msg_iovlen; i++ ) {
|
||||||
|
done -= iov[i].iov_len;
|
||||||
|
if ( done > 0 ) continue;
|
||||||
|
if ( dtm_send_some( fd, iov[i].iov_base + done + iov[i].iov_len,
|
||||||
|
(- done )) == DTMERROR )
|
||||||
|
return DTMERROR;
|
||||||
|
done = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_writev_buffer() - sends the buffers to receiving process.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_writev_buffer(int fd,struct iovec *iov,int32 iovlen,int32 iovsize,
|
||||||
|
struct sockaddr *addr,int addrlen )
|
||||||
|
#else
|
||||||
|
int dtm_writev_buffer( fd, iov, iovlen, iovsize, addr, addrlen )
|
||||||
|
int fd ;
|
||||||
|
struct iovec *iov ;
|
||||||
|
int32 iovlen ;
|
||||||
|
int32 iovsize ;
|
||||||
|
struct sockaddr *addr ;
|
||||||
|
int addrlen ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int tmp;
|
||||||
|
struct msghdr msgbuf ;
|
||||||
|
int todo;
|
||||||
|
|
||||||
|
DBGINT("# dtm_writev_buffer called, fd %d.\n", fd );
|
||||||
|
|
||||||
|
msgbuf.msg_name = (caddr_t)addr ;
|
||||||
|
msgbuf.msg_namelen = addrlen ;
|
||||||
|
msgbuf.msg_iov = iov ;
|
||||||
|
msgbuf.msg_iovlen = iovlen ;
|
||||||
|
msgbuf.msg_accrights = 0 ;
|
||||||
|
|
||||||
|
if( (tmp = sendmsg( fd, &msgbuf, 0 )) != iovsize )
|
||||||
|
return dtm_writev_failed( fd, &msgbuf, tmp );
|
||||||
|
|
||||||
|
DBGINT( "dtm_writev_buffer tmp = %d\n", tmp );
|
||||||
|
|
||||||
|
return DTM_OK ;
|
||||||
|
}
|
131
libdtm/sdl.c
Normal file
131
libdtm/sdl.c
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** sdl.c - Surface Description Language
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $Log: sdl.c,v $
|
||||||
|
* Revision 1.1.1.1 1995/01/11 00:03:02 alanb
|
||||||
|
* New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
*
|
||||||
|
* Revision 2.5 1994/12/29 23:40:17 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:33 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:14 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:38 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.9 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.8 1992/04/06 15:58:56 jplevyak
|
||||||
|
* Fixed levels of indirection on some arguments for non-prototype
|
||||||
|
* machines.
|
||||||
|
*
|
||||||
|
* Revision 1.7 92/04/03 12:39:33 dweber
|
||||||
|
* Fixed SDLbounds bug.
|
||||||
|
*
|
||||||
|
* Revision 1.6 92/04/03 12:33:10 dweber
|
||||||
|
* Added bounding box functions.
|
||||||
|
*
|
||||||
|
* Revision 1.5 91/09/10 15:09:00 jefft
|
||||||
|
* I removed all functionality from this file, HA!
|
||||||
|
*
|
||||||
|
* Revision 1.4 1991/07/18 16:29:15 jefft
|
||||||
|
* corrected the spelling of "primitive"
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/06/11 15:20:56 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/05/14 14:17:06 jefft
|
||||||
|
* cleaned-up and started using dtmmisc routines.
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:38:33 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "dtm.h"
|
||||||
|
#include "sdl.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void SDLsetBoundingBox(char *header, float *min, float *max)
|
||||||
|
#else
|
||||||
|
void SDLsetBoundingBox(header, min, max)
|
||||||
|
char *header;
|
||||||
|
float *min, *max;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[128];
|
||||||
|
|
||||||
|
strcat(header, SDLbounds);
|
||||||
|
strcat(header, " ");
|
||||||
|
|
||||||
|
sprintf(num, "%f %f %f %f %f %f ",
|
||||||
|
min[0], min[1], min[2], max[0], max[1], max[2]);
|
||||||
|
strcat(header, num);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int SDLgetBoundingBox(char *header, float *min, float *max)
|
||||||
|
#else
|
||||||
|
int SDLgetBoundingBox(header, min, max)
|
||||||
|
char *header;
|
||||||
|
float *min, *max;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((header = dtm_find_tag(header, SDLbounds)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
header = strchr(header, ' ')+1;
|
||||||
|
|
||||||
|
for (i=0; i<3; i+=1)
|
||||||
|
if ((header = strchr(header, ' ')) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
min[i] = atoi(++header);
|
||||||
|
|
||||||
|
for (i=0; i<3; i+=1)
|
||||||
|
if ((header = strchr(header, ' ')) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
max[i] = atoi(++header);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
162
libdtm/sdl.h
Normal file
162
libdtm/sdl.h
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Surface Description Language include file - contains constants used
|
||||||
|
** with the SDL header type.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $Log: sdl.h,v $
|
||||||
|
* Revision 1.3 1996/02/18 23:40:17 spowers
|
||||||
|
* PROTO -> DTM_PROTO
|
||||||
|
*
|
||||||
|
* Revision 1.2 1995/01/12 02:33:38 spowers
|
||||||
|
* Finally...Dave complained that I blew away the RCSLOGs without leaving the
|
||||||
|
* actual entries there as comments...so I put them back in as COMMENTS! Not as
|
||||||
|
* RCSLOG. Hopefully our woeful begining with cvs will now become a happy one.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:14 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:39 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.13 92/04/30 20:27:05 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.12 1992/04/03 12:39:42 dweber
|
||||||
|
* Fixed SDLbounds bug.
|
||||||
|
*
|
||||||
|
* Revision 1.11 92/04/03 12:33:23 dweber
|
||||||
|
* Added bounding box functions.
|
||||||
|
*
|
||||||
|
* Revision 1.10 1992/02/25 20:36:35 dweber
|
||||||
|
* Fixed another prototyping clash, SDLgetPrimitive.
|
||||||
|
*
|
||||||
|
* Revision 1.9 1992/01/31 09:46:35 dweber
|
||||||
|
* Added #define SDL_INC to avoid duplicate inclusions.
|
||||||
|
*
|
||||||
|
* Revision 1.8 1992/01/24 19:14:33 dweber
|
||||||
|
* Added header length macros.
|
||||||
|
*
|
||||||
|
* Revision 1.7 91/11/01 10:10:28 dweber
|
||||||
|
* Added SDLtristrip
|
||||||
|
*
|
||||||
|
* Revision 1.6 91/09/10 15:07:55 jefft
|
||||||
|
* cleaned-up message class macros.
|
||||||
|
*
|
||||||
|
* Revision 1.5 1991/07/25 22:22:27 jefft
|
||||||
|
* Added transformation triplet enum types
|
||||||
|
*
|
||||||
|
* Revision 1.4 1991/07/18 16:29:43 jefft
|
||||||
|
* corrected the spelling of "primitive" and added macros for backwards
|
||||||
|
* compatibility.
|
||||||
|
*
|
||||||
|
* Revision 1.3 1991/06/11 15:22:58 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/03/01 10:27:13 jefft
|
||||||
|
* Added SDLcompareClass functions and enum for triplet types
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:38:51 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SDL_INC
|
||||||
|
#define SDL_INC
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Surface description language class typedefs and macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define SDLclass "SDL"
|
||||||
|
#define SDLsize 256
|
||||||
|
#define SDLprimitive "PT"
|
||||||
|
#define SDLbounds "BB"
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SDLpoint = 1, SDLlineseg, SDLtriangle, SDLtristrip, SDLquad, SDLsphere
|
||||||
|
} SDLprim_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SDLposition, SDLcolor, SDLnormal, SDLtranslate, SDLrotate, SDLscale
|
||||||
|
} SDLtriplet;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SDLflat, SDLgouraud, SDLphong
|
||||||
|
} SDLshade_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SDLpoints, SDLlines, SDLpolygons
|
||||||
|
} SDLdraw_t;
|
||||||
|
|
||||||
|
#define SDLsetClass(h) dtm_set_class((h), SDLclass)
|
||||||
|
#define SDLcompareClass(h) dtm_compare_class((h), SDLclass)
|
||||||
|
|
||||||
|
#define SDLsetPrimitive(h, p) dtm_set_int((h), SDLprimitive, (p))
|
||||||
|
#define SDLgetPrimitive(h, p) ((*(p)=(int)SDLpoint), \
|
||||||
|
(dtm_get_int((h), SDLprimitive, (int *)(p))))
|
||||||
|
|
||||||
|
#define SDLsetTitle dtm_set_title
|
||||||
|
#define SDLgetTitle dtm_get_title
|
||||||
|
|
||||||
|
#define SDLheaderLength dtm_header_length
|
||||||
|
#define SDLHL dtm_header_length
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void SDLsetBoundingBox DTM_PROTO(( char* h, float *min, float *max));
|
||||||
|
extern int SDLgetBoundingBox DTM_PROTO(( char* h, float *min, float *max));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View control matrix class typedefs and macros
|
||||||
|
*/
|
||||||
|
#define VCTRLclass "VCTRL"
|
||||||
|
#define VCTRLsize 256
|
||||||
|
#define VCTRLgtm "GTM "
|
||||||
|
|
||||||
|
#define VCTRLsetClass(h) dtm_set_class((h), VCTRLclass)
|
||||||
|
#define VCTRLcompareClass(h) dtm_compare_class((h), VCTRLclass)
|
||||||
|
|
||||||
|
#define VCTRLsetGTM(h) strcat(h, VCTRLgtm)
|
||||||
|
#define VCTRLgetGTM(h) ((dtm_find_tag(h, VCTRLgtm) == NULL) ? 0 : 1)
|
||||||
|
|
||||||
|
#define VCTRLsetTitle dtm_set_title
|
||||||
|
#define VCTRLgetTitle dtm_get_title
|
||||||
|
|
||||||
|
#define VCTRLheaderLength dtm_header_length
|
||||||
|
#define VCTRLHL dtm_header_length
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* SDL_INC */
|
235
libdtm/sds.c
Normal file
235
libdtm/sds.c
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** sds.c - Scientific Data Set utility routines.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
/*
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: sds.c,v $
|
||||||
|
Revision 1.2 1995/10/13 06:33:25 spowers
|
||||||
|
Solaris support added.
|
||||||
|
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:03:02 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:40:20 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:33 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:14 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:40 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.12 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.11 1992/03/16 20:39:10 creiman
|
||||||
|
* Changed declaration of SDSgetMinMax to match prototype. (Changed doubles
|
||||||
|
* to floats)
|
||||||
|
*
|
||||||
|
* Revision 1.10 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.9 1992/01/30 19:31:14 jplevyak
|
||||||
|
* Change float to double (standard coersion).
|
||||||
|
* Needed to correct problem with protot
|
||||||
|
* types.
|
||||||
|
*
|
||||||
|
* Revision 1.8 1991/12/19 09:32:18 jefft
|
||||||
|
* Removed the single quote from the log message. Even though the line
|
||||||
|
* is #ifdefed out. The SGI still pukes.
|
||||||
|
*
|
||||||
|
* Revision 1.7 91/12/18 02:42:41 dweber
|
||||||
|
* Oops. Guess I forgot to change getRanks name.
|
||||||
|
*
|
||||||
|
* Revision 1.6 1991/12/18 02:41:53 dweber
|
||||||
|
* Added SDSgetRank
|
||||||
|
*
|
||||||
|
* Revision 1.5 91/12/09 12:12:27 dweber
|
||||||
|
* Deleted the function SDSconvert
|
||||||
|
*
|
||||||
|
* Revision 1.4 91/09/26 20:20:52 jplevyak
|
||||||
|
* Minor header file reorganization.
|
||||||
|
*
|
||||||
|
* Revision 1.3 91/09/13 18:01:21 jplevyak
|
||||||
|
* Fixed minor bug w/extra argument in call.
|
||||||
|
*
|
||||||
|
* Revision 1.2 91/06/11 15:20:50 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:39:09 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#else
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dtm.h"
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "sds.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void SDSsetDimensions(char *h,int rank,int *dims)
|
||||||
|
#else
|
||||||
|
void SDSsetDimensions(h, rank, dims)
|
||||||
|
char *h;
|
||||||
|
int rank, *dims;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[8];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
sprintf(num, "%d ", rank);
|
||||||
|
strcat(h, SDSdims); strcat(h, " ");
|
||||||
|
strcat(h, num);
|
||||||
|
|
||||||
|
for (i=0; i<rank; i+=1) {
|
||||||
|
sprintf(num, "%d ", dims[i]);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int SDSgetDimensions(char *h,int *rank,int *dims,int len)
|
||||||
|
#else
|
||||||
|
int SDSgetDimensions(h, rank, dims, len)
|
||||||
|
char *h;
|
||||||
|
int *rank, *dims, len;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((h = dtm_find_tag(h, SDSdims)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
*rank = atoi(h);
|
||||||
|
|
||||||
|
for (i=0; i<*rank && i<len; i+=1)
|
||||||
|
if ((h = strchr(h, ' ')) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
dims[i] = atoi(++h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int SDSgetRank(char *h,int *rank)
|
||||||
|
#else
|
||||||
|
int SDSgetRank(h, rank)
|
||||||
|
char *h;
|
||||||
|
int *rank;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if ((h = dtm_find_tag(h, SDSdims)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
*rank = atoi(h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void SDSsetMinMax(char *h,float min,float max)
|
||||||
|
#else
|
||||||
|
void SDSsetMinMax(h, min, max)
|
||||||
|
char *h;
|
||||||
|
float min, max;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char num[12];
|
||||||
|
|
||||||
|
strcat(h, SDSminmax); strcat(h, " ");
|
||||||
|
|
||||||
|
sprintf(num, "%f ", min);
|
||||||
|
strcat(h, num);
|
||||||
|
|
||||||
|
sprintf(num, "%f ", max);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int SDSgetMinMax(char *h,float *min,float *max)
|
||||||
|
#else
|
||||||
|
int SDSgetMinMax(h, min, max)
|
||||||
|
char *h;
|
||||||
|
float *min, *max;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((h = dtm_find_tag(h, SDSminmax)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
|
||||||
|
*min = (float)atof(h);
|
||||||
|
|
||||||
|
h = strchr(h, ' ') + 1;
|
||||||
|
*max = (float)atof(h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int SDSnumElements(int rank,int *dims)
|
||||||
|
#else
|
||||||
|
int SDSnumElements(rank, dims)
|
||||||
|
int rank, *dims;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
|
||||||
|
size = *dims++;
|
||||||
|
while (--rank > 0)
|
||||||
|
size *= *dims++;
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
109
libdtm/sds.h
Normal file
109
libdtm/sds.h
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Scientific Data Set include file - contains constants used with the
|
||||||
|
** SDS header type.
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/sds.h,v 1.4 1996/02/18 23:40:18 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:14 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:42 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.8 92/04/30 20:27:37 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.7 1992/03/16 21:03:18 creiman
|
||||||
|
* Changed SDSsetMinMax prototype to use floats. NOT related to the change in
|
||||||
|
* sds.c for SDSgetMinMax. This is getting confusing...
|
||||||
|
*
|
||||||
|
* Revision 1.6 1992/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.5 1992/01/30 19:32:29 jplevyak
|
||||||
|
* Added prototypes and support for C++ type external definitions.
|
||||||
|
*
|
||||||
|
* Revision 1.4 92/01/24 19:13:51 dweber
|
||||||
|
* Added header lenght macros
|
||||||
|
*
|
||||||
|
* Revision 1.3 91/09/10 15:07:10 jefft
|
||||||
|
* cleaned-up message class macros.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1991/06/11 15:22:52 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.1 1990/11/08 16:39:26 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define SDSclass "SDS"
|
||||||
|
#define SDSsize 256
|
||||||
|
|
||||||
|
/* SDS specific tags */
|
||||||
|
#define SDSdims "DIM"
|
||||||
|
#define SDSminmax "MM"
|
||||||
|
|
||||||
|
|
||||||
|
/* SDS specific macros */
|
||||||
|
#define SDSsetClass(h) dtm_set_class(h, SDSclass)
|
||||||
|
#define SDScompareClass(h) dtm_compare_class(h, SDSclass)
|
||||||
|
|
||||||
|
/* SDS rename macros */
|
||||||
|
#define SDSheaderLength dtm_header_length
|
||||||
|
#define SDSHL dtm_header_length
|
||||||
|
|
||||||
|
#define SDSsetType dtm_set_type
|
||||||
|
#define SDSgetType dtm_get_type
|
||||||
|
|
||||||
|
#define SDSsetTitle dtm_set_title
|
||||||
|
#define SDSgetTitle dtm_get_title
|
||||||
|
|
||||||
|
/* SDS routines */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern void SDSsetDimensions DTM_PROTO(( char* h, int rank, int *dims ));
|
||||||
|
extern int SDSgetDimensions DTM_PROTO(( char* h, int * rank, int* dims,
|
||||||
|
int len ));
|
||||||
|
extern int SDSgetRank DTM_PROTO(( char* h, int * rank ));
|
||||||
|
extern int SDSnumElements DTM_PROTO(( int rank, int *dims ));
|
||||||
|
extern void SDSsetMinMax DTM_PROTO(( char* h, float min, float max));
|
||||||
|
extern int SDSgetMinMax DTM_PROTO(( char* h, float* min, float* max));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif
|
243
libdtm/sdsF.c
Normal file
243
libdtm/sdsF.c
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/sdsF.c,v 1.1.1.1 1995/01/11 00:03:03 alanb Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
#ifdef RCSLOG
|
||||||
|
|
||||||
|
$Log: sdsF.c,v $
|
||||||
|
Revision 1.1.1.1 1995/01/11 00:03:03 alanb
|
||||||
|
New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
|
||||||
|
* Revision 2.5 1994/12/29 23:40:25 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:34 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:14 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:43 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.5 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <fortran.h>
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "sds.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern int atoi();
|
||||||
|
extern double atof();
|
||||||
|
extern char * dtm_find_tag();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
**
|
||||||
|
** Cray version of SDS macros
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/* SDSsetClass */
|
||||||
|
void SDSSC(s)
|
||||||
|
_fcd s;
|
||||||
|
{
|
||||||
|
strcat(strcpy(_fcdtocp(s), SDSclass), " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SDScompareClass */
|
||||||
|
long SDSCC(s)
|
||||||
|
_fcd s;
|
||||||
|
{
|
||||||
|
return _btol(!strncmp(_fcdtocp(s), SDSclass, strlen(SDSclass)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SDSheaderLength */
|
||||||
|
#undef SDSHL
|
||||||
|
long SDSHL(s)
|
||||||
|
_fcd s;
|
||||||
|
{
|
||||||
|
return _fcdlen(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SDSsetType */
|
||||||
|
void SDSSDT(s, type)
|
||||||
|
_fcd s;
|
||||||
|
int *type;
|
||||||
|
{
|
||||||
|
dtm_set_int(_fcdtocp(s), DTMtype, *type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SDSgetType */
|
||||||
|
void SDSGDT(s, type)
|
||||||
|
_fcd s;
|
||||||
|
int *type;
|
||||||
|
{
|
||||||
|
dtm_get_int(_fcdtocp(s), DTMtype, *type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SDSsetTitle */
|
||||||
|
void SDSST(s, t)
|
||||||
|
_fcd s, t;
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char *tptr = _fcdtocp(t);
|
||||||
|
|
||||||
|
strcat(strcat(_fcdtocp(s), DTMtitle), " '");
|
||||||
|
|
||||||
|
for (i=0; i< _fcdlen(t); i+=1)
|
||||||
|
if (*tptr == ' ' && *(tptr+1) == ' ')
|
||||||
|
break;
|
||||||
|
|
||||||
|
strcat(strncat(_fcdtocp(s), _fcdtocp(t), i), "' ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SDSgetTitle */
|
||||||
|
void SDSGT(s, t)
|
||||||
|
_fcd s, t;
|
||||||
|
{
|
||||||
|
dtm_get_int(_fcdtocp(s), DTMtype, _fcdtocp(t), _fcdlen(t));;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
**
|
||||||
|
** Cray version of SDS functions
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
/* SDSsetDimensions */
|
||||||
|
void SDSSD(s, rank, dims)
|
||||||
|
_fcd s;
|
||||||
|
int *rank, *dims;
|
||||||
|
{
|
||||||
|
char *h = _fcdtocp(s);
|
||||||
|
char num[8];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(num, "%d ", *rank);
|
||||||
|
strcat(h, SDSdims); strcat(h, " ");
|
||||||
|
strcat(h, num);
|
||||||
|
|
||||||
|
for (i=0; i< *rank; i+=1) {
|
||||||
|
sprintf(num, "%d ", dims[i]);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SDSgetDimensions */
|
||||||
|
int SDSGD(s, rank, dims, len)
|
||||||
|
_fcd s;
|
||||||
|
int *rank, *dims, *len;
|
||||||
|
{
|
||||||
|
char *h = _fcdtocp(s);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
if ((h = dtm_find_tag(h, SDSdims)) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
*rank = atoi(h);
|
||||||
|
|
||||||
|
for (i=0; i<*rank && i<*len; i+=1)
|
||||||
|
if ((h = strchr(h, ' ')) == NULL)
|
||||||
|
return DTMERROR;
|
||||||
|
else
|
||||||
|
dims[i] = atoi(++h);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SDSsetMinMax */
|
||||||
|
void SDSSMM(s, min, max)
|
||||||
|
_fcd s;
|
||||||
|
float *min, *max;
|
||||||
|
{
|
||||||
|
char *h = _fcdtocp(s);
|
||||||
|
char num[12];
|
||||||
|
|
||||||
|
|
||||||
|
strcat(h, SDSminmax); strcat(h, " ");
|
||||||
|
|
||||||
|
sprintf(num, "%f ", *min);
|
||||||
|
strcat(h, num);
|
||||||
|
|
||||||
|
sprintf(num, "%f ", *max);
|
||||||
|
strcat(h, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SDSgetMinMax */
|
||||||
|
long SDSGMM(s, min, max)
|
||||||
|
_fcd s;
|
||||||
|
float *min, *max;
|
||||||
|
{
|
||||||
|
char *h = _fcdtocp(s);
|
||||||
|
|
||||||
|
if ((h = dtm_find_tag(h, SDSminmax)) == NULL)
|
||||||
|
return _btol(0);
|
||||||
|
else
|
||||||
|
h = strchr(h, ' ')+1;
|
||||||
|
|
||||||
|
|
||||||
|
*min = atof(h);
|
||||||
|
|
||||||
|
h = strchr(h, ' ') + 1;
|
||||||
|
*max = atof(h);
|
||||||
|
|
||||||
|
return _btol(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* SDSnumElements */
|
||||||
|
long SDSNE(rank, dims)
|
||||||
|
int *rank, *dims;
|
||||||
|
{
|
||||||
|
int size;
|
||||||
|
|
||||||
|
size = *dims++;
|
||||||
|
while (--(*rank) > 0)
|
||||||
|
size *= *dims++;
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
776
libdtm/socket.c
Normal file
776
libdtm/socket.c
Normal file
@ -0,0 +1,776 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
** $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/socket.c,v 1.2 1995/10/13 06:33:27 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $Log: socket.c,v $
|
||||||
|
* Revision 1.2 1995/10/13 06:33:27 spowers
|
||||||
|
* Solaris support added.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1995/01/11 00:03:03 alanb
|
||||||
|
* New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
*
|
||||||
|
* Revision 2.5 1994/12/29 23:40:27 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:34 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.3 1993/10/29 03:46:50 marca
|
||||||
|
* Tweaks.
|
||||||
|
*
|
||||||
|
* Revision 1.2 1993/10/06 06:19:10 ebina
|
||||||
|
* Ditto const shit
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:14 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:44 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.28 92/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.27 1992/04/06 15:58:49 jplevyak
|
||||||
|
* Fixed minor problems for machines little Endian machines.
|
||||||
|
*
|
||||||
|
* Revision 1.26 92/03/10 22:07:10 jplevyak
|
||||||
|
* Added changed for PC/MAC from Quincey Koziol (koziol@ncsa.uiuc.edu)
|
||||||
|
* with modification.
|
||||||
|
*
|
||||||
|
* Revision 1.25 1992/02/28 03:40:24 jplevyak
|
||||||
|
* int/long confict fix (no diff on workstations)
|
||||||
|
* ,
|
||||||
|
*
|
||||||
|
* Revision 1.24 92/01/30 19:33:07 jplevyak
|
||||||
|
* Fix bug in MAC version of dtm_get_ipaddr.
|
||||||
|
*
|
||||||
|
* Revision 1.23 1992/01/15 17:05:37 creiman
|
||||||
|
* Added typecast to dtm_socket_init:getsockname
|
||||||
|
*
|
||||||
|
* Revision 1.22 1992/01/14 16:31:40 creiman
|
||||||
|
* Removed mac #include
|
||||||
|
*
|
||||||
|
* Revision 1.21 1991/12/17 23:46:30 jefft
|
||||||
|
* dtm_socket_init used to only determine the socketname for logical ports,
|
||||||
|
* it now correctly sets the sockaddr_in structure maintained within the DTM
|
||||||
|
* port structure for every call.
|
||||||
|
*
|
||||||
|
* Revision 1.20 1991/10/29 22:07:10 sreedhar
|
||||||
|
* struct sockaddr * type casting
|
||||||
|
*
|
||||||
|
* Revision 1.19 1991/10/29 16:38:58 jplevyak
|
||||||
|
* Fixed bug in code that parses addressses. (extra (STDINT)).
|
||||||
|
*
|
||||||
|
* Revision 1.18 1991/10/16 23:26:00 jplevyak
|
||||||
|
* Fixed debugging message.
|
||||||
|
*
|
||||||
|
* Revision 1.17 1991/10/15 18:21:25 jplevyak
|
||||||
|
* Changed memcpy to structure cast, select field and assign. This
|
||||||
|
* is less kludgy and not only that, it works on the CRAY which the other
|
||||||
|
* did not.
|
||||||
|
*
|
||||||
|
* Revision 1.16 1991/10/14 16:49:32 jplevyak
|
||||||
|
* Fix problem with physical addressing.
|
||||||
|
*
|
||||||
|
* Revision 1.15 1991/10/10 15:15:04 jplevyak
|
||||||
|
* Fixed naming convensions.
|
||||||
|
*
|
||||||
|
* Revision 1.14 91/09/26 20:21:55 jplevyak
|
||||||
|
* Cosmetics
|
||||||
|
*
|
||||||
|
* Revision 1.13 91/09/18 15:33:08 jplevyak
|
||||||
|
* Added additional parameter to dtm_socket_init
|
||||||
|
*
|
||||||
|
* Revision 1.12 91/09/13 20:28:52 sreedhar
|
||||||
|
* accept :9900 change
|
||||||
|
*
|
||||||
|
* Revision 1.11 1991/09/13 20:13:35 sreedhar
|
||||||
|
* take current host as default
|
||||||
|
*
|
||||||
|
* Revision 1.10 1991/08/19 18:53:37 jefft
|
||||||
|
* Fixed bug with dtm_socket_init, now checks port number for absolute
|
||||||
|
* address instead of the IP address (which isn't used anyway).
|
||||||
|
*
|
||||||
|
* Revision 1.9 1991/08/15 18:56:35 sreedhar
|
||||||
|
* Changes for logical portname version
|
||||||
|
*
|
||||||
|
* Revision 1.7 1991/06/11 15:19:45 sreedhar
|
||||||
|
* disclaimer added
|
||||||
|
*
|
||||||
|
* Revision 1.6 1991/06/07 16:07:21 sreedhar
|
||||||
|
* Changes for sequence start message
|
||||||
|
*
|
||||||
|
* Revision 1.5 1991/05/30 15:52:10 sreedhar
|
||||||
|
* Changes for readMsg/writeMsg internal release
|
||||||
|
*
|
||||||
|
* Revision 1.4 1990/12/11 14:11:38 jefft
|
||||||
|
* made dtm_get_ipaddr CRAY specific to fix final portability problem.
|
||||||
|
*
|
||||||
|
* Revision 1.3 90/11/21 12:43:15 jefft
|
||||||
|
* Fixed portibility problem with dtm_get_ipaddr.
|
||||||
|
*
|
||||||
|
* Revision 1.2 90/11/21 10:54:18 jefft
|
||||||
|
* Added new routine, dtm_get_ipaddr. It returns an ascii string of the
|
||||||
|
* current hosts IP address.
|
||||||
|
*
|
||||||
|
* Revision 1.1 90/11/08 16:39:40 jefft
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
+++++ System call - merge dtm_connect, dtm_quick_connect +++++
|
||||||
|
|
||||||
|
Check on whether dtm_get_ipaddr and dtm_init_sockaddr can be merged.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <io.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#include "uio.h"
|
||||||
|
#else
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/uio.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* Machine specific header file(s) */
|
||||||
|
|
||||||
|
#ifdef SOLARIS
|
||||||
|
#include <sys/filio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RS6000
|
||||||
|
#include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
#include <nmpcip.h>
|
||||||
|
#else
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#endif
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int buf_size = DTM_BUFF_SIZE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_parse_ipaddr()
|
||||||
|
Check whetherer given address string is in dotted
|
||||||
|
decimal notation and if so, to return the address in network byte
|
||||||
|
order.
|
||||||
|
|
||||||
|
Return values : TRUE, if in dotted decimal notation.
|
||||||
|
( network order address returned thru *addr )
|
||||||
|
FALSE, if not.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_parse_ipaddr(char *s,unsigned long *addr )
|
||||||
|
#else
|
||||||
|
int dtm_parse_ipaddr( s, addr )
|
||||||
|
char *s; /* address string */
|
||||||
|
unsigned long *addr; /* location to return network byte order address */
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int b1, b2, b3, b4;
|
||||||
|
int got;
|
||||||
|
|
||||||
|
if( (got = sscanf(s, "%d.%d.%d.%d", &b1, &b2, &b3, &b4)) != 4 ) {
|
||||||
|
DTMerrno = DTMADDR;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
*addr = htonl(b1 << 24 | b2 << 16 | b3 << 8 | b4);
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_quick_select()
|
||||||
|
Check whether a socket (s) has count bytes ready.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_quick_select(int s,int *count)
|
||||||
|
#else
|
||||||
|
int dtm_quick_select(s, count)
|
||||||
|
int s;
|
||||||
|
int *count;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
fd_set filedes;
|
||||||
|
static struct timeval timeout = {0L, 0L};
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_quick_select called.\n");
|
||||||
|
|
||||||
|
FD_ZERO(&filedes);
|
||||||
|
FD_SET(s, &filedes);
|
||||||
|
|
||||||
|
#ifdef __hpux
|
||||||
|
if (select(32, (int *)&filedes, (int *)NULL, (int *)NULL, &timeout)) {
|
||||||
|
#else
|
||||||
|
if (select(32, &filedes, (fd_set *)NULL, (fd_set *)NULL, &timeout)) {
|
||||||
|
#endif
|
||||||
|
ioctl(s, FIONREAD, count);
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
*count = 0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_select()
|
||||||
|
Wait (time) seconds for count bytes to be ready on socket s.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_select(int s,int32 *count,int32 time )
|
||||||
|
#else
|
||||||
|
int dtm_select( s, count, time )
|
||||||
|
int s;
|
||||||
|
int32 *count;
|
||||||
|
int32 time;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
fd_set filedes;
|
||||||
|
static struct timeval timeout = { 0L, 0L };
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_select called.\n");
|
||||||
|
|
||||||
|
timeout.tv_sec = time ;
|
||||||
|
|
||||||
|
FD_ZERO( &filedes );
|
||||||
|
FD_SET( s, &filedes );
|
||||||
|
|
||||||
|
#ifdef __hpux
|
||||||
|
if( (*count = select( 32, (int *)&filedes, (int *)NULL, (int *)NULL,
|
||||||
|
#else
|
||||||
|
if( (*count = select( 32, &filedes, (fd_set *)NULL, (fd_set *)NULL,
|
||||||
|
#endif
|
||||||
|
&timeout ) )) {
|
||||||
|
ioctl( s, FIONREAD, count );
|
||||||
|
return TRUE;
|
||||||
|
} else {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_accept().
|
||||||
|
Function to accept connection request on specified socket.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_accept(int s,S_ADDR *sn,struct timeval *timeout )
|
||||||
|
#else
|
||||||
|
int dtm_accept( s, sn, timeout )
|
||||||
|
int s;
|
||||||
|
S_ADDR *sn;
|
||||||
|
struct timeval *timeout ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int snsize = sizeof (S_ADDR);
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_accept called.\n");
|
||||||
|
DBGMSG1( "dtm_accept: sockfd = %d\n", s );
|
||||||
|
|
||||||
|
/*
|
||||||
|
Await connect for specified time period only.
|
||||||
|
|
||||||
|
if timeout == NULL, it means just goahead and accept,
|
||||||
|
else wait for specified period and accept only if
|
||||||
|
connection request arrives in that period.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( timeout ) {
|
||||||
|
fd_set readmask ;
|
||||||
|
fd_set *fchk = &readmask ;
|
||||||
|
int nf ;
|
||||||
|
|
||||||
|
FD_ZERO( fchk );
|
||||||
|
FD_SET( s, fchk );
|
||||||
|
|
||||||
|
#ifdef __hpux
|
||||||
|
nf = select( FD_SETSIZE, (int *)fchk, (int *)0, (int *)0, timeout );
|
||||||
|
#else
|
||||||
|
nf = select( FD_SETSIZE, fchk, (fd_set *)0, (fd_set *)0, timeout );
|
||||||
|
#endif
|
||||||
|
if ( nf < 0 ) {
|
||||||
|
DBGINT( "dtm_accept: select errno %d\n", errno );
|
||||||
|
DTMerrno = DTMSELECT ;
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( nf == 0 ) {
|
||||||
|
/* No connect request in specified time */
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_accept: timed out\n" );
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* accept connections on socket */
|
||||||
|
|
||||||
|
if ((s = accept(s, (struct sockaddr *)sn, &snsize)) < 0 ) {
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
DBGINT("dtm_accept: error %d accepting connection.", errno );
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_connect()
|
||||||
|
Attempt to connect to the the address sn, returning
|
||||||
|
the connected port in *s.
|
||||||
|
returns DTMERROR on failure. DTM_OK on success.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_connect(S_ADDR *sn,int *s)
|
||||||
|
#else
|
||||||
|
int dtm_connect(sn, s)
|
||||||
|
S_ADDR *sn;
|
||||||
|
int *s;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int d;
|
||||||
|
int refusedcount = 0;
|
||||||
|
|
||||||
|
DBGFLOW("dtm_connect called.\n");
|
||||||
|
DBGINT( "dtm_connect: s_addr = %x\n",
|
||||||
|
ntohl( sn -> sin_addr.s_addr ) );
|
||||||
|
DBGINT( "dtm_connect: sin_port = %d\n",
|
||||||
|
ntohs( sn -> sin_port ));
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
|
|
||||||
|
/* create socket */
|
||||||
|
if ((d = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
DTMERR("dtm_connect: could not create socket.");
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* attempt to connect to receiver */
|
||||||
|
if (connect(d, (struct sockaddr *)sn, sizeof (S_ADDR)) < 0) {
|
||||||
|
/* if connection refused, try again in 2 second */
|
||||||
|
if (errno == ECONNREFUSED) {
|
||||||
|
close(d);
|
||||||
|
sleep(2);
|
||||||
|
if ((refusedcount += 1) > DTM_REFUSE_LIMIT) {
|
||||||
|
DTMerrno = DTMTIMEOUT;
|
||||||
|
return DTMERROR;
|
||||||
|
} else
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
/* system error, can not connect, quit */
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
DTMERR("dtm_connect: could not connect.");
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* connect complete, set working socket to original socket */
|
||||||
|
*s = d;
|
||||||
|
setsockopt(*s, IPPROTO_TCP, TCP_NODELAY, (char *)&d, sizeof d);
|
||||||
|
setsockopt(*s, SOL_SOCKET, SO_SNDBUF, (char *)&buf_size,
|
||||||
|
sizeof(int));
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
} /* end while */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
dtm_quick_connect()
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_quick_connect(S_ADDR *sn,int *s)
|
||||||
|
#else
|
||||||
|
int dtm_quick_connect(sn, s)
|
||||||
|
S_ADDR *sn;
|
||||||
|
int *s;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int d;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_quick_connect called.\n");
|
||||||
|
|
||||||
|
/* create socket */
|
||||||
|
if ((d = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
DBGFLOW("dtm_quick_connect: could not create socket.");
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* attempt to connect to receiver */
|
||||||
|
if (connect(d, (struct sockaddr *)sn, sizeof (S_ADDR)) < 0) {
|
||||||
|
|
||||||
|
/* if connection refused */
|
||||||
|
|
||||||
|
if (errno == ECONNREFUSED) {
|
||||||
|
close(d);
|
||||||
|
DTMerrno = DTMTIMEOUT;
|
||||||
|
return DTMERROR;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* system error, can not connect, quit */
|
||||||
|
|
||||||
|
DTMerrno = DTMSOCK;
|
||||||
|
DBGFLOW("dtm_quick_connect: could not connect.");
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* else connection has been made */
|
||||||
|
|
||||||
|
*s = d;
|
||||||
|
setsockopt(*s, IPPROTO_TCP, TCP_NODELAY, (char *)&d, sizeof d);
|
||||||
|
setsockopt(*s, SOL_SOCKET, SO_SNDBUF, (char *)&buf_size, sizeof (int));
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_end_connect(int s)
|
||||||
|
#else
|
||||||
|
int dtm_end_connect(s)
|
||||||
|
int s;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
struct linger lbuf ;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_end_connect called.\n");
|
||||||
|
DBGINT( "dtm_end_connect: sockfd %d\n", s );
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
lbuf.l_onoff = 0 ;
|
||||||
|
setsockopt( s, SOL_SOCKET, SO_LINGER, &lbuf, sizeof( struct linger ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return close( s );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return values :
|
||||||
|
On success,
|
||||||
|
Direct - host address in network byte order.
|
||||||
|
Indirect - *ipaddr has host address in dotted
|
||||||
|
decimal notation.
|
||||||
|
|
||||||
|
On error, 0.
|
||||||
|
Notes:
|
||||||
|
Error is returned as 0, since an internet address
|
||||||
|
of 0 is not possible for any host ( 0 refers to 'this' host
|
||||||
|
in internet context ).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
unsigned long dtm_get_ipaddr(char *ipaddrstr )
|
||||||
|
#else
|
||||||
|
unsigned long dtm_get_ipaddr( ipaddrstr )
|
||||||
|
char *ipaddrstr ;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char hostname[MAXHOSTNAMELEN];
|
||||||
|
struct hostent *hp;
|
||||||
|
unsigned long tmp;
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_get_ipaddr called\n" );
|
||||||
|
|
||||||
|
/* get hostname */
|
||||||
|
|
||||||
|
gethostname( hostname, sizeof hostname );
|
||||||
|
|
||||||
|
#ifdef _ARCH_MACOS
|
||||||
|
|
||||||
|
/* check if hostname is in dotted decimal notation - this is a Mac-Hack */
|
||||||
|
if ( dtm_parse_ipaddr( hostname, &tmp ) != DTMERROR ) {
|
||||||
|
strcpy( ipaddrstr , hostname );
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* lookup IP address */
|
||||||
|
|
||||||
|
if( (hp = gethostbyname(hostname)) == NULL ) {
|
||||||
|
DTMerrno = DTMHOST;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* extract dotted decimal address */
|
||||||
|
|
||||||
|
{
|
||||||
|
struct in_addr inaddr ;
|
||||||
|
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
inaddr = *((struct in_addr *)( hp -> h_addr)) ;
|
||||||
|
strcpy( ipaddrstr , inet_ntoa( inaddr.s_addr ));
|
||||||
|
#else
|
||||||
|
inaddr = *((struct in_addr *)( hp -> h_addr_list[ 0 ])) ;
|
||||||
|
strcpy( ipaddrstr , inet_ntoa( inaddr ));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
DBGINT( "dtm_get_ipaddr: dotted decimal address = '%s'\n", ipaddrstr );
|
||||||
|
return inet_addr( ipaddrstr ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to acquire and bind a UDP or TCP port.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_socket_init(S_ADDR *sockaddr,int porttype,int fLogicalName )
|
||||||
|
#else
|
||||||
|
int dtm_socket_init( sockaddr, porttype, fLogicalName )
|
||||||
|
S_ADDR *sockaddr;
|
||||||
|
int porttype;
|
||||||
|
int fLogicalName;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int sockfd;
|
||||||
|
int type;
|
||||||
|
int protocol;
|
||||||
|
int opt = 1;
|
||||||
|
int sockaddrsize = sizeof (struct sockaddr_in);
|
||||||
|
char buf[128];
|
||||||
|
|
||||||
|
DBGMSG1( "dtm_socket_init: sockaddr -> s_addr = %x\n",
|
||||||
|
ntohl( sockaddr -> sin_addr.s_addr) );
|
||||||
|
DBGMSG1( "dtm_socket_init: sockaddr -> sin_port = %d\n",
|
||||||
|
ntohs( sockaddr -> sin_port) );
|
||||||
|
|
||||||
|
sockaddr -> sin_family = AF_INET ;
|
||||||
|
if ( fLogicalName ) {
|
||||||
|
/*
|
||||||
|
Logical name had been supplied for makeport.
|
||||||
|
Assign port from system ( sin_port = 0 ), and accept
|
||||||
|
from all network interfaces for multi-homed host
|
||||||
|
( INADDR_ANY ).
|
||||||
|
*/
|
||||||
|
sockaddr -> sin_addr.s_addr = htonl( INADDR_ANY );
|
||||||
|
sockaddr -> sin_port = htons( 0 ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Acquire appropriate socket ( UDP or TCP ) */
|
||||||
|
|
||||||
|
if( porttype == INPORTTYPE ) {
|
||||||
|
sockaddr -> sin_addr.s_addr = htonl( INADDR_ANY );
|
||||||
|
type = SOCK_STREAM ;
|
||||||
|
protocol = IPPROTO_TCP ;
|
||||||
|
} else {
|
||||||
|
type = SOCK_DGRAM ;
|
||||||
|
protocol = IPPROTO_UDP ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( (sockfd = socket( sockaddr -> sin_family, type, protocol )) < 0 ) {
|
||||||
|
DTMerrno = DTMSOCK ;
|
||||||
|
DBGINT( "dtm_socket_init: socket create error %d", errno );
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set socket options. */
|
||||||
|
|
||||||
|
setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof opt );
|
||||||
|
setsockopt( sockfd, SOL_SOCKET, SO_RCVBUF, (char *)&buf_size, sizeof(int) );
|
||||||
|
if( porttype == INPORTTYPE ) {
|
||||||
|
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&opt, sizeof opt );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bind name to socket */
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_socket_init: Before bind\n" );
|
||||||
|
DBGINT( "dtm_socket_init: sockfd = %d\n", sockfd );
|
||||||
|
DBGINT( "dtm_socket_init: sockaddr -> family = %d\n",
|
||||||
|
sockaddr -> sin_family );
|
||||||
|
DBGINT( "dtm_socket_init: sockaddr -> s_addr = %x\n",
|
||||||
|
ntohl( sockaddr -> sin_addr.s_addr) );
|
||||||
|
DBGINT( "dtm_socket_init: sockaddr -> sin_port = %d\n",
|
||||||
|
ntohs( sockaddr -> sin_port) );
|
||||||
|
|
||||||
|
if( bind( sockfd, (struct sockaddr *)sockaddr,
|
||||||
|
sizeof( struct sockaddr_in ) ) < 0 ) {
|
||||||
|
DTMerrno = DTMSOCK ;
|
||||||
|
DBGMSG1( "dtm_socket_init: could not bind to sockaddr, errno = %d\n",
|
||||||
|
errno );
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Listen at socket for TCP port, buffer for 5 pending connections */
|
||||||
|
|
||||||
|
if( porttype == INPORTTYPE )
|
||||||
|
listen( sockfd, 5 );
|
||||||
|
|
||||||
|
/*
|
||||||
|
Get the actual assigned (port) address ( netid/hostid/portid )
|
||||||
|
- netid/hostid from dtm_get_ipaddr(),portid from getsockname().
|
||||||
|
|
||||||
|
Netid/hostid and portid is in network byte order.
|
||||||
|
Assumption - host is not multi-homed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* get the port number */
|
||||||
|
if(getsockname(sockfd,(struct sockaddr *)sockaddr,&sockaddrsize)<0) {
|
||||||
|
DBGINT( "dtm_socket_init: Unable to get sin_port, errno %d\n", errno );
|
||||||
|
DTMerrno = DTMSOCK ;
|
||||||
|
return DTMERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get the IP address */
|
||||||
|
if( (sockaddr -> sin_addr.s_addr = dtm_get_ipaddr( buf )) == 0) {
|
||||||
|
DBGFLOW( "dtm_socket_init: Unable to get s_addr\n" );
|
||||||
|
DTMerrno = DTMSOCK ;
|
||||||
|
return DTMERROR ;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_socket_init: Verify nethostid/portid\n" );
|
||||||
|
DBGINT( "dtm_socket_init: Nethostid = %x\n",
|
||||||
|
ntohl( sockaddr -> sin_addr.s_addr ) );
|
||||||
|
DBGINT( "dtm_socket_init: Portid = %d \n",
|
||||||
|
ntohs( sockaddr -> sin_port ) );
|
||||||
|
|
||||||
|
DBGINT( "dtm_socket_init: exit sockfd = %d\n", sockfd );
|
||||||
|
|
||||||
|
return sockfd ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function to get sockaddr if portname is specified in
|
||||||
|
physical portname format ( e.g. "kankakee:9900" )
|
||||||
|
|
||||||
|
Return value : 0 on success,
|
||||||
|
DTMERROR on error
|
||||||
|
|
||||||
|
Notes : Algorithm -
|
||||||
|
|
||||||
|
1. Check portname format.
|
||||||
|
2. If logical format, sockaddr.sin_addr.s_addr = 0
|
||||||
|
3. If physical format, fill in sockaddr.sin_port and
|
||||||
|
sockaddr.sin_addr.s_addr.
|
||||||
|
|
||||||
|
It returns:
|
||||||
|
sockaddr in network byte order.
|
||||||
|
*pfLogicalName = TRUE if the port is logical.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int dtm_init_sockaddr(struct sockaddr_in *sockaddr,char *portname,
|
||||||
|
int *pfLogicalName )
|
||||||
|
#else
|
||||||
|
int dtm_init_sockaddr( sockaddr, portname, pfLogicalName )
|
||||||
|
struct sockaddr_in *sockaddr ;
|
||||||
|
char *portname ; /* read-only */
|
||||||
|
int *pfLogicalName;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
char *host ;
|
||||||
|
char *port ;
|
||||||
|
char lportname[ PNAMELEN ] ;
|
||||||
|
char hostname[ MAXHOSTNAMELEN ] ;
|
||||||
|
u_long saddr_temp;
|
||||||
|
|
||||||
|
strncpy( lportname, portname, PNAMELEN - 1 );
|
||||||
|
lportname[ PNAMELEN - 1 ] = '\0' ;
|
||||||
|
|
||||||
|
DBGFLOW( "dtm_init_sockaddr called\n" );
|
||||||
|
|
||||||
|
if( lportname[0] == ':' ) {
|
||||||
|
host = NULL ;
|
||||||
|
port = lportname + 1;
|
||||||
|
} else {
|
||||||
|
if( (port = strchr( lportname, ':' )) == NULL ) {
|
||||||
|
/* Logical format */
|
||||||
|
DBGSTR( "dtm_init_sockaddr: logical portname %s\n", lportname );
|
||||||
|
sockaddr -> sin_port = htons( 0 );
|
||||||
|
sockaddr -> sin_addr.s_addr = htonl(0);
|
||||||
|
*pfLogicalName = TRUE;
|
||||||
|
DBGINT( "dtm_init_sockaddr: sin_port = %d\n",
|
||||||
|
ntohs( sockaddr->sin_port ));
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
||||||
|
*port++ = '\0';
|
||||||
|
host = lportname;
|
||||||
|
}
|
||||||
|
*pfLogicalName = FALSE;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Physical format - hostname is either in dotted decimal
|
||||||
|
notation ( call ipaddr() ) or direct or missing.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if( host == NULL ) {
|
||||||
|
gethostname( hostname, sizeof hostname );
|
||||||
|
host = hostname ;
|
||||||
|
}
|
||||||
|
DBGINT( "dtm_init_sockaddr: host %s\n", host );
|
||||||
|
DBGINT( "dtm_init_sockaddr: port %s\n", port );
|
||||||
|
|
||||||
|
if( dtm_parse_ipaddr( host, &saddr_temp ) == DTMERROR) {
|
||||||
|
struct hostent *hp ;
|
||||||
|
if( (hp = gethostbyname( host )) == NULL ) {
|
||||||
|
DBGFLOW("dtm_init_sockaddr: gethostbyname returns error\n");
|
||||||
|
DTMerrno = DTMHOST ;
|
||||||
|
return DTMERROR ;
|
||||||
|
} else {
|
||||||
|
#ifdef _ARCH_MSDOS
|
||||||
|
saddr_temp = ((struct in_addr *)(hp->h_addr))->s_addr;
|
||||||
|
#else
|
||||||
|
saddr_temp = ((struct in_addr *)(hp->h_addr_list[0]))->s_addr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sockaddr->sin_addr.s_addr = saddr_temp;
|
||||||
|
|
||||||
|
/* Fill in port id */
|
||||||
|
sockaddr -> sin_port = htons((unsigned short)atol( port ));
|
||||||
|
|
||||||
|
DBGINT( "dtm_init_sockaddr: nethostid = %x\n",
|
||||||
|
ntohl( sockaddr -> sin_addr.s_addr ));
|
||||||
|
DBGINT( "dtm_init_sockaddr: portid = %d\n", ntohs( sockaddr -> sin_port) );
|
||||||
|
|
||||||
|
return DTM_OK ;
|
||||||
|
}
|
91
libdtm/srv.h
Normal file
91
libdtm/srv.h
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#define SRVclass "SRV"
|
||||||
|
#define SRVid "ID"
|
||||||
|
#define SRVFunc "FNC"
|
||||||
|
#define SRVInPort "INPORT"
|
||||||
|
#define SRVVString "VERSION"
|
||||||
|
#define SRVVnumber "VERSIONNUM"
|
||||||
|
#define SRVLock "LOCK"
|
||||||
|
|
||||||
|
#define SRV_FUNC_CONNECT 1
|
||||||
|
#define SRV_FUNC_DISCONNECT 2
|
||||||
|
#define SRV_FUNC_LOCK 3
|
||||||
|
#define SRV_FUNC_UNLOCK 4
|
||||||
|
#define SRV_FUNC_ADD_USER 5
|
||||||
|
#define SRV_FUNC_REMOVE_USER 6
|
||||||
|
|
||||||
|
/* for future use */
|
||||||
|
#define SRV_FUNC_LOCK_REQUEST 7
|
||||||
|
|
||||||
|
/**************************************************************
|
||||||
|
*
|
||||||
|
* for a connect message:
|
||||||
|
* SRVclass SRVid SRV_FUNC_CONNECT SRVInPort SRVVString SRVnumber
|
||||||
|
* for a disconnect message:
|
||||||
|
* SRVclass SRVid SRV_FUNC_DISCONNECT SRVInPort
|
||||||
|
* for a lock:
|
||||||
|
* SRVclass SRVid SRV_FUNC_LOCK SRVLock
|
||||||
|
* for a lock:
|
||||||
|
* SRVclass SRVid SRV_FUNC_UNLOCK SRVLock
|
||||||
|
* for a user joining:
|
||||||
|
* SRVclass SRVid SRV_FUNC_ADD_USER SRVInPort
|
||||||
|
* for a user leaving:
|
||||||
|
* SRVclass SRVid SRV_FUNC_REMOVE_USER SRVInPort
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* SRVsetClass(char *header,char *title) */
|
||||||
|
/* SRVcompareClass(char *header,char *title, int maxTitleLength) */
|
||||||
|
#ifdef DTM1
|
||||||
|
#define SRVsetClass(h) DTMsetClass((h), SRVclass)
|
||||||
|
#define SRVcompareClass(h) DTMcompareClass((h), SRVclass)
|
||||||
|
#else
|
||||||
|
#define SRVsetClass(h) dtm_set_class((h), SRVclass)
|
||||||
|
#define SRVcompareClass(h) dtm_compare_class((h), SRVclass)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* SRVsetID(char *header,char *id) */
|
||||||
|
/* SRVgetID(char *header,char *id, int maxIdLength) */
|
||||||
|
#define SRVsetID(h,s) dtm_set_char(h,SRVid,s)
|
||||||
|
#define SRVgetID(h,s,l) dtm_get_char(h,SRVid,s,l)
|
||||||
|
|
||||||
|
|
||||||
|
/* SRVsetFunction(char *header,int function) */
|
||||||
|
/* SRVgetFunction(char *header,int &function) */
|
||||||
|
/* function is either SRV_FUNC_CONNECT or SRV_FUNC_DISCONNECT */
|
||||||
|
#define SRVsetFunction(h,i) dtm_set_int(h,SRVFunc,i)
|
||||||
|
#define SRVgetFunction(h,i) dtm_get_int(h,SRVFunc,i)
|
||||||
|
|
||||||
|
|
||||||
|
/* SRVsetInPort(char *header,char *InPort) */
|
||||||
|
/* SRVgetInPort(char *header,char *InPort,int maxInPortStringLength) */
|
||||||
|
#define SRVsetInPort(h,s) dtm_set_char(h,SRVInPort,s)
|
||||||
|
#define SRVgetInPort(h,s,l) dtm_get_char(h,SRVInPort,s,l)
|
||||||
|
|
||||||
|
/* SRVsetVersionString(char *header,char *version) */
|
||||||
|
/* SRVgetVersionString(char *header,char *version, int maxIdLength) */
|
||||||
|
#define SRVsetVersionString(h,s) dtm_set_char(h,SRVVString,s)
|
||||||
|
#define SRVgetVersionString(h,s,l) dtm_get_char(h,SRVVSTRING,s,l)
|
||||||
|
|
||||||
|
/* SRVsetVersionNumber(char *header,int number) */
|
||||||
|
/* SRVgetVersionNumber(char *header,int &number) */
|
||||||
|
#define SRVsetVersionNumber(h,i) dtm_set_int(h,SRVVnumber,i)
|
||||||
|
#define SRVgetVersionNumber(h,i) dtm_get_int(h,SRVVnumber,i)
|
||||||
|
|
||||||
|
/* SRVsetLockClass(char *header,int mask) */
|
||||||
|
/* SRVgetLockClass(char *header,int &mask) */
|
||||||
|
/* 1 is locked 0 is unlocked */
|
||||||
|
|
||||||
|
#define SRV_SDS_MASK (1L << 0)
|
||||||
|
#define SRV_RIS8_MASK (1L << 1)
|
||||||
|
#define SRV_PAL_MASK (1L << 2)
|
||||||
|
#define SRV_ANIM_MASK (1L << 3)
|
||||||
|
#define SRV_COL_MASK (1L << 4)
|
||||||
|
#define SRV_TXT_MASK (1L << 5)
|
||||||
|
#define SRV_VDATA_MASK (1L << 6)
|
||||||
|
#define SRV_MESG_MASK (1L << 7)
|
||||||
|
#define SRV_COM_MASK (1L << 8)
|
||||||
|
#define SRV_EXEC_MASK (1L << 9)
|
||||||
|
|
||||||
|
#define SRVsetLockClass(h,i) dtm_set_int(h,SRVLock,i)
|
||||||
|
#define SRVgetLockClass(h,i) dtm_get_int(h,SRVLock,i)
|
69
libdtm/text.h
Normal file
69
libdtm/text.h
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#define TXTclass "TXT"
|
||||||
|
#define TXTid "ID"
|
||||||
|
#define TXTdims "DIM"
|
||||||
|
#define TXTip "IPT" /* Insertion Point */
|
||||||
|
#define TXTncr "NCR" /* Number of characters to Replace */
|
||||||
|
#define TXTra "TRA" /* Text should replace entire file*/
|
||||||
|
#define TXTsl "TSL" /* Text selection left position */
|
||||||
|
#define TXTsr "TSR" /* Text selection right position */
|
||||||
|
|
||||||
|
/* TXTsetClass(char *header) */
|
||||||
|
#ifdef DTM1
|
||||||
|
#define TXTsetClass(h) DTMsetClass((h), TXTclass)
|
||||||
|
#define TXTcompareClass(h) DTMcompareClass((h), TXTclass)
|
||||||
|
#else
|
||||||
|
#define TXTsetClass(h) dtm_set_class((h), TXTclass)
|
||||||
|
#define TXTcompareClass(h) dtm_compare_class((h), TXTclass)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* TXTsetTitle(char *header,char *title) */
|
||||||
|
/* TXTgetTitle(char *header,char *title, int maxTitleLength) */
|
||||||
|
#ifdef DTM1
|
||||||
|
#define TXTsetTitle DTMsetTitle
|
||||||
|
#define TXTgetTitle DTMgetTitle
|
||||||
|
#else
|
||||||
|
#define TXTsetTitle dtm_set_title
|
||||||
|
#define TXTgetTitle dtm_get_title
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* TXTsetID(char *header,char *id) */
|
||||||
|
/* TXTgetID(char *header,char *id, int maxIdLength) */
|
||||||
|
#define TXTsetID(h,s) dtm_set_char(h,TXTid,s)
|
||||||
|
#define TXTgetID(h,s,l) dtm_get_char(h,TXTid,s,l)
|
||||||
|
|
||||||
|
/* TXTsetInsertionPt(char *header,int InsertionPoint) */
|
||||||
|
/* TXTsetInsertionPt(char *header,int &InsertionPoint) */
|
||||||
|
#define TXTsetInsertionPt(h,i) dtm_set_int(h,TXTip,i)
|
||||||
|
#define TXTgetInsertionPt(h,i) dtm_get_int(h,TXTip,i)
|
||||||
|
|
||||||
|
/* TXTsetNumReplace(char *header,int numberToReplace) */
|
||||||
|
/* if (numberToReplace == 0) then no replace just insert */
|
||||||
|
/* TXTgetNumReplace(char *header,int &numberToReplace) */
|
||||||
|
#define TXTsetNumReplace(h,i) dtm_set_int(h,TXTncr,i)
|
||||||
|
#define TXTgetNumReplace(h,i) dtm_get_int(h,TXTncr,i)
|
||||||
|
|
||||||
|
/* TXTsetReplaceAll(char *header) */
|
||||||
|
/* Boolean TXTshouldReplaceAll(char *header,int garbage) */
|
||||||
|
#define TXTsetReplaceAll(h) dtm_set_int(h,TXTra,1)
|
||||||
|
#define TXTshouldReplaceAll(h,i) (dtm_get_int(h,TXTra,&(i)) == -1)?0:1
|
||||||
|
|
||||||
|
/* TXTsetDimension(char *header,int numBytes) */
|
||||||
|
/* TXTgetDimension(char *header,int &numBytes) */
|
||||||
|
#define TXTsetDimension(h,i) dtm_set_int(h,TXTdims,i)
|
||||||
|
#define TXTgetDimension(h,i) dtm_get_int(h,TXTdims,i)
|
||||||
|
|
||||||
|
/* TXTsetSelectionLeft(char *header, int leftPosition) */
|
||||||
|
/* TXTsetSelectionLeft(char *header, int &leftPosition) */
|
||||||
|
#define TXTsetSelectionLeft(h,i) dtm_set_int(h,TXTsl,i)
|
||||||
|
#define TXTgetSelectionLeft(h,i) dtm_get_int(h,TXTsl,i)
|
||||||
|
|
||||||
|
/* TXTsetSelectionRight(char *header, int rightPosition) */
|
||||||
|
/* TXTsetSelectionRight(char *header, int &rightPosition) */
|
||||||
|
#define TXTsetSelectionRight(h,i) dtm_set_int(h,TXTsr,i)
|
||||||
|
#define TXTgetSelectionRight(h,i) dtm_get_int(h,TXTsr,i)
|
||||||
|
|
||||||
|
#define TXTheaderLength dtm_header_length
|
||||||
|
#define TXTHL(h) dtm_header_length
|
||||||
|
|
95
libdtm/uio.h
Normal file
95
libdtm/uio.h
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/*********************************************************************
|
||||||
|
**
|
||||||
|
* $Header: /X11/mosaic/cvsroot/xmosaic3/libdtm/uio.h,v 1.3 1995/01/12 02:33:40 spowers Exp $
|
||||||
|
**
|
||||||
|
**********************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:15 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:49 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.2 92/04/30 20:27:37 jplevyak
|
||||||
|
* Changed Version to 2.3
|
||||||
|
*
|
||||||
|
* Revision 1.1 1992/03/06 22:51:22 jplevyak
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef UIO_H
|
||||||
|
#define UIO_H
|
||||||
|
|
||||||
|
#include <sys\types.h>
|
||||||
|
|
||||||
|
typedef char far *caddr_t;
|
||||||
|
|
||||||
|
struct iovec {
|
||||||
|
caddr_t iov_base;
|
||||||
|
long int iov_len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct uio {
|
||||||
|
struct iovec *uio_iov;
|
||||||
|
long int uio_iovcnt;
|
||||||
|
off_t uio_offset;
|
||||||
|
long int uio_segflg;
|
||||||
|
short uio_fmode;
|
||||||
|
int uio_resid;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct msghdr {
|
||||||
|
caddr_t msg_name; /* optional address */
|
||||||
|
long int msg_namelen; /* size of address */
|
||||||
|
struct iovec *msg_iov; /* scatter/gather array */
|
||||||
|
long int msg_iovlen; /* # elements in msg_iov */
|
||||||
|
caddr_t msg_accrights; /* access rights sent/received */
|
||||||
|
long int msg_accrightslen;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef EFAULT
|
||||||
|
#define EFAULT 14 /* for UNIX compability */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum uio_rw { UIO_READ, UIO_WRITE };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Segment flag values (should be enum).
|
||||||
|
*/
|
||||||
|
#define UIO_USERSPACE 0 /* from user data space */
|
||||||
|
#define UIO_SYSSPACE 1 /* from system space */
|
||||||
|
#define UIO_USERISPACE 2 /* from user I space */
|
||||||
|
|
||||||
|
#if defined(__STDC__) | defined (_STDC_)
|
||||||
|
extern long int readv(int ,struct iovec *,int );
|
||||||
|
extern long int writev(int ,struct iovec *,int );
|
||||||
|
|
||||||
|
extern long int recvmsg(int ,struct msghdr *,int );
|
||||||
|
extern long int sendmsg(int ,struct msghdr *,int );
|
||||||
|
#endif /* defined(__STDC__) */
|
||||||
|
|
||||||
|
#endif /* UIO_H */
|
||||||
|
|
561
libdtm/vaxcvt.c
Normal file
561
libdtm/vaxcvt.c
Normal file
@ -0,0 +1,561 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define swap(x,y) x ^= y; y ^= x; x ^= y
|
||||||
|
|
||||||
|
|
||||||
|
union float_uint_uchar {
|
||||||
|
float f;
|
||||||
|
int i;
|
||||||
|
unsigned char c[4];
|
||||||
|
};
|
||||||
|
|
||||||
|
union double_uint_uchar {
|
||||||
|
double f;
|
||||||
|
int i[2];
|
||||||
|
unsigned char c[8];
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_char(int mode,char *buf,int size)
|
||||||
|
#else
|
||||||
|
static int dtm_char(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
DBGFLOW("# dtm_char called.\n");
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_short(int mode,char *buf,int size)
|
||||||
|
#else
|
||||||
|
static int dtm_short(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_short called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) size /= 2;
|
||||||
|
if (buf != NULL) {
|
||||||
|
for (i=0; i<size; i++) {
|
||||||
|
swap(*buf, *(buf+1));
|
||||||
|
buf += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? size : (size * 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_int(int mode,char *buf,int size)
|
||||||
|
#else
|
||||||
|
static int dtm_int(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_int called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) size /= 4;
|
||||||
|
if (buf != NULL) {
|
||||||
|
for (i=0; i<size; i++) {
|
||||||
|
swap(*buf, *(buf+3));
|
||||||
|
swap(*(buf+1), *(buf+2));
|
||||||
|
buf += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? size : (size * 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_float(int mode,char *buf,int size)
|
||||||
|
#else
|
||||||
|
static int dtm_float(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_float called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) {
|
||||||
|
size >>= 2;
|
||||||
|
if (buf != NULL) DTMVieeeF2vaxF(buf, size);
|
||||||
|
return (size);
|
||||||
|
} else {
|
||||||
|
if (buf != NULL) DTMVvaxF2ieeeF(buf, size);
|
||||||
|
return (size << 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_double(int mode,char *buf,int size)
|
||||||
|
#else
|
||||||
|
static int dtm_double(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_flt64 called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) {
|
||||||
|
size >>= 3;
|
||||||
|
if (buf != NULL) DTMVieeeD2vaxD(buf, size);
|
||||||
|
return (size);
|
||||||
|
} else {
|
||||||
|
if (buf != NULL) DTMVvaxD2ieeeD(buf, size);
|
||||||
|
return (size << 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_complex(int mode,char *buf,int size)
|
||||||
|
#else
|
||||||
|
static int dtm_complex(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_complex called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) {
|
||||||
|
size >>= 2;
|
||||||
|
if (buf != NULL) DTMVieeeF2vaxF(buf, size);
|
||||||
|
return (size >> 1);
|
||||||
|
} else {
|
||||||
|
size <<= 1;
|
||||||
|
if (buf != NULL) DTMVvaxF2ieeeF(buf, size);
|
||||||
|
return (size << 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
static int dtm_triplet(int mode,char *buf,int size)
|
||||||
|
#else
|
||||||
|
static int dtm_triplet(mode, buf, size)
|
||||||
|
int mode, size;
|
||||||
|
char *buf;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
DBGFLOW("# dtm_triplet called.\n");
|
||||||
|
|
||||||
|
if (mode == DTMLOCAL) size /= 16;
|
||||||
|
if (buf != NULL) {
|
||||||
|
for (i=0; i<size; i++) {
|
||||||
|
swap(*buf, *(buf+3));
|
||||||
|
swap(*(buf+1), *(buf+2));
|
||||||
|
buf += 4;
|
||||||
|
if (mode == DTMLOCAL) DTMVieeeF2vaxF(buf, 3);
|
||||||
|
else DTMVvaxF2ieeeF(buf, 3);
|
||||||
|
buf += 12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((mode == DTMLOCAL) ? size : (size * 16));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* conversion routine function table */
|
||||||
|
int (*DTMconvertRtns[])() = {
|
||||||
|
dtm_char,
|
||||||
|
dtm_short,
|
||||||
|
dtm_int,
|
||||||
|
dtm_float,
|
||||||
|
dtm_double,
|
||||||
|
dtm_complex,
|
||||||
|
dtm_triplet
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMVvaxF2ieeeF(union float_uint_uchar f[],int size)
|
||||||
|
#else
|
||||||
|
int DTMVvaxF2ieeeF(f, size)
|
||||||
|
union float_uint_uchar f[];
|
||||||
|
int size;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register unsigned char exp;
|
||||||
|
unsigned char c0, c1, c2, c3;
|
||||||
|
|
||||||
|
for (i=0; i<size; i++)
|
||||||
|
{
|
||||||
|
c0 = f[i].c[0];
|
||||||
|
c1 = f[i].c[1];
|
||||||
|
c2 = f[i].c[2];
|
||||||
|
c3 = f[i].c[3];
|
||||||
|
exp = (c1 << 1) | (c0 >> 7); /* extract exponent */
|
||||||
|
if (!exp && !c1) f[i].i = 0; /* zero value */
|
||||||
|
else if (exp>2) { /* normal value */
|
||||||
|
f[i].c[0] = c1 - 1; /* subtracts 2 from exponent */
|
||||||
|
/* copy mantissa, LSB of exponent */
|
||||||
|
f[i].c[1] = c0;
|
||||||
|
f[i].c[2] = c3;
|
||||||
|
f[i].c[3] = c2;
|
||||||
|
}
|
||||||
|
else if (exp) { /* denormalized number */
|
||||||
|
register int shft;
|
||||||
|
|
||||||
|
f[i].c[0] = c1 & 0x80; /* keep sign, zero exponent */
|
||||||
|
shft = 3 - exp;
|
||||||
|
/* shift original mant by 1 or 2 to get denormalized mant */
|
||||||
|
/* prefix mantissa with '1'b or '01'b as appropriate */
|
||||||
|
f[i].c[1] = ((c0 & 0x7f) >> shft) | (0x10 << exp);
|
||||||
|
f[i].c[2] = (c0 << (8-shft)) | (c3 >> shft);
|
||||||
|
f[i].c[3] = (c3 << (8-shft)) | (c2 >> shft);
|
||||||
|
}
|
||||||
|
else { /* sign=1 -> infinity or NaN */
|
||||||
|
f[i].c[0] = 0xff; /* set exp to 255 */
|
||||||
|
/* copy mantissa */
|
||||||
|
f[i].c[1] = c0 | 0x80; /* LSB of exp = 1 */
|
||||||
|
f[i].c[2] = c3;
|
||||||
|
f[i].c[3] = c2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMVieeeF2vaxF(union float_uint_uchar f[],int size)
|
||||||
|
#else
|
||||||
|
int DTMVieeeF2vaxF(f, size)
|
||||||
|
union float_uint_uchar f[];
|
||||||
|
int size;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register unsigned char exp;
|
||||||
|
unsigned char c0, c1, c2, c3;
|
||||||
|
|
||||||
|
for (i=0; i<size; i++)
|
||||||
|
{
|
||||||
|
c0 = f[i].c[0];
|
||||||
|
c1 = f[i].c[1];
|
||||||
|
c2 = f[i].c[2];
|
||||||
|
c3 = f[i].c[3];
|
||||||
|
exp = (c0 << 1) | (c1 >> 7); /* extract exponent */
|
||||||
|
if (exp) { /* non-zero exponent */
|
||||||
|
/* copy mantissa, last bit of exponent */
|
||||||
|
f[i].c[0] = c1;
|
||||||
|
f[i].c[2] = c3;
|
||||||
|
f[i].c[3] = c2;
|
||||||
|
if (exp<254) /* normal value */
|
||||||
|
f[i].c[1] = c0 + 1; /* actually adds two to exp */
|
||||||
|
else { /* infinity or NaN */
|
||||||
|
if (exp==254) /* unrepresentable - OFL */
|
||||||
|
f[i].i = 0; /* set mant=0 for overflow */
|
||||||
|
f[i].c[0] &= 0x7f; /* set last bit of exp to 0 */
|
||||||
|
f[i].c[1] = 0x80; /* sign=1 exp=0 -> OFL or NaN */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c1 & 0x60) { /* denormalized value */
|
||||||
|
register int shft;
|
||||||
|
|
||||||
|
shft = (c1 & 0x40) ? 1 : 2; /* shift needed to normalize */
|
||||||
|
/* shift mantissa */
|
||||||
|
/* note last bit of exp set to 1 implicitly */
|
||||||
|
f[i].c[0] = (c1 << shft) | (c2 >> (8-shft));
|
||||||
|
f[i].c[3] = (c2 << shft) | (c3 >> (8-shft));
|
||||||
|
f[i].c[2] = c3 << shft;
|
||||||
|
f[i].c[1] = (c0 & 0x80); /* sign */
|
||||||
|
if (shft==1) { /* set exp to 2 */
|
||||||
|
f[i].c[1] |= 0x01;
|
||||||
|
f[i].c[0] &= 0x7f; /* set LSB of exp to 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else f[i].i = 0; /* zero */
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMVvaxD2ieeeD(union double_uint_uchar d[],int size)
|
||||||
|
#else
|
||||||
|
int DTMVvaxD2ieeeD(d, size)
|
||||||
|
union double_uint_uchar d[];
|
||||||
|
int size;
|
||||||
|
#endif
|
||||||
|
/* GFLOAT is much closer match to IEEE than DFLOAT */
|
||||||
|
/* but there is no support for GFLOAT under f77 */
|
||||||
|
/* and both cc and vcc don't work right with GLOAT */
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register int exp;
|
||||||
|
unsigned char c0, c1, c2, c3, c4, c5, c6, c7;
|
||||||
|
|
||||||
|
for (i=0; i<size; i++)
|
||||||
|
{
|
||||||
|
c0 = d[i].c[0];
|
||||||
|
c1 = d[i].c[1];
|
||||||
|
c2 = d[i].c[2];
|
||||||
|
c3 = d[i].c[3];
|
||||||
|
c4 = d[i].c[4];
|
||||||
|
c5 = d[i].c[5];
|
||||||
|
c6 = d[i].c[6];
|
||||||
|
c7 = d[i].c[7];
|
||||||
|
exp = (((c1 & 0x7f) << 1) | (c0 >> 7)); /* extract exponent */
|
||||||
|
if (!exp && !c1) { /* zero value */
|
||||||
|
d[i].i[0] = 0;
|
||||||
|
d[i].i[1] = 0;
|
||||||
|
} else {
|
||||||
|
if (exp) { /* normal value */
|
||||||
|
exp += 894;
|
||||||
|
d[i].c[0] = (c1 & 0x80) | (exp >> 4);
|
||||||
|
d[i].c[1] = ((exp & 0xf) << 4) | (c0 >> 3);
|
||||||
|
} else { /* sign=1 -> infinity or NaN */
|
||||||
|
d[i].c[0] = 0xff; /* set exp to 2047 */
|
||||||
|
d[i].c[1] = 0xf0 | (c0 >> 3); /* and copy mantissa */
|
||||||
|
}
|
||||||
|
d[i].c[2] = (c3 >> 3) | (c0 << 5);
|
||||||
|
d[i].c[3] = (c2 >> 3) | (c3 << 5);
|
||||||
|
d[i].c[4] = (c5 >> 3) | (c2 << 5);
|
||||||
|
d[i].c[5] = (c4 >> 3) | (c5 << 5);
|
||||||
|
d[i].c[6] = (c7 >> 3) | (c4 << 5);
|
||||||
|
d[i].c[7] = (c6 >> 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMVieeeD2vaxD(union double_uint_uchar d[],int size)
|
||||||
|
#else
|
||||||
|
int DTMVieeeD2vaxD(d, size)
|
||||||
|
union double_uint_uchar d[];
|
||||||
|
int size;
|
||||||
|
#endif
|
||||||
|
/* GFLOAT is much closer match to IEEE than DFLOAT */
|
||||||
|
/* but there is no support for GFLOAT under f77 */
|
||||||
|
/* and both cc and vcc don't work right with GLOAT */
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register int exp;
|
||||||
|
unsigned char c0, c1, c2, c3, c4, c5, c6, c7;
|
||||||
|
|
||||||
|
for (i=0; i<size; i++)
|
||||||
|
{
|
||||||
|
c0 = d[i].c[0];
|
||||||
|
c1 = d[i].c[1];
|
||||||
|
c2 = d[i].c[2];
|
||||||
|
c3 = d[i].c[3];
|
||||||
|
c4 = d[i].c[4];
|
||||||
|
c5 = d[i].c[5];
|
||||||
|
c6 = d[i].c[6];
|
||||||
|
c7 = d[i].c[7];
|
||||||
|
exp = (((c0 & 0x7f) << 4) | (c1 >> 4)) - 894; /* extract exponent */
|
||||||
|
if (exp > 0) { /* non-zero exponent */
|
||||||
|
/* copy mantissa, last bit of exponent */
|
||||||
|
d[i].c[0] = (c1 << 3) | (c2 >> 5);
|
||||||
|
d[i].c[2] = (c3 << 3) | (c4 >> 5);
|
||||||
|
d[i].c[3] = (c2 << 3) | (c3 >> 5);
|
||||||
|
d[i].c[4] = (c5 << 3) | (c6 >> 5);
|
||||||
|
d[i].c[5] = (c4 << 3) | (c5 >> 5);
|
||||||
|
d[i].c[6] = (c7 << 3);
|
||||||
|
d[i].c[7] = (c6 << 3) | (c7 >> 5);
|
||||||
|
if (exp<=255) /* normal value */
|
||||||
|
d[i].c[1] = (c0 & 0x80) | (exp >> 1);
|
||||||
|
else { /* infinity or NaN */
|
||||||
|
if (exp != 1153) { /* unrepresentable - OFL */
|
||||||
|
d[i].i[0] = 0; /* set mant=0 for overflow */
|
||||||
|
d[i].i[1] = 0;
|
||||||
|
}
|
||||||
|
d[i].c[0] &= 0x7f; /* set last bit of exp to 0 */
|
||||||
|
d[i].c[1] = 0x80; /* sign=1 exp=0 -> OFL or NaN */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Some serious shifting of mantissa needed for exp values <= 0 */
|
||||||
|
else {
|
||||||
|
d[i].i[0] = 0; /* zero */
|
||||||
|
d[i].i[1] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMVvaxG2ieeeD(union double_uint_uchar g[],int size)
|
||||||
|
#else
|
||||||
|
int DTMVvaxG2ieeeD(g, size)
|
||||||
|
union double_uint_uchar g[];
|
||||||
|
int size;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register int exp;
|
||||||
|
unsigned char c0, c1, c2, c3, c4, c5, c6, c7;
|
||||||
|
|
||||||
|
for (i=0; i<size; i++)
|
||||||
|
{
|
||||||
|
c0 = g[i].c[0];
|
||||||
|
c1 = g[i].c[1];
|
||||||
|
c2 = g[i].c[2];
|
||||||
|
c3 = g[i].c[3];
|
||||||
|
c4 = g[i].c[4];
|
||||||
|
c5 = g[i].c[5];
|
||||||
|
c6 = g[i].c[6];
|
||||||
|
c7 = g[i].c[7];
|
||||||
|
exp = ((c1 & 0x7f) << 4) | (c0 >> 4); /* extract exponent */
|
||||||
|
if (!exp && !c1) { /* zero value */
|
||||||
|
g[i].i[0] = 0;
|
||||||
|
g[i].i[1] = 0;
|
||||||
|
}
|
||||||
|
else if (exp>2) { /* normal value */
|
||||||
|
exp -= 2;
|
||||||
|
g[i].c[0] = (c1 & 0x80) | (exp >> 4);
|
||||||
|
g[i].c[1] = (c0 & 0x0f) | ((exp & 0x0f) << 4);
|
||||||
|
g[i].c[2] = c3;
|
||||||
|
g[i].c[3] = c2;
|
||||||
|
g[i].c[4] = c5;
|
||||||
|
g[i].c[5] = c4;
|
||||||
|
g[i].c[6] = c7;
|
||||||
|
g[i].c[7] = c6;
|
||||||
|
}
|
||||||
|
else if (exp) { /* denormalized number */
|
||||||
|
register int shft;
|
||||||
|
|
||||||
|
g[i].c[0] = c1 & 0x80; /* keep sign, zero exponent */
|
||||||
|
shft = 3 - exp;
|
||||||
|
/* shift original mant by 1 or 2 to get denormalized mant */
|
||||||
|
/* prefix mantissa with '1'b or '01'b as appropriate */
|
||||||
|
g[i].c[1] = ((c0 & 0x0f) >> shft) | (0x02 << exp);
|
||||||
|
g[i].c[2] = (c0 << (8-shft)) | (c3 >> shft);
|
||||||
|
g[i].c[3] = (c3 << (8-shft)) | (c2 >> shft);
|
||||||
|
g[i].c[4] = (c2 << (8-shft)) | (c5 >> shft);
|
||||||
|
g[i].c[5] = (c5 << (8-shft)) | (c4 >> shft);
|
||||||
|
g[i].c[6] = (c4 << (8-shft)) | (c7 >> shft);
|
||||||
|
g[i].c[7] = (c7 << (8-shft)) | (c6 >> shft);
|
||||||
|
}
|
||||||
|
else { /* sign=1 -> infinity or NaN */
|
||||||
|
g[i].c[0] = 0xff; /* set exp to 2047 */
|
||||||
|
/* copy mantissa */
|
||||||
|
g[i].c[1] = c0 | 0xf0; /* LSBs of exp = 1 */
|
||||||
|
g[i].c[2] = c3;
|
||||||
|
g[i].c[3] = c2;
|
||||||
|
g[i].c[4] = c5;
|
||||||
|
g[i].c[5] = c4;
|
||||||
|
g[i].c[6] = c7;
|
||||||
|
g[i].c[7] = c6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMVieeeD2vaxG(union double_uint_uchar g[],int size)
|
||||||
|
#else
|
||||||
|
int DTMVieeeD2vaxG(g, size)
|
||||||
|
union double_uint_uchar g[];
|
||||||
|
int size;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
register int exp;
|
||||||
|
unsigned char c0, c1, c2, c3, c4, c5, c6, c7;
|
||||||
|
|
||||||
|
for (i=0; i<size; i++)
|
||||||
|
{
|
||||||
|
c0 = g[i].c[0];
|
||||||
|
c1 = g[i].c[1];
|
||||||
|
c2 = g[i].c[2];
|
||||||
|
c3 = g[i].c[3];
|
||||||
|
c4 = g[i].c[4];
|
||||||
|
c5 = g[i].c[5];
|
||||||
|
c6 = g[i].c[6];
|
||||||
|
c7 = g[i].c[7];
|
||||||
|
exp = (((c0 & 0x7f) << 4) | (c1 >> 4)) + 2;/* extract exponent */
|
||||||
|
if (exp > 2) { /* non-zero exponent */
|
||||||
|
/* copy mantissa */
|
||||||
|
g[i].c[2] = c3;
|
||||||
|
g[i].c[3] = c2;
|
||||||
|
g[i].c[4] = c5;
|
||||||
|
g[i].c[5] = c4;
|
||||||
|
g[i].c[6] = c7;
|
||||||
|
g[i].c[7] = c6;
|
||||||
|
if (exp<=2047) { /* normal value */
|
||||||
|
g[i].c[0] = (c1 & 0x0f) | ((exp & 0x0f) << 4);
|
||||||
|
g[i].c[1] = (c0 & 0x80) | (exp >> 4);
|
||||||
|
} else { /* infinity or NaN */
|
||||||
|
if (exp==2048) { /* unrepresentable - OFL */
|
||||||
|
g[i].i[0] = 0; /* set mant=0 for overflow */
|
||||||
|
g[i].i[1] = 0;
|
||||||
|
}
|
||||||
|
g[i].c[0] &= 0x0f; /* set last bit of exp to 0 */
|
||||||
|
g[i].c[1] = 0x80; /* sign=1 exp=0 -> OFL or NaN */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c1 & 0x0c) { /* denormalized value */
|
||||||
|
register int shft;
|
||||||
|
|
||||||
|
shft = (c1 & 0x08) ? 1 : 2; /* shift needed to normalize */
|
||||||
|
/* shift mantissa */
|
||||||
|
/* note last bit of exp set to 1 implicitly */
|
||||||
|
g[i].c[0] = (c1 << shft) | (c2 >> (8-shft));
|
||||||
|
g[i].c[1] = (c0 & 0x80); /* sign */
|
||||||
|
g[i].c[2] = (c3 << shft) | (c4 >> (8-shft));
|
||||||
|
g[i].c[3] = (c2 << shft) | (c3 >> (8-shft));
|
||||||
|
g[i].c[4] = (c5 << shft) | (c6 >> (8-shft));
|
||||||
|
g[i].c[5] = (c4 << shft) | (c5 >> (8-shft));
|
||||||
|
g[i].c[6] = c7 << shft;
|
||||||
|
g[i].c[7] = (c6 << shft) | (c7 >> (8-shft));
|
||||||
|
g[i].c[1] = (c0 & 0x80); /* sign */
|
||||||
|
if (shft==1) { /* set exp to 2 */
|
||||||
|
g[i].c[1] |= 0x20;
|
||||||
|
g[i].c[1] &= 0xef; /* set LSB of exp to 0 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
g[i].i[0] = 0; /* zero */
|
||||||
|
g[i].i[1] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
79
libdtm/vdata.c
Normal file
79
libdtm/vdata.c
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "dtm.h"
|
||||||
|
#include "vdata.h"
|
||||||
|
|
||||||
|
#ifndef MALLOC
|
||||||
|
#define MALLOC(x) malloc(x)
|
||||||
|
#define FREE(x) free(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int VDATAsetPath(header,magicPath,pathLength)
|
||||||
|
char *header;
|
||||||
|
VdataPathElement **magicPath;
|
||||||
|
int pathLength;
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
char pathString[DTM_MAX_HEADER];
|
||||||
|
char idString[DTM_MAX_HEADER];
|
||||||
|
char buff[80];
|
||||||
|
|
||||||
|
pathString[0]='\0';
|
||||||
|
for (x=0; x < pathLength; x++) {
|
||||||
|
strcat(pathString,magicPath[x]->nodeName);
|
||||||
|
strcat(pathString," ");
|
||||||
|
}
|
||||||
|
|
||||||
|
idString[0]='\0';
|
||||||
|
for (x=0; x < pathLength; x++) {
|
||||||
|
sprintf(buff,"%d ",magicPath[x]->nodeID);
|
||||||
|
strcat(idString,buff);
|
||||||
|
}
|
||||||
|
dtm_set_int(header,VDATApathLength,pathLength);
|
||||||
|
dtm_set_char(header,VDATApathName,pathString);
|
||||||
|
dtm_set_char(header,VDATApathID,idString);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int VDATAgetPath(header,magicPath,pathLength)
|
||||||
|
char *header;
|
||||||
|
VdataPathElement **magicPath;
|
||||||
|
int *pathLength;
|
||||||
|
{
|
||||||
|
char pathString[DTM_MAX_HEADER];
|
||||||
|
char pathID[DTM_MAX_HEADER];
|
||||||
|
int numPath;
|
||||||
|
int integer[10];
|
||||||
|
char pathStep[DTM_MAX_HEADER];
|
||||||
|
char *ptr;
|
||||||
|
int x;
|
||||||
|
|
||||||
|
dtm_get_int(header,VDATApathLength,&numPath);
|
||||||
|
dtm_get_char(header,VDATApathName,pathString,DTM_MAX_HEADER);
|
||||||
|
dtm_get_char(header,VDATApathID,pathID,DTM_MAX_HEADER);
|
||||||
|
|
||||||
|
numPath = (numPath > *pathLength)? (*pathLength) : numPath;
|
||||||
|
*pathLength = numPath;
|
||||||
|
|
||||||
|
ptr = pathID;
|
||||||
|
for (x = 0; x < numPath; x++) {
|
||||||
|
sscanf(ptr,"%s ",integer);
|
||||||
|
ptr += (strlen(ptr) + 1);
|
||||||
|
magicPath[x]->nodeID = atoi(integer);
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = pathString;
|
||||||
|
for (x = 0; x < numPath; x++) {
|
||||||
|
sscanf(ptr,"%s ",pathStep);
|
||||||
|
ptr += (strlen(ptr) + 1);
|
||||||
|
if (!(magicPath[x]->nodeName = (char *)
|
||||||
|
MALLOC( strlen(pathStep) + 1))) {
|
||||||
|
fprintf(stderr,"VDATAgetPath: Out of Memory\n");
|
||||||
|
return(-1);
|
||||||
|
}
|
||||||
|
strcpy(magicPath[x]->nodeName,pathStep);
|
||||||
|
}
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
49
libdtm/vdata.h
Normal file
49
libdtm/vdata.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#ifndef VDATA_DTM_INCLUDE_BEFORE
|
||||||
|
#define VDATA_DTM_INCLUDE_BEFORE
|
||||||
|
|
||||||
|
#define VDATAclass "VDATA"
|
||||||
|
#define VDATAid "ID"
|
||||||
|
#define VDATApathLength "PLEN"
|
||||||
|
#define VDATApathName "PNAME"
|
||||||
|
#define VDATApathID "PID"
|
||||||
|
#define VDATAnodeID "NID"
|
||||||
|
#define VDATAnodeName "NNAME"
|
||||||
|
#define VDATAfield "FIELD"
|
||||||
|
#define VDATAnumRec "NREC"
|
||||||
|
#define VDATAnumElem "NELEM"
|
||||||
|
|
||||||
|
#define VDATAsetClass(h) dtm_set_class(h,VDATAclass)
|
||||||
|
#define VDATAcompareClass(h) dtm_compare_class(h,VDATAclass)
|
||||||
|
|
||||||
|
#define VDATAsetTitle dtm_set_title
|
||||||
|
#define VDATAgetTitle dtm_get_title
|
||||||
|
|
||||||
|
#define VDATAsetID(h,s) dtm_set_char(h,VDATAid,s)
|
||||||
|
#define VDATAgetID(h,s,l) dtm_get_char(h,VDATAid,s,l)
|
||||||
|
|
||||||
|
#define VDATAsetType dtm_set_type
|
||||||
|
#define VDATAgetType dtm_get_type
|
||||||
|
|
||||||
|
#define VDATAgetPathLength(h,i) dtm_get_int(h,VDATApathLength,i)
|
||||||
|
|
||||||
|
#define VDATAsetNodeID(h,i) dtm_set_int(h,VDATAnodeID,i);
|
||||||
|
#define VDATAgetNodeID(h,i) dtm_get_int(h,VDATAnodeID,i);
|
||||||
|
|
||||||
|
#define VDATAsetNodeName(h,s) dtm_set_char(h,VDATAnodeName,s)
|
||||||
|
#define VDATAgetNodeName(h,s,l) dtm_get_char(h,VDATAnodeName,s,l)
|
||||||
|
|
||||||
|
#define VDATAsetField(h,s) dtm_set_char(h,VDATAfield,s)
|
||||||
|
#define VDATAgetField(h,s,l) dtm_get_char(h,VDATAfield,s,l)
|
||||||
|
|
||||||
|
#define VDATAsetNumRecords(h,i) dtm_set_int(h,VDATAnumRec,i);
|
||||||
|
#define VDATAgetNumRecords(h,i) dtm_get_int(h,VDATAnumRec,i);
|
||||||
|
|
||||||
|
#define VDATAsetNumElements(h,i) dtm_set_int(h,VDATAnumElem,i);
|
||||||
|
#define VDATAgetNumElements(h,i) dtm_get_int(h,VDATAnumElem,i);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int nodeID;
|
||||||
|
char *nodeName;
|
||||||
|
} VdataPathElement;
|
||||||
|
|
||||||
|
#endif /* VDATA_DTM_INCLUDE_BEFORE */
|
162
libdtm/x.c
Normal file
162
libdtm/x.c
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* NCSA DTM version 2.3
|
||||||
|
* May 1, 1992
|
||||||
|
*
|
||||||
|
* NCSA DTM Version 2.3 source code and documentation are in the public
|
||||||
|
* domain. Specifically, we give to the public domain all rights for future
|
||||||
|
* licensing of the source code, all resale rights, and all publishing rights.
|
||||||
|
*
|
||||||
|
* We ask, but do not require, that the following message be included in all
|
||||||
|
* derived works:
|
||||||
|
*
|
||||||
|
* Portions developed at the National Center for Supercomputing Applications at
|
||||||
|
* the University of Illinois at Urbana-Champaign.
|
||||||
|
*
|
||||||
|
* THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
|
||||||
|
* SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
|
||||||
|
* WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** x.c Contains the DTM interface to X.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $Log: x.c,v $
|
||||||
|
* Revision 1.1.1.1 1995/01/11 00:03:04 alanb
|
||||||
|
* New CVS source tree, Mosaic 2.5 beta 4
|
||||||
|
*
|
||||||
|
* Revision 2.5 1994/12/29 23:40:42 alanb
|
||||||
|
* I'm committing with a new symbolic revision number.
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1994/12/28 21:37:32 alanb
|
||||||
|
*
|
||||||
|
* Revision 1.1.1.1 1993/07/04 00:03:16 marca
|
||||||
|
* Mosaic for X version 2 distribution
|
||||||
|
*
|
||||||
|
* Revision 1.1 1993/01/18 21:50:54 marca
|
||||||
|
* I think I got it now.
|
||||||
|
*
|
||||||
|
* Revision 1.4 92/05/05 22:27:50 jplevyak
|
||||||
|
* Corrected X interface code.
|
||||||
|
*
|
||||||
|
* Revision 1.3 1992/05/04 22:05:55 jplevyak
|
||||||
|
* Declare DTMaddInput external
|
||||||
|
*
|
||||||
|
* Revision 1.2 1992/04/30 20:25:27 jplevyak
|
||||||
|
* Changed Version to 2.3.
|
||||||
|
*
|
||||||
|
* Revision 1.1 1992/04/29 22:20:16 jplevyak
|
||||||
|
* Initial revision
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <X11/Intrinsic.h>
|
||||||
|
|
||||||
|
#include "arch.h"
|
||||||
|
#include "dtmint.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
|
#if XtInputReadMask != (1L<<0)
|
||||||
|
Balk - you must change the definition in dtm.c near
|
||||||
|
the function dtm_set_Xcallback
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void dtm_handle_new_in( caddr_t client_data, int * fd, XtInputId * id)
|
||||||
|
#else
|
||||||
|
void dtm_handle_new_in( client_data, fd, id )
|
||||||
|
caddr_t client_data;
|
||||||
|
int * fd;
|
||||||
|
XtInputId * id;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int p = (int) client_data;
|
||||||
|
DTMPORT * pp = DTMpt[p];
|
||||||
|
|
||||||
|
dtm_accept_read_connections( pp, FALSE );
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
void dtm_handle_new_out( caddr_t client_data, int * fd, XtInputId * id)
|
||||||
|
#else
|
||||||
|
void dtm_handle_new_out( client_data, fd, id )
|
||||||
|
caddr_t client_data;
|
||||||
|
int * fd;
|
||||||
|
XtInputId * id;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
int p = (int) client_data;
|
||||||
|
DTMPORT * pp = DTMpt[p];
|
||||||
|
int p_ext = p;
|
||||||
|
|
||||||
|
dtm_map_port_external( &p_ext );
|
||||||
|
pp->Xcallback( pp->Xcallback_data, &p_ext, id );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
/*
|
||||||
|
STATIC FUNCTION PROTOTYPES
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
DTMaddInput()
|
||||||
|
|
||||||
|
Add X style input handlers for DTM ports. Currently only
|
||||||
|
read ports are handled.
|
||||||
|
|
||||||
|
condition
|
||||||
|
The read/write portions of the condition value are ignored
|
||||||
|
in favor of the Read/Write quality of the port. Any operating-
|
||||||
|
system-dependant options should be included here.
|
||||||
|
proc
|
||||||
|
The user must provide an X style callback which will be called
|
||||||
|
when data has arrived at an input port. New connections are
|
||||||
|
automatically handled.
|
||||||
|
*/
|
||||||
|
#ifdef DTM_PROTOTYPES
|
||||||
|
int DTMaddInput( int p_ext, caddr_t condition,
|
||||||
|
XtInputCallbackProc proc, caddr_t client_data )
|
||||||
|
#else
|
||||||
|
int DTMaddInput( p_ext, condition, proc, client_data )
|
||||||
|
int p_ext;
|
||||||
|
caddr_t condition;
|
||||||
|
XtInputCallbackProc proc;
|
||||||
|
caddr_t client_data;
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
reg DTMPORT *pp;
|
||||||
|
reg Inport *inp;
|
||||||
|
reg int p;
|
||||||
|
|
||||||
|
DTMerrno = DTMNOERR;
|
||||||
|
|
||||||
|
CHECK_ERR( p = dtm_map_port_internal( p_ext ));
|
||||||
|
pp = DTMpt[p];
|
||||||
|
|
||||||
|
pp->Xcallback_data = client_data;
|
||||||
|
pp->Xcallback = proc;
|
||||||
|
pp->XaddInput = (XtInputCallbackProc) XtAddInput;
|
||||||
|
pp->XremoveInput = (XtInputCallbackProc) XtRemoveInput;
|
||||||
|
if ( pp->porttype == INPORTTYPE ) {
|
||||||
|
/*
|
||||||
|
Set up callback for new connections
|
||||||
|
*/
|
||||||
|
XtAddInput( pp->sockfd, XtInputReadMask, dtm_handle_new_in,
|
||||||
|
(caddr_t) p );
|
||||||
|
FOR_EACH_IN_PORT( inp, pp ) {
|
||||||
|
inp->XinputId = XtAddInput( inp->fd, XtInputReadMask,
|
||||||
|
dtm_handle_in, (caddr_t) p );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
XtAddInput( pp->sockfd, XtInputReadMask, dtm_handle_new_out,
|
||||||
|
(caddr_t) p );
|
||||||
|
}
|
||||||
|
return DTM_OK;
|
||||||
|
}
|
8
libhtmlw/AnchoredImage.xbm
Normal file
8
libhtmlw/AnchoredImage.xbm
Normal 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
16
libhtmlw/DelayedImage.xbm
Normal 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
193
libhtmlw/DrawingArea.c
Normal 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
35
libhtmlw/DrawingArea.h
Normal 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
45
libhtmlw/DrawingAreaP.h
Normal 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
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
1924
libhtmlw/HTML-PSformat.c.org
Normal file
File diff suppressed because it is too large
Load Diff
7138
libhtmlw/HTML.c
Normal file
7138
libhtmlw/HTML.c
Normal file
File diff suppressed because it is too large
Load Diff
638
libhtmlw/HTML.h
Normal file
638
libhtmlw/HTML.h
Normal 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
270
libhtmlw/HTMLP.h
Normal 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
173
libhtmlw/HTMLamp.h
Normal 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
7059
libhtmlw/HTMLformat.c
Normal file
File diff suppressed because it is too large
Load Diff
1054
libhtmlw/HTMLimages.c
Normal file
1054
libhtmlw/HTMLimages.c
Normal file
File diff suppressed because it is too large
Load Diff
736
libhtmlw/HTMLjot.c
Normal file
736
libhtmlw/HTMLjot.c
Normal 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
935
libhtmlw/HTMLlists.c
Normal 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);
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user