summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sci-chemistry/molmol
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sci-chemistry/molmol')
-rw-r--r--sci-chemistry/molmol/Manifest2
-rw-r--r--sci-chemistry/molmol/files/cast.patch21
-rw-r--r--sci-chemistry/molmol/files/ldflags.patch13
-rw-r--r--sci-chemistry/molmol/files/libpng15.patch32
-rw-r--r--sci-chemistry/molmol/files/molmol-2k_p2-fink.patch356
-rw-r--r--sci-chemistry/molmol/files/opengl.patch96
-rw-r--r--sci-chemistry/molmol/files/pjf_RH9_molmol2k2.diff103
-rw-r--r--sci-chemistry/molmol/files/prefix.patch22
-rw-r--r--sci-chemistry/molmol/files/wild.patch1866
-rw-r--r--sci-chemistry/molmol/metadata.xml5
-rw-r--r--sci-chemistry/molmol/molmol-2k_p2-r2.ebuild80
-rw-r--r--sci-chemistry/molmol/molmol-2k_p2-r3.ebuild84
-rw-r--r--sci-chemistry/molmol/molmol-2k_p2-r4.ebuild86
-rw-r--r--sci-chemistry/molmol/molmol-2k_p2-r5.ebuild85
14 files changed, 2851 insertions, 0 deletions
diff --git a/sci-chemistry/molmol/Manifest b/sci-chemistry/molmol/Manifest
new file mode 100644
index 000000000000..3b9280e4b834
--- /dev/null
+++ b/sci-chemistry/molmol/Manifest
@@ -0,0 +1,2 @@
+DIST molmol-2k.2.0-doc.tar.gz 1062297 SHA256 07e1c3fd04ffe7c9e9d91eaefa0bf72e6d0913a981eec3bf0879bfc65537a6be SHA512 131f747a5762859398ebe9b676a07df56c82c8864ecc035ec914f1dea74dafcd67f87993421dfe5899c640470c7e1e1ef03ae262b04a9b360ae329eb19a331fe WHIRLPOOL b74f47149c4dce8199722075fda17c9cbe22263eec57b647ef543b15386d53b267ee85d5a2c44a4fda7e533fd6ccdafb82fbbbd71e671ec4e1fd58e07363677c
+DIST molmol-2k.2.0-src.tar.gz 1088805 SHA256 1104dcb1b2517581c7d6b1695ff2e92f4076ad34afc48dd896eec38e5acf2287 SHA512 6ab01a6fd3d19752634a2cf22919a20e43d195768bd4bdacd5f0bbe016c3058c94915bad4c7fa64dcd86576be39cad0ae112cb62f5e69ffb10041518101e7a9b WHIRLPOOL e258ede83ac4a8fe9b4a9274588ced7e1294415d864c909ed83e3e56d36512e1388e6f77e45da614bc19992a265d32b739c54aace7faa28971c61a01bba27541
diff --git a/sci-chemistry/molmol/files/cast.patch b/sci-chemistry/molmol/files/cast.patch
new file mode 100644
index 000000000000..16ac411c76e5
--- /dev/null
+++ b/sci-chemistry/molmol/files/cast.patch
@@ -0,0 +1,21 @@
+diff --git a/src/data/DataDist.c b/src/data/DataDist.c
+index 7f7121f..18eef33 100644
+--- a/src/data/DataDist.c
++++ b/src/data/DataDist.c
+@@ -27,6 +27,7 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <stdint.h>
+
+ #include <hashtab.h>
+
+@@ -89,7 +90,7 @@ hashInter(void *p, unsigned size)
+ {
+ TabEntryInter *entryP = p;
+
+- return ((unsigned) entryP->atom1P + (unsigned) entryP->atom2P) % size;
++ return ((unsigned)(uintptr_t) entryP->atom1P + (unsigned)(uintptr_t) entryP->atom2P) % size;
+ }
+
+ static int
diff --git a/sci-chemistry/molmol/files/ldflags.patch b/sci-chemistry/molmol/files/ldflags.patch
new file mode 100644
index 000000000000..ff6e06ef490c
--- /dev/null
+++ b/sci-chemistry/molmol/files/ldflags.patch
@@ -0,0 +1,13 @@
+diff --git a/src/main/Makefile b/src/main/Makefile
+index 74530fa..102d1b7 100644
+--- a/src/main/Makefile
++++ b/src/main/Makefile
+@@ -22,7 +22,7 @@ SRC = $(OBJ:.o=.c)
+ default: $(PROGRAM)
+
+ $(PROGRAM): $(OBJ) $(LIBS) $(SGLIB) $(TOOLSLIB)
+- $(CC) -o $@ $(CFLAGS) $(OBJ) $(LIBS) $(SGLIB) $(TOOLSLIB) $(SYSLIB)
++ $(CC) $(CFLAGS) ${LDFLAGS} -o $@ $(OBJ) $(LIBS) $(SGLIB) $(TOOLSLIB) $(SYSLIB)
+
+ clean:
+ rm -f $(OBJ) $(PROGRAM) core *.ps
diff --git a/sci-chemistry/molmol/files/libpng15.patch b/sci-chemistry/molmol/files/libpng15.patch
new file mode 100644
index 000000000000..cd27e4906608
--- /dev/null
+++ b/sci-chemistry/molmol/files/libpng15.patch
@@ -0,0 +1,32 @@
+--- src/motogl/MotOGLDump.c
++++ src/motogl/MotOGLDump.c
+@@ -248,7 +248,7 @@
+ pngErrHand(png_structp pngStrucP, char *errMsg)
+ {
+ IORaiseError(errMsg);
+- longjmp(pngStrucP->jmpbuf, 1);
++ longjmp(png_jmpbuf(pngStrucP), 1);
+ }
+ #endif
+
+@@ -357,7 +357,7 @@
+ return IO_RES_ERR;
+ }
+
+- if (setjmp(pngStrucP->jmpbuf)) {
++ if (setjmp(png_jmpbuf(pngStrucP))) {
+ if (cBuf != NULL)
+ free(cBuf);
+ if (fBuf != NULL)
+@@ -368,10 +368,7 @@
+
+ png_init_io(pngStrucP, ImgFileP);
+
+- pngInfoP->width = imgW;
+- pngInfoP->height = imgH;
+- pngInfoP->bit_depth = 8;
+- pngInfoP->color_type = PNG_COLOR_TYPE_RGB;
++ png_set_IHDR(pngStrucP, pngInfoP, imgW, imgH, 8, PNG_COLOR_TYPE_RGB, 0, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+ png_write_info(pngStrucP, pngInfoP);
+ }
+ #endif
diff --git a/sci-chemistry/molmol/files/molmol-2k_p2-fink.patch b/sci-chemistry/molmol/files/molmol-2k_p2-fink.patch
new file mode 100644
index 000000000000..14cc83b63e9e
--- /dev/null
+++ b/sci-chemistry/molmol/files/molmol-2k_p2-fink.patch
@@ -0,0 +1,356 @@
+ src/calc/CalcRmsd.c | 8 ++++----
+ src/cmdfig/FigUtil.c | 46 +++++++++++++++++++++++-----------------------
+ src/cmdio/ExWriteSec.c | 6 +++---
+ src/data/DataDist.c | 2 +-
+ src/data/DataHand.c | 8 ++++----
+ src/expr/ExprScan.c | 2 +-
+ src/iodev/IODev.c | 2 --
+ src/motif/MotifDial.c | 2 +-
+ src/motif/MotifMainW.c | 4 ++--
+ src/os/GFile.c | 2 +-
+ src/prim/PrimDraw.c | 2 +-
+ src/prim/RibbonCalc.c | 12 ++++++------
+ src/pudev/PuMainW.c | 2 +-
+ src/tty/TTY.c | 2 +-
+ tools/src/IsoSurface.c | 22 +++++++++++-----------
+ 15 files changed, 60 insertions(+), 62 deletions(-)
+
+diff --git a/src/calc/CalcRmsd.c b/src/calc/CalcRmsd.c
+index 0e4629e..ed99e76 100644
+--- a/src/calc/CalcRmsd.c
++++ b/src/calc/CalcRmsd.c
+@@ -1025,10 +1025,10 @@ CalcRmsd(BOOL fitPairs, char *range, char *glob1, char *glob2,
+ }
+
+ for (propI = 0; propI < 2; propI++) {
+- if (groupNo == 0 || propI == 0 && ! calc1)
++ if (groupNo == 0 || (propI == 0 && ! calc1))
+ continue;
+
+- if (groupNo == 0 || propI == 1 && ! calc2)
++ if (groupNo == 0 || (propI == 1 && ! calc2))
+ continue;
+
+ Report("\nAverage RMSD, dev., min. and max of ");
+@@ -1052,8 +1052,8 @@ CalcRmsd(BOOL fitPairs, char *range, char *glob1, char *glob2,
+ Report(" ");
+
+ for (groupI2 = 0; groupI2 < groupNo; groupI2++) {
+- if (groupI1 < groupI2 &&
+- groupInfoP[groupI1].membNo != groupInfoP[groupI2].membNo ||
++ if (((groupI1 < groupI2) &&
++ (groupInfoP[groupI1].membNo != groupInfoP[groupI2].membNo)) ||
+ groupInfoP[groupI1].membNo == 0 ||
+ groupInfoP[groupI2].membNo == 0) {
+ groupInfoP[groupI2].stat.avg = 0.0f;
+diff --git a/src/cmdfig/FigUtil.c b/src/cmdfig/FigUtil.c
+index 20d403a..b8dc3a6 100644
+--- a/src/cmdfig/FigUtil.c
++++ b/src/cmdfig/FigUtil.c
+@@ -44,29 +44,29 @@ typedef struct {
+ } TabEntry;
+
+ static TabEntry GreekTab[] = {
+- "ALPHA", 'a',
+- "BETA", 'b',
+- "CHI", 'c',
+- "DELTA", 'd',
+- "EPSILON", 'e',
+- "PHI" , 'f',
+- "GAMMA", 'g',
+- "ETA", 'h',
+- "IOTA", 'i',
+- "KAPPA", 'k',
+- "LAMBDA", 'l',
+- "MU", 'm',
+- "NU", 'n',
+- "PI", 'p',
+- "THETA", 'q',
+- "RHO", 'r',
+- "SIGMA", 's',
+- "TAU", 't',
+- "UPSILON", 'u',
+- "OMEGA", 'w',
+- "XI", 'x',
+- "PSI", 'y',
+- "ZETA", 'z'
++ {"ALPHA", 'a'},
++ {"BETA", 'b'},
++ {"CHI", 'c'},
++ {"DELTA", 'd'},
++ {"EPSILON", 'e'},
++ {"PHI" , 'f'},
++ {"GAMMA", 'g'},
++ {"ETA", 'h'},
++ {"IOTA", 'i'},
++ {"KAPPA", 'k'},
++ {"LAMBDA", 'l'},
++ {"MU", 'm'},
++ {"NU", 'n'},
++ {"PI", 'p'},
++ {"THETA", 'q'},
++ {"RHO", 'r'},
++ {"SIGMA", 's'},
++ {"TAU", 't'},
++ {"UPSILON", 'u'},
++ {"OMEGA", 'w'},
++ {"XI", 'x'},
++ {"PSI", 'y'},
++ {"ZETA", 'z'}
+ };
+
+ int
+diff --git a/src/cmdio/ExWriteSec.c b/src/cmdio/ExWriteSec.c
+index 7f705d4..8da8336 100644
+--- a/src/cmdio/ExWriteSec.c
++++ b/src/cmdio/ExWriteSec.c
+@@ -250,9 +250,9 @@ writeSecondary(DhResP *resPA, int resNo)
+
+ if (neighLStart != NO_RES) {
+ if (num != neighLEnd + 1 ||
+- neighNum != neighREnd + 1 && neighNum != neighREnd - 1 ||
+- neighREnd > neighRStart && neighNum != neighREnd + 1 ||
+- neighREnd < neighRStart && neighNum != neighREnd - 1) {
++ (neighNum != neighREnd + 1 && neighNum != neighREnd - 1) ||
++ (neighREnd > neighRStart && neighNum != neighREnd + 1) ||
++ (neighREnd < neighRStart && neighNum != neighREnd - 1)) {
+ writeNeigh(neighLStart, neighLEnd, neighRStart, neighREnd);
+ neighLStart = NO_RES;
+ } else {
+diff --git a/src/data/DataDist.c b/src/data/DataDist.c
+index 18eef33..c683f9e 100644
+--- a/src/data/DataDist.c
++++ b/src/data/DataDist.c
+@@ -117,7 +117,7 @@ fillIntra(TabEntryIntra *entryP, DhAtomP atom1P, DhAtomP atom2P)
+ entryP->atom2I = DhAtomGetNumber(atom2P);
+
+ if (entryP->res1I > entryP->res2I ||
+- entryP->res1I == entryP->res2I && entryP->atom1I > entryP->atom2I) {
++ (entryP->res1I == entryP->res2I && entryP->atom1I > entryP->atom2I)) {
+ t = entryP->res1I;
+ entryP->res1I = entryP->res2I;
+ entryP->res2I = t;
+diff --git a/src/data/DataHand.c b/src/data/DataHand.c
+index b20e29c..368aad3 100644
+--- a/src/data/DataHand.c
++++ b/src/data/DataHand.c
+@@ -2043,8 +2043,8 @@ applyBondList(PropRefP refP, LINLIST bondL, int groupNum,
+ groupNum1 = getGroupNum(bondAddP->res1P->molP);
+ groupNum2 = getGroupNum(bondAddP->res2P->molP);
+ if (atom1P->state == AS_VALID && atom2P->state == AS_VALID &&
+- (groupNum1 == groupNum && groupNum2 == groupNum ||
+- groupNum < 0 && groupNum1 != groupNum2))
++ ((groupNum1 == groupNum && groupNum2 == groupNum) ||
++ (groupNum < 0 && groupNum1 != groupNum2)))
+ applyF(bondP, atom1P, atom2P, clientData);
+ }
+ bondAddP = nextBondAddP;
+@@ -2367,8 +2367,8 @@ callDistApply(PropRefP refP, DhDistP distP, int groupNum,
+ groupNum1 = getGroupNum(distP->res1P->molP);
+ groupNum2 = getGroupNum(distP->res2P->molP);
+ if (atom1P->state == AS_VALID && atom2P->state == AS_VALID &&
+- (groupNum1 == groupNum && groupNum2 == groupNum ||
+- groupNum < 0 && groupNum1 != groupNum2))
++ ((groupNum1 == groupNum && groupNum2 == groupNum) ||
++ (groupNum < 0 && groupNum1 != groupNum2)))
+ applyF(distP, atom1P, atom2P, clientData);
+ }
+ }
+diff --git a/src/expr/ExprScan.c b/src/expr/ExprScan.c
+index dcef69e..6266b4d 100644
+--- a/src/expr/ExprScan.c
++++ b/src/expr/ExprScan.c
+@@ -221,7 +221,7 @@ ExprScanGetSym(void)
+ for (;;) {
+ if (isdigit(ch)) {
+ DStrAppChar(StrVal, ch);
+- } else if (ch == '.' && ExprStr[1] != '.' ||
++ } else if ((ch == '.' && ExprStr[1] != '.') ||
+ ch == 'e' || ch == 'E') {
+ DStrAppChar(StrVal, ch);
+ isFloat = TRUE;
+diff --git a/src/iodev/IODev.c b/src/iodev/IODev.c
+index 9c04ce8..aa4f9a7 100644
+--- a/src/iodev/IODev.c
++++ b/src/iodev/IODev.c
+@@ -44,7 +44,6 @@ extern void IOMotifGLDSetDev(void);
+ #endif
+ #ifdef IO_DEV_MOTIF_OGL
+ extern void IOMotifOGLSetDev(void);
+-extern void IOMotifOGLDSetDev(void);
+ #endif
+ #ifdef IO_DEV_MOTIF_XGL
+ extern void IOMotifXGLSetDev(void);
+@@ -76,7 +75,6 @@ static DevListEntry DevList[] = {
+ #endif
+ #ifdef IO_DEV_MOTIF_OGL
+ {"Motif/OpenGL", IOMotifOGLSetDev},
+- {"Motif/OpenGLD", IOMotifOGLDSetDev},
+ #endif
+ #ifdef IO_DEV_MOTIF_XGL
+ {"Motif/XGL", IOMotifXGLSetDev},
+diff --git a/src/motif/MotifDial.c b/src/motif/MotifDial.c
+index 2514549..6e3bfd7 100644
+--- a/src/motif/MotifDial.c
++++ b/src/motif/MotifDial.c
+@@ -1323,7 +1323,7 @@ PuMotifAddGizmoCB(PuGizmo gizmo, PuGizmoCBType type,
+
+ switch (type) {
+ case PU_CT_ACTIVATE:
+- if (gType == GIZMO_TEXT_FIELD || GIZMO_TEXT)
++ if (gType == (GIZMO_TEXT_FIELD | GIZMO_TEXT))
+ XtAddCallback(gizmo, XmNactivateCallback, textActivateCB, infoP);
+ else if (gType == GIZMO_BUTTON)
+ XtAddCallback(gizmo, XmNactivateCallback, gizmoGenCB, infoP);
+diff --git a/src/motif/MotifMainW.c b/src/motif/MotifMainW.c
+index abbb444..77ce8fd 100644
+--- a/src/motif/MotifMainW.c
++++ b/src/motif/MotifMainW.c
+@@ -80,8 +80,8 @@ checkPressOrExpose(Display *dpy, XEvent *eventP, XPointer arg)
+ {
+ Window *winP = (Window *) arg;
+
+- return eventP->type == ButtonPress && eventP->xbutton.window == *winP ||
+- eventP->type == Expose && eventP->xexpose.window == *winP;
++ return (eventP->type == ButtonPress && eventP->xbutton.window == *winP) ||
++ (eventP->type == Expose && eventP->xexpose.window == *winP);
+ }
+
+ static void
+diff --git a/src/os/GFile.c b/src/os/GFile.c
+index d0d63b6..08d48c7 100644
+--- a/src/os/GFile.c
++++ b/src/os/GFile.c
+@@ -385,7 +385,7 @@ GFileEOF(GFile gf)
+ {
+ if (gf->format == GF_FORMAT_MEMORY)
+ return gf->currP == NULL ||
+- gf->currP->nextP == NULL && gf->currPos == gf->currP->len;
++ (gf->currP->nextP == NULL && gf->currPos == gf->currP->len);
+ else
+ return feof(gf->fp);
+ }
+diff --git a/src/prim/PrimDraw.c b/src/prim/PrimDraw.c
+index 32bd593..ba89c57 100644
+--- a/src/prim/PrimDraw.c
++++ b/src/prim/PrimDraw.c
+@@ -461,7 +461,7 @@ drawRibbon(PrimObjP primP)
+ }
+
+ if (partP->paint == RP_ATOM ||
+- partP->paint == RP_ATOM_SMOOTH && partP->polyNo > 0)
++ (partP->paint == RP_ATOM_SMOOTH && partP->polyNo > 0))
+ SgSetColor(attrP->colR, attrP->colG, attrP->colB);
+
+ if (partP->paint == RP_ATOM_SMOOTH)
+diff --git a/src/prim/RibbonCalc.c b/src/prim/RibbonCalc.c
+index 09874cf..0849d03 100644
+--- a/src/prim/RibbonCalc.c
++++ b/src/prim/RibbonCalc.c
+@@ -907,7 +907,7 @@ calcStrips(PrimObjP primP, PrimObjP prevP)
+ getSplinePoints(partP, ribbonP, ePar, partP->endPar, ePNo + 1,
+ parA + sPNo + mPNo - 1, xA + sPNo + mPNo - 1, dzA + sPNo + mPNo - 1);
+
+- if (partP->style == RS_ROUND && partP->midRad == 0.0f ||
++ if ((partP->style == RS_ROUND && partP->midRad == 0.0f) ||
+ BreakInterrupted()) {
+ /* draw only one line */
+ partP->traceNo = 1;
+@@ -1128,15 +1128,15 @@ calcStrips(PrimObjP primP, PrimObjP prevP)
+ Vec3Copy(partP->traceA[traceI].nvA[pointI], nv);
+ }
+
+- if (pointI == 0 && partP->startStyle == RE_SHARP ||
+- pointI == pointNo - ePNo && partP->endStyle == RE_ARROW)
++ if ((pointI == 0 && partP->startStyle == RE_SHARP) ||
++ (pointI == pointNo - ePNo && partP->endStyle == RE_ARROW))
+ Vec3Copy(partP->polyA[polyI].xA[traceNo - 1 - traceI], x);
+ else if (pointI == pointNo - 1 && partP->endStyle == RE_SHARP)
+ Vec3Copy(partP->polyA[polyI].xA[traceI], x);
+ }
+
+- if (pointI == 0 && partP->startStyle == RE_SHARP ||
+- pointI == pointNo - ePNo && partP->endStyle == RE_ARROW) {
++ if ((pointI == 0 && partP->startStyle == RE_SHARP) ||
++ (pointI == pointNo - ePNo && partP->endStyle == RE_ARROW)) {
+ Vec3Copy(x, dy);
+ Vec3Cross(x, dx);
+ Vec3Copy(partP->polyA[polyI].nv, x);
+@@ -1327,7 +1327,7 @@ RibbonCalc(PrimObjP primP)
+
+ if (! partP->pointValid || prec != partP->prec ||
+ startRad != partP->startRad ||
+- partP->style == RS_ROUND && midRad != partP->midRad ||
++ (partP->style == RS_ROUND && midRad != partP->midRad) ||
+ endRad != partP->endRad || radChanged) {
+ for (i = 0; i < partP->traceNo; i++) {
+ free(partP->traceA[i].xA);
+diff --git a/src/pudev/PuMainW.c b/src/pudev/PuMainW.c
+index 73d183b..d287345 100644
+--- a/src/pudev/PuMainW.c
++++ b/src/pudev/PuMainW.c
+@@ -57,7 +57,7 @@ PuSetTextField(PuTextFieldChoice fieldChoice, char *text)
+ if (text[0] != LOCK_CHAR)
+ return;
+ text++;
+- if (text[0] == '\0' || text[0] == ' ' && text[1] == '\0') {
++ if (text[0] == '\0' || (text[0] == ' ' && text[1] == '\0')) {
+ StatusLocked = FALSE;
+ text = " ";
+ }
+diff --git a/src/tty/TTY.c b/src/tty/TTY.c
+index 0090f75..22adfef 100644
+--- a/src/tty/TTY.c
++++ b/src/tty/TTY.c
+@@ -164,7 +164,7 @@ PuTTYSwitchFullscreen(BOOL onOff)
+ void
+ PuTTYSetTextField(PuTextFieldChoice fieldChoice, char *text)
+ {
+- if (text[0] == '\0' || text[0] == ' ' && text[1] == '\0')
++ if (text[0] == '\0' || (text[0] == ' ' && text[1] == '\0'))
+ return;
+
+ switch (fieldChoice) {
+diff --git a/tools/src/IsoSurface.c b/tools/src/IsoSurface.c
+index 5e11a98..09f89d0 100644
+--- a/tools/src/IsoSurface.c
++++ b/tools/src/IsoSurface.c
+@@ -104,19 +104,19 @@ typedef struct {
+ } Strip;
+
+ static CubeDesc CubeEven = {
+- 0, 3, 5, 6, {{D_0, 1}, {D_0, 2}, {D_0, 3}, {D_0, 4}},
+- 3, 0, 5, 1, {{D_0, 0}, {D_MZ, 4}, {D_MY, 1}, {D_PX, 2}},
+- 0, 3, 6, 2, {{D_0, 0}, {D_MZ, 3}, {D_PY, 2}, {D_MX, 1}},
+- 3, 5, 6, 7, {{D_0, 0}, {D_PX, 3}, {D_PZ, 1}, {D_PY, 4}},
+- 5, 0, 6, 4, {{D_0, 0}, {D_MY, 3}, {D_MX, 4}, {D_PZ, 2}}
++ {{0, 3, 5, 6, {{D_0, 1}, {D_0, 2}, {D_0, 3}, {D_0, 4}}},
++ {3, 0, 5, 1, {{D_0, 0}, {D_MZ, 4}, {D_MY, 1}, {D_PX, 2}}},
++ {0, 3, 6, 2, {{D_0, 0}, {D_MZ, 3}, {D_PY, 2}, {D_MX, 1}}},
++ {3, 5, 6, 7, {{D_0, 0}, {D_PX, 3}, {D_PZ, 1}, {D_PY, 4}}},
++ {5, 0, 6, 4, {{D_0, 0}, {D_MY, 3}, {D_MX, 4}, {D_PZ, 2}}}}
+ };
+
+ static CubeDesc CubeOdd = {
+- 1, 2, 7, 4, {{D_0, 1}, {D_0, 2}, {D_0, 3}, {D_0, 4}},
+- 2, 1, 7, 3, {{D_0, 0}, {D_MZ, 3}, {D_PX, 2}, {D_PY, 1}},
+- 1, 2, 4, 0, {{D_0, 0}, {D_MZ, 4}, {D_MX, 1}, {D_MY, 2}},
+- 2, 7, 4, 6, {{D_0, 0}, {D_PY, 4}, {D_PZ, 2}, {D_MX, 3}},
+- 7, 1, 4, 5, {{D_0, 0}, {D_PX, 4}, {D_MY, 3}, {D_PZ, 1}}
++ {{1, 2, 7, 4, {{D_0, 1}, {D_0, 2}, {D_0, 3}, {D_0, 4}}},
++ {2, 1, 7, 3, {{D_0, 0}, {D_MZ, 3}, {D_PX, 2}, {D_PY, 1}}},
++ {1, 2, 4, 0, {{D_0, 0}, {D_MZ, 4}, {D_MX, 1}, {D_MY, 2}}},
++ {2, 7, 4, 6, {{D_0, 0}, {D_PY, 4}, {D_PZ, 2}, {D_MX, 3}}},
++ {7, 1, 4, 5, {{D_0, 0}, {D_PX, 4}, {D_MY, 3}, {D_PZ, 1}}}}
+ };
+
+ static BOOL Initialized = FALSE;
+@@ -158,7 +158,7 @@ fillFaces(TetDesc *tetP)
+ static BOOL
+ equalPair(int i00, int i01, int i10, int i11)
+ {
+- return i00 == i10 && i01 == i11 || i00 == i11 && i01 == i10;
++ return (i00 == i10 && i01 == i11) || (i00 == i11 && i01 == i10);
+ }
+
+ static int
diff --git a/sci-chemistry/molmol/files/opengl.patch b/sci-chemistry/molmol/files/opengl.patch
new file mode 100644
index 000000000000..c1db35d9013d
--- /dev/null
+++ b/sci-chemistry/molmol/files/opengl.patch
@@ -0,0 +1,96 @@
+ molmol | 65 +++++++++--------------------------------------------------------
+ 1 file changed, 9 insertions(+), 56 deletions(-)
+
+diff --git a/molmol b/molmol
+index 7863225..b6c75ce 100755
+--- a/molmol
++++ b/molmol
+@@ -11,55 +11,8 @@ ostype=`uname`
+ osrel=`uname -r`
+ osmaj=`echo $osrel | awk -F. '{print $1}'`
+ osmin=`echo $osrel | awk -F. '{print $2}'`
+-localdev=
+-glxdev=
+-
+-if [ $ostype = "IRIX" -o $ostype = "IRIX64" ]; then
+- if [ $osmaj -eq 6 -a $osmin -ge 2 -o $osmaj -gt 6 ]; then
+- arch=sgi6
+- localdev=Motif/OpenGL
+- glxdev=Motif/OpenGL
+- elif [ $osmaj -eq 5 -a $osmin -ge 3 -o $osmaj -gt 5 ]; then
+- arch=sgi5
+- localdev=Motif/OpenGL
+- glxdev=Motif/OpenGL
+- else
+- arch=sgi4
+- localdev=Motif/GL
+- fi
+- MONITOR=72HZ; export MONITOR
+-elif [ $ostype = "AIX" ]; then
+- arch=aix
+- localdev=Motif/OpenGL
+-elif [ $ostype = "HP-UX" ]; then
+- arch=hp
+- localdev=Motif/OpenGL
+- glxdev=Motif/OpenGL
+-elif [ $ostype = "OSF1" ]; then
+- arch=dec
+- localdev=Motif/OpenGL
+-elif [ $ostype = "Linux" ]; then
+- arch=lnx
+- localdev=Motif/OpenGL
+-elif [ $ostype = "SunOS" ]; then
+- if [ $osmaj -eq 5 -a $osmin -ge 4 -o $osmaj -gt 5 ]; then
+- arch=sol
+- localdev=Motif/OpenGL
+- else
+- arch=sun
+- fi
+-else
+- arch=unknown
+-fi
+-
+-if [ $ostype = "SunOS" ]; then
+- xdpy=/usr/openwin/bin/xdpyinfo
+-elif [ $ostype = "HP-UX" ]; then
+- xdpy=/usr/contrib/bin/X11/xdpyinfo
+-else
+- xdpy=/usr/bin/X11/xdpyinfo
+-fi
+-
++localdev=Motif/OpenGL
++glxdev=Motif/OpenGL
+ printUsage () {
+ echo "Usage: molmol -ht2as [-o dev] [-r range] [-f macro] files"
+ echo ""
+@@ -121,15 +74,15 @@ done
+
+ magictmp=/tmp/molmol_magic$$
+
+-if [ ! -d $HOME/molmol ]; then
+- mkdir $HOME/molmol
++if [ ! -d $HOME/.molmol ]; then
++ mkdir $HOME/.molmol
+ fi
+-startmacro=$HOME/molmol/options.mac
++startmacro=$HOME/.molmol/options.mac
+ cp /dev/null $startmacro
+
+ if [ -n "$*" ]; then
+- if [ -f $HOME/molmol/dump ]; then
+- mv -f $HOME/molmol/dump $HOME/molmol/dump.old
++ if [ -f $HOME/.molmol/dump ]; then
++ mv -f $HOME/.molmol/dump $HOME/.molmol/dump.old
+ fi
+ echo "0 long 0x3b7a12f9 MOLMOL" > $magictmp
+ echo "0 long 0xf9127a3b MOLMOL" >> $magictmp
+@@ -209,7 +162,7 @@ elif [ -x $xdpy ]; then
+ fi
+
+ if [ "$input" = "-" -o -n "$nograph" ]; then
+- $MOLMOLHOME/molmol.$arch $xopt
++ $MOLMOLHOME/molmol $xopt
+ else
+- $MOLMOLHOME/molmol.$arch $xopt < /dev/null
++ $MOLMOLHOME/molmol $xopt < /dev/null
+ fi
diff --git a/sci-chemistry/molmol/files/pjf_RH9_molmol2k2.diff b/sci-chemistry/molmol/files/pjf_RH9_molmol2k2.diff
new file mode 100644
index 000000000000..0ad57d93e107
--- /dev/null
+++ b/sci-chemistry/molmol/files/pjf_RH9_molmol2k2.diff
@@ -0,0 +1,103 @@
+Only in molmol_rh9: makedef
+diff -ru molmol_rh9_unpatched/makedef.lnx molmol_rh9/makedef.lnx
+--- molmol_rh9_unpatched/makedef.lnx 2003-01-20 16:10:18.000000000 -0500
++++ molmol_rh9/makedef.lnx 2003-05-06 10:40:08.000000000 -0400
+@@ -1,31 +1,38 @@
+ # definitions for Linux
+
+-MISSFUNC = -Dsqrtf=sqrt -Dexpf=exp -Dlogf=log -Dpowf=pow \
+- -Dsinf=sin -Dcosf=cos -Dtanf=tan \
+- -Dasinf=asin -Dacosf=acos -Datanf=atan -Datan2f=atan2 \
+- -Dfabsf=fabs -Dceilf=ceil
+-MCPPFLAGS = $(MISSFUNC)
+-MCFLAGS = -O2
+-
+-RANLIB = /bin/true
+-WAIT = /usr/bin/sleep 2
+-SHELL = /bin/sh
+-CPP = /lib/cpp
+-CC = /usr/bin/gcc
++#TIFFDIR = $(TOP)/tiff-v3.4/libtiff
++#JPEGDIR = $(TOP)/../libjpeg/jpeg-6a
++#PNGDIR = $(TOP)/../libpng/libpng-0.89c
++#ZLIBDIR = $(TOP)/../libpng/zlib-1.0.2
++
++IMGDEF = -DTIFF_SUPPORT -DJPEG_SUPPORT -DPNG_SUPPORT
++IMGLIB = -ltiff -ljpeg -lpng -lz
++IMGINCL = # -I$(TIFFDIR) -I$(JPEGDIR) -I$(PNGDIR) -I$(ZLIBDIR)
++
++XINCL = -I/usr/X11R6/include
++
++CC=gcc
++MCPPFLAGS =
++MCFLAGS =-pipe -O3 -ffast-math -march=i686 -mcpu=i686
++
++RANLIB = /bin/true
++WAIT = sleep 2
++SHELL = /bin/sh
++CPP = /lib/cpp
+
+-SGDEVDIR = x11 no pov rib vrml1 vrml2 ps fm
+-
+-SGDEVDEF = -DSG_DEV_X11 -DSG_DEV_NO -DSG_DEV_POV -DSG_DEV_RIB -DSG_DEV_VRML1 -DSG_DEV_VRML2 -DSG_DEV_PS -DSG_DEV_CPS -DSG_DEV_FM3 -DSG_DEV_FM4
++SGDEVDIR = ogl x11 no pov rib vrml1 vrml2 ps fm
++SGDEVDEF = -DSG_DEV_OGL -DSG_DEV_X11 -DSG_DEV_NO -DSG_DEV_POV -DSG_DEV_RIB -DSG_DEV_VRML1 -DSG_DEV_VRML2 -DSG_DEV_PS -DSG_DEV_CPS -DSG_DEV_FM3 -DSG_DEV_FM4
+
+ PUDEVDIR = motif tty
+ PUDEVDEF = -DPU_DEV_MOTIF -DPU_DEV_TTY
+
+-IODEVDIR = motx11 ttyno
+-IODEVDEF = -DIO_DEV_MOTIF_X11 -DIO_DEV_TTY_NO
++IODEVDIR = motogl motx11 ttyno
++IODEVDEF = -DIO_DEV_MOTIF_OGL -DIO_DEV_MOTIF_X11 -DIO_DEV_TTY_NO
+
++OPENGLDEF = -DOPENGL_SGI_STEREO
+ MOTIFDEF = -DFUNCPROTO
+
+-SYSLIB = -L/usr/X11R6/lib -lXm -lXt -lXpm -lX11 -lm -lc -lieee
++SYSLIB = -lGLw -lGLU -lGL -lXm -lXpm -lXt -lXext -lX11 -lm
+
+ TOOLSDIR = $(TOP)/tools
+-SGDIR = $(TOP)/sg
++SGDIR = $(TOP)/sg
+diff -ru molmol_rh9_unpatched/src/motogl/MotOGL.c molmol_rh9/src/motogl/MotOGL.c
+--- molmol_rh9_unpatched/src/motogl/MotOGL.c 2000-05-29 12:31:51.000000000 -0400
++++ molmol_rh9/src/motogl/MotOGL.c 2003-05-06 11:51:05.000000000 -0400
+@@ -31,7 +31,7 @@
+ #include <Xm/XmStrDefs.h>
+
+ #define BOOL MOTIF_BOOL /* hack to avoid naming conflict */
+-#include <X11/GLw/GLwMDrawA.h>
++#include <GL/GLwMDrawA.h>
+ #undef BOOL
+
+ #include <sg.h>
+diff -ru molmol_rh9_unpatched/src/os/GFile.c molmol_rh9/src/os/GFile.c
+--- molmol_rh9_unpatched/src/os/GFile.c 2001-06-17 14:59:17.000000000 -0400
++++ molmol_rh9/src/os/GFile.c 2003-05-06 12:34:34.000000000 -0400
+@@ -30,6 +30,7 @@
+ #include <string.h>
+ #include <memory.h>
+ #include <ctype.h>
++#include <errno.h>
+
+ #include <linlist.h>
+
+@@ -38,7 +39,7 @@
+ const INT32 GFMagic = 0x3b7a12f9;
+
+ #ifndef __linux__
+-extern char *sys_errlist[];
++extern char *strerror();
+ #endif
+ extern int errno;
+
+@@ -81,7 +82,7 @@
+ {
+ if (msg == NULL) {
+ if (NextMsg == NULL)
+- msg = sys_errlist[errno];
++ msg = strerror(errno);
+ else
+ msg = NextMsg;
+ }
diff --git a/sci-chemistry/molmol/files/prefix.patch b/sci-chemistry/molmol/files/prefix.patch
new file mode 100644
index 000000000000..89f17b2e984e
--- /dev/null
+++ b/sci-chemistry/molmol/files/prefix.patch
@@ -0,0 +1,22 @@
+diff --git a/molmol b/molmol
+index e774abf..9f10558 100755
+--- a/molmol
++++ b/molmol
+@@ -57,7 +57,7 @@ if [ $ostype = "SunOS" ]; then
+ elif [ $ostype = "HP-UX" ]; then
+ xdpy=/usr/contrib/bin/X11/xdpyinfo
+ else
+- xdpy=/usr/bin/X11/xdpyinfo
++ xdpy=@GENTOO_PORTAGE_EPREFIX@/usr/bin/xdpyinfo
+ fi
+
+ printUsage () {
+@@ -119,7 +119,7 @@ while [ -n "$*" ]; do
+ esac
+ done
+
+-magictmp=/tmp/molmol_magic$$
++magictmp=@GENTOO_PORTAGE_EPREFIX@/tmp/molmol_magic$$
+
+ if [ ! -d $HOME/molmol ]; then
+ mkdir $HOME/molmol
diff --git a/sci-chemistry/molmol/files/wild.patch b/sci-chemistry/molmol/files/wild.patch
new file mode 100644
index 000000000000..8be9baf92203
--- /dev/null
+++ b/sci-chemistry/molmol/files/wild.patch
@@ -0,0 +1,1866 @@
+ include/cmd_dial.h | 1 +
+ include/cmd_io.h | 7 +-
+ include/cmd_struc.h | 1 +
+ include/curr_dir.h | 1 +
+ include/data_hand.h | 6 +
+ src/cip/cmd_tab.h | 3 +
+ src/cmddial/ExDialColor.c | 314 +++++++++++++++++++++++++++++++-----------
+ src/cmddial/ExDialRes.c | 340 ++++++++++++++++++++++++++++++++++++++++++++++
+ src/cmddial/Makefile | 2 +-
+ src/cmdio/ExPdb.c | 70 +++++++++-
+ src/cmdstruc/ExBuild.c | 123 +++++++++++++++++
+ src/data/DataHand.c | 114 +++++++++++++++-
+ src/iodev/IODev.c | 2 +
+ src/main/MolInit.c | 5 +-
+ src/main/MolMol.c | 2 +-
+ src/motif/MotifDial.c | 32 ++---
+ src/motogl/MotOGLDump.c | 2 +-
+ src/os/CurrDir.c | 46 ++-----
+ src/os/ProgDir.c | 25 +++-
+ src/win/WinDial.c | 255 +++++++++++++++++-----------------
+ src/winogl/WinOGLDump.c | 7 +-
+ 21 files changed, 1073 insertions(+), 285 deletions(-)
+
+diff --git a/include/cmd_dial.h b/include/cmd_dial.h
+index f60e918..47fb8f8 100644
+--- a/include/cmd_dial.h
++++ b/include/cmd_dial.h
+@@ -29,6 +29,7 @@ extern ErrCode ExUserInterface(char *);
+
+ extern ErrCode ExDialColor(char *);
+ extern ErrCode ExDialMol(char *);
++extern ErrCode ExDialRes(char *);
+ extern ErrCode ExDialMeasure(char *);
+ extern ErrCode ExDialRmsd(char *);
+ extern ErrCode ExDialSelect(char *);
+diff --git a/include/cmd_io.h b/include/cmd_io.h
+index 79b173c..9a7b12c 100644
+--- a/include/cmd_io.h
++++ b/include/cmd_io.h
+@@ -30,15 +30,16 @@ extern ErrCode ExReadAng(char *);
+ extern ErrCode ExReadDg(char *);
+ extern ErrCode ExReadDump(char *);
+ extern ErrCode ExReadLib(char *);
+-extern ErrCode ExReadPdb(char *);
+-extern ErrCode ExReadSeq(char *);
+-extern ErrCode ExReadShift(char *);
+ extern ErrCode ExReadLimit(char *);
+ extern ErrCode ExReadListAng(char *);
+ extern ErrCode ExReadListDg(char *);
+ extern ErrCode ExReadListPdb(char *);
++extern ErrCode ExReadOldPdb(char *);
+ extern ErrCode ExReadOmap(char *);
++extern ErrCode ExReadPdb(char *);
+ extern ErrCode ExReadPot(char *);
++extern ErrCode ExReadSeq(char *);
++extern ErrCode ExReadShift(char *);
+ extern ErrCode ExReadSybyl(char *);
+ extern ErrCode ExReadXyz(char *);
+ extern ErrCode ExWriteAng(char *);
+diff --git a/include/cmd_struc.h b/include/cmd_struc.h
+index e0d729f..f4950b9 100644
+--- a/include/cmd_struc.h
++++ b/include/cmd_struc.h
+@@ -33,6 +33,7 @@ extern ErrCode ExAddDist(char *);
+ extern ErrCode ExAddLimit(char *);
+ extern ErrCode ExAddPseudo(char *);
+ extern ErrCode ExAddRes(char *);
++extern ErrCode ExMakeMolCyclic(char *);
+ extern ErrCode ExChangeRes(char *);
+ extern ErrCode ExFirstMol(char *);
+ extern ErrCode ExFlipAtom(char *);
+diff --git a/include/curr_dir.h b/include/curr_dir.h
+index c7895c4..04e404d 100644
+--- a/include/curr_dir.h
++++ b/include/curr_dir.h
+@@ -26,6 +26,7 @@
+ #ifndef _CURR_DIR_H_
+ #define _CURR_DIR_H_
+
++extern void CurrDirSet(char *dir);
+ extern char *CurrDirGet(void);
+
+ #endif /* _CURR_DIR_H_ */
+diff --git a/include/data_hand.h b/include/data_hand.h
+index 4462328..74a716a 100644
+--- a/include/data_hand.h
++++ b/include/data_hand.h
+@@ -112,6 +112,7 @@ extern void DhMolMoveFirst(DhMolP);
+ extern void DhMolDestroy(DhMolP);
+
+ extern DhResP DhResNew(DhMolP, DhResDefP, DhSeqPos);
++extern DhResP DhResNewCyclic(DhMolP, DhResDefP, DhSeqPos);
+ extern void DhResMutate(DhResP, DhResDefP, DhMutationKind);
+ extern void DhResSetNeigh(DhResP, DhNeighChoice, DhResP);
+ extern BOOL DhResDestroy(DhResP);
+@@ -287,6 +288,7 @@ extern void DhMolGetTransVect(DhMolP, Vec3);
+ extern MolAttrP DhMolGetAttr(DhMolP);
+
+ extern DSTR DhResGetName(DhResP);
++extern DhAtomP DhResGetAtomA(DhResP);
+ extern int DhResGetNumber(DhResP);
+
+ extern DSTR DhAtomGetName(DhAtomP);
+@@ -335,6 +337,10 @@ extern void DhResAnglesChanged(DhResP);
+ extern void DhResDockPrev(DhResP);
+ extern void DhResDockNext(DhResP);
+ extern void DhResCalcAtom(DhResP, DSTR);
++extern DhResP DhResPrev(DhResP resP);
++extern DhResP DhResNext(DhResP resP);
++extern DhResP DhResFirst(DhMolP molP);
++extern DhResP DhResLast(DhMolP molP);
+
+ /* dump/undump */
+
+diff --git a/src/cip/cmd_tab.h b/src/cip/cmd_tab.h
+index 0b73f65..cf7bc2a 100644
+--- a/src/cip/cmd_tab.h
++++ b/src/cip/cmd_tab.h
+@@ -108,6 +108,7 @@ static CmdTabEntry BuiltinCmdTab[] = {
+ {"DialColor", ExDialColor, US_NONE},
+ {"DialMeasure", ExDialMeasure, US_NONE},
+ {"DialMol", ExDialMol, US_NONE},
++ {"DialRes", ExDialRes, US_NONE},
+ {"DialRmsd", ExDialRmsd, US_NONE},
+ {"DialSelect", ExDialSelect, US_NONE},
+ {"DialStyle", ExDialStyle, US_NONE},
+@@ -164,6 +165,7 @@ static CmdTabEntry BuiltinCmdTab[] = {
+ {"ListSelectedDist", ExListSelected, US_NONE},
+ {"ListSelectedMol", ExListSelected, US_NONE},
+ {"ListSelectedRes", ExListSelected, US_NONE},
++ {"MakeMolCyclic", ExMakeMolCyclic, US_ALL},
+ {"MaterialAtom", ExMaterial, US_ALL},
+ {"MaterialBond", ExMaterial, US_ALL},
+ {"MaterialDist", ExMaterial, US_ALL},
+@@ -213,6 +215,7 @@ static CmdTabEntry BuiltinCmdTab[] = {
+ {"ReadListDg", ExReadListDg, US_ALL},
+ {"ReadListPdb", ExReadListPdb, US_ALL},
+ {"ReadLol", ExReadLimit, US_ALL},
++ {"ReadOldPdb", ExReadOldPdb, US_ALL},
+ {"ReadOmap", ExReadOmap, US_ALL},
+ {"ReadPdb", ExReadPdb, US_ALL},
+ {"ReadPot", ExReadPot, US_ALL},
+diff --git a/src/cmddial/ExDialColor.c b/src/cmddial/ExDialColor.c
+index f960e1d..e827c4f 100644
+--- a/src/cmddial/ExDialColor.c
++++ b/src/cmddial/ExDialColor.c
+@@ -43,6 +43,9 @@
+ #define NAME_LEN 100
+ #define NUM_LEN 6
+ #define CMD_NO 7
++#define MAXRGBVALUE 255
++#define ICOLOR(c) (int) ((float)c * (float)MAXRGBVALUE)
++#define FCOLOR(c) (float) ((float)c / (float)MAXRGBVALUE)
+
+ #define EPS ((float) 1.0e-5)
+
+@@ -56,8 +59,8 @@ typedef struct {
+ static ColorDesc *ColorList;
+ static int ColorNo = 0;
+ static BOOL DialOn = FALSE;
+-static PuGizmo DialGizmo = NULL, NameGizmo, RGizmo, GGizmo, BGizmo, ColGizmo;
+-static DSTR NameStr = NULL, RStr, GStr, BStr;
++static PuGizmo DialGizmo = NULL, NameGizmo, RGizmo, GGizmo, BGizmo, ColGizmo, rGizmo, gGizmo, bGizmo;
++static DSTR NameStr = NULL, RStr, GStr, BStr, rStr, gStr, bStr;
+
+ static char *LabelList[] = {
+ "Back",
+@@ -136,22 +139,50 @@ editCB(PuGizmo g, char *name, void *clientData, void *callData)
+ char *field = clientData;
+ PuTextCBStruc *callP = callData;
+
+- if (field[0] == 'N')
++ if (field[0] == 'N') {
+ DStrAssignStr(NameStr, callP->newText);
+- else if (field[0] == 'R')
++ }
++ else if (field[0] == 'R') {
+ DStrAssignStr(RStr, callP->newText);
+- else if (field[0] == 'G')
++ }
++ else if (field[0] == 'G') {
+ DStrAssignStr(GStr, callP->newText);
+- else
++ }
++ else if (field[0] == 'B') {
+ DStrAssignStr(BStr, callP->newText);
++ }
++ else if (field[0] == 'r') {
++ DStrAssignStr(rStr, callP->newText);
++ }
++ else if (field[0] == 'g') {
++ DStrAssignStr(gStr, callP->newText);
++ }
++ else if (field[0] == 'b') {
++ DStrAssignStr(bStr, callP->newText);
++ }
+ }
+
+ static void
+ updateFields(int colorI)
+ {
++ char buf[10];
++ float f;
++
+ PuSetStr(RGizmo, PU_SC_TEXT, ColorList[colorI].r);
+ PuSetStr(GGizmo, PU_SC_TEXT, ColorList[colorI].g);
+ PuSetStr(BGizmo, PU_SC_TEXT, ColorList[colorI].b);
++
++ f = atof(ColorList[colorI].r);
++ (void) sprintf(buf, "%i", ICOLOR(f));
++ PuSetStr(rGizmo, PU_SC_TEXT, buf);
++
++ f = atof(ColorList[colorI].g);
++ (void) sprintf(buf, "%i", ICOLOR(f));
++ PuSetStr(gGizmo, PU_SC_TEXT, buf);
++
++ f = atof(ColorList[colorI].b);
++ (void) sprintf(buf, "%i", ICOLOR(f));
++ PuSetStr(bGizmo, PU_SC_TEXT, buf);
+ }
+
+ static void
+@@ -190,17 +221,96 @@ activateCB(PuGizmo g, char *name, void *clientData, void *callData)
+ {
+ char *field = clientData;
+ int i;
++ float f;
++ char buf[10];
+
+ if (field[0] == 'N') {
+ for (i = 0; i < ColorNo; i++)
+ if (strcmp(ColorList[i].name, DStrToStr(NameStr)) == 0) {
+- updateFields(i);
+- break;
++ updateFields(i);
++ break;
+ }
+ } else {
++ if (field[0] == 'R') {
++ f = atof(DStrToStr(RStr));
++ if (f>1.0) {
++ f=1.0;
++ i=MAXRGBVALUE;
++ sprintf(buf,"%1.3f", FCOLOR(i));
++ DStrAssignStr(RStr, buf);
++ PuSetStr(RGizmo, PU_SC_TEXT, buf);
++ }
++ sprintf(buf,"%i", ICOLOR(f));
++ DStrAssignStr(rStr, buf);
++ PuSetStr(rGizmo, PU_SC_TEXT, buf);
++ }
++ else if (field[0] == 'G') {
++ f = atof(DStrToStr(GStr));
++ if (f>1.0) {
++ f=1.0;
++ i=MAXRGBVALUE;
++ sprintf(buf,"%1.3f", FCOLOR(i));
++ DStrAssignStr(GStr, buf);
++ PuSetStr(GGizmo, PU_SC_TEXT, buf);
++ }
++ sprintf(buf,"%i", ICOLOR(f));
++ DStrAssignStr(gStr, buf);
++ PuSetStr(gGizmo, PU_SC_TEXT, buf);
++ }
++ else if (field[0] == 'B') {
++ f = atof(DStrToStr(BStr));
++ if (f>1.0) {
++ f=1.0;
++ i=MAXRGBVALUE;
++ sprintf(buf,"%1.3f", FCOLOR(i));
++ DStrAssignStr(BStr, buf);
++ PuSetStr(BGizmo, PU_SC_TEXT, buf);
++ }
++ sprintf(buf,"%i", ICOLOR(f));
++ DStrAssignStr(bStr, buf);
++ PuSetStr(bGizmo, PU_SC_TEXT, buf);
++ }
++ else if (field[0] == 'r') {
++ i = atoi(DStrToStr(rStr));
++ if (i>MAXRGBVALUE) {
++ f=1.0;
++ i=MAXRGBVALUE;
++ sprintf(buf,"%i", ICOLOR(f));
++ DStrAssignStr(rStr, buf);
++ PuSetStr(rGizmo, PU_SC_TEXT, buf);
++ }
++ sprintf(buf,"%1.3f", FCOLOR(i));
++ DStrAssignStr(RStr, buf);
++ PuSetStr(RGizmo, PU_SC_TEXT, buf);
++ }
++ else if (field[0] == 'g') {
++ i = atoi(DStrToStr(gStr));
++ if (i>MAXRGBVALUE) {
++ f=1.0;
++ i=MAXRGBVALUE;
++ sprintf(buf,"%i", ICOLOR(f));
++ DStrAssignStr(gStr, buf);
++ PuSetStr(gGizmo, PU_SC_TEXT, buf);
++ }
++ sprintf(buf,"%1.3f", FCOLOR(i));
++ DStrAssignStr(GStr, buf);
++ PuSetStr(GGizmo, PU_SC_TEXT, buf);
++ }
++ else if (field[0] == 'b') {
++ i = atoi(DStrToStr(bStr));
++ if (i>MAXRGBVALUE) {
++ f=1.0;
++ i=MAXRGBVALUE;
++ sprintf(buf,"%i", ICOLOR(f));
++ DStrAssignStr(bStr, buf);
++ PuSetStr(bGizmo, PU_SC_TEXT, buf);
++ }
++ sprintf(buf,"%1.3f", FCOLOR(i));
++ DStrAssignStr(BStr, buf);
++ PuSetStr(BGizmo, PU_SC_TEXT, buf);
++ }
+ showName();
+ }
+-
+ showColor();
+ }
+
+@@ -258,13 +368,20 @@ showAttr(AttrP attrP)
+ {
+ char buf[10];
+
+- (void) sprintf(buf, "%5.3f", attrP->colR);
++ (void) sprintf(buf, "%1.3f", attrP->colR);
+ PuSetStr(RGizmo, PU_SC_TEXT, buf);
+- (void) sprintf(buf, "%5.3f", attrP->colG);
++ (void) sprintf(buf, "%1.3f", attrP->colG);
+ PuSetStr(GGizmo, PU_SC_TEXT, buf);
+- (void) sprintf(buf, "%5.3f", attrP->colB);
++ (void) sprintf(buf, "%1.3f", attrP->colB);
+ PuSetStr(BGizmo, PU_SC_TEXT, buf);
+
++ (void) sprintf(buf, "%i", ICOLOR(attrP->colR));
++ PuSetStr(rGizmo, PU_SC_TEXT, buf);
++ (void) sprintf(buf, "%i", ICOLOR(attrP->colG));
++ PuSetStr(gGizmo, PU_SC_TEXT, buf);
++ (void) sprintf(buf, "%i", ICOLOR(attrP->colB));
++ PuSetStr(bGizmo, PU_SC_TEXT, buf);
++
+ showName();
+ showColor();
+ }
+@@ -315,107 +432,152 @@ buildDial(void)
+ PuGizmo g;
+ PuConstraints con;
+ int i;
+-
+- DialGizmo = PuCreateDialog("Color Dialog", 7, 5);
+- PuSetBool(DialGizmo, PU_BC_PLACE_OUTSIDE, TRUE);
+-
+- con.x = 0;
+- con.w = 1;
+- con.h = 1;
+-
+- g = PuCreateLabel(DialGizmo, "Name");
+- con.y = 0;
+- PuSetConstraints(g, con);
+- PuSwitchGizmo(g, TRUE);
+-
+- g = PuCreateLabel(DialGizmo, "Red");
+- con.y = 1;
+- PuSetConstraints(g, con);
+- PuSwitchGizmo(g, TRUE);
+-
+- g = PuCreateLabel(DialGizmo, "Green");
+- con.y = 2;
+- PuSetConstraints(g, con);
+- PuSwitchGizmo(g, TRUE);
+-
+- g = PuCreateLabel(DialGizmo, "Blue");
+- con.y = 3;
+- PuSetConstraints(g, con);
+- PuSwitchGizmo(g, TRUE);
+-
+- con.x = 1;
+- con.w = 2;
+- con.h = 1;
+-
+ NameStr = DStrNew();
++
+ RStr = DStrNew();
+ GStr = DStrNew();
+ BStr = DStrNew();
++ rStr = DStrNew();
++ gStr = DStrNew();
++ bStr = DStrNew();
++
+ DStrAssignStr(RStr, "0.0");
+ DStrAssignStr(GStr, "0.0");
+ DStrAssignStr(BStr, "0.0");
++ DStrAssignStr(rStr, "0");
++ DStrAssignStr(gStr, "0");
++ DStrAssignStr(bStr, "0");
+
++ DialGizmo = PuCreateDialog("Color Dialog", 3, 20);
++ PuSetBool(DialGizmo, PU_BC_PLACE_OUTSIDE, TRUE);
++
++ con.x = 1;
++ con.y = 0;
++ con.w = 2;
++ con.h = 3;
++ ColGizmo = PuCreateColorField(DialGizmo, "Color");
++ PuSetConstraints(ColGizmo, con);
++ PuSetConstraints(ColGizmo, con);
++ showColor();
++ PuSwitchGizmo(ColGizmo, TRUE);
++
++ con.x = 0;
++ con.y = 4;
++ con.w = 1;
++ con.h = 1;
++ g = PuCreateLabel(DialGizmo, "Name");
++ PuSetConstraints(g, con);
++ PuSwitchGizmo(g, TRUE);
++ con.x = 1;
++ con.w = 2;
++ con.h = 1;
+ NameGizmo = PuCreateTextField(DialGizmo, "Name", DStrToStr(NameStr));
+- con.y = 0;
+ PuSetConstraints(NameGizmo, con);
+- PuSetInt(NameGizmo, PU_IC_TEXT_WIDTH, 13);
++ PuSetInt(NameGizmo, PU_IC_TEXT_WIDTH, 10);
+ PuAddGizmoCB(NameGizmo, PU_CT_MODIFY, editCB, "N", NULL);
+ PuAddGizmoCB(NameGizmo, PU_CT_ACTIVATE, activateCB, "N", NULL);
+ showName();
+ PuSwitchGizmo(NameGizmo, TRUE);
+
+- RGizmo = PuCreateTextField(DialGizmo, "Red", DStrToStr(RStr));
+- con.y = 1;
++ con.x = 1;
++ con.y = 5;
++ con.w = 2;
++ con.h = 5;
++ g = PuCreateList(DialGizmo, "Color List");
++ for (i = 0; i < ColorNo; i++)
++ PuAddListEntry(g, ColorList[i].name, FALSE);
++ PuSetConstraints(g, con);
++ PuSetBool(g, PU_BC_AUTO_DESEL, TRUE);
++ PuAddGizmoCB(g, PU_CT_SELECT, selectCB, NULL, NULL);
++ PuSwitchGizmo(g, TRUE);
++
++ con.x = 1;
++ con.y = 11;
++ con.w = 1;
++ con.h = 1;
++ g = PuCreateLabel(DialGizmo, "Float");
++ PuSetConstraints(g, con);
++ PuSwitchGizmo(g, TRUE);
++ con.x = 2;
++ con.y = 11;
++ g = PuCreateLabel(DialGizmo, "RGB");
++ PuSetConstraints(g, con);
++ PuSwitchGizmo(g, TRUE);
++
++ con.x = 0;
++ con.y = 12;
++ con.w = 1;
++ con.h = 1;
++ g = PuCreateLabel(DialGizmo, "Red");
++ PuSetConstraints(g, con);
++ PuSwitchGizmo(g, TRUE);
++ con.x = 1;
++ RGizmo = PuCreateTextField(DialGizmo, "RED", DStrToStr(RStr));
+ PuSetConstraints(RGizmo, con);
+ PuSetInt(RGizmo, PU_IC_TEXT_WIDTH, NUM_LEN);
+ PuAddGizmoCB(RGizmo, PU_CT_MODIFY, editCB, "R", NULL);
+ PuAddGizmoCB(RGizmo, PU_CT_ACTIVATE, activateCB, "R", NULL);
+ PuSwitchGizmo(RGizmo, TRUE);
++ con.x = 2;
++ rGizmo = PuCreateTextField(DialGizmo, "red", DStrToStr(rStr));
++ PuSetConstraints(rGizmo, con);
++ PuSetInt(rGizmo, PU_IC_TEXT_WIDTH, NUM_LEN);
++ PuAddGizmoCB(rGizmo, PU_CT_MODIFY, editCB, "r", NULL);
++ PuAddGizmoCB(rGizmo, PU_CT_ACTIVATE, activateCB, "r", NULL);
++ PuSwitchGizmo(rGizmo, TRUE);
+
+- GGizmo = PuCreateTextField(DialGizmo, "Green", DStrToStr(GStr));
+- con.y = 2;
++ con.x = 0;
++ con.y = 13;
++ con.w = 1;
++ con.h = 1;
++ g = PuCreateLabel(DialGizmo, "Green");
++ PuSetConstraints(g, con);
++ PuSwitchGizmo(g, TRUE);
++ con.x = 1;
++ GGizmo = PuCreateTextField(DialGizmo, "GREEN", DStrToStr(GStr));
+ PuSetConstraints(GGizmo, con);
+ PuSetInt(GGizmo, PU_IC_TEXT_WIDTH, NUM_LEN);
+ PuAddGizmoCB(GGizmo, PU_CT_MODIFY, editCB, "G", NULL);
+ PuAddGizmoCB(GGizmo, PU_CT_ACTIVATE, activateCB, "G", NULL);
+ PuSwitchGizmo(GGizmo, TRUE);
++ con.x = 2;
++ gGizmo = PuCreateTextField(DialGizmo, "green", DStrToStr(gStr));
++ PuSetConstraints(gGizmo, con);
++ PuSetInt(gGizmo, PU_IC_TEXT_WIDTH, NUM_LEN);
++ PuAddGizmoCB(gGizmo, PU_CT_MODIFY, editCB, "g", NULL);
++ PuAddGizmoCB(gGizmo, PU_CT_ACTIVATE, activateCB, "g", NULL);
++ PuSwitchGizmo(gGizmo, TRUE);
+
+- BGizmo = PuCreateTextField(DialGizmo, "Blue", DStrToStr(BStr));
+- con.y = 3;
++ con.x = 0;
++ con.y = 14;
++ con.w = 1;
++ con.h = 1;
++ g = PuCreateLabel(DialGizmo, "Blue");
++ PuSetConstraints(g, con);
++ PuSwitchGizmo(g, TRUE);
++ con.x = 1;
++ BGizmo = PuCreateTextField(DialGizmo, "BLUE", DStrToStr(BStr));
+ PuSetConstraints(BGizmo, con);
+ PuSetInt(BGizmo, PU_IC_TEXT_WIDTH, NUM_LEN);
+ PuAddGizmoCB(BGizmo, PU_CT_MODIFY, editCB, "B", NULL);
+ PuAddGizmoCB(BGizmo, PU_CT_ACTIVATE, activateCB, "B", NULL);
+ PuSwitchGizmo(BGizmo, TRUE);
++ con.x = 2;
++ bGizmo = PuCreateTextField(DialGizmo, "blue", DStrToStr(bStr));
++ PuSetConstraints(bGizmo, con);
++ PuSetInt(bGizmo, PU_IC_TEXT_WIDTH, NUM_LEN);
++ PuAddGizmoCB(bGizmo, PU_CT_MODIFY, editCB, "b", NULL);
++ PuAddGizmoCB(bGizmo, PU_CT_ACTIVATE, activateCB, "b", NULL);
++ PuSwitchGizmo(bGizmo, TRUE);
+
+- ColGizmo = PuCreateColorField(DialGizmo, "Color");
+- con.x = 3;
+- con.y = 0;
+- con.w = 2;
+- con.h = 4;
+- PuSetConstraints(ColGizmo, con);
+- showColor();
+- PuSwitchGizmo(ColGizmo, TRUE);
+-
+- g = PuCreateList(DialGizmo, "Color List");
+- for (i = 0; i < ColorNo; i++)
+- PuAddListEntry(g, ColorList[i].name, FALSE);
+- con.x = 5;
+- con.y = 0;
+- con.w = 2;
+- con.h = 4;
+- PuSetConstraints(g, con);
+- PuSetBool(g, PU_BC_AUTO_DESEL, TRUE);
+- PuAddGizmoCB(g, PU_CT_SELECT, selectCB, NULL, NULL);
+- PuSwitchGizmo(g, TRUE);
+-
+- con.y = 4;
++ con.x = 0;
++ con.y = 15;
+ con.w = 1;
+ con.h = 1;
+-
+ for (i = 0; i < CMD_NO; i++) {
+ g = PuCreateButton(DialGizmo, LabelList[i]);
+- con.x = i;
++ con.x = i%3;
++ if (i%3 == 0) con.y++;
+ PuSetConstraints(g, con);
+ PuAddGizmoCB(g, PU_CT_ACTIVATE, cmdCB, NULL, NULL);
+ PuSwitchGizmo(g, TRUE);
+diff --git a/src/cmddial/ExDialRes.c b/src/cmddial/ExDialRes.c
+new file mode 100644
+index 0000000..06925ff
+--- /dev/null
++++ b/src/cmddial/ExDialRes.c
+@@ -0,0 +1,340 @@
++/*
++************************************************************************
++*
++* ExDialMol.c - DialMol command
++*
++* Copyright (c) 1994-98
++*
++* ETH Zuerich
++* Institut fuer Molekularbiologie und Biophysik
++* ETH-Hoenggerberg
++* CH-8093 Zuerich
++*
++* SPECTROSPIN AG
++* Industriestr. 26
++* CH-8117 Faellanden
++*
++* All Rights Reserved
++*
++* Date of last modification : 98/08/17
++* Pathname of SCCS file : /tmp_mnt/net/sn/homeb/rkoradi/molmol-master/src/cmddial/SCCS/s.ExDialMol.c
++* SCCS identification : 1.10
++*
++************************************************************************
++*/
++
++#include <cmd_dial.h>
++
++#include <stdio.h>
++#include <string.h>
++#include <stdlib.h>
++
++#include <break.h>
++#include <pu.h>
++#include <arg.h>
++#include <cip.h>
++#include <data_hand.h>
++
++#define PROP_NO 3
++
++typedef struct {
++ char *label;
++ char *propName;
++ char *cmd;
++} PropDesc;
++typedef struct {
++ char *name;
++ BOOL active;
++} Residue;
++
++static BOOL DialOn = FALSE;
++static PuGizmo DialGizmo = NULL, ListGizmo;
++static int CurrProp;
++static PropRefP CurrRefP;
++static int MolNo, MolI;
++static BOOL *MolStateA;
++static BOOL SuppressUpdate = FALSE;
++static PropDesc PropTab[] = {
++ {"sel", PROP_SELECTED, "SelectRes"},
++ {"disp", PROP_DISPLAYED, "DefPropRes 'displayed'"},
++ {"move", PROP_MOVABLE, "DefProRes 'movable'"}
++};
++static Residue ResidueTab[] = {
++ {"ARG", FALSE},
++ {"CYS", FALSE},
++ {"PRO", FALSE},
++ {"ASP", FALSE},
++ {"PHE", FALSE},
++ {"LEU", FALSE},
++ {"GLU", FALSE},
++ {"PRO", FALSE},
++ {"TYR", FALSE},
++ {"GLY", FALSE},
++ {"ASN", FALSE},
++ {"ALA", FALSE},
++ {"SER", FALSE},
++ {"THR", FALSE},
++ {"LYS", FALSE},
++ {"ILE", FALSE}
++};
++
++static void
++countMol(DhResP molP, void *clientData)
++{
++ MolNo++;
++}
++
++
++
++static void
++addMol(DhResP molP, void *clientData)
++{
++
++
++ DSTR name;
++ DSTR residue;
++ char buf[10];
++ char buf2[5];
++ BOOL propVal;
++ int j;
++ name = DStrNew();
++ residue = DStrNew();
++
++
++ j= DhResGetNumber(molP);
++ (void) sprintf(buf, "%5d " , j);
++
++ DStrAssignStr(name, buf);
++ DStrAssignStr(residue, buf2);
++ DStrAppStr(name, " ");
++
++ DStrAppDStr(residue, DhResGetName(molP));
++ DStrAppDStr(name, DhResGetName(molP));
++ propVal = DhResGetProp(CurrRefP, molP);
++
++
++
++ if (! BreakCheck(10)){
++ PuAddListEntry(ListGizmo, DStrToStr(name), propVal);
++
++ }
++
++
++
++ MolStateA[MolI] = propVal;
++
++ DStrFree(name);
++
++ MolI++;
++}
++
++static void
++selectMolCB(PuGizmo g, char *name, void *clientData, void *callData)
++{
++ PuSelectCBStruc *callP = callData;
++ DSTR cmd;
++ BOOL isFirst;
++ char buf[10];
++ int num, startI, i;
++
++ (void) sscanf(name, "%d", &num);
++ MolStateA[num - 1] = callP->onOff;
++
++ if (! callP->last)
++ return;
++
++ cmd = DStrNew();
++ DStrAssignStr(cmd, PropTab[CurrProp].cmd);
++ isFirst = TRUE;
++
++ for (i = 0; i < MolNo; i++) {
++ if (i == 0 || ! MolStateA[i - 1])
++ startI = i;
++ if (MolStateA[i] && (i == MolNo - 1 || ! MolStateA[i + 1])) {
++ if (isFirst)
++ DStrAppStr(cmd, " 'num = ");
++ else
++ DStrAppStr(cmd, ",");
++ (void) sprintf(buf, "%d", startI + 1);
++ DStrAppStr(cmd, buf);
++ if (i > startI) {
++ DStrAppStr(cmd, "..");
++ (void) sprintf(buf, "%d", i + 1);
++ DStrAppStr(cmd, buf);
++ }
++
++ isFirst = FALSE;
++ }
++ }
++
++ if (isFirst)
++ DStrAppStr(cmd, " '0'");
++ else
++ DStrAppStr(cmd, "'");
++
++ SuppressUpdate = TRUE;
++ CipExecCmd(DStrToStr(cmd));
++ SuppressUpdate = FALSE;
++
++ DStrFree(cmd);
++}
++
++static void
++buildList(void)
++{
++ int lineNo;
++
++ MolNo = 0;
++ DhApplyRes(PropGetRef(PROP_ALL, FALSE), countMol, NULL);
++ if (MolNo > 0) {
++ if (MolStateA == NULL)
++ MolStateA = malloc(MolNo * sizeof(*MolStateA));
++ else
++ MolStateA = realloc(MolStateA, MolNo * sizeof(*MolStateA));
++ lineNo = MolNo;
++ if (lineNo > 40)
++ lineNo = 40;
++ } else {
++ lineNo = 1;
++ }
++
++ PuSetInt(ListGizmo, PU_IC_ENTRY_NO, lineNo);
++
++ MolI = 0;
++ BreakActivate(TRUE);
++ DhApplyRes(PropGetRef(PROP_ALL, FALSE), addMol, NULL);
++ BreakActivate(FALSE);
++
++ PuSwitchGizmo(ListGizmo, TRUE);
++}
++
++static void
++updateList(void)
++{
++ if (SuppressUpdate)
++ return;
++
++ PuSwitchGizmo(ListGizmo, FALSE);
++ PuRemoveListEntries(ListGizmo, 0, MolNo);
++ buildList();
++}
++
++static void
++selectPropCB(PuGizmo g, char *name, void *clientData, void *callData)
++{
++ PuSelectCBStruc *callP = callData;
++ PropRefP newPropP;
++ int i;
++
++ if (! callP->onOff)
++ return;
++
++ for (i = 0; i < PROP_NO; i++)
++ if (strcmp(name, PropTab[i].label) == 0)
++ break;
++
++ newPropP = PropGetRef(PropTab[i].propName, FALSE);
++
++ if (newPropP != CurrRefP) {
++ CurrRefP = newPropP;
++ CurrProp = i;
++ updateList();
++ }
++}
++
++static void
++popdownCB(PuGizmo g, char *name, void *clientData, void *callData)
++{
++ PuSwitchGizmo(DialGizmo, FALSE);
++ DialOn = FALSE;
++}
++
++static void
++listCB(void *clientData)
++{
++ updateList();
++}
++
++static void
++helpCB(PuGizmo g, char *name, void *clientData, void *callData)
++{
++ CipShowHelpFile(DialGizmo, "DialMol");
++}
++
++static void
++buildDial(void)
++{
++
++ PuGizmo g;
++ int i;
++
++ CurrProp = 0;
++ CurrRefP = PropGetRef(PropTab[CurrProp].propName, FALSE);
++
++ DialGizmo = PuCreateDialog("Residue Dialog", 0, 0);
++ PuSetBool(DialGizmo, PU_BC_PLACE_OUTSIDE, TRUE);
++
++ g = PuCreateRadioBox(DialGizmo, "Property");
++ for (i = 0; i < PROP_NO; i++)
++ PuAddToggle(g, PropTab[i].label, i == 0);
++ PuAddGizmoCB(g, PU_CT_SELECT, selectPropCB, NULL, NULL);
++ PuSwitchGizmo(g, TRUE);
++
++ ListGizmo = PuCreateList(DialGizmo, "Molecules");
++ PuAddGizmoCB(ListGizmo, PU_CT_SELECT, selectMolCB, NULL, NULL);
++ PuSetBool(ListGizmo, PU_BC_MULT_SEL, TRUE);
++ buildList();
++
++ PuAddGizmoCB(DialGizmo, PU_CT_CLOSE, popdownCB, NULL, NULL);
++ PuAddGizmoCB(DialGizmo, PU_CT_HELP, helpCB, NULL, NULL);
++
++}
++
++ErrCode
++ExDialRes(char *cmd)
++{
++ ArgDescr arg;
++ EnumEntryDescr enumEntry[2];
++ ErrCode errCode;
++
++ arg.type = AT_ENUM;
++
++ ArgInit(&arg, 1);
++
++ arg.prompt = "Residue Dialog";
++ arg.u.enumD.entryP = enumEntry;
++ arg.u.enumD.n = 2;
++
++ enumEntry[0].str = "off";
++ enumEntry[1].str = "on";
++
++ enumEntry[0].onOff = DialOn;
++ enumEntry[1].onOff = ! DialOn;
++ if (DialOn)
++ arg.v.intVal = 0;
++ else
++ arg.v.intVal = 1;
++
++ errCode = ArgGet(&arg, 1);
++ if (errCode != EC_OK) {
++ ArgCleanup(&arg, 1);
++ return errCode;
++ }
++
++ DialOn = (arg.v.intVal == 1);
++
++ ArgCleanup(&arg, 1);
++
++ if (DialOn) {
++ if (DialGizmo == NULL) {
++ buildDial();
++ DhAddMolListCB(listCB, NULL);
++ }
++ PuSwitchGizmo(DialGizmo, TRUE);
++ } else {
++ if (DialGizmo != NULL)
++ PuSwitchGizmo(DialGizmo, FALSE);
++ }
++
++ return EC_OK;
++}
+\ No newline at end of file
+diff --git a/src/cmddial/Makefile b/src/cmddial/Makefile
+index d94609d..66fdea9 100644
+--- a/src/cmddial/Makefile
++++ b/src/cmddial/Makefile
+@@ -8,7 +8,7 @@ CPPFLAGS = $(INCLUDES) $(MCPPFLAGS)
+ CFLAGS = $(CPPFLAGS) $(MCFLAGS)
+
+ OBJ = ExDialColor.o ExDialSelect.o ExDialStyle.o ExDialMol.o ExDialMeas.o \
+- ExDialRmsd.o ExUserInterf.o ExRecordMac.o
++ ExDialRes.o ExDialRmsd.o ExUserInterf.o ExRecordMac.o
+ SRC = $(OBJ:.o=.c)
+
+ default: $(LIBDIR)/libcmd.a
+diff --git a/src/cmdio/ExPdb.c b/src/cmdio/ExPdb.c
+index 8447c4c..fde9c73 100644
+--- a/src/cmdio/ExPdb.c
++++ b/src/cmdio/ExPdb.c
+@@ -1,7 +1,7 @@
+ /*
+ ************************************************************************
+ *
+-* ExPdb.c - ReadPdb, ReadListPdb and WritePdb commands
++* ExPdb.c - ReadPdb, ReadOldPdb, ReadListPdb and WritePdb commands
+ *
+ * Copyright (c) 1994-98
+ *
+@@ -105,7 +105,7 @@ compFunc(void *p1, void *p2)
+ }
+
+ static void
+-readTransTab(BOOL pdbToIntern)
++readTransTab(BOOL pdbToIntern, BOOL isNewNomenclature)
+ {
+ GFile gf;
+ GFileRes res;
+@@ -114,7 +114,7 @@ readTransTab(BOOL pdbToIntern)
+
+ TransTab = TreeOpen(sizeof(TransTabEntry), compFunc);
+ gf = SetupOpen(PN_PDB_ATOMS, "PdbAtoms", FALSE);
+- if (gf == NULL)
++ if (gf == NULL || isNewNomenclature)
+ return;
+
+ if (pdbToIntern) {
+@@ -675,7 +675,7 @@ ExReadPdb(char *cmd)
+ return errCode;
+ }
+
+- readTransTab(TRUE);
++ readTransTab(TRUE, TRUE);
+ UnknownErrInit();
+
+ if (replace) {
+@@ -755,7 +755,7 @@ ExReadListPdb(char *cmd)
+
+ FileNamePath(fileName);
+
+- readTransTab(TRUE);
++ readTransTab(TRUE,TRUE);
+ UnknownErrInit();
+ inName = DStrNew();
+ pdbName = DStrNew();
+@@ -932,7 +932,7 @@ ExWritePdb(char *cmd)
+ if (gf == NULL)
+ return EC_ERROR;
+
+- readTransTab(FALSE);
++ readTransTab(FALSE,TRUE);
+
+ CHECK_RES(GFileWriteStr(gf, "HEADER Structure from"));
+ CHECK_RES(GFileWriteStr(gf, PROG_NAME));
+@@ -987,3 +987,61 @@ ExWritePdb(char *cmd)
+
+ return EC_OK;
+ }
++
++ErrCode
++ExReadOldPdb(char *cmd)
++{
++ BOOL replace;
++ DSTR name;
++ int molNo, readNo;
++ DhMolP *molPA;
++ ErrCode errCode;
++ DSTR errStr;
++
++ replace = (strncmp(cmd, "Replace", 7) == 0);
++
++ name = DStrNew();
++ errCode = ArgGetFilename(name, CurrDirGet(), "*.pdb", TRUE);
++ if (errCode != EC_OK) {
++ DStrFree(name);
++ return errCode;
++ }
++
++ readTransTab(TRUE, FALSE);
++ UnknownErrInit();
++
++ if (replace) {
++ molNo = SelMolGet(NULL, 0);
++ if (molNo > 0) {
++ molPA = malloc(molNo * sizeof(*molPA));
++ (void) SelMolGet(molPA, molNo);
++ }
++ } else {
++ molNo = 0;
++ molPA = NULL;
++ }
++
++ BreakActivate(TRUE);
++ errCode = readFile(molPA, molNo, name, &readNo);
++ BreakActivate(FALSE);
++
++ DStrFree(name);
++ TreeClose(TransTab);
++ if (molNo > 0)
++ free(molPA);
++
++ if (errCode != EC_OK)
++ return EC_ERROR;
++
++ if (replace)
++ GraphMolChanged(PROP_SELECTED);
++
++ errStr = UnknownErrGet();
++ if (errStr != NULL) {
++ CipSetError(DStrToStr(errStr));
++ DStrFree(errStr);
++ return EC_WARNING;
++ }
++
++ return EC_OK;
++}
+diff --git a/src/cmdstruc/ExBuild.c b/src/cmdstruc/ExBuild.c
+index 32bc650..7f003b2 100644
+--- a/src/cmdstruc/ExBuild.c
++++ b/src/cmdstruc/ExBuild.c
+@@ -31,11 +31,16 @@
+ #include <data_hand.h>
+ #include <data_sel.h>
+ #include <graph_draw.h>
++#include <pu.h>
+
+ #define ARG_NUM 1
+
+ static int CurrPos = 1;
+ static int CurrKind = 0;
++static PuTextWindow TextW;
++static DhMolP LastMolP=NULL;
++static BOOL messageWindowCreated=FALSE;
++static BOOL cyclicResidueFound=FALSE;
+
+ ErrCode
+ ExNewMol(char *cmd)
+@@ -206,3 +211,121 @@ ExChangeRes(char *cmd)
+
+ return EC_OK;
+ }
++
++static void
++writeInt(int num)
++{
++ char buf[10];
++ (void) sprintf(buf, "%5d ", num);
++ PuWriteStr(TextW, buf);
++}
++
++static void
++checkMolCyclic(DhMolP molP, void *clientData)
++{
++ DhResP resP;
++ DSTR resName = DStrNew();
++ DStrAssignStr(resName, "XXX");
++
++ resP = DhResFirst(molP);
++ while (resP != NULL) {
++ if (DStrCmp(resName, DhResGetName(resP)) == 0) {
++ cyclicResidueFound=TRUE;
++ }
++ resP = DhResNext(resP);
++ }
++
++ if (cyclicResidueFound && !messageWindowCreated) {
++ TextW = PuCreateTextWindow("MakeMolCyclic");
++ PuWriteStr(TextW, "--------------------------------------------------\n");
++ messageWindowCreated=TRUE;
++ }
++ if (cyclicResidueFound) {
++ PuWriteStr(TextW, "Error -");
++ writeInt(DhMolGetNumber(molP) + 1);
++ PuWriteStr(TextW, DStrToStr(DhMolGetName(molP)));
++ PuWriteStr(TextW, " already made cyclic!\n");
++ }
++}
++
++static void
++makeMolCyclic(DhMolP molP, void *clientData)
++{
++ DhResP xResP, yResP;
++ Vec3 firstCoord, lastCoord, midCoord;
++ DhResP firstResP, lastResP;
++ DhAtomP caAtomP;
++ DSTR atomName = DStrNew();
++ DhResDefP resDefP = (DhResDefP) clientData;
++
++ DStrAssignStr(atomName, "CA");
++
++ xResP = DhResNewCyclic(molP, resDefP, SP_FIRST);
++ DhResInit(xResP);
++ yResP = DhResNewCyclic(molP, resDefP, SP_LAST);
++ DhResInit(yResP);
++
++ xResP = DhResFirst(molP);
++
++ firstResP = DhResNext(xResP);
++ caAtomP = NULL;
++ while (caAtomP == NULL && firstResP != NULL) {
++ caAtomP = DhAtomFindName(firstResP, atomName, FALSE);
++ firstResP = DhResNext(firstResP);
++ }
++ if (caAtomP == NULL) {
++ return;
++ }
++ DhAtomGetCoord(caAtomP, firstCoord);
++
++ yResP = DhResLast(molP);
++ lastResP = DhResPrev(yResP);
++ caAtomP = NULL;
++ while (caAtomP == NULL && lastResP != NULL) {
++ caAtomP = DhAtomFindName(lastResP, atomName, FALSE);
++ lastResP = DhResPrev(lastResP);
++ }
++ if (caAtomP == NULL) {
++ return;
++ }
++
++ DhAtomGetCoord(caAtomP, lastCoord);
++
++ midCoord[0] = (firstCoord[0]+lastCoord[0])/2;
++ midCoord[1] = (firstCoord[1]+lastCoord[1])/2;
++ midCoord[2] = (firstCoord[2]+lastCoord[2])/2;
++
++ DhAtomSetCoord(DhResGetAtomA(xResP), midCoord);
++ DhAtomSetCoord(DhResGetAtomA(yResP), midCoord);
++}
++
++ErrCode
++ExMakeMolCyclic(char *cmd)
++{
++ int ind=0;
++ DhResDefP resDefP;
++ DSTR resName = DStrNew();
++
++ messageWindowCreated=FALSE;
++ cyclicResidueFound=FALSE;
++ DhApplyMol(PropGetRef(PROP_SELECTED, FALSE), checkMolCyclic, NULL);
++ if (cyclicResidueFound) {
++ DSTR msg = DStrNew();
++ DStrAssignStr(msg, "Error cyclic molecules selected");
++ PuSetTextField(PU_TF_STATUS, DStrToStr(msg));
++ DStrFree(msg);
++ return EC_OK;
++ }
++
++ DStrAssignStr(resName, "XXX");
++ resDefP = DhResDefGet(resName);
++ if (resDefP == NULL) {
++ CipSetError("error cyclic marker residue 'XXX' not found in residue library");
++ return EC_ERROR;
++ }
++
++ DhApplyMol(PropGetRef(PROP_SELECTED, FALSE), makeMolCyclic, resDefP);
++ GraphMolChanged(PROP_SELECTED);
++ GraphRedrawNeeded();
++ return EC_OK;
++}
+diff --git a/src/data/DataHand.c b/src/data/DataHand.c
+index 368aad3..d020c20 100644
+--- a/src/data/DataHand.c
++++ b/src/data/DataHand.c
+@@ -994,9 +994,11 @@ BOOL
+ DhResDestroy(DhResP resP)
+ {
+ /* can only destroy first or last residue of molecule! */
++ DhMolP molP;
+ if (resP == ListFirst(resP->molP->resL)) {
++ molP = resP->molP;
+ ListRemove(resP->molP->resL, resP);
+- setEquivI(ListFirst(resP->molP->resL), NULL);
++ setEquivI((DhResP)ListFirst(molP->resL), NULL);
+ return TRUE;
+ } else if (resP == ListLast(resP->molP->resL)) {
+ ListRemove(resP->molP->resL, resP);
+@@ -2842,6 +2844,18 @@ DhResGetName(DhResP resP)
+ return resP->defP->name;
+ }
+
++DhAtomP
++DhResGetAtomA(DhResP resP)
++{
++ return resP->atomA;
++}
++
++DhResDefP
++DhResGetDefP(DhResP resP)
++{
++ return resP->defP;
++}
++
+ int
+ DhResGetNumber(DhResP resP)
+ {
+@@ -3313,3 +3327,101 @@ DhAltCoordListGet(void)
+ {
+ return AltCoordList;
+ }
++
++static void
++initResCyclic(DhResP resP)
++{
++ DhResDefP defP;
++ DhResP prevResP, nextResP;
++ DhAtomP atomP, equivAtomP;
++ int i;
++
++ defP = resP->defP;
++
++ resP->neighLeftP = NULL;
++ resP->neighRightP = NULL;
++
++ resP->atomA = malloc(defP->atomNo * sizeof(*resP->atomA));
++ resP->bondA = malloc(defP->bondNo * sizeof(*resP->bondA));
++ resP->angleA = malloc(defP->angleNo * sizeof(*resP->angleA));
++
++ for (i = 0; i < defP->atomNo; i++)
++ initAtom(resP->atomA + i, resP);
++
++ for (i = defP->firstBondI; i <= defP->lastBondI; i++)
++ initBond(resP->bondA + i, resP);
++
++ for (i = 0; i < defP->angleNo; i++) {
++ resP->angleA[i].resP = resP;
++ resP->angleA[i].val = 0.0f;
++ resP->angleA[i].minVal = DH_ANGLE_MIN;
++ resP->angleA[i].maxVal = DH_ANGLE_MAX;
++ resP->angleA[i].changed = FALSE;
++ resP->angleA[i].propTab = PropNewTab(FALSE);
++ }
++
++ resP->propTab = PropNewTab(FALSE);
++
++ for (i = 0; i < EQUIV_NO; i++) {
++ resP->equivI[i] = -1;
++ }
++
++ prevResP = ListPrev(resP->molP->resL, resP);
++ nextResP = ListNext(resP->molP->resL, resP);
++}
++
++DhResP
++DhResNewCyclic(DhMolP molP, DhResDefP defP, DhSeqPos pos)
++{
++ struct DhResS resS;
++ DhResP resP, prevResP, nextResP;
++
++ resS.molP = molP;
++ resS.defP = defP;
++
++ if (pos == SP_FIRST) {
++ nextResP = ListFirst(molP->resL);
++ if (nextResP == NULL)
++ resS.num = 1;
++ else
++ resS.num = nextResP->num - 1;
++
++ resP = ListInsertFirst(molP->resL, &resS);
++ } else {
++ prevResP = ListLast(molP->resL);
++ if (prevResP == NULL)
++ resS.num = 1;
++ else
++ resS.num = prevResP->num + 1;
++
++ resP = ListInsertLast(molP->resL, &resS);
++ }
++
++ initResCyclic(resP);
++
++ return resP;
++}
++
++DhResP
++DhResPrev(DhResP resP)
++{
++ return (DhResP) ListPrev(resP->molP->resL, resP);
++}
++
++DhResP
++DhResNext(DhResP resP)
++{
++ return (DhResP) ListNext(resP->molP->resL, resP);
++}
++
++DhResP
++DhResFirst(DhMolP molP)
++{
++ return (DhResP) ListFirst(molP->resL);
++}
++
++DhResP
++DhResLast(DhMolP molP)
++{
++ return (DhResP) ListLast(molP->resL);
++}
+diff --git a/src/iodev/IODev.c b/src/iodev/IODev.c
+index aa4f9a7..9c04ce8 100644
+--- a/src/iodev/IODev.c
++++ b/src/iodev/IODev.c
+@@ -44,6 +44,7 @@ extern void IOMotifGLDSetDev(void);
+ #endif
+ #ifdef IO_DEV_MOTIF_OGL
+ extern void IOMotifOGLSetDev(void);
++extern void IOMotifOGLDSetDev(void);
+ #endif
+ #ifdef IO_DEV_MOTIF_XGL
+ extern void IOMotifXGLSetDev(void);
+@@ -75,6 +76,7 @@ static DevListEntry DevList[] = {
+ #endif
+ #ifdef IO_DEV_MOTIF_OGL
+ {"Motif/OpenGL", IOMotifOGLSetDev},
++ {"Motif/OpenGLD", IOMotifOGLDSetDev},
+ #endif
+ #ifdef IO_DEV_MOTIF_XGL
+ {"Motif/XGL", IOMotifXGLSetDev},
+diff --git a/src/main/MolInit.c b/src/main/MolInit.c
+index a7c467a..fccccd3 100644
+--- a/src/main/MolInit.c
++++ b/src/main/MolInit.c
+@@ -313,8 +313,9 @@ MolInit(char *defaultDev, int argc, char *argv[], char *macroName)
+
+ SgSetDoubleBuffer(TRUE);
+
+- ProgDirSet("MOLMOLHOME", "/usr/molmol");
++ ProgDirSet("MOLMOLHOME", argv[0]);
+ SetupSetDir("setup");
++ CurrDirSet(getenv("HOME"));
+- UserFileSetDir(CurrDirGet(), "molmol");
++ UserFileSetDir(CurrDirGet(), ".molmol");
+ GFileSetErrorHandler(handleFileError);
+
+@@ -326,7 +327,7 @@ MolInit(char *defaultDev, int argc, char *argv[], char *macroName)
+ IOSetErrorHandler(handleIOError);
+
+ PuSetTextField(PU_TF_TITLE,
+- "MOLMOL - MOLecule analysis and MOLecule display");
++ "MOLMOL - MOLecule analysis and MOLecule display - JCU V1.0.8");
+
+ gf = UserFileOpenRead("par");
+ if (gf != NULL) {
+diff --git a/src/main/MolMol.c b/src/main/MolMol.c
+index 6f825e8..902b50a 100644
+--- a/src/main/MolMol.c
++++ b/src/main/MolMol.c
+@@ -30,5 +30,5 @@
+ int
+ main(int argc, char *argv[])
+ {
+- return MolInit("Motif/X11", argc, argv, NULL);
++ return MolInit("Motif/OpenGL", argc, argv, NULL);
+ }
+diff --git a/src/motif/MotifDial.c b/src/motif/MotifDial.c
+index 6e3bfd7..8fe0c5a 100644
+--- a/src/motif/MotifDial.c
++++ b/src/motif/MotifDial.c
+@@ -1115,26 +1115,24 @@ PuMotifSetStr(PuGizmo gizmo, PuStrChoice choice, char *val)
+ void
+ PuMotifSetColor(PuGizmo gizmo, float r, float g, float b)
+ {
+- Display *dpy;
+- int screen;
+- Pixel pix;
+- XColor col;
++ Display *display;
++ Pixel pixel;
++ XColor color;
++ Colormap colormap;
+
+- dpy = XtDisplay(gizmo);
+- screen = DefaultScreen(dpy);
+- XtVaGetValues(gizmo,
+- XmNbackground, &pix,
+- NULL);
++ display = XtDisplay(gizmo);
++ XtVaGetValues(gizmo, XmNbackground, &pixel, NULL);
++ colormap = DefaultColormapOfScreen(XtScreen(gizmo));
+
+- if (pix == BlackPixel(dpy, screen))
+- return;
++ color.pixel = pixel;
++ color.red = FLOAT2SHORT(r);
++ color.green = FLOAT2SHORT(g);
++ color.blue = FLOAT2SHORT(b);
++ color.flags = DoRed | DoGreen | DoBlue;
+
+- col.pixel = pix;
+- col.red = FLOAT2SHORT(r);
+- col.green = FLOAT2SHORT(g);
+- col.blue = FLOAT2SHORT(b);
+- col.flags = DoRed | DoGreen | DoBlue;
+- XStoreColor(dpy, DefaultColormap(dpy, screen), &col);
++ XFreeColors(display, colormap, &pixel, 1, 0);
++ XAllocColor(display, colormap, &color);
++ XtVaSetValues(gizmo, XmNbackground, color.pixel, NULL);
+ }
+
+ void
+diff --git a/src/motogl/MotOGLDump.c b/src/motogl/MotOGLDump.c
+index 54a4222..3bc25cc 100644
+--- a/src/motogl/MotOGLDump.c
++++ b/src/motogl/MotOGLDump.c
+@@ -302,7 +302,7 @@ writeImg(void)
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
+
+ if (Quality < 100)
+- TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);
++ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
+ else
+ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+
+diff --git a/src/os/CurrDir.c b/src/os/CurrDir.c
+index edee778..7d2b242 100644
+--- a/src/os/CurrDir.c
++++ b/src/os/CurrDir.c
+@@ -26,9 +26,9 @@
+ #include <curr_dir.h>
+
+ #include <stdlib.h>
+-#ifdef WIN32
+-#include <direct.h>
+ #include <string.h>
++#ifdef WIN32
++#include <direct.h>
+ #else
+ #include <unistd.h>
+ #include <errno.h>
+@@ -36,43 +36,15 @@
+
+ static char *CurrDir = NULL;
+
++void
++CurrDirSet(char *dir)
++{
++ CurrDir = malloc(strlen(dir) + 1);
++ (void) strcpy(CurrDir, dir);
++}
++
+ char *
+ CurrDirGet(void)
+ {
+-#ifdef WIN32
+- int len, i;
+-#else
+- int size = 10;
+-#endif
+-
+- if (CurrDir != NULL)
+- return CurrDir;
+-
+-#ifdef WIN32
+- CurrDir = _getcwd(NULL, 0);
+- if (CurrDir != NULL) {
+- len = strlen(CurrDir);
+- for (i = 0; i < len; i++)
+- if (CurrDir[i] == '\\')
+- CurrDir[i] = '/';
+- return CurrDir;
+- }
+-#else
+- CurrDir = malloc(size);
+- for (;;) {
+- if (getcwd(CurrDir, size) != NULL)
+- return CurrDir;
+- if (errno != ERANGE)
+- break;
+- size *= 2;
+- CurrDir = realloc(CurrDir, size);
+- }
+-#endif
+-
+- /* cannot get current directory, return root directory */
+- CurrDir = realloc(CurrDir, 2);
+- CurrDir[0] = '/';
+- CurrDir[1] = '\0';
+-
+ return CurrDir;
+ }
+diff --git a/src/os/ProgDir.c b/src/os/ProgDir.c
+index 7abb08d..79ede45 100644
+--- a/src/os/ProgDir.c
++++ b/src/os/ProgDir.c
+@@ -45,10 +45,6 @@ ProgDirSet(char *envVar, char *defVal)
+ dir = getenv(envVar);
+ if (dir == NULL) {
+ len = GetModuleFileName(NULL, exePath, sizeof(exePath));
+- if (len == 0) {
+- ProgDir = defVal;
+- return;
+- }
+ len--;
+ while (len > 0 && exePath[len] != '\\')
+ len--;
+@@ -65,9 +61,24 @@ ProgDirSet(char *envVar, char *defVal)
+ if (ProgDir[i] == '\\')
+ ProgDir[i] = '/';
+ #else
+- ProgDir = getenv(envVar);
+- if (ProgDir == NULL)
+- ProgDir = defVal;
++ char *dir;
++ char *exePath;
++ int len;
++ dir = getenv(envVar);
++ if (dir == NULL) {
++ exePath = defVal;
++ len = strlen(exePath);
++ len--;
++ while (len > 0 && exePath[len] != '/')
++ len--;
++ dir = exePath;
++ } else {
++ len = strlen(dir);
++ }
++
++ ProgDir = malloc(len + 1);
++ (void) strncpy(ProgDir, dir, len);
++
+ #endif
+ }
+
+diff --git a/src/win/WinDial.c b/src/win/WinDial.c
+index 61d6432..e880559 100644
+--- a/src/win/WinDial.c
++++ b/src/win/WinDial.c
+@@ -1072,148 +1072,143 @@ dialProc(HWND w, UINT msgKind, WPARAM wParam, LPARAM lParam)
+ childP = (GizmoInfo *) GetWindowLong(childW, GWL_USERDATA);
+
+ switch (notifyCode) {
+- case BN_CLICKED:
+- if (childId < infoP->u.dial.childNo) {
++ case BN_CLICKED:
++ if (childId < infoP->u.dial.childNo) {
+ childP = (GizmoInfo *) GetWindowLong(GetFocus(), GWL_USERDATA);
+- if (childP->type == GIZMO_TOGGLE) {
+- boxP = childP->u.toggle.boxP;
+- if (boxP->type == GIZMO_RADIO_BOX) {
+- for (i = 0; i < infoP->u.dial.childNo; i++) {
+- cP = infoP->u.dial.childPA[i];
+- if (cP->type != GIZMO_TOGGLE)
+- continue;
+- if (cP->u.toggle.boxP != boxP)
+- continue;
+- onOff = SendMessage(cP->w, BM_GETCHECK, 0, 0);
+- if (onOff && cP != childP) {
+- cP->u.toggle.onOff = FALSE;
+- SendMessage(cP->w, BM_SETCHECK, FALSE, 0);
+- selectStruc.onOff = FALSE;
+- callCB(boxP, PU_CT_SELECT, cP->name, &selectStruc);
+- break;
+- }
+- }
+- if (cP != childP) {
+- childP->u.toggle.onOff = TRUE;
+- SendMessage(childP->w, BM_SETCHECK, TRUE, 0);
+- selectStruc.onOff = TRUE;
+- callCB(boxP, PU_CT_SELECT, childP->name, &selectStruc);
+- }
+- } else {
+- onOff = ! SendMessage(childP->w, BM_GETCHECK, 0, 0);
+- childP->u.toggle.onOff = onOff;
+- SendMessage(childP->w, BM_SETCHECK, onOff, 0);
+- selectStruc.onOff = onOff;
+- callCB(boxP, PU_CT_SELECT, childP->name, &selectStruc);
+- }
+- } else {
+- callCB(childP, PU_CT_ACTIVATE, childP->name, NULL);
+- if (childP->type == GIZMO_TEXT_FIELD &&
+- childP->u.text.historySize > 0)
+- childP->u.text.firstMod = TRUE;
+- }
+- } else {
+- buttonI = childId - infoP->u.dial.childNo;
+- callCB(infoP, BUTTON_FIRST + buttonI, ButtonLabelA[buttonI], NULL);
+- }
++ if (childP->type == GIZMO_TOGGLE) {
++ boxP = childP->u.toggle.boxP;
++ if (boxP->type == GIZMO_RADIO_BOX) {
++ for (i = 0; i < infoP->u.dial.childNo; i++) {
++ cP = infoP->u.dial.childPA[i];
++ if (cP->type != GIZMO_TOGGLE) continue;
++ if (cP->u.toggle.boxP != boxP) continue;
++ onOff = SendMessage(cP->w, BM_GETCHECK, 0, 0);
++ if (onOff && cP != childP) {
++ cP->u.toggle.onOff = FALSE;
++ SendMessage(cP->w, BM_SETCHECK, FALSE, 0);
++ selectStruc.onOff = FALSE;
++ callCB(boxP, PU_CT_SELECT, cP->name, &selectStruc);
++ break;
++ }
++ }
++ if (cP != childP) {
++ childP->u.toggle.onOff = TRUE;
++ SendMessage(childP->w, BM_SETCHECK, TRUE, 0);
++ selectStruc.onOff = TRUE;
++ callCB(boxP, PU_CT_SELECT, childP->name, &selectStruc);
++ }
++ } else {
++ onOff = ! SendMessage(childP->w, BM_GETCHECK, 0, 0);
++ childP->u.toggle.onOff = onOff;
++ SendMessage(childP->w, BM_SETCHECK, onOff, 0);
++ selectStruc.onOff = onOff;
++ callCB(boxP, PU_CT_SELECT, childP->name, &selectStruc);
++ }
++ } else {
++ callCB(childP, PU_CT_ACTIVATE, childP->name, NULL);
++ if (childP->type == GIZMO_TEXT_FIELD && childP->u.text.historySize > 0) childP->u.text.firstMod = TRUE;
++ }
++ } else {
++ buttonI = childId - infoP->u.dial.childNo;
++ callCB(infoP, BUTTON_FIRST + buttonI, ButtonLabelA[buttonI], NULL);
++ }
+ return TRUE;
+- case EN_UPDATE:
+- textEdit(childP);
+- return TRUE;
+- case LBN_SELCHANGE:
+- for (i = 0; i < childP->u.list.entryNo; i++)
+- if (SendMessage(childW, LB_GETSEL, i, 0) !=
+- childP->u.list.entryA[i].onOff)
+- lastI = i;
+
+- for (i = 0; i < childP->u.list.entryNo; i++) {
+- onOff = SendMessage(childW, LB_GETSEL, i, 0);
+- if (onOff != childP->u.list.entryA[i].onOff) {
+- if (! childP->u.list.autoDesel)
++ case EN_UPDATE:
++ textEdit(childP);
++ return TRUE;
++
++ case LBN_SELCHANGE:
++ for (i = 0; i < childP->u.list.entryNo; i++)
++ if (SendMessage(childW, LB_GETSEL, i, 0) != childP->u.list.entryA[i].onOff)
++ lastI = i;
++
++ for (i = 0; i < childP->u.list.entryNo; i++) {
++ onOff = SendMessage(childW, LB_GETSEL, i, 0);
++ if (onOff != childP->u.list.entryA[i].onOff) {
++ if (! childP->u.list.autoDesel)
+ childP->u.list.entryA[i].onOff = onOff;
+- selectStruc.onOff = onOff;
+- selectStruc.last = (i == lastI);
+- callCB(childP, PU_CT_SELECT,
+- childP->u.list.entryA[i].str, &selectStruc);
+- }
+- }
+-
+- if (childP->u.list.autoDesel)
+- SendMessage(childW, LB_SETCURSEL, -1, 0);
+-
+- return TRUE;
++ selectStruc.onOff = onOff;
++ selectStruc.last = (i == lastI);
++ callCB(childP, PU_CT_SELECT,
++ childP->u.list.entryA[i].str, &selectStruc);
++ }
++ }
++ if (childP->u.list.autoDesel)
++ SendMessage(childW, LB_SETCURSEL, -1, 0);
++ return TRUE;
+ }
++ break;
+
+- break;
+- case WM_VSCROLL:
+- childW = (HWND) lParam;
+- childP = (GizmoInfo *) GetWindowLong(childW, GWL_USERDATA);
+- scrollCode = LOWORD(wParam);
++ case WM_VSCROLL:
++ childW = (HWND) lParam;
++ childP = (GizmoInfo *) GetWindowLong(childW, GWL_USERDATA);
++ scrollCode = LOWORD(wParam);
+
+- if (scrollCode == SB_LINEUP) {
+- upHistory(childP->u.scroll.textP);
+- } else if (scrollCode == SB_LINEDOWN) {
+- downHistory(childP->u.scroll.textP);
+- } else {
+- return FALSE;
+- }
+- return TRUE;
+- case WM_HSCROLL:
+- scrollCode = LOWORD(wParam);
+- if (scrollCode != SB_THUMBPOSITION && scrollCode != SB_THUMBTRACK)
+- return FALSE;
++ if (scrollCode == SB_LINEUP) {
++ upHistory(childP->u.scroll.textP);
++ } else if (scrollCode == SB_LINEDOWN) {
++ downHistory(childP->u.scroll.textP);
++ } else {
++ return FALSE;
++ }
++ return TRUE;
++ case WM_HSCROLL:
++ scrollCode = LOWORD(wParam);
++ if (scrollCode != SB_THUMBPOSITION && scrollCode != SB_THUMBTRACK)
++ return FALSE;
+
+- scrollPos = (int)(short)HIWORD(wParam);
+- childW = (HWND) lParam;
+- childP = (GizmoInfo *) GetWindowLong(childW, GWL_USERDATA);
++ scrollPos = (int)(short)HIWORD(wParam);
++ childW = (HWND) lParam;
++ childP = (GizmoInfo *) GetWindowLong(childW, GWL_USERDATA);
+
+- floatStruc.oldVal = childP->u.slider.val;
+- childP->u.slider.val = scrollPos / childP->u.slider.factor;
+- SetScrollPos(childW, SB_CTL,
+- (int) (childP->u.slider.val * childP->u.slider.factor),
+- TRUE);
++ floatStruc.oldVal = childP->u.slider.val;
++ childP->u.slider.val = scrollPos / childP->u.slider.factor;
++ SetScrollPos(childW, SB_CTL,
++ (int) (childP->u.slider.val * childP->u.slider.factor), TRUE);
+
+- if (childP->u.slider.valuatorCB == NULL) {
+- floatStruc.newVal = childP->u.slider.val;
+- callCB(childP, PU_CT_MODIFY, childP->name, &floatStruc);
+- } else {
+- valStruc.act = PU_MA_ACTIVATE;
+- valStruc.name = childP->name;
+- valStruc.val = childP->u.slider.val;
+- childP->u.slider.valuatorCB(childP, childP->u.slider.clientData, &valStruc);
+- }
++ if (childP->u.slider.valuatorCB == NULL) {
++ floatStruc.newVal = childP->u.slider.val;
++ callCB(childP, PU_CT_MODIFY, childP->name, &floatStruc);
++ } else {
++ valStruc.act = PU_MA_ACTIVATE;
++ valStruc.name = childP->name;
++ valStruc.val = childP->u.slider.val;
++ childP->u.slider.valuatorCB(childP, childP->u.slider.clientData, &valStruc);
++ }
++ return TRUE;
+
+- return TRUE;
+- case WM_PAINT:
+- for (childId = 0; childId < infoP->u.dial.childNo; childId++) {
+- childP = infoP->u.dial.childPA[childId];
+- if (childP->type == GIZMO_COLOR_FIELD)
+- paintColor(childP->w,
+- childP->u.color.r, childP->u.color.g, childP->u.color.b);
+- }
+- break;
+- case WM_MOVE:
+- if (infoP->u.dial.outside) {
+- WinPlaceChanged(infoP->w);
+- return TRUE;
+- }
+- break;
+- case WM_CLOSE:
+- buttonNo = 0;
+- for (i = 0; i < BUTTON_NO; i++)
+- if (infoP->u.dial.buttonSwitchA[i])
+- buttonNo++;
+- if (buttonNo == 0)
+- ShowWindow(infoP->w, SW_HIDE);
+- return TRUE;
+- case WM_DESTROY:
+- WinRemoveDialog(w);
+- for (childId = 0; childId < infoP->u.dial.childNo; childId++)
+- freeInfo(infoP->u.dial.childPA[childId]);
+- freeInfo(infoP);
+- return TRUE;
+- }
++ case WM_PAINT:
++ for (childId = 0; childId < infoP->u.dial.childNo; childId++) {
++ childP = infoP->u.dial.childPA[childId];
++ if (childP->type == GIZMO_COLOR_FIELD)
++ paintColor(childP->w,
++ childP->u.color.r, childP->u.color.g, childP->u.color.b);
++ }
++ break;
+
++ case WM_MOVE:
++ if (infoP->u.dial.outside) {
++ WinPlaceChanged(infoP->w);
++ return TRUE;
++ }
++ break;
++ case WM_CLOSE:
++ buttonNo = 0;
++ for (i = 0; i < BUTTON_NO; i++) {
++ if (infoP->u.dial.buttonSwitchA[i]) buttonNo++;
++ if (buttonNo == 0) {
++ ShowWindow(infoP->w, SW_HIDE);
++ }
++ }
++ return TRUE;
++ case WM_DESTROY:
++ WinRemoveDialog(w);
++ for (childId = 0; childId < infoP->u.dial.childNo; childId++)
++ freeInfo(infoP->u.dial.childPA[childId]);
++ freeInfo(infoP);
++ return TRUE;
++ }
+ return FALSE;
+ }
+
+diff --git a/src/winogl/WinOGLDump.c b/src/winogl/WinOGLDump.c
+index 0a7d61a..a8ce850 100644
+--- a/src/winogl/WinOGLDump.c
++++ b/src/winogl/WinOGLDump.c
+@@ -44,6 +44,7 @@
+ #endif
+ #ifdef PNG_SUPPORT
+ #include <png.h>
++#include <pngpriv.h>
+ #endif
+
+ #include "winogl_int.h"
+@@ -251,7 +252,7 @@ static void
+ pngErrHand(png_structp pngStrucP, char *errMsg)
+ {
+ IORaiseError(errMsg);
+- longjmp(pngStrucP->jmpbuf, 1);
++ longjmp(pngStrucP->longjmp_buffer, 1);
+ }
+ #endif
+
+@@ -314,7 +315,7 @@ writeImg(void)
+ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
+
+ if (Quality < 100)
+- TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);
++ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);
+ else
+ TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
+
+@@ -369,7 +370,7 @@ writeImg(void)
+ return IO_RES_ERR;
+ }
+
+- if (setjmp(pngStrucP->jmpbuf)) {
++ if (setjmp(pngStrucP->longjmp_buffer)) {
+ if (cBuf != NULL)
+ free(cBuf);
+ if (fBuf != NULL)
diff --git a/sci-chemistry/molmol/metadata.xml b/sci-chemistry/molmol/metadata.xml
new file mode 100644
index 000000000000..51fdedab1b38
--- /dev/null
+++ b/sci-chemistry/molmol/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-chemistry</herd>
+</pkgmetadata>
diff --git a/sci-chemistry/molmol/molmol-2k_p2-r2.ebuild b/sci-chemistry/molmol/molmol-2k_p2-r2.ebuild
new file mode 100644
index 000000000000..a8658310e612
--- /dev/null
+++ b/sci-chemistry/molmol/molmol-2k_p2-r2.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils multilib prefix toolchain-funcs
+
+MY_PV="${PV/_p/.}.0"
+MY_P="${PN}-${MY_PV}"
+
+DESCRIPTION="Publication-quality molecular visualization package"
+HOMEPAGE="http://hugin.ethz.ch/wuthrich/software/molmol/index.html"
+SRC_URI="
+ ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip/${MY_P}-src.tar.gz
+ ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip/${MY_P}-doc.tar.gz"
+
+LICENSE="molmol"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+DEPEND="
+ || (
+ ( media-libs/mesa
+ x11-libs/libGLw )
+ media-libs/mesa[motif] )
+ media-libs/libpng:0
+ media-libs/tiff:0
+ sys-libs/zlib
+ virtual/glu
+ virtual/jpeg
+ x11-libs/libXpm
+ x11-libs/motif:0
+ x11-apps/xdpyinfo"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+pkg_setup() {
+ MMDIR="/usr/$(get_libdir)/molmol"
+}
+
+src_prepare() {
+ rm -rf tiff*
+ # Patch from http://pjf.net/science/molmol.html, where src.rpm is provided
+ epatch "${FILESDIR}"/pjf_RH9_molmol2k2.diff
+
+ epatch "${FILESDIR}"/prefix.patch
+ eprefixify molmol
+
+ epatch "${FILESDIR}"/ldflags.patch
+
+ ln -s makedef.lnx "${S}"/makedef || die
+
+ sed \
+ -e "s:/bin/ksh:${EPREFIX}/bin/sh:" \
+ -e "s:^MOLMOLHOME.*:MOLMOLHOME=${EPREFIX}/${MMDIR}:" \
+ -i "${S}"/molmol || die
+ sed \
+ -e "s:^MCFLAGS.*:MCFLAGS = ${CFLAGS}:" \
+ -e "s:^CC.*:CC = $(tc-getCC):" \
+ -i "${S}"/makedef || die
+
+ epatch "${FILESDIR}"/cast.patch
+ epatch "${FILESDIR}"/libpng15.patch
+}
+
+src_install() {
+ dobin molmol
+
+ exeinto ${MMDIR}
+ newexe src/main/molmol molmol.lnx
+ insinto ${MMDIR}
+ doins -r auxil help macros man setup tips
+
+ dodoc HISTORY README
+}
diff --git a/sci-chemistry/molmol/molmol-2k_p2-r3.ebuild b/sci-chemistry/molmol/molmol-2k_p2-r3.ebuild
new file mode 100644
index 000000000000..366d41a75bd9
--- /dev/null
+++ b/sci-chemistry/molmol/molmol-2k_p2-r3.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils multilib prefix toolchain-funcs
+
+MY_PV="${PV/_p/.}.0"
+MY_P="${PN}-${MY_PV}"
+
+DESCRIPTION="Publication-quality molecular visualization package"
+HOMEPAGE="http://hugin.ethz.ch/wuthrich/software/molmol/index.html"
+SRC_URI="
+ ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip/${MY_P}-src.tar.gz
+ ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip/${MY_P}-doc.tar.gz"
+
+LICENSE="molmol"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+DEPEND="
+ || (
+ ( media-libs/mesa
+ x11-libs/libGLw )
+ media-libs/mesa[motif] )
+ media-libs/libpng:0
+ media-libs/tiff:0
+ sys-libs/zlib
+ virtual/glu
+ virtual/jpeg
+ x11-libs/libXpm
+ x11-libs/motif:0
+ x11-apps/xdpyinfo"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+pkg_setup() {
+ MMDIR="/usr/$(get_libdir)/molmol"
+}
+
+src_prepare() {
+ rm -rf tiff*
+ # Patch from http://pjf.net/science/molmol.html, where src.rpm is provided
+ epatch "${FILESDIR}"/pjf_RH9_molmol2k2.diff
+
+ epatch "${FILESDIR}"/prefix.patch
+ eprefixify molmol
+
+ epatch "${FILESDIR}"/ldflags.patch
+
+ ln -s makedef.lnx "${S}"/makedef || die
+
+ sed \
+ -e "s:/bin/ksh:${EPREFIX}/bin/sh:" \
+ -e "s:^MOLMOLHOME.*:MOLMOLHOME=${EPREFIX}/${MMDIR}:" \
+ -i "${S}"/molmol || die
+ sed \
+ -e "s:^MCFLAGS.*:MCFLAGS = ${CFLAGS}:" \
+ -e "s:^CC.*:CC = $(tc-getCC):" \
+ -i "${S}"/makedef || die
+
+ epatch "${FILESDIR}"/cast.patch
+ epatch "${FILESDIR}"/libpng15.patch
+
+ # patch from fink
+ # fixes numerous bad bracings and hopefully the OGL bug 429974
+ epatch "${FILESDIR}"/${P}-fink.patch
+}
+
+src_install() {
+ dobin molmol
+
+ exeinto ${MMDIR}
+ newexe src/main/molmol molmol.lnx
+ insinto ${MMDIR}
+ doins -r auxil help macros man setup tips
+
+ dodoc HISTORY README
+}
diff --git a/sci-chemistry/molmol/molmol-2k_p2-r4.ebuild b/sci-chemistry/molmol/molmol-2k_p2-r4.ebuild
new file mode 100644
index 000000000000..e463ff241d06
--- /dev/null
+++ b/sci-chemistry/molmol/molmol-2k_p2-r4.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils multilib prefix toolchain-funcs
+
+MY_PV="${PV/_p/.}.0"
+MY_P="${PN}-${MY_PV}"
+
+DESCRIPTION="Publication-quality molecular visualization package"
+HOMEPAGE="http://hugin.ethz.ch/wuthrich/software/molmol/index.html"
+SRC_URI="
+ ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip/${MY_P}-src.tar.gz
+ ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip/${MY_P}-doc.tar.gz"
+
+LICENSE="molmol"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+DEPEND="
+ || (
+ ( media-libs/mesa
+ x11-libs/libGLw )
+ media-libs/mesa[motif] )
+ media-libs/libpng:0
+ media-libs/tiff:0
+ sys-libs/zlib
+ virtual/glu
+ virtual/jpeg
+ x11-libs/libXpm
+ x11-libs/motif:0
+ x11-apps/xdpyinfo"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+pkg_setup() {
+ MMDIR="/usr/$(get_libdir)/molmol"
+}
+
+src_prepare() {
+ rm -rf tiff*
+ # Patch from http://pjf.net/science/molmol.html, where src.rpm is provided
+ epatch "${FILESDIR}"/pjf_RH9_molmol2k2.diff
+
+ epatch "${FILESDIR}"/prefix.patch
+ eprefixify molmol
+
+ epatch "${FILESDIR}"/ldflags.patch
+
+ ln -s makedef.lnx "${S}"/makedef || die
+
+ sed \
+ -e "s:/bin/ksh:${EPREFIX}/bin/sh:" \
+ -e "s:^MOLMOLHOME.*:MOLMOLHOME=${EPREFIX}/${MMDIR}:" \
+ -i "${S}"/molmol || die
+ sed \
+ -e "s:^MCFLAGS.*:MCFLAGS = ${CFLAGS}:" \
+ -e "s:^CC.*:CC = $(tc-getCC):" \
+ -i "${S}"/makedef || die
+
+ epatch "${FILESDIR}"/cast.patch
+ epatch "${FILESDIR}"/libpng15.patch
+
+ # patch from fink
+ # fixes numerous bad bracings and hopefully the OGL bug 429974
+ epatch "${FILESDIR}"/${P}-fink.patch
+
+ tc-export AR
+}
+
+src_install() {
+ dobin molmol
+
+ exeinto ${MMDIR}
+ newexe src/main/molmol molmol.lnx
+ insinto ${MMDIR}
+ doins -r auxil help macros man setup tips
+
+ dodoc HISTORY README
+}
diff --git a/sci-chemistry/molmol/molmol-2k_p2-r5.ebuild b/sci-chemistry/molmol/molmol-2k_p2-r5.ebuild
new file mode 100644
index 000000000000..8def42023aac
--- /dev/null
+++ b/sci-chemistry/molmol/molmol-2k_p2-r5.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils multilib prefix toolchain-funcs
+
+MY_PV="${PV/_p/.}.0"
+MY_P="${PN}-${MY_PV}"
+
+DESCRIPTION="Publication-quality molecular visualization package"
+HOMEPAGE="http://hugin.ethz.ch/wuthrich/software/molmol/index.html"
+SRC_URI="
+ ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip/${MY_P}-src.tar.gz
+ ftp://ftp.mol.biol.ethz.ch/software/MOLMOL/unix-gzip/${MY_P}-doc.tar.gz"
+
+LICENSE="molmol"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+DEPEND="
+ || (
+ ( media-libs/mesa
+ x11-libs/libGLw )
+ media-libs/mesa[motif] )
+ media-libs/libpng:0
+ media-libs/tiff:0
+ sys-libs/zlib
+ virtual/glu
+ virtual/jpeg
+ x11-libs/libXpm
+ x11-libs/motif:0
+ x11-apps/xdpyinfo"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+pkg_setup() {
+ MMDIR="/usr/$(get_libdir)/molmol"
+}
+
+src_prepare() {
+ rm -rf tiff*
+ # Patch from http://pjf.net/science/molmol.html, where src.rpm is provided
+ epatch "${FILESDIR}"/pjf_RH9_molmol2k2.diff
+
+ epatch "${FILESDIR}"/ldflags.patch
+ epatch "${FILESDIR}"/opengl.patch
+
+ ln -s makedef.lnx "${S}"/makedef || die
+
+ sed \
+ -e "s:ksh:sh:" \
+ -e "s:^MOLMOLHOME.*:MOLMOLHOME=${EPREFIX}/${MMDIR};MOLMOLDEV=\"Motif/OpenGL\":" \
+ -i "${S}"/molmol || die
+ sed \
+ -e "s:^MCFLAGS.*:MCFLAGS = ${CFLAGS}:" \
+ -e "s:^CC.*:CC = $(tc-getCC):" \
+ -i "${S}"/makedef || die
+
+ epatch "${FILESDIR}"/cast.patch
+ epatch "${FILESDIR}"/libpng15.patch
+
+ # patch from fink
+ # fixes numerous bad bracings and hopefully the OGL bug 429974
+ epatch "${FILESDIR}"/${P}-fink.patch
+
+ epatch "${FILESDIR}"/wild.patch
+ tc-export AR
+}
+
+src_install() {
+ dobin molmol
+
+ exeinto ${MMDIR}
+ doexe src/main/molmol
+ insinto ${MMDIR}
+ doins -r auxil help macros man setup tips
+
+ dodoc HISTORY README
+}