forked from lijiext/lammps
remove xmovie
This commit is contained in:
parent
554531a302
commit
f0c6ed004d
|
@ -1,63 +0,0 @@
|
|||
CC = gcc
|
||||
LN = gcc
|
||||
OPTIM = -O2 -finline-functions -g
|
||||
XLIBDIR = -L/usr/X11R6/lib
|
||||
XINCLUDE =
|
||||
DEFINES = -DMISSINGDEFS -D_POSIX_SOURCE -DUSEPRIVATE -DINCL_FLOAT
|
||||
WARNS = -Wimplicit -Wunused -Wmissing-prototypes
|
||||
CCOPTS = -c $(OPTIM) $(DEFINES) $(WARNS) $(XINCLUDE)
|
||||
LNOPTS = $(OPTIM)
|
||||
|
||||
LIBS = $(XLIBDIR) -lX11 -lXaw -lm
|
||||
|
||||
# try this version on a Mac
|
||||
#LIBS = $(XLIBDIR) -lX11 -lXaw -lXt -lXext -lXmu -lXpm
|
||||
|
||||
OBJS = xmovie.o \
|
||||
control.o \
|
||||
scene.o \
|
||||
read.o \
|
||||
hpsort.o
|
||||
|
||||
EXES = xmovie dummy tobinary toascii
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CCOPTS) $*.c
|
||||
|
||||
xmovie: $(OBJS)
|
||||
$(CC) $(CCOPTS) version.c
|
||||
$(LN) -o xmovie $(LNOPTS) version.o $(OBJS) $(LIBS)
|
||||
|
||||
xmovie.o: xmovie.h resource.h xmovie.c
|
||||
control.o: xmovie.h control.c
|
||||
scene.o: xmovie.h scene.c
|
||||
read.o: xmovie.h read.c
|
||||
hpsort.o: hpsort.c
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ $(EXES)
|
||||
|
||||
tar:
|
||||
tar cvf xmovie.tar Makefile *.c *.h
|
||||
compress xmovie.tar
|
||||
uuencode xmovie.tar.Z xmovie.tar.Z > xmovie.tar.Z.uu
|
||||
|
||||
clean_obj:
|
||||
rm -f *.o
|
||||
|
||||
all: $(EXES)
|
||||
|
||||
dummy: dummy.o
|
||||
$(LN) $(LNOPTS) -o dummy dummy.o -lm
|
||||
|
||||
dummy.o: dummy.c
|
||||
|
||||
toascii: toascii.o
|
||||
$(LN) $(LNOPTS) -o toascii toascii.o
|
||||
|
||||
toascii.o: toascii.c
|
||||
|
||||
tobinary: tobinary.o
|
||||
$(LN) $(LNOPTS) -o tobinary tobinary.o
|
||||
|
||||
tobinary.o: tobinary.c
|
|
@ -1,51 +0,0 @@
|
|||
Xmovie is an X-based visualization package that can reads particle
|
||||
data in a simple text format. LAMMPS output files are in this format
|
||||
(by default). Xmovie displays 2d projections of 3d (or 2d) data sets.
|
||||
While simple, it is extremely fast, and often useful for debugging.
|
||||
|
||||
Xmovie was written by Mike Uttormark, while visiting Sandia, in the
|
||||
summer of 1994. Subsequent small changes have been made by Steve
|
||||
Plimpton.
|
||||
|
||||
To make xmovie for your platform, edit the top section of the Makefile
|
||||
appropriately for your machine. You will need to point at the correct
|
||||
X libraries for xmovie to compile and link properly.
|
||||
|
||||
Once you have an xmovie executable you can test it by typing:
|
||||
|
||||
xmovie dummy.dat
|
||||
|
||||
A control window and a display window should pop open. Move the
|
||||
"thickness" slider all the way to the right and click "Start". You
|
||||
should see a small white ball oscillate back and forth in the display.
|
||||
|
||||
The examples directory in the LAMMPS distribution has several
|
||||
simulations that can be run with LAMMPS to produce dump.* files that
|
||||
you can use xmovie to visualize. The Movies page of the LAMMPS WWW
|
||||
Site has animations of these simulations that were produced by
|
||||
converting saved xmovie snapshots to MPEG files (via ImageMagick's
|
||||
convert program). Note that LAMMPS output is scaled by default (so
|
||||
all coordinates are from 0 to 1). Thus you need to run xmovie like
|
||||
this:
|
||||
|
||||
xmovie -scale dump.*
|
||||
|
||||
to see the snapshot you expect.
|
||||
|
||||
The xmovie control window options should be self-explanatory. You are
|
||||
always viewing a 2d projection of your 2d or 3d snapshot; the
|
||||
"position" and "thickness" sliders control the range of the slab of
|
||||
atoms being projected. You will not always see a snapshot when xmovie
|
||||
begins, unless you push the "thickness" slider to the right.
|
||||
|
||||
Type xmovie to see a list of command-line options and info on file
|
||||
formats.
|
||||
|
||||
---------------------------------------------------------------
|
||||
|
||||
If the xpm.h file is not on a system, it must be downloaded from
|
||||
somewhere
|
||||
|
||||
Needed to build on IBM cheetah at ORNL:
|
||||
#include </apps/xpm/3.4k/rs_aix51/include/X11/xpm.h>
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
! Resources that users may want to change.
|
||||
! Add these lines to your .Xdefaults file or
|
||||
! merge them using xrdb -merge
|
||||
!
|
||||
|
||||
!
|
||||
! colors used for drawing atoms
|
||||
!
|
||||
|
||||
#ifdef COLOR
|
||||
|
||||
XMovie.*.scene.*.foreground: red
|
||||
XMovie.*.scene.*.background: black
|
||||
XMovie.*.scene.width: 600
|
||||
XMovie.*.scene.height: 600
|
||||
|
||||
#else
|
||||
|
||||
XMovie.*.scene.*.foreground: black
|
||||
XMovie.*.scene.*.background: white
|
||||
|
||||
#endif
|
||||
|
||||
!
|
||||
! Default slider positions (0.0 -> 1.0)
|
||||
!
|
||||
|
||||
XMovie.*.speedbar.topOfThumb: 1.0
|
||||
XMovie.*.positionbar.topOfThumb: 0.50
|
||||
XMovie.*.thicknessbar.topOfThumb: 1.0
|
||||
|
||||
!
|
||||
! Default viewing axis
|
||||
! set only one, or chaos will surely ensue.
|
||||
! need to turn z off before turning others on
|
||||
!
|
||||
|
||||
! XMovie.*.z.state: False
|
||||
! XMovie.*.y.state: True
|
||||
|
||||
! XMovie.*.x.state: True
|
||||
! XMovie.*.z.state: True
|
||||
|
||||
!
|
||||
! Default viewing direction
|
||||
! again, set only one.
|
||||
! turn vminus off before turning vplus on
|
||||
!
|
||||
|
||||
! XMovie.*.vminus.state: False
|
||||
! XMovie.*.vplus.state: True
|
File diff suppressed because it is too large
Load Diff
|
@ -1,63 +0,0 @@
|
|||
/* program to generate dummy data set */
|
||||
/* Mike Uttormark 7/16/92 */
|
||||
/* Sandia Nat'l Labs 1421 */
|
||||
/* On leave from University of Wisconsin--Madison */
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define RANGE 5.0
|
||||
#define STEPS 2000
|
||||
#define PI 3.14159
|
||||
#define S 50
|
||||
|
||||
#ifdef MISSINGDEFS
|
||||
int printf(char *, ...);
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j, step, npart;
|
||||
int nsteps;
|
||||
|
||||
if (argc < 2)
|
||||
nsteps = STEPS;
|
||||
else
|
||||
nsteps = atoi(argv[1]);
|
||||
|
||||
if (argc < 3)
|
||||
npart = 1;
|
||||
else
|
||||
npart = atoi(argv[2]);
|
||||
|
||||
for(step = 0; step < nsteps; step++) {
|
||||
|
||||
printf("ITEM: TIME\n%g\n", (float) step);
|
||||
|
||||
if (step == 0) {
|
||||
printf("ITEM: BOUNDS\n");
|
||||
for (i = 3; i; i--)
|
||||
printf("%g, %g\n", -RANGE, RANGE);
|
||||
}
|
||||
printf("ITEM: POSITIONS\n");
|
||||
|
||||
for( j = 0; j < npart; j++)
|
||||
printf("%i, %i, %g, %g, %g\n",
|
||||
j+1,
|
||||
1 + j%4,
|
||||
RANGE*sin(2*PI*(step+j)/S),
|
||||
RANGE*cos(0.25*PI*(step+j)/S),
|
||||
RANGE*sin(5*PI*(step+j)/S));
|
||||
|
||||
if (npart > 1) {
|
||||
printf("ITEM: BONDS\n");
|
||||
for ( j = 0; j < npart-1; j++)
|
||||
printf("%i %i %i\n", 1 + j%4, j+1, j+2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,43 +0,0 @@
|
|||
/* Numerical Recipes heap sort, modified to be like C library qsort */
|
||||
|
||||
/* accepts arbitrary objects to be sorted, user provides compare function
|
||||
this routine sorts a F77-style array indexed from 1-n
|
||||
thus you MUST call it from C with hpsort(ra-1, ) to offset C ptr by -1
|
||||
also added multiply-array-index-by-size to enable arbitrary objects
|
||||
*/
|
||||
|
||||
void hpsort(char *ra, int n, int size,
|
||||
int (*cmp)(const void *, const void *))
|
||||
{
|
||||
unsigned long i,ir,j,l;
|
||||
char *rra;
|
||||
|
||||
if (n < 2) return;
|
||||
l = (n >> 1)+1;
|
||||
ir = n;
|
||||
rra = (char *) malloc(size);
|
||||
for (;;) {
|
||||
if (l > 1) {
|
||||
memcpy(rra,&ra[(--l)*size],size);
|
||||
} else {
|
||||
memcpy(rra,&ra[ir*size],size);
|
||||
memcpy(&ra[ir*size],&ra[1*size],size);
|
||||
if (--ir == 1) {
|
||||
memcpy(&ra[1*size],rra,size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
i = l;
|
||||
j = l+l;
|
||||
while (j <= ir) {
|
||||
if (j < ir && (*cmp)(&ra[j*size],&ra[(j+1)*size]) < 0) j++;
|
||||
if ((*cmp)(rra,&ra[j*size]) < 0) {
|
||||
memcpy(&ra[i*size],&ra[j*size],size);
|
||||
i = j;
|
||||
j <<= 1;
|
||||
} else j = ir+1;
|
||||
}
|
||||
memcpy(&ra[i*size],rra,size);
|
||||
}
|
||||
free(rra);
|
||||
}
|
1239
tools/xmovie/read.c
1239
tools/xmovie/read.c
File diff suppressed because it is too large
Load Diff
|
@ -1,244 +0,0 @@
|
|||
/* **************************************************************** */
|
||||
/* Resource database values */
|
||||
/* Can be overridden from .Xdefaults */
|
||||
|
||||
String FallbackResources[] = {
|
||||
"*.foreground: black",
|
||||
"*.background: white",
|
||||
|
||||
"*.horizDistance: 4",
|
||||
"*.vertDistance: 4",
|
||||
|
||||
"*Dialog*Translations: #override \\n\
|
||||
<Key>Return: NoOp()\\n\
|
||||
<Key>Up: NoOp()\\n\
|
||||
<Key>Down: NoOp()\\n\
|
||||
Ctrl<Key>C: NoOp()\\n\
|
||||
Ctrl<Key>I: NoOp()\\n\
|
||||
Ctrl<Key>J: NoOp()\\n\
|
||||
Ctrl<Key>M: NoOp()\\n\
|
||||
Ctrl<Key>N: NoOp()\\n\
|
||||
Ctrl<Key>O: NoOp()\\n\
|
||||
Ctrl<Key>P: NoOp()\\n\
|
||||
Ctrl<Key>Q: NoOp()\\n\
|
||||
Ctrl<Key>R: NoOp()\\n\
|
||||
Ctrl<Key>S: NoOp()\\n\
|
||||
Ctrl<Key>V: NoOp()\\n\
|
||||
Ctrl<Key>X: NoOp()\\n\
|
||||
Ctrl<Key>Z: NoOp()\\n\
|
||||
Meta<Key>V: NoOp()",
|
||||
|
||||
"*.Toggle.Translations: #replace \\n\
|
||||
<EnterWindow>: highlight(Always) \\n\
|
||||
<LeaveWindow>: unhighlight() \\n\
|
||||
<Btn1Down>,<Btn1Up>: set()notify() \\n\
|
||||
<Btn2Down>,<Btn2Up>: set()notify() \\n\
|
||||
<Btn3Down>,<Btn3Up>: set()notify()",
|
||||
|
||||
"*.quit.label: Quit",
|
||||
"*.start.label: Start",
|
||||
"*.stop.label: Stop",
|
||||
"*.restart.label: Restart",
|
||||
"*.step.label: +Step",
|
||||
"*.back.label: -Step",
|
||||
"*.save.label: Save",
|
||||
"*.color.label: Color",
|
||||
|
||||
"*.start.fromHoriz: quit",
|
||||
"*.stop.fromHoriz: start",
|
||||
"*.restart.fromHoriz: stop",
|
||||
"*.step.fromHoriz: restart",
|
||||
"*.back.fromHoriz: step",
|
||||
"*.save.fromHoriz: back",
|
||||
"*.color.fromHoriz: save",
|
||||
|
||||
"*.quit.popup.dialog.label: Do you really want to Quit?",
|
||||
"*.quit.popup.dialog.ok.label: Ok",
|
||||
"*.quit.popup.dialog.cancel.label: Cancel",
|
||||
"*.quit.popup.overrideRedirect: True",
|
||||
|
||||
"*.save.menu.atoms.label: Animaton Off",
|
||||
"*.save.menu.bonds.label: Animation On",
|
||||
"*.save.menu.background.label: This Snapshot",
|
||||
|
||||
"*.color.menu.atoms.label: Atoms",
|
||||
"*.color.menu.bonds.label: Bonds",
|
||||
"*.color.menu.background.label: Background",
|
||||
"*.color.menu.filecolor.label: from File",
|
||||
|
||||
"*.atomcolors.title: xmovie atom colors",
|
||||
|
||||
"*.atomcolors.*.apply.label: Apply",
|
||||
"*.atomcolors.*.cancel.label: Dismiss",
|
||||
|
||||
"*.atomcolors.*.Form.Dialog.borderWidth: 2",
|
||||
"*.atomcolors.*.Dialog.*.resizable: True",
|
||||
"*.atomcolors.*.Dialog.Text.width: 200",
|
||||
"*.atomcolors.*.Form.Form.Dialog.borderWidth: 0",
|
||||
"*.atomcolors.*.Form.Form.borderWidth: 2",
|
||||
|
||||
"*.bondcolors.title: xmovie bond colors",
|
||||
|
||||
"*.bondcolors.*.apply.label: Apply",
|
||||
"*.bondcolors.*.cancel.label: Dismiss",
|
||||
|
||||
"*.bondcolors.*.Form.Dialog.borderWidth: 2",
|
||||
"*.bondcolors.*.Dialog.*.resizable: True",
|
||||
"*.bondcolors.*.Dialog.Text.width: 200",
|
||||
"*.bondcolors.*.Form.Form.Dialog.borderWidth: 0",
|
||||
"*.bondcolors.*.Form.Form.borderWidth: 2",
|
||||
|
||||
"*.backcolors.title: xmovie background colors",
|
||||
|
||||
"*.backcolors.*.apply.label: Apply",
|
||||
"*.backcolors.*.cancel.label: Dismiss",
|
||||
|
||||
"*.backcolors.*.bg.label: Background Color",
|
||||
"*.backcolors.*.bg.value: black",
|
||||
"*.backcolors.*.Dialog.Text.width: 200",
|
||||
"*.backcolors.*.Dialog.*.resizable: True",
|
||||
|
||||
"*.filecolors.title: xmovie colors from file",
|
||||
|
||||
"*.filecolors.*.apply.label: Apply",
|
||||
"*.filecolors.*.cancel.label: Dismiss",
|
||||
|
||||
"*.filecolors.*.file.label: File of color settings",
|
||||
"*.filecolors.*.file.value: xmovie.colors",
|
||||
"*.filecolors.*.Dialog.Text.width: 200",
|
||||
"*.filecolors.*.Dialog.*.resizable: True",
|
||||
|
||||
"*.sceneshell.title: xmovie scene",
|
||||
"*.scene.foreground: white",
|
||||
"*.scene.background: black",
|
||||
"*.scene.width: 400",
|
||||
"*.scene.height: 400",
|
||||
"*.scene.Translations: #override \\n\
|
||||
<Expose>: ExposeScene()",
|
||||
|
||||
"*.Scrollbar.orientation: horizontal",
|
||||
"*.Scrollbar.height: 25",
|
||||
"*.Scrollbar.width: 200",
|
||||
"*.Scrollbar.shown: 0.06",
|
||||
|
||||
"*.Label.resize: False",
|
||||
|
||||
"*.time.label: Time: ?",
|
||||
"*.time.width: 406",
|
||||
"*.time.fromVert: quit",
|
||||
|
||||
"*.speedbar.fromVert: time",
|
||||
"*.speedbar.topOfThumb: 0.25",
|
||||
|
||||
"*.speed.fromHoriz: speedbar",
|
||||
"*.speed.fromVert: time",
|
||||
"*.speed.label: Speed: ?",
|
||||
"*.speed.width: 200",
|
||||
"*.speed.height: 25",
|
||||
"*.speed.resize: False",
|
||||
|
||||
"*.positionbar.fromVert: speedbar",
|
||||
"*.positionbar.topOfThumb: 0.5",
|
||||
|
||||
"*.position.fromHoriz: positionbar",
|
||||
"*.position.fromVert: speed",
|
||||
"*.position.label: Position: ?",
|
||||
"*.position.width: 200",
|
||||
"*.position.height: 25",
|
||||
"*.position.resize: False",
|
||||
|
||||
"*.thicknessbar.fromVert: positionbar",
|
||||
"*.thicknessbar.topOfThumb: 0.1",
|
||||
|
||||
"*.thickness.fromHoriz: thicknessbar",
|
||||
"*.thickness.fromVert: position",
|
||||
"*.thickness.label: Speed: ?",
|
||||
"*.thickness.width: 200",
|
||||
"*.thickness.height: 25",
|
||||
"*.thickness.resize: False",
|
||||
|
||||
"*.Scrollbar.Translations: #override \\n\
|
||||
<Btn1Down>: StartScroll(Continuous)MoveThumb()NotifyThumb() \\n\
|
||||
<Btn3Down>: StartScroll(Continuous)MoveThumb()NotifyThumb() \\n\
|
||||
<Btn1Motion>: MoveThumb()NotifyThumb() \\n\
|
||||
<Btn3Motion>: MoveThumb()NotifyThumb()",
|
||||
|
||||
"*.axis.label: Viewing Axis",
|
||||
"*.axis.fromVert: thicknessbar",
|
||||
"*.axis.width: 200",
|
||||
"*.axis.height: 25",
|
||||
|
||||
"*.x.fromVert: axis",
|
||||
"*.x.label: X",
|
||||
"*.x.width: 26",
|
||||
"*.x.height: 25",
|
||||
"*.x.horizDistance: 61",
|
||||
|
||||
"*.y.fromVert: axis",
|
||||
"*.y.fromHoriz: x",
|
||||
"*.y.label: Y",
|
||||
"*.y.width: 26",
|
||||
"*.y.height: 25",
|
||||
"*.y.radioGroup: x",
|
||||
|
||||
"*.z.fromVert: axis",
|
||||
"*.z.fromHoriz: y",
|
||||
"*.z.label: Z",
|
||||
"*.z.width: 26",
|
||||
"*.z.height: 25",
|
||||
"*.z.radioGroup: x",
|
||||
"*.z.state: True",
|
||||
|
||||
"*.viewdir.label: Viewing Direction",
|
||||
"*.viewdir.fromVert: x",
|
||||
"*.viewdir.width: 200",
|
||||
"*.viewdir.height: 25",
|
||||
|
||||
"*.vplus.fromVert: viewdir",
|
||||
"*.vplus.horizDistance: 76",
|
||||
"*.vplus.label: +",
|
||||
"*.vplus.height: 25",
|
||||
"*.vplus.width: 26",
|
||||
|
||||
"*.vminus.fromVert: viewdir",
|
||||
"*.vminus.fromHoriz: vplus",
|
||||
"*.vminus.label: -",
|
||||
"*.vminus.width: 26",
|
||||
"*.vminus.height: 25",
|
||||
"*.vminus.radioGroup: vplus",
|
||||
"*.vminus.state: True",
|
||||
|
||||
"*.motiondir.label: Movie Direction",
|
||||
"*.motiondir.fromVert: vplus",
|
||||
"*.motiondir.width: 200",
|
||||
"*.motiondir.height: 25",
|
||||
|
||||
"*.mplus.fromVert: motiondir",
|
||||
"*.mplus.horizDistance: 12",
|
||||
"*.mplus.label: Forward",
|
||||
"*.mplus.width: 90",
|
||||
"*.mplus.height: 25",
|
||||
"*.mplus.state: True",
|
||||
|
||||
"*.mminus.fromVert: motiondir",
|
||||
"*.mminus.fromHoriz: mplus",
|
||||
"*.mminus.label: Backward",
|
||||
"*.mminus.width: 90",
|
||||
"*.mminus.height: 25",
|
||||
"*.mminus.radioGroup: mplus",
|
||||
|
||||
"*.axes.fromVert: thickness",
|
||||
"*.axes.fromHoriz: axis",
|
||||
"*.axes.width: 200",
|
||||
"*.axes.height: 177",
|
||||
"*.axes.resize: False",
|
||||
"*.axes.Translations: #override \\n\
|
||||
<Expose>: ExposeAxes()",
|
||||
|
||||
"*.read.fromVert: mplus",
|
||||
"*.read.height: 100",
|
||||
"*.read.width: 406",
|
||||
"*.read.resize: False",
|
||||
|
||||
NULL,
|
||||
};
|
|
@ -1,673 +0,0 @@
|
|||
/* **************************************************************** */
|
||||
/* functions to deal with drawing atoms, etc. */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/StringDefs.h>
|
||||
#include <X11/Shell.h>
|
||||
|
||||
#include <X11/Xaw/Label.h>
|
||||
#include <X11/Xaw/Cardinals.h>
|
||||
|
||||
#include <X11/xpm.h>
|
||||
|
||||
#include "xmovie.h"
|
||||
|
||||
/* hard offsets so we dont draw on exact edge of screen */
|
||||
|
||||
#define HOFFSET 5
|
||||
#define VOFFSET 5
|
||||
|
||||
typedef XArc POINT;
|
||||
typedef XSegment LINE;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* local prototypes */
|
||||
|
||||
PRIVATE LINE *ClipAndScaleLines(BOND *b, int cnt, int *nlines);
|
||||
PRIVATE POINT *ClipAndScalePoints(POSITION *p, int cnt, Dimension diam,
|
||||
int *npoints);
|
||||
PRIVATE void DrawPoints(Display *display, Drawable drawable, GC gc,
|
||||
POINT *points, int npoints);
|
||||
PRIVATE void DrawLines(Display *display, Drawable drawable, GC gc,
|
||||
LINE *lines, int nlines);
|
||||
PRIVATE void SceneDraw(void);
|
||||
PRIVATE void SetAllColors(void);
|
||||
PRIVATE void MotionUpdate(void);
|
||||
|
||||
/* **************************************************************** */
|
||||
/* local data */
|
||||
|
||||
static Widget Scene;
|
||||
static Widget Shell;
|
||||
static Pixmap Buffer;
|
||||
|
||||
static GC *gc = (GC *) NULL;
|
||||
static GC *bondgc = (GC *) NULL;
|
||||
static GC bggc;
|
||||
static int first = 1;
|
||||
static Dimension Height, Width;
|
||||
|
||||
XtIntervalId TimeOut = (XtIntervalId) NULL;
|
||||
static String null_string = "";
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
Widget CreateScene(Widget parent, char *name)
|
||||
{
|
||||
Shell = XtCreatePopupShell("sceneshell", transientShellWidgetClass,
|
||||
parent, NULL, ZERO);
|
||||
|
||||
Scene = XtVaCreateManagedWidget(name, labelWidgetClass, Shell,
|
||||
XtNlabel, &null_string, NULL);
|
||||
|
||||
gc = (GC *) XtMalloc(Common.natomcolors * sizeof(GC));
|
||||
bondgc = (GC *) XtMalloc(Common.nbondcolors * sizeof(GC));
|
||||
|
||||
XtPopup(Shell, XtGrabNone);
|
||||
|
||||
return(Scene);
|
||||
}
|
||||
|
||||
PRIVATE void SceneDraw(void)
|
||||
{
|
||||
DATA *dptr;
|
||||
POINT *points;
|
||||
LINE *lines;
|
||||
POSITION *p;
|
||||
BOND *b;
|
||||
int i;
|
||||
int npoints, nlines;
|
||||
char s[40];
|
||||
static int last_step = -1;
|
||||
|
||||
if (!XtIsRealized(Scene)) return;
|
||||
|
||||
if (first) {
|
||||
SetAllColors();
|
||||
first = 0;
|
||||
}
|
||||
|
||||
/* Clear everything */
|
||||
|
||||
if (Common.step >= Common.ndata) return;
|
||||
if (Common.step < 0) return;
|
||||
|
||||
XFillRectangle(XtDisplay(Scene), Buffer, bggc, 0, 0,
|
||||
Width, Height);
|
||||
|
||||
/* XClearWindow(XtDisplay(Scene), XtWindow(Scene)); */
|
||||
|
||||
/* find the data */
|
||||
|
||||
dptr = Common.dataptr + Common.step;
|
||||
|
||||
/* loop over colors */
|
||||
|
||||
b = dptr->bonds;
|
||||
for(i = 0; i < Common.nbondcolors; i++) {
|
||||
if (Common.bonds_visible[i]) {
|
||||
lines = ClipAndScaleLines(b, dptr->nbtypes[i],&nlines);
|
||||
DrawLines(XtDisplay(Scene), Buffer, bondgc[i],
|
||||
lines, nlines);
|
||||
}
|
||||
b += dptr->nbtypes[i];
|
||||
}
|
||||
|
||||
p = dptr->positions;
|
||||
for(i = 0; i < Common.natomcolors; i++){
|
||||
if (Common.atoms_visible[i]) {
|
||||
points = ClipAndScalePoints(p, dptr->natypes[i],
|
||||
Common.diameter[i], &npoints);
|
||||
DrawPoints(XtDisplay(Scene), Buffer, gc[i], points,
|
||||
npoints);
|
||||
}
|
||||
p += dptr->natypes[i];
|
||||
}
|
||||
|
||||
XCopyArea(XtDisplay(Scene), Buffer, XtWindow(Scene), bggc,
|
||||
0, 0, Width, Height, 0, 0);
|
||||
|
||||
XFlush(XtDisplay(Scene));
|
||||
|
||||
if (Common.step == last_step) return;
|
||||
last_step = Common.step;
|
||||
|
||||
sprintf(s,"Time: %g Frame: %i", dptr->time, Common.step+1);
|
||||
SetTime(s);
|
||||
}
|
||||
|
||||
PRIVATE void MotionUpdate(void)
|
||||
{
|
||||
int next_step;
|
||||
|
||||
SceneUpdate();
|
||||
|
||||
if (Common.saveflag) {
|
||||
char str[24];
|
||||
if (Common.step < 10)
|
||||
sprintf(str,"image00%d.xpm",Common.step);
|
||||
else if (Common.step < 100)
|
||||
sprintf(str,"image0%d.xpm",Common.step);
|
||||
else
|
||||
sprintf(str,"image%d.xpm",Common.step);
|
||||
XpmWriteFileFromPixmap(XtDisplay(Scene),str,Buffer,NULL,NULL);
|
||||
}
|
||||
|
||||
if (!Common.motion) return;
|
||||
|
||||
next_step = CoerceStep(Common.step + Common.dstep);
|
||||
|
||||
if (next_step == Common.step) {
|
||||
RemoveMotion();
|
||||
return;
|
||||
}
|
||||
|
||||
Common.step = next_step;
|
||||
|
||||
TimeOut = (XtIntervalId) NULL;
|
||||
|
||||
InstallMotion();
|
||||
}
|
||||
|
||||
void SceneUpdate(void)
|
||||
{
|
||||
|
||||
if (!Common.init) return;
|
||||
|
||||
/* Common.step = CoerceStep(Common.step); */
|
||||
|
||||
SceneDraw();
|
||||
}
|
||||
|
||||
void SceneSave(void)
|
||||
{
|
||||
char str[24];
|
||||
sprintf(str,"image.%d.xpm",Common.step);
|
||||
XpmWriteFileFromPixmap(XtDisplay(Scene),str,Buffer,NULL,NULL);
|
||||
}
|
||||
|
||||
int CoerceStep(int step)
|
||||
{
|
||||
if (step >= Common.ndata) return (Common.ndata-1);
|
||||
if (step < 0) return(0);
|
||||
return(step);
|
||||
}
|
||||
|
||||
void ExposeScene(Widget w, XEvent *event, String *strings,
|
||||
Cardinal *nstrings)
|
||||
{
|
||||
NewDataSetup();
|
||||
SceneDraw();
|
||||
}
|
||||
|
||||
|
||||
void InstallMotion(void)
|
||||
{
|
||||
Common.motion = 1;
|
||||
|
||||
if (TimeOut == (XtIntervalId) NULL)
|
||||
TimeOut = XtAppAddTimeOut(XtWidgetToApplicationContext(Scene),
|
||||
Common.delay,
|
||||
(XtTimerCallbackProc) MotionUpdate, NULL);
|
||||
}
|
||||
|
||||
void RemoveMotion(void)
|
||||
{
|
||||
if (!Common.motion) return;
|
||||
|
||||
Common.motion = 0;
|
||||
Common.step = CoerceStep(Common.step - Common.dstep);
|
||||
|
||||
if (TimeOut != (XtIntervalId) NULL) XtRemoveTimeOut(TimeOut);
|
||||
TimeOut = (XtIntervalId) NULL;
|
||||
}
|
||||
|
||||
void SceneSize(Dimension *width, Dimension *height)
|
||||
{
|
||||
XtVaGetValues(Scene, XtNwidth, width, XtNheight, height, NULL);
|
||||
}
|
||||
|
||||
PRIVATE POINT *ClipAndScalePoints(POSITION *pos, int cnt, Dimension diam,
|
||||
int *npoints)
|
||||
{
|
||||
register int i;
|
||||
BOUND range;
|
||||
register POINT *p;
|
||||
Dimension width, height;
|
||||
static int max_points = 0;
|
||||
static POINT *points = (POINT *) NULL;
|
||||
|
||||
range.low = Common.position - Common.thickness * 0.5;
|
||||
range.high = Common.position + Common.thickness * 0.5;
|
||||
|
||||
/* use a static buffer so minimize number of allocations */
|
||||
/* didnt use Realloc because dont want data copied */
|
||||
|
||||
*npoints = cnt;
|
||||
if (*npoints > max_points) {
|
||||
XtFree((char *) points);
|
||||
points = (POINT *) XtMalloc( *npoints * sizeof(POINT));
|
||||
max_points = *npoints;
|
||||
}
|
||||
p = points;
|
||||
|
||||
if (cnt < 1) return(points);
|
||||
|
||||
SceneSize(&width, &height);
|
||||
width -= 2*HOFFSET;
|
||||
height -= 2*VOFFSET;
|
||||
|
||||
/* translate x, y, z to x and y in window. */
|
||||
/* note: index and type are also passed, but may not be used */
|
||||
|
||||
switch(3*Common.direction + Common.axis){
|
||||
case 0: /* negative direction, x axis */
|
||||
for(i = cnt; i; i--, pos++) {
|
||||
if (pos->x > range.high) continue;
|
||||
if (pos->x < range.low) continue;
|
||||
p->x = width -
|
||||
(pos->z * Common.scale + Common.offset[2]);
|
||||
p->y = height -
|
||||
(pos->y * Common.scale + Common.offset[1]);
|
||||
p->width = diam;
|
||||
p->height = diam;
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
case 1: /* negative direction, y axis */
|
||||
for(i = cnt; i; i--, pos++) {
|
||||
if (pos->y > range.high) continue;
|
||||
if (pos->y < range.low) continue;
|
||||
p->x = pos->x * Common.scale + Common.offset[0];
|
||||
p->y = pos->z * Common.scale + Common.offset[2];
|
||||
p->width = diam;
|
||||
p->height = diam;
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
case 2: /* negative direction, z axis */
|
||||
for(i = cnt; i; i--, pos++) {
|
||||
if (pos->z > range.high) continue;
|
||||
if (pos->z < range.low) continue;
|
||||
p->x = pos->x * Common.scale + Common.offset[0];
|
||||
p->y = height -
|
||||
(pos->y * Common.scale + Common.offset[1]);
|
||||
p->width = diam;
|
||||
p->height = diam;
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
case 3: /* positive direction, x axis */
|
||||
for(i = cnt; i; i--, pos++) {
|
||||
if (pos->x > range.high) continue;
|
||||
if (pos->x < range.low) continue;
|
||||
p->x = pos->z * Common.scale + Common.offset[2];
|
||||
p->y = height -
|
||||
(pos->y * Common.scale + Common.offset[1]);
|
||||
p->width = diam;
|
||||
p->height = diam;
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: /* positive direction, y axis */
|
||||
for(i = cnt; i; i--, pos++) {
|
||||
if (pos->y > range.high) continue;
|
||||
if (pos->y < range.low) continue;
|
||||
p->x = pos->x * Common.scale + Common.offset[0];
|
||||
p->y = height -
|
||||
(pos->z * Common.scale + Common.offset[2]);
|
||||
p->width = diam;
|
||||
p->height = diam;
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 5: /* postive direction, z axis */
|
||||
for(i = cnt; i; i--, pos++) {
|
||||
if (pos->z > range.high) continue;
|
||||
if (pos->z < range.low) continue;
|
||||
p->x = pos->x * Common.scale + Common.offset[0];
|
||||
p->y = pos->y * Common.scale + Common.offset[1];
|
||||
p->width = diam;
|
||||
p->height = diam;
|
||||
p++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
*npoints = p - points;
|
||||
|
||||
/* add the hard offsets so we dont draw on edge of screen */
|
||||
/* center drawing based on width, height */
|
||||
|
||||
for(i = *npoints, p = points; i; i--, p++) {
|
||||
p->x += HOFFSET - p->width/2;
|
||||
p->y += VOFFSET - p->height/2;
|
||||
}
|
||||
|
||||
return(points);
|
||||
}
|
||||
|
||||
|
||||
PRIVATE void DrawPoints(Display *display, Drawable drawable, GC gc,
|
||||
POINT *points, int npoints)
|
||||
{
|
||||
register int full_circle;
|
||||
register int i;
|
||||
register POINT *p;
|
||||
|
||||
if (npoints <= 0) return;
|
||||
|
||||
/* this version has POINT typedef'd to XArc, so we need to */
|
||||
/* fill in other fields before drawing */
|
||||
|
||||
full_circle = 64*360;
|
||||
|
||||
for(i = npoints, p = points; i ; i--, p++){
|
||||
p->angle1 = 0;
|
||||
p->angle2 = full_circle;
|
||||
}
|
||||
|
||||
if (Common.hollow) {
|
||||
if (Common.opaque)
|
||||
XFillArcs(display, drawable, bggc, points, npoints);
|
||||
XDrawArcs(display, drawable, gc, points, npoints);
|
||||
}
|
||||
else
|
||||
XFillArcs(display, drawable, gc, points, npoints);
|
||||
|
||||
}
|
||||
|
||||
PRIVATE LINE *ClipAndScaleLines(BOND *bond, int cnt, int *nlines)
|
||||
{
|
||||
register int i;
|
||||
BOUND range;
|
||||
register LINE *l;
|
||||
Dimension width, height;
|
||||
static int max_lines = 0;
|
||||
static LINE *lines = (LINE *) NULL;
|
||||
|
||||
range.low = Common.position - Common.thickness * 0.5;
|
||||
range.high = Common.position + Common.thickness * 0.5;
|
||||
|
||||
/* use a static buffer so minimize number of allocations */
|
||||
/* didnt use Realloc because dont want data copied */
|
||||
|
||||
*nlines = cnt;
|
||||
if (*nlines > max_lines) {
|
||||
XtFree((char *) lines);
|
||||
lines = (LINE *) XtMalloc( *nlines * sizeof(LINE));
|
||||
max_lines = *nlines;
|
||||
}
|
||||
l = lines;
|
||||
|
||||
if (cnt < 1) return(lines);
|
||||
|
||||
SceneSize(&width, &height);
|
||||
width -= 2*HOFFSET;
|
||||
height -= 2*VOFFSET;
|
||||
|
||||
/* translate x, y, z to x and y in window. */
|
||||
|
||||
switch(3*Common.direction + Common.axis){
|
||||
case 0: /* negative direction, x axis */
|
||||
for(i = cnt; i; i--, bond++) {
|
||||
if (bond->atom1->x > range.high) continue;
|
||||
if (bond->atom1->x < range.low) continue;
|
||||
if (bond->atom2->x > range.high) continue;
|
||||
if (bond->atom2->x < range.low) continue;
|
||||
l->x1 = width -
|
||||
(bond->atom1->z*Common.scale+Common.offset[2]);
|
||||
l->y1 = height -
|
||||
(bond->atom1->y*Common.scale+Common.offset[1]);
|
||||
l->x2 = width -
|
||||
(bond->atom2->z*Common.scale+Common.offset[2]);
|
||||
l->y2 = height -
|
||||
(bond->atom2->y*Common.scale+Common.offset[1]);
|
||||
l++;
|
||||
}
|
||||
break;
|
||||
case 1: /* negative direction, y axis */
|
||||
for(i = cnt; i; i--, bond++) {
|
||||
if (bond->atom1->y > range.high) continue;
|
||||
if (bond->atom1->y < range.low) continue;
|
||||
if (bond->atom2->y > range.high) continue;
|
||||
if (bond->atom2->y < range.low) continue;
|
||||
l->x1 = bond->atom1->x*Common.scale + Common.offset[0];
|
||||
l->y1 = bond->atom1->z*Common.scale + Common.offset[2];
|
||||
l->x2 = bond->atom2->x*Common.scale + Common.offset[0];
|
||||
l->y2 = bond->atom2->z*Common.scale + Common.offset[2];
|
||||
l++;
|
||||
}
|
||||
break;
|
||||
case 2: /* negative direction, z axis */
|
||||
for(i = cnt; i; i--, bond++) {
|
||||
if (bond->atom1->z > range.high) continue;
|
||||
if (bond->atom1->z < range.low) continue;
|
||||
if (bond->atom2->z > range.high) continue;
|
||||
if (bond->atom2->z < range.low) continue;
|
||||
l->x1 = bond->atom1->x*Common.scale + Common.offset[0];
|
||||
l->y1 = height -
|
||||
(bond->atom1->y*Common.scale+Common.offset[1]);
|
||||
l->x2 = bond->atom2->x*Common.scale + Common.offset[0];
|
||||
l->y2 = height -
|
||||
(bond->atom2->y*Common.scale+Common.offset[1]);
|
||||
l++;
|
||||
}
|
||||
break;
|
||||
case 3: /* positive direction, x axis */
|
||||
for(i = cnt; i; i--, bond++) {
|
||||
if (bond->atom1->x > range.high) continue;
|
||||
if (bond->atom1->x < range.low) continue;
|
||||
if (bond->atom2->x > range.high) continue;
|
||||
if (bond->atom2->x < range.low) continue;
|
||||
l->x1 = bond->atom1->z*Common.scale + Common.offset[2];
|
||||
l->y1 = height -
|
||||
(bond->atom1->y*Common.scale+Common.offset[1]);
|
||||
l->x2 = bond->atom2->z*Common.scale + Common.offset[2];
|
||||
l->y2 = height -
|
||||
(bond->atom2->y*Common.scale+Common.offset[1]);
|
||||
l++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: /* positive direction, y axis */
|
||||
for(i = cnt; i; i--, bond++) {
|
||||
if (bond->atom1->y > range.high) continue;
|
||||
if (bond->atom1->y < range.low) continue;
|
||||
if (bond->atom2->y > range.high) continue;
|
||||
if (bond->atom2->y < range.low) continue;
|
||||
l->x1 = bond->atom1->x*Common.scale + Common.offset[0];
|
||||
l->y1 = height -
|
||||
(bond->atom1->z*Common.scale+Common.offset[2]);
|
||||
l->x2 = bond->atom2->x*Common.scale + Common.offset[0];
|
||||
l->y2 = height -
|
||||
(bond->atom2->z*Common.scale+Common.offset[2]);
|
||||
l++;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 5: /* postive direction, z axis */
|
||||
for(i = cnt; i; i--, bond++) {
|
||||
if (bond->atom1->z > range.high) continue;
|
||||
if (bond->atom1->z < range.low) continue;
|
||||
if (bond->atom2->z > range.high) continue;
|
||||
if (bond->atom2->z < range.low) continue;
|
||||
l->x1 = bond->atom1->x*Common.scale + Common.offset[0];
|
||||
l->y1 = bond->atom1->y*Common.scale + Common.offset[1];
|
||||
l->x2 = bond->atom2->x*Common.scale + Common.offset[0];
|
||||
l->y2 = bond->atom2->y*Common.scale + Common.offset[1];
|
||||
l++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
*nlines = l - lines;
|
||||
|
||||
/* add the hard offsets so we dont draw on edge of screen */
|
||||
|
||||
for(i = *nlines, l = lines; i; i--, l++) {
|
||||
l->x1 += HOFFSET;
|
||||
l->y1 += VOFFSET;
|
||||
l->x2 += HOFFSET;
|
||||
l->y2 += VOFFSET;
|
||||
}
|
||||
|
||||
return(lines);
|
||||
}
|
||||
|
||||
|
||||
PRIVATE void DrawLines(Display *display, Drawable drawable, GC gc,
|
||||
LINE *lines, int nlines)
|
||||
{
|
||||
if (nlines <= 0) return;
|
||||
|
||||
XDrawSegments(display, drawable, gc, lines, nlines);
|
||||
}
|
||||
|
||||
void Setup(void)
|
||||
{
|
||||
NewDataSetup();
|
||||
SpeedUpdate();
|
||||
UpdateRadios();
|
||||
}
|
||||
|
||||
void NewDataSetup(void)
|
||||
{
|
||||
static int have_pixmap = 0;
|
||||
|
||||
BOUND *cb;
|
||||
int i;
|
||||
float longest, f;
|
||||
Dimension width, height;
|
||||
|
||||
SceneSize(&Width, &Height);
|
||||
|
||||
if (have_pixmap) XFreePixmap(XtDisplay(Scene), Buffer);
|
||||
|
||||
Buffer = XCreatePixmap(XtDisplay(Scene),
|
||||
RootWindowOfScreen(XtScreen(Scene)), Width, Height,
|
||||
DefaultDepthOfScreen(XtScreen(Scene)));
|
||||
|
||||
have_pixmap = 1;
|
||||
|
||||
/* determine global scaling and offset factors */
|
||||
/* offset + scale * coordinate = pixel */
|
||||
|
||||
longest = 0.0;
|
||||
for(i = 3, cb = Common.bounds; i ; i--, cb++)
|
||||
if ((f = (cb->high) - (cb->low)) > longest) longest = f;
|
||||
|
||||
SceneSize(&Width, &Height);
|
||||
width = Width;
|
||||
height = Height;
|
||||
|
||||
width -= HOFFSET*2;
|
||||
height -= VOFFSET*2;
|
||||
|
||||
Common.scale = (width < height) ? width/longest : height/longest;
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
Common.offset[i] = - Common.bounds[i].low * Common.scale;
|
||||
|
||||
PositionUpdate();
|
||||
ThicknessUpdate();
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void SetAtomColors(Pixel *fg)
|
||||
{
|
||||
int i;
|
||||
XGCValues xgc;
|
||||
|
||||
XtVaGetValues(Scene, XtNbackground, &xgc.background, NULL);
|
||||
|
||||
xgc.function = GXcopy;
|
||||
|
||||
for(i = 0; i < Common.natomcolors; i++) {
|
||||
if (gc[i]) XFreeGC(XtDisplay(Scene), gc[i]);
|
||||
xgc.foreground = fg[i];
|
||||
gc[i] = XCreateGC(XtDisplay(Scene), XtWindow(Scene),
|
||||
GCFunction | GCBackground | GCForeground, &xgc);
|
||||
}
|
||||
|
||||
if (bggc) XFreeGC(XtDisplay(Scene), bggc);
|
||||
xgc.foreground = xgc.background;
|
||||
bggc = XCreateGC(XtDisplay(Scene), XtWindow(Scene),
|
||||
GCFunction | GCBackground | GCForeground, &xgc);
|
||||
|
||||
}
|
||||
|
||||
void SetBGColor(Pixel bg)
|
||||
{
|
||||
XGCValues xgc;
|
||||
|
||||
XtVaSetValues(Scene, XtNbackground, bg, NULL);
|
||||
|
||||
if (bggc) XFreeGC(XtDisplay(Scene), bggc);
|
||||
|
||||
xgc.function = GXcopy;
|
||||
xgc.foreground = xgc.background = bg;
|
||||
|
||||
bggc = XCreateGC(XtDisplay(Scene), XtWindow(Scene),
|
||||
GCFunction | GCBackground | GCForeground, &xgc);
|
||||
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void SetBondColors(Pixel *fg, Dimension *thick)
|
||||
{
|
||||
int i;
|
||||
XGCValues xgc;
|
||||
|
||||
XtVaGetValues(Scene, XtNbackground, &xgc.background, NULL);
|
||||
|
||||
xgc.function = GXcopy;
|
||||
|
||||
for(i = 0; i < Common.nbondcolors; i++) {
|
||||
if (bondgc[i]) XFreeGC(XtDisplay(Scene), bondgc[i]);
|
||||
xgc.foreground = fg[i];
|
||||
xgc.line_width = thick[i];
|
||||
bondgc[i] = XCreateGC(XtDisplay(Scene), XtWindow(Scene),
|
||||
GCFunction | GCBackground | GCForeground | GCLineWidth,
|
||||
&xgc);
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
PRIVATE void SetAllColors(void)
|
||||
{
|
||||
int i;
|
||||
XGCValues xgc;
|
||||
|
||||
xgc.function = GXcopy;
|
||||
xgc.line_width = 1;
|
||||
|
||||
XtVaGetValues(Scene,
|
||||
XtNbackground, &xgc.background,
|
||||
XtNforeground, &xgc.foreground,
|
||||
NULL);
|
||||
|
||||
for(i = 0; i < Common.natomcolors; i++)
|
||||
gc[i] = XCreateGC(XtDisplay(Scene), XtWindow(Scene),
|
||||
GCFunction | GCBackground | GCForeground, &xgc);
|
||||
|
||||
for(i = 0; i < Common.nbondcolors; i++)
|
||||
bondgc[i] = XCreateGC(XtDisplay(Scene), XtWindow(Scene),
|
||||
GCFunction | GCBackground | GCForeground | GCLineWidth,
|
||||
&xgc);
|
||||
|
||||
xgc.foreground = xgc.background;
|
||||
bggc = XCreateGC(XtDisplay(Scene), XtWindow(Scene),
|
||||
GCFunction | GCBackground | GCForeground, &xgc);
|
||||
|
||||
}
|
||||
|
|
@ -1,425 +0,0 @@
|
|||
/* **************************************************************** */
|
||||
/* toascii.c - binary to ascii xmovie format converter */
|
||||
/* */
|
||||
/* Mike Uttormark - 8/11/92 */
|
||||
/* Sandia Nat'l Labs 1421 */
|
||||
/* On leave from University of Wisconsin--Madison */
|
||||
/* **************************************************************** */
|
||||
/* format of binary file: */
|
||||
/* */
|
||||
/* magic number - 4-byte integer */
|
||||
/* version - 4-byte integer */
|
||||
/* <records> */
|
||||
/* */
|
||||
/* generic record format: */
|
||||
/* record id - 4-byte integer */
|
||||
/* length (bytes) - 4-byte integer */
|
||||
/* data */
|
||||
/* **************************************************************** */
|
||||
|
||||
#define MagicNumber 12344321
|
||||
#define Version 1001
|
||||
|
||||
#define TimeID 100
|
||||
#define BoundID 101
|
||||
#define PositionID 102
|
||||
#define BondID 103
|
||||
#define CopyBondID 104
|
||||
#define CopyAtomID 105
|
||||
|
||||
#define LINELEN 256
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef MISSINGDEFS
|
||||
#include <unistd.h>
|
||||
int fprintf(FILE *, char *, ...);
|
||||
int fread(void *, size_t, size_t, FILE *);
|
||||
int fseek(FILE *, long int, int);
|
||||
#endif
|
||||
|
||||
#ifndef EXIT_SUCCESS
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
#undef TRUE
|
||||
#undef FALSE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
/* **************************************************************** */
|
||||
/* local typedefs */
|
||||
|
||||
typedef long INT4;
|
||||
typedef float REAL4;
|
||||
typedef void (*PFV)();
|
||||
|
||||
typedef struct {
|
||||
INT4 index;
|
||||
INT4 type;
|
||||
REAL4 coord[3];
|
||||
} POSITION;
|
||||
|
||||
typedef struct {
|
||||
INT4 type;
|
||||
INT4 index1;
|
||||
INT4 index2;
|
||||
} BOND;
|
||||
|
||||
typedef struct {
|
||||
REAL4 low[3];
|
||||
REAL4 high[3];
|
||||
} BOUND;
|
||||
|
||||
typedef struct {
|
||||
REAL4 time;
|
||||
} TIME;
|
||||
|
||||
typedef INT4 RECORD;
|
||||
typedef INT4 LENGTH;
|
||||
typedef INT4 MAGIC;
|
||||
typedef INT4 VERSION;
|
||||
|
||||
typedef struct {
|
||||
RECORD record_id;
|
||||
PFV writer;
|
||||
} WRITER;
|
||||
|
||||
typedef struct {
|
||||
RECORD record_id;
|
||||
PFV reader;
|
||||
} READER;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* function proto-types */
|
||||
|
||||
int main(int argc, char **argv);
|
||||
int GetRecord(FILE *file);
|
||||
void PutRecord(FILE *file);
|
||||
|
||||
void PutTime(FILE *f);
|
||||
void PutBound(FILE *f);
|
||||
void PutPosition(FILE *f);
|
||||
void PutBond(FILE *f);
|
||||
void PutCopyBond(FILE *f);
|
||||
void PutCopyAtom(FILE *f);
|
||||
|
||||
WRITER *GetWriter(RECORD record);
|
||||
|
||||
void PrintError(char *s);
|
||||
void *Realloc(void *ptr, size_t amt);
|
||||
|
||||
READER *GetReader(RECORD record);
|
||||
|
||||
void ReadHeader(FILE *f);
|
||||
int ReadRecordHeader(FILE *f);
|
||||
void ReadTime(FILE *f);
|
||||
void ReadBound(FILE *f);
|
||||
void ReadPosition(FILE *f);
|
||||
void ReadBond(FILE *f);
|
||||
void ReadDummy(FILE *f);
|
||||
|
||||
/* **************************************************************** */
|
||||
/* local data */
|
||||
|
||||
static MAGIC magic = MagicNumber;
|
||||
static VERSION version = Version;
|
||||
static RECORD record;
|
||||
static LENGTH length;
|
||||
static POSITION *positions = (POSITION *) NULL;
|
||||
static INT4 npositions = 0;
|
||||
static INT4 maxpositions = 0;
|
||||
static BOUND bounds;
|
||||
static TIME time;
|
||||
static BOND *bonds = (BOND *) NULL;
|
||||
static INT4 nbonds = 0;
|
||||
static INT4 maxbonds = 0;
|
||||
|
||||
static WRITER write_table[] = {
|
||||
{ TimeID, PutTime },
|
||||
{ BoundID, PutBound },
|
||||
{ PositionID, PutPosition },
|
||||
{ BondID, PutBond },
|
||||
{ CopyBondID, PutCopyBond },
|
||||
{ CopyAtomID, PutCopyAtom },
|
||||
};
|
||||
|
||||
static READER read_table[] = {
|
||||
{ TimeID, ReadTime },
|
||||
{ BoundID, ReadBound },
|
||||
{ PositionID, ReadPosition },
|
||||
{ BondID, ReadBond },
|
||||
{ CopyBondID, ReadDummy },
|
||||
{ CopyAtomID, ReadDummy },
|
||||
};
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
/* ARGSUSED */
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ReadHeader(stdin);
|
||||
|
||||
while(GetRecord(stdin))
|
||||
PutRecord(stdout);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
int GetRecord(FILE *f)
|
||||
{
|
||||
register READER *r;
|
||||
|
||||
while(1) {
|
||||
if (!ReadRecordHeader(f)) return(FALSE);
|
||||
r = GetReader(record);
|
||||
if (r == (READER *) NULL) { /* dont recognize */
|
||||
fseek(f, length, SEEK_CUR); /* skip */
|
||||
continue;
|
||||
}
|
||||
(*r->reader)(f);
|
||||
break;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
READER *GetReader(RECORD record)
|
||||
{
|
||||
register READER *r;
|
||||
register int i;
|
||||
|
||||
i = sizeof(read_table)/sizeof(read_table[0]);
|
||||
for(r = read_table; i ; i--, r++)
|
||||
if (r->record_id == record) return(r);
|
||||
|
||||
return((READER *) NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PutTime(FILE *f)
|
||||
{
|
||||
fprintf(f, "ITEM: TIME\n"
|
||||
"%g\n", time.time);
|
||||
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PutBound(FILE *f)
|
||||
{
|
||||
register int i;
|
||||
|
||||
fprintf(f, "ITEM: BOUNDS\n");
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
fprintf(f, "%g %g\n", bounds.low[i], bounds.high[i]);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PutPosition(FILE *f)
|
||||
{
|
||||
register POSITION *p;
|
||||
register int i;
|
||||
|
||||
fprintf(f,"ITEM: POSITIONS %i\n", npositions);
|
||||
|
||||
for(p = positions, i = npositions; i; i--, p++)
|
||||
fprintf(f, "%i %i %g %g %g\n",p->index, p->type,
|
||||
p->coord[0], p->coord[1], p->coord[2]);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PutBond(FILE *f)
|
||||
{
|
||||
register BOND *b;
|
||||
register int i;
|
||||
|
||||
fprintf(f,"ITEM: BONDS %i\n", nbonds);
|
||||
|
||||
for(b = bonds, i = nbonds; i; i--, b++)
|
||||
fprintf(f, "%i %i %i\n", b->type, b->index1, b->index2);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PutCopyBond(FILE *f)
|
||||
{
|
||||
fprintf(f, "ITEM: COPYBONDS\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PutCopyAtom(FILE *f)
|
||||
{
|
||||
fprintf(f, "ITEM: COPYATOMS\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PrintError(char *s)
|
||||
{
|
||||
fprintf(stderr,"%s", s);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void *Realloc(void *ptr, size_t amt)
|
||||
{
|
||||
ptr = (ptr == NULL) ? malloc(amt) : realloc(ptr, amt);
|
||||
|
||||
if (ptr != NULL) return(ptr);
|
||||
|
||||
PrintError("Error: unable to allocate space.\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PutRecord(FILE *f)
|
||||
{
|
||||
register WRITER *w;
|
||||
|
||||
w = GetWriter(record);
|
||||
if (w == (WRITER *) NULL)
|
||||
PrintError("Internal error: no writer.\n");
|
||||
|
||||
(*w->writer)(f);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
WRITER *GetWriter(RECORD r)
|
||||
{
|
||||
register int i;
|
||||
register WRITER *w;
|
||||
|
||||
i = sizeof(write_table)/sizeof(write_table[0]);
|
||||
for(w = write_table; i; i--, w++)
|
||||
if (w->record_id == r) return(w);
|
||||
|
||||
return((WRITER *) NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
|
||||
void ReadHeader(FILE *f)
|
||||
{
|
||||
if (1 > fread(&magic, sizeof(magic), 1, f)) goto error;
|
||||
if (1 > fread(&version, sizeof(version), 1, f)) goto error;
|
||||
|
||||
if (magic == MagicNumber) return;
|
||||
|
||||
error:
|
||||
|
||||
PrintError( "Error: magic number not found.\n"
|
||||
"File is probably not binary.\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadTime(FILE *f)
|
||||
{
|
||||
if (1 == fread(&time.time, length, 1, f)) return;
|
||||
|
||||
PrintError("Error: unable to read time.\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadBound(FILE *f)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for(i = 0; i < 3; i++) {
|
||||
if (1 > fread(&bounds.low[i], sizeof(bounds.low[0]), 1, f))
|
||||
goto error;
|
||||
if (1 > fread(&bounds.high[i], sizeof(bounds.high[0]), 1, f))
|
||||
goto error;
|
||||
}
|
||||
return;
|
||||
|
||||
error:
|
||||
PrintError("Error: unable to read bounds.\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadPosition(FILE *f)
|
||||
{
|
||||
register int i;
|
||||
register POSITION *p;
|
||||
|
||||
npositions = length /
|
||||
(sizeof(p->index) + sizeof(p->type) + 3*sizeof(p->coord[0]));
|
||||
|
||||
if (npositions > maxpositions) {
|
||||
maxpositions = npositions + 16;
|
||||
positions = (POSITION *)
|
||||
Realloc(positions, maxpositions * sizeof(*positions));
|
||||
}
|
||||
|
||||
for(i = npositions, p = positions; i; i--, p++) {
|
||||
if (1 > fread(&p->index, sizeof(p->index), 1, f)) goto error;
|
||||
if (1 > fread(&p->type, sizeof(p->type), 1, f)) goto error;
|
||||
if (1 > fread(&p->coord[0], sizeof(p->coord[0]), 1, f)) goto error;
|
||||
if (1 > fread(&p->coord[1], sizeof(p->coord[0]), 1, f)) goto error;
|
||||
if (1 > fread(&p->coord[2], sizeof(p->coord[0]), 1, f)) goto error;
|
||||
}
|
||||
return;
|
||||
|
||||
error:
|
||||
PrintError("Error: unable to get atom positions.\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadBond(FILE *f)
|
||||
{
|
||||
register int i;
|
||||
register BOND *b;
|
||||
|
||||
nbonds = length /
|
||||
(sizeof(b->type) + sizeof(b->index1) + sizeof(b->index2));
|
||||
|
||||
if (nbonds > maxbonds) {
|
||||
maxbonds = nbonds + 16;
|
||||
bonds = (BOND *)
|
||||
Realloc(bonds, maxbonds * sizeof(*bonds));
|
||||
}
|
||||
|
||||
for(i = nbonds, b = bonds; i; i--, b++) {
|
||||
if (1 > fread(&b->type, sizeof(b->type), 1, f)) goto error;
|
||||
if (1 > fread(&b->index1, sizeof(b->index1), 1, f)) goto error;
|
||||
if (1 > fread(&b->index2, sizeof(b->index2), 1, f)) goto error;
|
||||
}
|
||||
return;
|
||||
|
||||
error:
|
||||
PrintError("Error: unable to get bonds.\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
int ReadRecordHeader(FILE *f)
|
||||
{
|
||||
if (1 > fread(&record, sizeof(record), 1, f)) return(FALSE);
|
||||
if (1 > fread(&length, sizeof(length), 1, f)) return(FALSE);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadDummy(FILE *f)
|
||||
{}
|
|
@ -1,525 +0,0 @@
|
|||
/* **************************************************************** */
|
||||
/* tobinary.c - binary xmovie format converter */
|
||||
/* */
|
||||
/* Mike Uttormark - 8/11/92 */
|
||||
/* Sandia Nat'l Labs 1421 */
|
||||
/* On leave from University of Wisconsin--Madison */
|
||||
/* **************************************************************** */
|
||||
/* format of binary file: */
|
||||
/* */
|
||||
/* magic number - 4-byte integer */
|
||||
/* version - 4-byte integer */
|
||||
/* <records> */
|
||||
/* */
|
||||
/* generic record format: */
|
||||
/* record id - 4-byte integer */
|
||||
/* length (bytes) - 4-byte integer */
|
||||
/* data */
|
||||
/* **************************************************************** */
|
||||
|
||||
#define MagicNumber 12344321
|
||||
#define Version 1001
|
||||
|
||||
#define TimeID 100
|
||||
#define BoundID 101
|
||||
#define PositionID 102
|
||||
#define BondID 103
|
||||
#define CopyBondID 104
|
||||
#define CopyAtomID 105
|
||||
|
||||
#define LINELEN 256
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef MISSINGDEFS
|
||||
long strtol(char *s, char **t, int base);
|
||||
double strtod(char *s, char **t);
|
||||
int fprintf(FILE *, char *, ...);
|
||||
int fwrite(void *, size_t, size_t, FILE *);
|
||||
#endif
|
||||
|
||||
#ifndef EXIT_SUCCESS
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
#undef TRUE
|
||||
#undef FALSE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define WHITESPACE " \t\n\v\r"
|
||||
#define SEPARATORS WHITESPACE ",;"
|
||||
|
||||
/* **************************************************************** */
|
||||
/* local typedefs */
|
||||
|
||||
typedef long INT4;
|
||||
typedef float REAL4;
|
||||
typedef void (*PFV)();
|
||||
|
||||
typedef struct {
|
||||
INT4 index;
|
||||
INT4 type;
|
||||
REAL4 coord[3];
|
||||
} POSITION;
|
||||
|
||||
typedef struct {
|
||||
INT4 type;
|
||||
INT4 index1;
|
||||
INT4 index2;
|
||||
} BOND;
|
||||
|
||||
typedef struct {
|
||||
REAL4 low[3];
|
||||
REAL4 high[3];
|
||||
} BOUND;
|
||||
|
||||
typedef struct {
|
||||
REAL4 time;
|
||||
} TIME;
|
||||
|
||||
typedef INT4 RECORD;
|
||||
typedef INT4 LENGTH;
|
||||
typedef INT4 MAGIC;
|
||||
typedef INT4 VERSION;
|
||||
|
||||
typedef struct {
|
||||
char *item;
|
||||
RECORD record_id;
|
||||
PFV reader;
|
||||
} PARSER;
|
||||
|
||||
typedef struct {
|
||||
RECORD record_id;
|
||||
PFV writer;
|
||||
} WRITER;
|
||||
|
||||
/* **************************************************************** */
|
||||
/* function proto-types */
|
||||
|
||||
int main(int argc, char **argv);
|
||||
int GetRecord(FILE *file);
|
||||
void PutRecord(FILE *file);
|
||||
|
||||
void ReadTime(FILE *f);
|
||||
void ReadBound(FILE *f);
|
||||
void ReadPosition(FILE *f);
|
||||
void ReadBond(FILE *);
|
||||
void ReadDummy(FILE *F);
|
||||
|
||||
int GetLine(char *s, FILE *f);
|
||||
void UnGetLine(char *s);
|
||||
int LineIsBlank(char *s);
|
||||
int IsItem(char *s, char **t);
|
||||
PARSER *GetParser(char *s);
|
||||
|
||||
int GetInt4(char *s, char **t, INT4 *i);
|
||||
int GetReal4(char *s, char **t, REAL4 *r);
|
||||
|
||||
void PrintError(char *s);
|
||||
void *Realloc(void *ptr, size_t amt);
|
||||
|
||||
WRITER *GetWriter(RECORD record);
|
||||
|
||||
void WriteHeader(FILE *f);
|
||||
void WriteRecordHeader(FILE *f);
|
||||
void WriteTime(FILE *f);
|
||||
void WriteBound(FILE *f);
|
||||
void WritePosition(FILE *f);
|
||||
void WriteBond(FILE *f);
|
||||
void WriteDummy(FILE *f);
|
||||
|
||||
/* **************************************************************** */
|
||||
/* local data */
|
||||
|
||||
static MAGIC magic = MagicNumber;
|
||||
static VERSION version = Version;
|
||||
static RECORD record;
|
||||
static LENGTH length;
|
||||
static POSITION *positions = (POSITION *) NULL;
|
||||
static INT4 npositions = 0;
|
||||
static INT4 maxpositions = 0;
|
||||
static BOUND bounds;
|
||||
static TIME time;
|
||||
static BOND *bonds = (BOND *) NULL;
|
||||
static INT4 nbonds = 0;
|
||||
static INT4 maxbonds = 0;
|
||||
|
||||
static PARSER parse_table[] = {
|
||||
{ "TIME", TimeID, ReadTime },
|
||||
{ "BOUNDS", BoundID, ReadBound },
|
||||
{ "POSITIONS", PositionID, ReadPosition },
|
||||
{ "BONDS", BondID, ReadBond },
|
||||
{ "COPYBONDS", CopyBondID, ReadDummy },
|
||||
{ "COPYATOMS", CopyAtomID, ReadDummy },
|
||||
};
|
||||
|
||||
static WRITER write_table[] = {
|
||||
{ TimeID, WriteTime },
|
||||
{ BoundID, WriteBound },
|
||||
{ PositionID, WritePosition },
|
||||
{ BondID, WriteBond },
|
||||
{ CopyBondID, WriteDummy },
|
||||
{ CopyAtomID, WriteDummy },
|
||||
};
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
/* ARGSUSED */
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
WriteHeader(stdout);
|
||||
|
||||
while(GetRecord(stdin))
|
||||
PutRecord(stdout);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
int GetRecord(FILE *f)
|
||||
{
|
||||
char line[LINELEN];
|
||||
char *t;
|
||||
PARSER *p;
|
||||
|
||||
while(1) {
|
||||
if (!GetLine(line, f)) return(FALSE);
|
||||
if (!IsItem(line, &t)) continue;
|
||||
p = GetParser(t);
|
||||
if (p == (PARSER *) NULL) continue;
|
||||
record = p->record_id;
|
||||
(*p->reader)(f);
|
||||
break;
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
static int have_line = 0;
|
||||
static char hold_line[LINELEN];
|
||||
|
||||
int GetLine(char *s, FILE *f)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (have_line) {
|
||||
have_line = FALSE;
|
||||
strcpy(s, hold_line);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
do {
|
||||
result = (NULL != fgets(s, LINELEN, f));
|
||||
}
|
||||
while ( result && LineIsBlank(s) );
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
void UnGetLine(char *s)
|
||||
{
|
||||
have_line = TRUE;
|
||||
strcpy(hold_line, s);
|
||||
}
|
||||
|
||||
int LineIsBlank(char *s)
|
||||
{
|
||||
register char *t;
|
||||
|
||||
t = s + strspn(s, WHITESPACE);
|
||||
return(*t == '\0');
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
int IsItem(char *s, char **t)
|
||||
{
|
||||
register char *item;
|
||||
|
||||
item = strtok(s, WHITESPACE );
|
||||
if (strcmp(item, "ITEM:")) return(FALSE);
|
||||
|
||||
*t = strtok(NULL, WHITESPACE);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
PARSER *GetParser(char *s)
|
||||
{
|
||||
register PARSER *p;
|
||||
register int i;
|
||||
|
||||
i = sizeof(parse_table)/sizeof(parse_table[0]);
|
||||
for(p = parse_table; i ; i--, p++)
|
||||
if (!strcmp(p->item, s)) return(p);
|
||||
|
||||
return((PARSER *) NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadTime(FILE *f)
|
||||
{
|
||||
char line[80];
|
||||
char *t;
|
||||
|
||||
if (!GetLine(line, f))
|
||||
PrintError("Error: unable to get line for time.\n");
|
||||
|
||||
if (!GetReal4(line, &t, &time.time))
|
||||
PrintError("Error: unable to convert time.\n");
|
||||
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadBound(FILE *f)
|
||||
{
|
||||
char line[80];
|
||||
char *t;
|
||||
register int i;
|
||||
|
||||
for(i = 0; i < 3; i++) {
|
||||
if (!GetLine(line, f))
|
||||
PrintError("Error: unable to get line for bounds.\n");
|
||||
if (!GetReal4(line, &t, &bounds.low[i]))
|
||||
PrintError("Error: unable to get low bound.\n");
|
||||
if (!GetReal4(t, &t, &bounds.high[i]))
|
||||
PrintError("Error: unable to get high bound.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadPosition(FILE *f)
|
||||
{
|
||||
char line[LINELEN];
|
||||
char *t;
|
||||
POSITION p;
|
||||
register int i;
|
||||
|
||||
npositions = 0;
|
||||
|
||||
while(1) {
|
||||
if (!GetLine(line, f)) return;
|
||||
if (!GetInt4(line, &t, &p.index)) {
|
||||
UnGetLine(line);
|
||||
return;
|
||||
}
|
||||
if (!GetInt4(t, &t, &p.type))
|
||||
PrintError("Error: unable to get atoms type.\n");
|
||||
for(i = 0; i < 3; i++)
|
||||
if (!GetReal4(t, &t, &p.coord[i]))
|
||||
PrintError("Error: unable to atom position.\n");
|
||||
|
||||
if (npositions >= maxpositions) {
|
||||
maxpositions += 128;
|
||||
positions = (POSITION *) Realloc(positions,
|
||||
maxpositions * sizeof(*positions));
|
||||
}
|
||||
positions[npositions++] = p;
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadBond(FILE *f)
|
||||
{
|
||||
char line[LINELEN];
|
||||
char *t;
|
||||
BOND b;
|
||||
|
||||
nbonds = 0;
|
||||
|
||||
while(1) {
|
||||
if (!GetLine(line, f)) return;
|
||||
if (!GetInt4(line, &t, &b.type)) {
|
||||
UnGetLine(line);
|
||||
return;
|
||||
}
|
||||
if (!GetInt4(t, &t, &b.index1))
|
||||
PrintError("Error: unable to get bond index 1.\n");
|
||||
|
||||
if (!GetInt4(t, &t, &b.index2))
|
||||
PrintError("Error: unable to get bond index 2.\n");
|
||||
|
||||
if (nbonds >= maxbonds) {
|
||||
maxbonds += 128;
|
||||
bonds = (BOND *) Realloc(bonds,
|
||||
maxbonds * sizeof(*bonds));
|
||||
}
|
||||
bonds[nbonds++] = b;
|
||||
}
|
||||
}
|
||||
/* **************************************************************** */
|
||||
|
||||
void ReadDummy(FILE *f)
|
||||
{}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
int GetInt4(char *s, char **t, INT4 *i)
|
||||
{
|
||||
s += strspn(s, SEPARATORS);
|
||||
|
||||
*i = strtol(s, t, 10);
|
||||
|
||||
return(*t > s);
|
||||
}
|
||||
|
||||
int GetReal4(char *s, char **t, REAL4 *r)
|
||||
{
|
||||
s += strspn(s, SEPARATORS);
|
||||
|
||||
*r = strtod(s, t);
|
||||
|
||||
return(*t > s);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PrintError(char *s)
|
||||
{
|
||||
fprintf(stderr,"%s", s);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void *Realloc(void *ptr, size_t amt)
|
||||
{
|
||||
ptr = (ptr == NULL) ? malloc(amt) : realloc(ptr, amt);
|
||||
|
||||
if (ptr != NULL) return(ptr);
|
||||
|
||||
PrintError("Error: unable to allocate space.\n");
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void PutRecord(FILE *f)
|
||||
{
|
||||
WRITER *w;
|
||||
|
||||
w = GetWriter(record);
|
||||
if (w == (WRITER *) NULL)
|
||||
PrintError("Internal error: no writer.\n");
|
||||
|
||||
(*w->writer)(f);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
WRITER *GetWriter(RECORD r)
|
||||
{
|
||||
register int i;
|
||||
register WRITER *w;
|
||||
|
||||
i = sizeof(write_table)/sizeof(write_table[0]);
|
||||
for(w = write_table; i; i--, w++)
|
||||
if (w->record_id == r) return(w);
|
||||
|
||||
return((WRITER *) NULL);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
|
||||
void WriteHeader(FILE *f)
|
||||
{
|
||||
fwrite(&magic, sizeof(magic), 1, f);
|
||||
fwrite(&version, sizeof(version), 1, f);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void WriteTime(FILE *f)
|
||||
{
|
||||
length = sizeof(time.time);
|
||||
|
||||
WriteRecordHeader(f);
|
||||
|
||||
fwrite(&time.time, length, 1, f);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void WriteBound(FILE *f)
|
||||
{
|
||||
register int i;
|
||||
|
||||
length = 3 * (sizeof(bounds.low[0]) + sizeof(bounds.high[0]));
|
||||
|
||||
WriteRecordHeader(f);
|
||||
|
||||
for(i = 0; i < 3; i++) {
|
||||
fwrite(&bounds.low[i], sizeof(bounds.low[0]), 1, f);
|
||||
fwrite(&bounds.high[i], sizeof(bounds.high[0]), 1, f);
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void WritePosition(FILE *f)
|
||||
{
|
||||
register int i;
|
||||
register POSITION *p;
|
||||
|
||||
length = npositions *
|
||||
(sizeof(p->index) + sizeof(p->type) + 3*sizeof(p->coord[0]));
|
||||
|
||||
WriteRecordHeader(f);
|
||||
|
||||
for(i = npositions, p = positions; i; i--, p++) {
|
||||
fwrite(&p->index, sizeof(p->index), 1, f);
|
||||
fwrite(&p->type, sizeof(p->type), 1, f);
|
||||
fwrite(&p->coord[0], sizeof(p->coord[0]), 1, f);
|
||||
fwrite(&p->coord[1], sizeof(p->coord[0]), 1, f);
|
||||
fwrite(&p->coord[2], sizeof(p->coord[0]), 1, f);
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void WriteBond(FILE *f)
|
||||
{
|
||||
register int i;
|
||||
register BOND *b;
|
||||
|
||||
length = nbonds *
|
||||
(sizeof(b->type) + sizeof(b->index1) + sizeof(b->index2));
|
||||
|
||||
WriteRecordHeader(f);
|
||||
|
||||
for(i = nbonds, b = bonds; i; i--, b++) {
|
||||
fwrite(&b->type, sizeof(b->type), 1, f);
|
||||
fwrite(&b->index1, sizeof(b->index1), 1, f);
|
||||
fwrite(&b->index2, sizeof(b->index2), 1, f);
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void WriteDummy(FILE *f)
|
||||
{
|
||||
length = 0;
|
||||
|
||||
WriteRecordHeader(f);
|
||||
}
|
||||
|
||||
/* **************************************************************** */
|
||||
|
||||
void WriteRecordHeader(FILE *f)
|
||||
{
|
||||
fwrite(&record, sizeof(record), 1, f);
|
||||
fwrite(&length, sizeof(length), 1, f);
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/StringDefs.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
|
||||
#include "xmovie.h"
|
||||
|
||||
void Version(void)
|
||||
{
|
||||
fprintf(stderr,"%s %s, compiled %s %s\n"
|
||||
"Copyright 1992 Michael Uttormark, All rights reserved.\n",
|
||||
Progname, VERSION, __DATE__, __TIME__);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
|
@ -1,282 +0,0 @@
|
|||
/* ****************************************************************
|
||||
* xmovie - a simple X based movie program
|
||||
*
|
||||
* Mike Uttormark - 7/13/92
|
||||
* Sandia Nat'l Labs 1421
|
||||
* On leave from University of Wisconsin--Madison
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <X11/StringDefs.h>
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Xaw/Form.h>
|
||||
#include <X11/Xaw/Cardinals.h>
|
||||
|
||||
#include "xmovie.h"
|
||||
#include "resource.h"
|
||||
|
||||
extern FILE *popen(const char *, const char *);
|
||||
extern int pclose(FILE *);
|
||||
|
||||
/* **************************************************************** */
|
||||
/* local function prototypes */
|
||||
|
||||
int main(int argc, char **argv);
|
||||
PRIVATE void CheckResources(void);
|
||||
|
||||
/* **************************************************************** */
|
||||
/* common data */
|
||||
|
||||
CommonData Common = {
|
||||
NULL, /* atoms visible */
|
||||
NULL, /* bonds visible */
|
||||
FALSE, /* hollow */
|
||||
FALSE, /* opaque */
|
||||
FALSE, /* 2d mode */
|
||||
FALSE, /* periodic boundary conditions on bond drawing */
|
||||
FALSE, /* remap atoms into box bounds if necessary */
|
||||
FALSE, /* scale atoms to fill box bounds */
|
||||
FALSE, /* bond copying */
|
||||
FALSE, /* version */
|
||||
4, /* number of atom types */
|
||||
4, /* number of bond types */
|
||||
NULL, /* atom diameters */
|
||||
0, /* init */
|
||||
0, /* motion off */
|
||||
0, /* saveflag off */
|
||||
250L, /* delay interval (ms) */
|
||||
0, /* next drawing position */
|
||||
0, /* step number */
|
||||
1, /* dstep */
|
||||
2, /* z axis */
|
||||
0, /* view direction */
|
||||
{ { 1e20, 1e-20 }, { 1e20, 1e-20 }, { 1e20, 1e-20 } }, /* bounds */
|
||||
0, /* ndata */
|
||||
0, /* maxdata */
|
||||
NULL,
|
||||
};
|
||||
|
||||
Widget TopLevel;
|
||||
char *Progname;
|
||||
|
||||
|
||||
/* **************************************************************** */
|
||||
/* local data */
|
||||
|
||||
static XrmOptionDescRec options[] = {
|
||||
{ "-2D", "*twoDimensions", XrmoptionNoArg, "True" },
|
||||
{ "-2d", "*twoDimensions", XrmoptionNoArg, "True" },
|
||||
{ "-pbc", "*pbcBond", XrmoptionNoArg, "True" },
|
||||
{ "-remap", "*remap", XrmoptionNoArg, "True" },
|
||||
{ "-scale", "*scale", XrmoptionNoArg, "True" },
|
||||
{ "-copy", "*copyBond", XrmoptionNoArg, "True" },
|
||||
{ "-hollow", "*hollow", XrmoptionNoArg, "True" },
|
||||
{ "-opaque", "*opaque", XrmoptionNoArg, "True" },
|
||||
{ "-V", "*version", XrmoptionNoArg, "True" },
|
||||
{ "-atomcolors","*atomColors", XrmoptionSepArg, NULL },
|
||||
{ "-bondcolors","*bondColors", XrmoptionSepArg, NULL },
|
||||
};
|
||||
|
||||
#define Offset(x,y) (((char *) &(x.y)) - ((char *) &(x)))
|
||||
|
||||
static XtResource resources[] = {
|
||||
{ "hollow", "Hollow",
|
||||
XtRBool, sizeof(Bool),
|
||||
Offset(Common, hollow),
|
||||
XtRImmediate, (XtPointer) FALSE },
|
||||
|
||||
{ "opaque", "Opaque",
|
||||
XtRBool, sizeof(Bool),
|
||||
Offset(Common, opaque),
|
||||
XtRImmediate, (XtPointer) FALSE },
|
||||
|
||||
{ "twoDimensions", "TwoDimensions",
|
||||
XtRBool, sizeof(Bool),
|
||||
Offset(Common, two_d),
|
||||
XtRImmediate, (XtPointer) FALSE },
|
||||
|
||||
{ "pbcBond", "PbcBond",
|
||||
XtRBool, sizeof(Bool),
|
||||
Offset(Common, pbc_bond),
|
||||
XtRImmediate, (XtPointer) FALSE },
|
||||
|
||||
{ "remap", "Remap",
|
||||
XtRBool, sizeof(Bool),
|
||||
Offset(Common, remap),
|
||||
XtRImmediate, (XtPointer) FALSE },
|
||||
|
||||
{ "scale", "Scale",
|
||||
XtRBool, sizeof(Bool),
|
||||
Offset(Common, scaleflag),
|
||||
XtRImmediate, (XtPointer) FALSE },
|
||||
|
||||
{ "copyBond", "CopyBond",
|
||||
XtRBool, sizeof(Bool),
|
||||
Offset(Common, copy_bond),
|
||||
XtRImmediate, (XtPointer) FALSE },
|
||||
|
||||
{ "version", "Version",
|
||||
XtRBool, sizeof(Bool),
|
||||
Offset(Common, version),
|
||||
XtRImmediate, (XtPointer) FALSE },
|
||||
|
||||
{ "atomColors", "AtomColors",
|
||||
XtRInt, sizeof(int),
|
||||
Offset(Common,natomcolors),
|
||||
XtRImmediate, (XtPointer) NCOLORS },
|
||||
|
||||
{ "bondColors", "BondColors",
|
||||
XtRInt, sizeof(int),
|
||||
Offset(Common,nbondcolors),
|
||||
XtRImmediate, (XtPointer) NCOLORS },
|
||||
|
||||
};
|
||||
|
||||
static XtActionsRec actions[] = {
|
||||
{ "ExposeScene", ExposeScene },
|
||||
{ "ExposeAxes", ExposeAxes },
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
XtAppContext AppContext; /* the whole process variable */
|
||||
|
||||
/* Get X stuff going */
|
||||
|
||||
Progname = argv[0];
|
||||
|
||||
TopLevel = XtAppInitialize(&AppContext, "XMovie", options,
|
||||
XtNumber(options), &argc, argv,
|
||||
FallbackResources, NULL, ZERO);
|
||||
|
||||
XtVaGetApplicationResources(TopLevel, (XtPointer) &Common,
|
||||
resources, XtNumber(resources), NULL);
|
||||
|
||||
CheckResources();
|
||||
|
||||
XtAppAddActions(AppContext, actions, XtNumber(actions));
|
||||
|
||||
/* initialize the reading stuff */
|
||||
|
||||
InitRead(argc-1, argv+1);
|
||||
|
||||
/* Create the scene box */
|
||||
|
||||
(void) CreateScene(TopLevel,"scene");
|
||||
|
||||
/* Create the Control panel */
|
||||
|
||||
(void) CreateControl(TopLevel,"control");
|
||||
|
||||
XtRealizeWidget(TopLevel);
|
||||
|
||||
/* put reading into background */
|
||||
|
||||
XtAppAddWorkProc(AppContext, ReadProc, (XtPointer) NULL);
|
||||
|
||||
Setup();
|
||||
Common.init = 1;
|
||||
|
||||
/* Enter Event Loop */
|
||||
|
||||
XtAppMainLoop(AppContext);
|
||||
}
|
||||
|
||||
int Usage(void)
|
||||
{
|
||||
static char *msg[] = {
|
||||
"xmovie - a simple & fast atom/molecule visualizer",
|
||||
" written by Mike Uttormark while at Sandia, 1992",
|
||||
" updated by Steve Plimpton, Sandia National Labs",
|
||||
" contact info: sjplimp@sandia.gov",
|
||||
"",
|
||||
"Usage: xmovie [-Xoptions] [-options] file1 [file2 ...]",
|
||||
" xmovie [-Xoptions] [-options] < file",
|
||||
"",
|
||||
"where -Xoptions are any standard XToolkit options",
|
||||
"-options are any of",
|
||||
" -2d reads two dimensional data files",
|
||||
" -hollow draws hollow atoms",
|
||||
" -opaque draws opaque hollow atoms (implies -hollow)",
|
||||
" -V prints version number and exits",
|
||||
" -pbc does not draw bonds > 1/2 box size",
|
||||
" -remap remap atoms back into bounding box if necessary",
|
||||
" -scale scale atom positions to fill bounding box",
|
||||
" -copy copies bonds from one timestep to next",
|
||||
" -atomcolors n sets number of colors for atoms",
|
||||
" -bondcolors n sets number of colors for bonds",
|
||||
"",
|
||||
"and 'files' are data files in the format",
|
||||
"",
|
||||
" ITEM: TIMESTEP",
|
||||
" time",
|
||||
" ITEM: BOX BOUNDS",
|
||||
" xlow xhigh",
|
||||
" ylow yhigh",
|
||||
" zlow zhigh",
|
||||
" ITEM: BONDS",
|
||||
" type1 atom1a atom1b",
|
||||
" type2 atom2a atom2b",
|
||||
" etc.",
|
||||
" ITEM: ATOMS",
|
||||
" index1 type1 x1 y1 z1",
|
||||
" index2 type2 x2 y2 z2",
|
||||
" etc.",
|
||||
"",
|
||||
"Notes:",
|
||||
" A TIMESTEP item starts a new frame",
|
||||
" A new item (or EOF) ends the list of ATOMS or BONDS",
|
||||
" BOX BOUNDS persist unless reset",
|
||||
" Any items not matching these patterns are skipped",
|
||||
" Data files can be gzipped - e.g. xmovie dump.gz",
|
||||
|
||||
NULL,
|
||||
};
|
||||
|
||||
char **s;
|
||||
char *pager;
|
||||
FILE *pipe;
|
||||
|
||||
/* find user's pager */
|
||||
|
||||
pager = getenv("PAGER");
|
||||
if (!pager || !*pager) pager = "more";
|
||||
pipe = popen(pager, "w");
|
||||
if (!pipe) pipe = stderr;
|
||||
|
||||
for(s = msg; *s; s++)
|
||||
fprintf(pipe,"%s\n", *s);
|
||||
|
||||
if (pipe != stderr) pclose(pipe);
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
PRIVATE void CheckResources(void)
|
||||
{
|
||||
if (Common.version) Version();
|
||||
|
||||
if (Common.natomcolors < 0 || Common.natomcolors > MAXCOLORS)
|
||||
Common.natomcolors = 1;
|
||||
|
||||
if (Common.nbondcolors < 0 || Common.nbondcolors > MAXCOLORS)
|
||||
Common.nbondcolors = 1;
|
||||
|
||||
if (Common.opaque) Common.hollow = TRUE;
|
||||
|
||||
Common.atoms_visible =
|
||||
(Bool *) XtMalloc(Common.natomcolors * sizeof(Bool));
|
||||
|
||||
Common.diameter =
|
||||
(Dimension *) XtMalloc(Common.natomcolors * sizeof(Dimension));
|
||||
|
||||
Common.bonds_visible =
|
||||
(Bool *) XtMalloc(Common.nbondcolors * sizeof(Bool));
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
#ifndef PRIVATE
|
||||
#ifdef USEPRIVATE
|
||||
#define PRIVATE static
|
||||
#else
|
||||
#define PRIVATE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define VERSION "Version 9.0"
|
||||
|
||||
#define NCOLORS 4
|
||||
#define MAXCOLORS 24
|
||||
#define MAXDIAM 100
|
||||
#define MAXTHICK 100
|
||||
|
||||
#define MagicNumber 12344321
|
||||
#define TimeID 100
|
||||
#define BoundID 101
|
||||
#define PositionID 102
|
||||
#define BondID 103
|
||||
#define CopyBondID 104
|
||||
#define CopyAtomID 105
|
||||
|
||||
typedef long INT4;
|
||||
typedef float REAL4;
|
||||
|
||||
typedef INT4 RECORD;
|
||||
typedef INT4 LENGTH;
|
||||
|
||||
typedef struct {
|
||||
INT4 index;
|
||||
INT4 type;
|
||||
REAL4 x;
|
||||
REAL4 y;
|
||||
REAL4 z;
|
||||
} POSITION;
|
||||
|
||||
typedef struct {
|
||||
INT4 type;
|
||||
INT4 index1;
|
||||
INT4 index2;
|
||||
POSITION *atom1;
|
||||
POSITION *atom2;
|
||||
} BOND;
|
||||
|
||||
typedef struct {
|
||||
REAL4 low;
|
||||
REAL4 high;
|
||||
} BOUND;
|
||||
|
||||
typedef struct {
|
||||
REAL4 time;
|
||||
BOUND bounds[3];
|
||||
INT4 natoms;
|
||||
INT4 maxatoms;
|
||||
POSITION *positions;
|
||||
INT4 *natypes;
|
||||
INT4 nbonds;
|
||||
INT4 maxbonds;
|
||||
BOND *bonds;
|
||||
INT4 *nbtypes;
|
||||
} DATA;
|
||||
|
||||
typedef struct {
|
||||
Bool *atoms_visible;
|
||||
Bool *bonds_visible;
|
||||
Bool hollow;
|
||||
Bool opaque;
|
||||
Bool two_d;
|
||||
Bool pbc_bond;
|
||||
Bool remap;
|
||||
Bool scaleflag;
|
||||
Bool copy_bond;
|
||||
Bool version;
|
||||
int natomcolors;
|
||||
int nbondcolors;
|
||||
Dimension *diameter;
|
||||
int init;
|
||||
int motion;
|
||||
int saveflag;
|
||||
unsigned long delay;
|
||||
int next_pos;
|
||||
int step;
|
||||
int dstep;
|
||||
int axis;
|
||||
int direction;
|
||||
BOUND bounds[3];
|
||||
int ndata;
|
||||
int maxdata;
|
||||
DATA *dataptr;
|
||||
float position;
|
||||
float thickness;
|
||||
float offset[3];
|
||||
float scale;
|
||||
} CommonData;
|
||||
|
||||
extern CommonData Common;
|
||||
extern Widget TopLevel;
|
||||
extern char *Progname;
|
||||
|
||||
Widget CreateScene(Widget parent, char *name);
|
||||
Widget CreateControl(Widget parent, char *name);
|
||||
|
||||
void InitRead(int argc, char **argv);
|
||||
Boolean ReadProc(XtPointer client_data);
|
||||
|
||||
void RemoveMotion(void);
|
||||
void InstallMotion(void);
|
||||
void SceneUpdate(void);
|
||||
void SceneSave(void);
|
||||
void SetTime(char *s);
|
||||
int Usage(void);
|
||||
|
||||
void PositionUpdate(void);
|
||||
void SpeedUpdate(void);
|
||||
void ThicknessUpdate(void);
|
||||
void UpdateRadios(void);
|
||||
void SceneSize(Dimension *width, Dimension *height);
|
||||
void Setup(void);
|
||||
void NewDataSetup(void);
|
||||
|
||||
void ExposeScene(Widget w, XEvent *event, String *strings,
|
||||
Cardinal *nstrings);
|
||||
|
||||
void ExposeAxes(Widget w, XEvent *event, String *strings,
|
||||
Cardinal *nstrings);
|
||||
|
||||
int CoerceStep(int step);
|
||||
|
||||
void SetReadString(char *s);
|
||||
|
||||
void SetAtomColors(Pixel *fg);
|
||||
void SetBondColors(Pixel *fg, Dimension *thick);
|
||||
void SetBGColor(Pixel bg);
|
||||
|
||||
void Version(void);
|
||||
|
||||
#ifdef MISSINGDEFS
|
||||
|
||||
/* commented this out for SGI gcc compiler
|
||||
#ifdef stdin
|
||||
int fprintf(FILE *file, char *fmt, ... );
|
||||
int fclose(FILE *file);
|
||||
int printf(char *fmt, ...);
|
||||
int fflush(FILE *f);
|
||||
int pclose(FILE *);
|
||||
int fread(void *, size_t, size_t, FILE *);
|
||||
int fseek(FILE *, long int, int);
|
||||
int ungetc(int c, FILE *f);
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if 0
|
||||
void XtTranslateCoords(Widget w, Position x, Position y, Position *rx,
|
||||
Position *ry);
|
||||
#endif
|
||||
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue