From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- support/hypertex/tanmoy/.index.html | 8 + support/hypertex/tanmoy/README | 2 + support/hypertex/tanmoy/README-ghostview-mods.html | 67 + support/hypertex/tanmoy/X/.index.html | 103 + support/hypertex/tanmoy/X/Mosaic | 6 + support/hypertex/tanmoy/X/callmosaic | 36 + support/hypertex/tanmoy/X/newpg.c | 37 + support/hypertex/tanmoy/aps.hty | 110 + support/hypertex/tanmoy/article.hty | 17 + support/hypertex/tanmoy/book.hty | 9 + support/hypertex/tanmoy/espcrc2.hty | 27 + support/hypertex/tanmoy/examples/.index.html | 5 + support/hypertex/tanmoy/examples/Anomalkap.aux | 123 + support/hypertex/tanmoy/examples/Anomalkap.dvi | Bin 0 -> 88872 bytes support/hypertex/tanmoy/examples/Anomalkap.hrf | 157 + support/hypertex/tanmoy/examples/Anomalkap.log | 83 + support/hypertex/tanmoy/examples/Anomalkap.tex | 1252 ++++ support/hypertex/tanmoy/examples/Anomalkap.toc | 18 + support/hypertex/tanmoy/examples/README | 1 + support/hypertex/tanmoy/examples/ambjorn.aux | 30 + support/hypertex/tanmoy/examples/ambjorn.dvi | Bin 0 -> 20296 bytes support/hypertex/tanmoy/examples/ambjorn.hrf | 36 + support/hypertex/tanmoy/examples/ambjorn.log | 41 + support/hypertex/tanmoy/examples/ambjorn.tex | 383 ++ support/hypertex/tanmoy/examples/ambjorn.toc | 4 + support/hypertex/tanmoy/fleqn.hty | 34 + .../hypertex/tanmoy/ghostview-1.5-hacked/COPYING | 416 ++ support/hypertex/tanmoy/ghostview-1.5-hacked/Dir.c | 163 + .../hypertex/tanmoy/ghostview-1.5-hacked/Draw.c | 920 +++ .../tanmoy/ghostview-1.5-hacked/Ghostview.ad | 251 + .../tanmoy/ghostview-1.5-hacked/Ghostview.c | 2029 ++++++ .../tanmoy/ghostview-1.5-hacked/Ghostview.h | 210 + .../tanmoy/ghostview-1.5-hacked/GhostviewP.h | 120 + .../hypertex/tanmoy/ghostview-1.5-hacked/HISTORY | 453 ++ .../hypertex/tanmoy/ghostview-1.5-hacked/Imakefile | 81 + .../hypertex/tanmoy/ghostview-1.5-hacked/Makefile | 450 ++ .../hypertex/tanmoy/ghostview-1.5-hacked/Path.c | 900 +++ .../hypertex/tanmoy/ghostview-1.5-hacked/README | 177 + .../tanmoy/ghostview-1.5-hacked/README.VMS | 215 + .../tanmoy/ghostview-1.5-hacked/README.pdfmark | 62 + .../tanmoy/ghostview-1.5-hacked/README.selfile | 83 + .../tanmoy/ghostview-1.5-hacked/SFinternal.h | 145 + .../hypertex/tanmoy/ghostview-1.5-hacked/SelFile.c | 753 +++ .../hypertex/tanmoy/ghostview-1.5-hacked/actions.c | 512 ++ support/hypertex/tanmoy/ghostview-1.5-hacked/ad2c | 38 + .../tanmoy/ghostview-1.5-hacked/callbacks.c | 749 +++ .../tanmoy/ghostview-1.5-hacked/comments.doc | 71 + .../tanmoy/ghostview-1.5-hacked/descrip.mms | 65 + .../hypertex/tanmoy/ghostview-1.5-hacked/dialogs.c | 195 + .../hypertex/tanmoy/ghostview-1.5-hacked/getenv.c | 66 + .../tanmoy/ghostview-1.5-hacked/ghostview.man | 905 +++ .../tanmoy/ghostview-1.5-hacked/ghostview.ps | 7017 ++++++++++++++++++++ .../tanmoy/ghostview-1.5-hacked/gs.interface | 100 + support/hypertex/tanmoy/ghostview-1.5-hacked/gv.h | 255 + .../hypertex/tanmoy/ghostview-1.5-hacked/gvpdf.pro | 78 + .../hypertex/tanmoy/ghostview-1.5-hacked/main.c | 937 +++ .../hypertex/tanmoy/ghostview-1.5-hacked/misc.c | 1314 ++++ support/hypertex/tanmoy/ghostview-1.5-hacked/pdf.c | 88 + support/hypertex/tanmoy/ghostview-1.5-hacked/pdf.h | 9 + support/hypertex/tanmoy/ghostview-1.5-hacked/ps.c | 1431 ++++ support/hypertex/tanmoy/ghostview-1.5-hacked/ps.h | 127 + .../hypertex/tanmoy/ghostview-1.5-hacked/run-ad2c | 1 + .../hypertex/tanmoy/ghostview-1.5-hacked/setenv.c | 107 + .../hypertex/tanmoy/ghostview-1.5-hacked/stdc.h | 40 + .../tanmoy/ghostview-1.5-hacked/strcasecmp.c | 103 + .../hypertex/tanmoy/ghostview-1.5-hacked/test.ps | 3302 +++++++++ .../tanmoy/ghostview-1.5-hacked/vms_build.com | 37 + .../tanmoy/ghostview-1.5-hacked/vms_types.h | 351 + .../hypertex/tanmoy/ghostview-1.5-hacked/xstat.h | 23 + support/hypertex/tanmoy/hlatex.tex | 2 + support/hypertex/tanmoy/hyperbasics.1.tex | 206 + support/hypertex/tanmoy/hyperbasics.new.tex | 232 + support/hypertex/tanmoy/hyperbasics.old.tex | 190 + support/hypertex/tanmoy/hyperbasics.tex | 210 + support/hypertex/tanmoy/hypercwebmac.tex | 296 + support/hypertex/tanmoy/hyperlatex.tex | 263 + support/hypertex/tanmoy/hyperncwebmac.tex | 373 ++ support/hypertex/tanmoy/hypertest.tex | 39 + support/hypertex/tanmoy/hyperwebmac.tex | 254 + support/hypertex/tanmoy/ichep.hty | 59 + support/hypertex/tanmoy/lhyper.1.tex | 260 + support/hypertex/tanmoy/lhyper.old.tex | 257 + support/hypertex/tanmoy/prabib.hty | 19 + support/hypertex/tanmoy/prabib.old.hty | 16 + support/hypertex/tanmoy/report.hty | 9 + support/hypertex/tanmoy/revtex.hty | 1 + support/hypertex/tanmoy/vanilla.hty | 8 + support/hypertex/tanmoy/world_sci.hty | 54 + 88 files changed, 30686 insertions(+) create mode 100644 support/hypertex/tanmoy/.index.html create mode 100755 support/hypertex/tanmoy/README create mode 100644 support/hypertex/tanmoy/README-ghostview-mods.html create mode 100644 support/hypertex/tanmoy/X/.index.html create mode 100644 support/hypertex/tanmoy/X/Mosaic create mode 100644 support/hypertex/tanmoy/X/callmosaic create mode 100644 support/hypertex/tanmoy/X/newpg.c create mode 100644 support/hypertex/tanmoy/aps.hty create mode 100644 support/hypertex/tanmoy/article.hty create mode 100644 support/hypertex/tanmoy/book.hty create mode 100644 support/hypertex/tanmoy/espcrc2.hty create mode 100644 support/hypertex/tanmoy/examples/.index.html create mode 100644 support/hypertex/tanmoy/examples/Anomalkap.aux create mode 100644 support/hypertex/tanmoy/examples/Anomalkap.dvi create mode 100644 support/hypertex/tanmoy/examples/Anomalkap.hrf create mode 100644 support/hypertex/tanmoy/examples/Anomalkap.log create mode 100644 support/hypertex/tanmoy/examples/Anomalkap.tex create mode 100644 support/hypertex/tanmoy/examples/Anomalkap.toc create mode 120000 support/hypertex/tanmoy/examples/README create mode 100644 support/hypertex/tanmoy/examples/ambjorn.aux create mode 100644 support/hypertex/tanmoy/examples/ambjorn.dvi create mode 100644 support/hypertex/tanmoy/examples/ambjorn.hrf create mode 100644 support/hypertex/tanmoy/examples/ambjorn.log create mode 100644 support/hypertex/tanmoy/examples/ambjorn.tex create mode 100644 support/hypertex/tanmoy/examples/ambjorn.toc create mode 100644 support/hypertex/tanmoy/fleqn.hty create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/COPYING create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/Dir.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/Draw.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.ad create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.h create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/GhostviewP.h create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/HISTORY create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/Imakefile create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/Makefile create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/Path.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/README create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/README.VMS create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/README.pdfmark create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/README.selfile create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/SFinternal.h create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/SelFile.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/actions.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/ad2c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/callbacks.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/comments.doc create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/descrip.mms create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/dialogs.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/getenv.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/ghostview.man create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/ghostview.ps create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/gs.interface create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/gv.h create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/gvpdf.pro create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/main.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/misc.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/pdf.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/pdf.h create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/ps.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/ps.h create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/run-ad2c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/setenv.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/stdc.h create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/strcasecmp.c create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/test.ps create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/vms_build.com create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/vms_types.h create mode 100644 support/hypertex/tanmoy/ghostview-1.5-hacked/xstat.h create mode 100644 support/hypertex/tanmoy/hlatex.tex create mode 100644 support/hypertex/tanmoy/hyperbasics.1.tex create mode 100644 support/hypertex/tanmoy/hyperbasics.new.tex create mode 100644 support/hypertex/tanmoy/hyperbasics.old.tex create mode 100644 support/hypertex/tanmoy/hyperbasics.tex create mode 100644 support/hypertex/tanmoy/hypercwebmac.tex create mode 100644 support/hypertex/tanmoy/hyperlatex.tex create mode 100644 support/hypertex/tanmoy/hyperncwebmac.tex create mode 100644 support/hypertex/tanmoy/hypertest.tex create mode 100644 support/hypertex/tanmoy/hyperwebmac.tex create mode 100644 support/hypertex/tanmoy/ichep.hty create mode 100644 support/hypertex/tanmoy/lhyper.1.tex create mode 100644 support/hypertex/tanmoy/lhyper.old.tex create mode 100644 support/hypertex/tanmoy/prabib.hty create mode 100644 support/hypertex/tanmoy/prabib.old.hty create mode 100644 support/hypertex/tanmoy/report.hty create mode 100644 support/hypertex/tanmoy/revtex.hty create mode 100644 support/hypertex/tanmoy/vanilla.hty create mode 100644 support/hypertex/tanmoy/world_sci.hty (limited to 'support/hypertex/tanmoy') diff --git a/support/hypertex/tanmoy/.index.html b/support/hypertex/tanmoy/.index.html new file mode 100644 index 0000000000..83c12bc240 --- /dev/null +++ b/support/hypertex/tanmoy/.index.html @@ -0,0 +1,8 @@ + +
+ +HyperTeX +
+ +This document has moved here. + diff --git a/support/hypertex/tanmoy/README b/support/hypertex/tanmoy/README new file mode 100755 index 0000000000..42935560b7 --- /dev/null +++ b/support/hypertex/tanmoy/README @@ -0,0 +1,2 @@ +See http://xxx.lanl.gov/hypertex/ for explanation +(or via anonymous ftp, xxx.lanl.gov:/pub/hypertex/index.html ) diff --git a/support/hypertex/tanmoy/README-ghostview-mods.html b/support/hypertex/tanmoy/README-ghostview-mods.html new file mode 100644 index 0000000000..0686895efc --- /dev/null +++ b/support/hypertex/tanmoy/README-ghostview-mods.html @@ -0,0 +1,67 @@ +
+Last Modified: Dec 1 1994, 10:47
+
+PDF (Portable  Document Format)  is  a format   defined by  Adobe  and
+describes  a page description   language that supports hyperlinks. The
+adobe product `distill' can  create PDF documents from postscript ones
+by translating the page    description. In  addition, it   allows  the
+postscript file  to specify  the  hyperlinks through  a new postscript
+operator, pdfmark.
+
+This  
+alpha release
+of the  changed  version of ghostview is  a first
+attempt to  make ghostview  pdfmark aware.  It recognizes the  pdfmark
+operator, and tries to cretae `hotlinks' on the display. A key click
+on the link follows the link.
+
+The companion products,  the modifications to dvips  by Mark Doyle and
+the    set of      macros   comprising  hypertex  (as   described   at
+xxx)
+facilitates the  generation  of these ps
+files   from   TeX documents. The    modified dvips  actually   uses a
+postscript procedure pdfm (which translates  to an appropriate call to
+pdfmark if pdfm is undefined)  to describe  the linkage structure.  As
+the translation of pdfm to  pdfmark is lossy, ghostview should ideally
+understand pdfm directly: see the TODO list.
+
+All keys work as in the standard release of ghostscript: except 
+
+  1) any key-click inside a link follows link instead of magnifying
+     it.
+  2) b or B goes back in link history if history is non-null: goes to
+     previous page (default behaviour) otherwise.  (delete, backspace
+     etc. are still bound to previous_page) does nothing on first page
+     if link history empty. 
+  3) page menu has an extra entry for back which works as in (2).
+
+Here is what it never plans to do:
+
+  1) Support SRCPAGE option of pdfmark.
+  2) Support pdfmarks in non-DSC structured documents.
+
+Here is the TODO list. (can also be considered BUG list)
+
+1) Handle pdfmarks of kinds other than /LNK (/ANNOT etc. should be
+   very easy) (currently ignores them)
+2) Handle pdfmarks called in non-default coordinate system.
+3) Handle /LNK to other documents.
+4) Look at target view specification as well (currently it only looks
+   at target page)
+5) Check if communication with ghostscript possible through means
+   other than the stdout.
+6) Do a proper job of parsing pdfmark parameters.(easy but tedious)
+7) Use the rx and ry parameters of the /Border specification of
+   pdfmark. (easy)
+8) Support forward/backward navigation or menu-oriented navigation in
+   link history.
+
+Here is the TODO list for processing pdfm (in addition to pdfmark).
+
+1) Allow initial jump to arbitrary target.
+2) Allow user specified jump to arbitrary target.
+3) Take into account target coordinate.
+4) Allow network URL's.
+5) Make middle click open a smaller window with the target properly
+   centered. 
+
diff --git a/support/hypertex/tanmoy/X/.index.html b/support/hypertex/tanmoy/X/.index.html new file mode 100644 index 0000000000..1451189154 --- /dev/null +++ b/support/hypertex/tanmoy/X/.index.html @@ -0,0 +1,103 @@ +
external URL's under X
+

external URL's under X

+
+Date: Sat, 16 Jul 94 12:49:47 MDT
+From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
+To: ginsparg@qfwfq.lanl.gov
+Subject: more things needed
+
+The script for Mosaic is not really that good right now: and we should +probably think a bit more, and probably should talk to the Mosaic guys +as well. That is why I do not yet want to publish it. We can put it up +as an example of how it can be done within the present framework +itself: not as a way in which we think these should be done. +

+At the minimum we need Mosaic (and any other www client) +to set two environmentvariables containing respectively: +(1) its own pid, and (2) The URL of the document it is calling, +and should accept by `remote control' either (a) an absolute URL, OR +(b) a relative URL and a BASE HREF.
+(Instead of using an environment variable for (2), it could instead put +the URL into a file and name the file in the environment. +[Does mac have environment variables? It is easy to overflow +IBM PC environment space].) +


+Anyway, here is how the system on nqcd works. No portability issues +had been considered when writing them: I have tried to express my +concerns below. + +
    +
  1. There is a c-program +newpg.c which takes 2 or more parameters. +
      +
    1. if the first parameter is non-zero, +it sets its pgid to the first parameter, +else it sets its pgid to its pid. +
    2. it replaces itself (without changing pid's) with the program + named by its second parameter and passes the rest of the + arguments to it. +
    3. Note that it requires ANSI C, the header to define pid_t, and + the routines setpgid (I haven't checked to see if it exists in + SYSV) and execvp. +
    + +
  2. The actual Mosaic is renamed Mosaic.binary + +
  3. Mosaic + is a script that calls the c-program (newpg) which starts the + actual Mosaic. (It also provides default values to a few environment + variables: only WWWBROWSER is relevant to this project). It should + work on all unices unchanged provided $0 gets correctly translated, + and the paths are corrected. + +
  4. callmosaic takes two parameters and does the + following: +
      +
    1. Ignores the second parameter. See later. +
    2. It clears the PATH environment variable, and changes the MOSAIC + environment variable, if present, to /usr/local/bin/Mosaic. (As + a result it uses absolute paths for all system programs, + bringing in system dependencies). It redirects standard output + to standard error. (should it?) +
    3. gets its own pgid. (call it x) Doing this from shell is + extremely machine dependent. (depends on exact format of ps + output! On some machines like IBM Risc stations, may be next to + impossible). Should be done with a two line C program instead. +
    4. checks process with PID x to see if it exists and its + identification as returned by ps contains the string + `Mosaic'. If so, goes to step 6. (There may be differences + between BSD and SYSV ps calls). Probably should also check the + DISPLAY environment variable, but no sure way of doing that + unless one call call a process which has group kmem + permissions. (Unless pstat, which is such a process gives us a + way of doing it: I do not know). A less than perfect way does + exist with ps -e. +
    5. checks to see if ${HOME}/.mosaicpid exists and is readable. + If so, call the pid in it as x (probably crash if file not in + right format), else go to step 6. +
    6. checks to see if process with PID x exists and its + identification as returned by ps contains the string + `Mosaic'. If so goto step 6. (BSD and SYSV ps calls may + differ). (Note that it does not check to see if the DISPLAY is + the same! See point 2) +
    7. Start a Mosaic passing it the first parameter; and exit when + that exits. (should probably `exec' the Mosaic instead. Should + it also try a ps -x and check for an unique Mosaic on this + display before it starts a new one? See point 2 about + display). (The redirection of standard output to standard error + stays!) (What happens if the parameter contains backquotes? + Haven't checked!) +
    8. Creates /tmp/Mosaic.x (x being the aforementioned pid) and + writes two lines into it (probably crashes if it cannot): the + first being `goto' and the second contains whatever came in as + the first parameter. Then it signals USR1 to x, and + exits. (probably should write the second parameter as a third + line.) (What happens if the parameter contains backquotes? + Haven't checked!) +
    9. Note that the second parameter is always ignored. (It is supposed + to be the BASE HREF of the document which is calling callmosaic). +
    + +
+ + diff --git a/support/hypertex/tanmoy/X/Mosaic b/support/hypertex/tanmoy/X/Mosaic new file mode 100644 index 0000000000..0d75e4f6d8 --- /dev/null +++ b/support/hypertex/tanmoy/X/Mosaic @@ -0,0 +1,6 @@ +#!/bin/sh -- +WWWBROWSER=${WWWBROWSER-/usr/local/bin/callmosaic} \ +PATH=/usr/ucb:$PATH \ +NNTPSERVER=${NNTPSERVER-newshost} \ +WWW_wais_GATEWAY=${WWW_wais_GATEWAY-http://www.ncsa.uiuc.edu:8001} \ +/usr/local/bin/newpg 0 $0.binary $* diff --git a/support/hypertex/tanmoy/X/callmosaic b/support/hypertex/tanmoy/X/callmosaic new file mode 100644 index 0000000000..a0eec1463b --- /dev/null +++ b/support/hypertex/tanmoy/X/callmosaic @@ -0,0 +1,36 @@ +#!/bin/sh -- +# This is a generic shell script for messaging Mosaic written by +# tanmoy@lanl.gov based on an idea by Paul F. Mende and +# an implementation by krobison@nucleus.harvard.edu +# +# It takes two params: an URL and a base URL to interpret it with +# respect to. It currently ignores this second parameter. +# +# stdout to stderr anyway +exec >&2 +# Note that it sets PATH to null to avoid security +# problems. +PATH= +MOSAIC=/usr/local/bin/Mosaic +# Find my invoking Mosaic. (pid with our pgid) +mypid=`/bin/ps -jx$$ | /usr/ucb/tail -1 | /bin/cut -c 12-17` +mypid=`/bin/expr $mypid` +if /bin/ps -lww$mypid | /bin/grep Mosaic > /dev/null; then /bin/true; +else + if [ -r ${HOME}/.mosaicpid ]; then + mypid=`/bin/cat ${HOME}/.mosaicpid` + mypid=`/bin/expr $mypid` + if /bin/ps -lww$mypid | /bin/grep Mosaic > /dev/null; then /bin/true; + else + ${MOSAIC} "$1" & + exit 0 + fi + else + ${MOSAIC} "$1" & + exit 0 + fi +fi +/bin/rm -f /tmp/Mosaic.$mypid +/bin/echo goto >/tmp/Mosaic.$mypid +/bin/echo "$1" >>/tmp/Mosaic.$mypid +/bin/kill -USR1 $mypid diff --git a/support/hypertex/tanmoy/X/newpg.c b/support/hypertex/tanmoy/X/newpg.c new file mode 100644 index 0000000000..d17832f49e --- /dev/null +++ b/support/hypertex/tanmoy/X/newpg.c @@ -0,0 +1,37 @@ +#include +#include +#include + +#ifndef EXIT_FAILURE + #define EXIT_FAILURE 1 +#endif + +#define abrt() return EXIT_FAILURE + +int main(int argc, char *argv[]) +{ + pid_t pgid, pid=0; int arg1; + + if (argc < 3) { + fprintf(stderr,"Usage: %s pgid command args\n",argv[0]); + abrt(); + } + + if(sscanf(argv[1],"%d",&arg1)!=1) { + fprintf(stderr,"Usage: %s pgid command args\n",argv[0]); + abrt(); + } + pgid = arg1; + + if (setpgid(0,pgid)) { + fprintf(stderr,"Error changing pgid\n"); + abrt(); + } + + if(execvp(argv[2],&argv[2])) { + fprintf(stderr,"Error execvping\n"); + abrt(); + } + + return 0; /* Impossible */ +} diff --git a/support/hypertex/tanmoy/aps.hty b/support/hypertex/tanmoy/aps.hty new file mode 100644 index 0000000000..daebb0a95e --- /dev/null +++ b/support/hypertex/tanmoy/aps.hty @@ -0,0 +1,110 @@ +\let\hypernoname=\relax +\def\@eqnnum{\hbox{\reset@font\rm(\hyperdef\hypernoname{equation}% + {\theequation}{\theequation})}} +\let\make@eqnnum=\@eqnnum +\def\eqnum#1{\dec@eqnnum \global\def\make@eqnnum{\reset@font\rm + (\hyperdef\hypernoname{equation}{#1}{#1})}% +\edef\@currentlabel{\hyper@\hyperpr@ref{}{equation}{#1}{#1}}% +} + +\def\mathletters{% +\inc@eqnnum \setcounter{eqletter}{0}% +\hyperdef\hypernoname{equation}{\theequation}{}% +\edef\@currentlabel{\hyper@\hyperpr@ref{}{equation}% + {\theequation}{\theequation}}% +\def\theequation{\theequation@prefix\arabic{equation}\alph{eqletter}}% +\def\inc@eqnnum{\addtocounter{eqletter}{1}}% +\def\dec@eqnnum{\addtocounter{eqletter}{-1}}% +} + +\def\equation{\par\vskip-\lastskip\vskip\abovedisplayskip +\inc@eqnnum\def\@currentlabel{% + \hyper@\hyperpr@ref{}{equation}{\theequation}{\theequation}}% +\setbox\@testboxa=\hbox\bgroup\hskip\@totalleftmargin\hskip\@indentamount +\hbox\bgroup$\displaystyle +} + +\def\hyperdis@bl@#1#2#3#4{{#4}}% +\def\eqnarray{\par\vskip-\lastskip\vskip\abovedisplayskip +\inc@eqnnum\def\@currentlabel{% + \hyper@\hyperpr@ref{}{equation}{\theequation}{\theequation}}% +\global\@eqnswtrue\m@th +\global\@eqcnt\z@ +\tabskip\@totalleftmargin\advance\tabskip by\@indentamount\let\\\@eqncr +\halign to\hsize\bgroup\hskip\@centering +$\displaystyle\tabskip\z@{##{}}$&\global\@eqcnt\@ne +\hfil${{}##{}}$\hfil +&\global\@eqcnt\tw@ $\displaystyle\tabskip\z@{##}$\hfil +\tabskip\@centering \if@eqnsw\phantom{\let\hyperdef=\hyperdis@bl@ +\make@eqnnum\kern\@eqtoeqnum}\fi +&\llap{##}\tabskip\z@\cr} + +\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth +\let\@svsec\@empty\else + \let\hyper@n@=\hyperdef + \let\hyperdef=\hyper@nique + \refstepcounter{#1}% + \let\hyperdef=\hyper@n@ +\def\@tempa{#8}% +\def\hyper@tmp@{#1}% +\ifx\@tempa\empty % +\ifappendixon % +\if@mainhead % +\def\@tempa{APPENDIX }\def\@tempb{}\def\hyper@tmp@{appendix}% +\else % +\def\@tempa{}\def\@tempb{. }\def\hyper@tmp@{#1}% +\fi +\else % +\def\@tempa{}\def\@tempb{. }\def\hyper@tmp@{#1}% +\fi +\else % +\ifappendixon % +\if@mainhead % +\def\@tempa{APPENDIX }\def\@tempb{: }\def\hyper@tmp@{appendix}% +\else % +\def\@tempa{}\def\@tempb{. }\def\hyper@tmp@{#1}% +\fi +\else % +\def\@tempa{}\def\@tempb{. }\def\hyper@tmp@{#1}% +\fi +\fi + \let\hyper@n@=\hyperdef + \let\hyperdef=\relax\let\hypernoname=\relax +\edef\@svsec{\hyperdef\hypernoname{\hyper@tmp@}% + {\csname the#1\endcsname}{\@tempa\csname the#1\endcsname\@tempb}} + \let\hyperdef=\hyper@n@\fi +\@tempskipa #5\relax +\ifdim \@tempskipa>\z@ +\begingroup #6\relax +{\hskip #3\relax\@svsec}{\interlinepenalty \@M +\if@mainhead\uppercase{#8}\else#8\fi\par}% +\endgroup +\csname #1mark\endcsname{#7}\addcontentsline +{toc}{#1}{\ifnum #2>\c@secnumdepth \else +\protect\numberline{\hyper@\hyperpr@ref\hypernoname + {\hbox{\hskip1pt\relax\csname the#1\endcsname}% + }\hskip-1pt\relax}\fi +#7}\else +\def\@svsechd{#6\hskip #3\relax % +\@svsec \if@mainhead\uppercase{#8}\else#8\fi +\csname #1mark\endcsname +{#7}\addcontentsline +{toc}{#1}{\ifnum #2>\c@secnumdepth \else +\protect\numberline{\hyper@\hyperpr@ref\hypernoname + {\hbox{\hskip1pt\relax\csname the#1\endcsname}% + }\hskip-1pt\relax}\fi +#7}}\fi +\@xsect{#5}} + +\hyper@pen{aps1\@ptsize} +\def\@tempa{prb} +\ifx\@tempa\@journal % +\def\tempa{\hyper@pen{prbbib}} +\else +\def\tempa{\hyper@pen{prabib}} +\fi +\tempa + +\if@titlepage +\hyper@pen{titlepag} +\fi diff --git a/support/hypertex/tanmoy/article.hty b/support/hypertex/tanmoy/article.hty new file mode 100644 index 0000000000..2bd4de4bd7 --- /dev/null +++ b/support/hypertex/tanmoy/article.hty @@ -0,0 +1,17 @@ +\long\def\@makecaption#1#2{% + \vskip 10\p@ + \setbox\@tempboxa\hbox{#1: #2}% + \ifdim \wd\@tempboxa >\hsize + \unhbox\@tempboxa\par + \else + \hbox to\hsize{\hfil\box\@tempboxa\hfil}% + \fi} + +\hyper@pen{art1\@ptsize} +\if@twocolumn + \hyper@pen{twocolum} +\fi + +\if@titlepage + \hyper@pen{titlepag} +\fi diff --git a/support/hypertex/tanmoy/book.hty b/support/hypertex/tanmoy/book.hty new file mode 100644 index 0000000000..c616929a22 --- /dev/null +++ b/support/hypertex/tanmoy/book.hty @@ -0,0 +1,9 @@ +\long\def\@makecaption#1#2{% + \vskip 10\p@ + \setbox\@tempboxa\hbox{#1: #2}% + \ifdim \wd\@tempboxa >\hsize + \unhbox\@tempboxa\par + \else + \hbox to\hsize{\hfil\box\@tempboxa\hfil}% + \fi} + diff --git a/support/hypertex/tanmoy/espcrc2.hty b/support/hypertex/tanmoy/espcrc2.hty new file mode 100644 index 0000000000..0da7c46632 --- /dev/null +++ b/support/hypertex/tanmoy/espcrc2.hty @@ -0,0 +1,27 @@ +\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth + \def\@svsec{}\else + \let\hyper@n@=\hyperdef + \let\hyperdef=\hyper@nique + \refstepcounter{#1}% + \let\hyperdef=\relax\let\hypernoname=\relax + \edef\@svsec{\hyperdef\hypernoname{#1}% + {\csname the#1\endcsname}{\csname the#1\endcsname.\hskip0.5em}}% + \let\hyperdef=\hyper@n@\fi + \@tempskipa #5\relax + \ifdim \@tempskipa>\z@ + \begingroup + #6\relax + \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}% + \endgroup + \csname #1mark\endcsname{#7}\addcontentsline + {toc}{#1}{\ifnum #2>\c@secnumdepth \else + \protect\numberline{\hyper@\hyperpr@ref\hypernoname + {\hbox{\hskip1pt\relax\csname the#1\endcsname}% + }\hskip-1pt\relax}\fi #7}% + \else + \def\@svsechd{#6\hskip #3\@svsec #8\csname #1mark\endcsname + {#7}\addcontentsline{toc}{#1}{\ifnum #2>\c@secnumdepth \else + \protect\numberline{\hyper@\hyperpr@ref\hypernoname + {\hbox{\hskip1pt\relax\csname the#1\endcsname}% + }\hskip-1pt\relax}\fi #7}}% + \fi \@xsect{#5}} diff --git a/support/hypertex/tanmoy/examples/.index.html b/support/hypertex/tanmoy/examples/.index.html new file mode 100644 index 0000000000..35eee2a0e3 --- /dev/null +++ b/support/hypertex/tanmoy/examples/.index.html @@ -0,0 +1,5 @@ +

ERROR! ERROR! ERROR!

+ +Who told you to look here? + +Please go back to hypertex root directory. diff --git a/support/hypertex/tanmoy/examples/Anomalkap.aux b/support/hypertex/tanmoy/examples/Anomalkap.aux new file mode 100644 index 0000000000..98d88ee63f --- /dev/null +++ b/support/hypertex/tanmoy/examples/Anomalkap.aux @@ -0,0 +1,123 @@ +\relax +\citation{KP} +\citation{Jan} +\citation{CS} +\citation{KP} +\citation{FS} +\citation{Neu} +\citation{Neu2} +\citation{AK} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {i}}{\hbox {\hskip 1pt\relax \uppercase {i}}}\hskip -1pt\relax }Introduction}{3}} +\newlabel{sec:int}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {i}}{\uppercase {i}}}{3}} +\citation{KP} +\citation{Alt} +\citation{Dis} +\citation{CS} +\citation{Neu} +\citation{Neu} +\citation{Sham} +\citation{chiral} +\citation{Neu} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {ii}}{\hbox {\hskip 1pt\relax \uppercase {ii}}}\hskip -1pt\relax }Action, Fermion Propagator and Chiral Zero Modes}{5}} +\newlabel{sec:model}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {ii}}{\uppercase {ii}}}{5}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{A}{\hbox {\hskip 1pt\relax A}}\hskip -1pt\relax }Lattice Action}{5}} +\citation{Neu} +\citation{KP} +\citation{Neu} +\citation{Dis} +\citation{Neu} +\citation{Neu} +\citation{Alt} +\newlabel{actionf}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{3}{3}}{6}} +\citation{Neu} +\citation{CS} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{B}{\hbox {\hskip 1pt\relax B}}\hskip -1pt\relax }Chiral Zero Modes}{7}} +\citation{Neu} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{C}{\hbox {\hskip 1pt\relax C}}\hskip -1pt\relax }Fermion Propagator and Zero Modes}{8}} +\newlabel{fprop}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{11}{11}}{8}} +\newlabel{gl}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{13}{13}}{8}} +\citation{Neu} +\citation{Neu} +\citation{CS} +\newlabel{gr}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{14}{14}}{9}} +\citation{Sham} +\citation{Sham} +\citation{Dis} +\newlabel{wil}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{17}{17}}{10}} +\newlabel{shl}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{18}{18}}{10}} +\newlabel{shr}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{19}{19}}{10}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{D}{\hbox {\hskip 1pt\relax D}}\hskip -1pt\relax }Fermion Feynman Rules }{10}} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {iii}}{\hbox {\hskip 1pt\relax \uppercase {iii}}}\hskip -1pt\relax }Perturbative Calculations for the Chiral Schwinger Model}{11}} +\newlabel{sec:2dim}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {iii}}{\uppercase {iii}}}{11}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{A@}{\hbox {\hskip 1pt\relax A}}\hskip -1pt\relax }Effective Action at Fermion One-Loop}{12}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{B@}{\hbox {\hskip 1pt\relax B}}\hskip -1pt\relax }Evaluation of Zero Mode Contributions}{12}} +\citation{Dis} +\newlabel{sumf}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{37}{37}}{14}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{C@}{\hbox {\hskip 1pt\relax C}}\hskip -1pt\relax }Evaluation of Remaining Contributions}{14}} +\newlabel{gcs}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{39}{39}}{14}} +\citation{CS} +\citation{CS} +\newlabel{sum}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{41}{41}}{15}} +\newlabel{cst}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{42}{42}}{15}} +\citation{FS} +\citation{Neu,AK} +\citation{chiral} +\citation{Dis} +\citation{chiral} +\newlabel{sumk}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{44}{44}}{16}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{D@}{\hbox {\hskip 1pt\relax D}}\hskip -1pt\relax }Total Contributions}{16}} +\newlabel{eff}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{45}{45}}{16}} +\citation{Neu} +\citation{Neu2} +\citation{JR} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {iv}}{\hbox {\hskip 1pt\relax \uppercase {iv}}}\hskip -1pt\relax }Anomalies in the Chiral Schwinger Model}{17}} +\newlabel{sec:anomaly}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {iv}}{\uppercase {iv}}}{17}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{A@@}{\hbox {\hskip 1pt\relax A}}\hskip -1pt\relax }Currents and their Divergence}{17}} +\newlabel{current}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{49}{49}}{18}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{B@@}{\hbox {\hskip 1pt\relax B}}\hskip -1pt\relax }Gauge invariance}{18}} +\newlabel{sum0a}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{52}{52}}{18}} +\citation{Jan} +\newlabel{sum0b}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{53}{53}}{19}} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{C@@}{\hbox {\hskip 1pt\relax C}}\hskip -1pt\relax }Gauge Anomalies}{19}} +\citation{KP,CS} +\citation{CS} +\citation{CS} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{D@@}{\hbox {\hskip 1pt\relax D}}\hskip -1pt\relax }Chern-Simons Current}{20}} +\citation{CS} +\citation{Dis} +\citation{KP,Jan,Dis} +\citation{Dis} +\@writefile{toc}{\string\contentsline\space {subsection}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{E}{\hbox {\hskip 1pt\relax E}}\hskip -1pt\relax }Pythagorean Chiral Schwinger Model and Anomaly in Fermion Number Current}{21}} +\citation{Dis} +\citation{Neu} +\citation{AK} +\citation{Dis} +\citation{chiral} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {v}}{\hbox {\hskip 1pt\relax \uppercase {v}}}\hskip -1pt\relax }conclusions}{23}} +\newlabel{sec:concl}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {v}}{\uppercase {v}}}{23}} +\citation{Neu} +\citation{Neu3} +\citation{Neu2} +\bibcite{KP}{1} +\bibcite{Jan}{2} +\bibcite{CS}{3} +\bibcite{FS}{4} +\bibcite{Neu}{5} +\bibcite{Neu2}{6} +\bibcite{AK}{7} +\bibcite{Alt}{8} +\bibcite{Dis}{9} +\bibcite{Sham}{10} +\bibcite{chiral}{11} +\bibcite{JR}{12} +\bibcite{Neu3}{13} +\@writefile{lof}{\string\contentsline\space {figure}{\string\numberline\space {1}{\ignorespaces Two zero modes $u_L$ and $u_R$ as a function of $s$ at $m_0=0.1$ and 0.5 for $p_1=p_2=0$. We take $L=100$.}}{26}} +\newlabel{zero}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{figure}{1}{1}}{26}} +\@writefile{lof}{\string\contentsline\space {figure}{\string\numberline\space {2}{\ignorespaces The coefficient of the anomaly $C(s)$ for the Kaplan's method as a function of $s$ at $m_0=0.1$ and 0.5 for $L=100$.}}{26}} +\newlabel{anomalyK}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{figure}{2}{2}}{26}} +\@writefile{lof}{\string\contentsline\space {figure}{\string\numberline\space {3}{\ignorespaces The coefficient of the anomaly $C(s)$ for the Shamir's method as a function of $s$ at $m_0=0.1$ and 0.5 for $L=100$.}}{26}} +\newlabel{anomalyS}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{figure}{3}{3}}{26}} +\@writefile{lof}{\string\contentsline\space {figure}{\string\numberline\space {4}{\ignorespaces The coefficient of the Chern-Simons current $I(s)$ for the Kaplan's method as a function of $s$ at $m_0=0.1$ and 0.5 for $L=100$.}}{26}} +\newlabel{CSK}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{figure}{4}{4}}{26}} +\@writefile{lof}{\string\contentsline\space {figure}{\string\numberline\space {5}{\ignorespaces The coefficient of the Chern-Simons current $I(s)$ for the Shamir's method as a function of $s$ at $m_0=0.1$ and 0.5 for $L=100$.}}{26}} +\newlabel{CSS}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{figure}{5}{5}}{26}} diff --git a/support/hypertex/tanmoy/examples/Anomalkap.dvi b/support/hypertex/tanmoy/examples/Anomalkap.dvi new file mode 100644 index 0000000000..980bc473c5 Binary files /dev/null and b/support/hypertex/tanmoy/examples/Anomalkap.dvi differ diff --git a/support/hypertex/tanmoy/examples/Anomalkap.hrf b/support/hypertex/tanmoy/examples/Anomalkap.hrf new file mode 100644 index 0000000000..1ceb603dd4 --- /dev/null +++ b/support/hypertex/tanmoy/examples/Anomalkap.hrf @@ -0,0 +1,157 @@ +\def \hyperj@nk {{}{page}{1}} +\def \hyperj@nk {{}{page}{2}} +\def \hypernoname {{}{section}{\uppercase {i}}} +\def \hyperj@nk {{}{page}{3}} +\def \hyperj@nk {{}{page}{4}} +\def \hypernoname {{}{section}{\uppercase {ii}}} +\def \hypernoname {{}{subsection}{A}} +\def \hypernoname {{}{equation}{1}} +\def \hypernoname {{}{equation}{2}} +\def \hyperj@nk {{}{page}{5}} +\def \hypernoname {{}{equation}{3}} +\def \hypernoname {{}{equation}{4}} +\def \hypernoname {{}{equation}{4a}} +\def \hypernoname {{}{equation}{4b}} +\def \hypernoname {{}{equation}{5}} +\def \hypernoname {{}{equation}{6}} +\def \hyperj@nk {{}{page}{6}} +\def \hypernoname {{}{subsection}{B}} +\def \hypernoname {{}{equation}{7}} +\def \hypernoname {{}{equation}{8}} +\def \hypernoname {{}{equation}{9}} +\def \hypernoname {{}{equation}{10}} +\def \hyperj@nk {{}{page}{7}} +\def \hypernoname {{}{subsection}{C}} +\def \hypernoname {{}{equation}{11}} +\def \hypernoname {{}{equation}{12}} +\def \hypernoname {{}{equation}{13}} +\def \hypernoname {{}{equation}{14}} +\def \hyperj@nk {{}{page}{8}} +\def \hypernoname {{}{equation}{15}} +\def \hypernoname {{}{equation}{15a}} +\def \hypernoname {{}{equation}{15b}} +\def \hypernoname {{}{equation}{15c}} +\def \hypernoname {{}{equation}{15d}} +\def \hypernoname {{}{equation}{16}} +\def \hypernoname {{}{equation}{17}} +\def \hyperj@nk {{}{page}{9}} +\def \hypernoname {{}{equation}{18}} +\def \hypernoname {{}{equation}{19}} +\def \hypernoname {{}{equation}{20}} +\def \hypernoname {{}{equation}{21}} +\def \hypernoname {{}{subsection}{D}} +\def \hypernoname {{}{equation}{22}} +\def \hyperj@nk {{}{page}{10}} +\def \hypernoname {{}{equation}{23}} +\def \hypernoname {{}{equation}{24}} +\def \hypernoname {{}{equation}{25}} +\def \hypernoname {{}{section}{\uppercase {iii}}} +\def \hyperj@nk {{}{page}{11}} +\def \hypernoname {{}{subsection}{A@}} +\def \hypernoname {{}{equation}{26}} +\def \hypernoname {{}{equation}{27}} +\def \hypernoname {{}{equation}{28}} +\def \hypernoname {{}{subsection}{B@}} +\def \hypernoname {{}{equation}{29}} +\def \hypernoname {{}{equation}{30}} +\def \hyperj@nk {{}{page}{12}} +\def \hypernoname {{}{equation}{31}} +\def \hypernoname {{}{equation}{32}} +\def \hypernoname {{}{equation}{33}} +\def \hypernoname {{}{equation}{34}} +\def \hypernoname {{}{equation}{34a}} +\def \hypernoname {{}{equation}{34b}} +\def \hypernoname {{}{equation}{35}} +\def \hyperj@nk {{}{page}{13}} +\def \hypernoname {{}{equation}{36}} +\def \hypernoname {{}{equation}{37}} +\def \hypernoname {{}{subsection}{C@}} +\def \hypernoname {{}{equation}{38}} +\def \hypernoname {{}{equation}{39}} +\def \hypernoname {{}{equation}{40}} +\def \hyperj@nk {{}{page}{14}} +\def \hypernoname {{}{equation}{41}} +\def \hypernoname {{}{equation}{42}} +\def \hypernoname {{}{equation}{43}} +\def \hypernoname {{}{equation}{44}} +\def \hyperj@nk {{}{page}{15}} +\def \hypernoname {{}{subsection}{D@}} +\def \hypernoname {{}{equation}{45}} +\def \hyperj@nk {{}{page}{16}} +\def \hypernoname {{}{equation}{46}} +\def \hypernoname {{}{equation}{47}} +\def \hypernoname {{}{section}{\uppercase {iv}}} +\def \hypernoname {{}{subsection}{A@@}} +\def \hypernoname {{}{equation}{48}} +\def \hyperj@nk {{}{page}{17}} +\def \hypernoname {{}{equation}{49}} +\def \hypernoname {{}{equation}{50}} +\def \hypernoname {{}{equation}{51}} +\def \hypernoname {{}{subsection}{B@@}} +\def \hypernoname {{}{equation}{52}} +\def \hypernoname {{}{equation}{53}} +\def \hyperj@nk {{}{page}{18}} +\def \hypernoname {{}{subsection}{C@@}} +\def \hypernoname {{}{equation}{54}} +\def \hypernoname {{}{equation}{55}} +\def \hypernoname {{}{equation}{56}} +\def \hypernoname {{}{equation}{57}} +\def \hypernoname {{}{equation}{58}} +\def \hypernoname {{}{equation}{59}} +\def \hypernoname {{}{equation}{60}} +\def \hyperj@nk {{}{page}{19}} +\def \hypernoname {{}{equation}{61}} +\def \hypernoname {{}{subsection}{D@@}} +\def \hypernoname {{}{equation}{62}} +\def \hypernoname {{}{equation}{63}} +\def \hypernoname {{}{equation}{64}} +\def \hyperj@nk {{}{page}{20}} +\def \hypernoname {{}{equation}{65}} +\def \hypernoname {{}{subsection}{E}} +\def \hypernoname {{}{equation}{66}} +\def \hyperj@nk {{}{page}{21}} +\def \hypernoname {{}{equation}{67}} +\def \hypernoname {{}{equation}{68}} +\def \hypernoname {{}{equation}{69}} +\def \hypernoname {{}{equation}{70}} +\def \hypernoname {{}{equation}{71}} +\def \hypernoname {{}{section}{\uppercase {v}}} +\def \hyperj@nk {{}{page}{22}} +\def \hypernoname {{}{enumi}{1}} +\def \hypernoname {{}{enumi}{2}} +\def \hyperj@nk {{}{page}{23}} +\def \hypernoname {{}{enumi}{3}} +\def \hyperj@nk {{}{page}{24}} +\def \hypernoname {{}{enumiv}{1}} +\def \hypernoname {{}{reference}{1}} +\def \hypernoname {{}{enumiv}{2}} +\def \hypernoname {{}{reference}{2}} +\def \hypernoname {{}{enumiv}{3}} +\def \hypernoname {{}{reference}{3}} +\def \hypernoname {{}{enumiv}{4}} +\def \hypernoname {{}{reference}{4}} +\def \hypernoname {{}{enumiv}{5}} +\def \hypernoname {{}{reference}{5}} +\def \hypernoname {{}{enumiv}{6}} +\def \hypernoname {{}{reference}{6}} +\def \hypernoname {{}{enumiv}{7}} +\def \hypernoname {{}{reference}{7}} +\def \hypernoname {{}{enumiv}{8}} +\def \hypernoname {{}{reference}{8}} +\def \hypernoname {{}{enumiv}{9}} +\def \hypernoname {{}{reference}{9}} +\def \hypernoname {{}{enumiv}{10}} +\def \hypernoname {{}{reference}{10}} +\def \hypernoname {{}{enumiv}{11}} +\def \hypernoname {{}{reference}{11}} +\def \hypernoname {{}{enumiv}{12}} +\def \hypernoname {{}{reference}{12}} +\def \hypernoname {{}{enumiv}{13}} +\def \hypernoname {{}{reference}{13}} +\def \hyperj@nk {{}{page}{25}} +\def \hypernoname {{}{figure}{1}} +\def \hypernoname {{}{figure}{2}} +\def \hypernoname {{}{figure}{3}} +\def \hypernoname {{}{figure}{4}} +\def \hypernoname {{}{figure}{5}} +\def \hyperj@nk {{}{page}{26}} diff --git a/support/hypertex/tanmoy/examples/Anomalkap.log b/support/hypertex/tanmoy/examples/Anomalkap.log new file mode 100644 index 0000000000..ce0984f50c --- /dev/null +++ b/support/hypertex/tanmoy/examples/Anomalkap.log @@ -0,0 +1,83 @@ +This is TeX, C Version 3.141 (format=hlatex 94.7.16) 17 JUL 1994 21:43 +**Anomalkap +(Anomalkap.tex +LaTeX Version 2.09 <25 March 1992> +(/usr/local/lib/tex/inputs/hypertex/hyperlatex.tex +(/usr/local/lib/tex/inputs/hypertex/hyperbasics.tex +\hyperf@le=\read1 + (Anomalkap.hrf) +\hyperf@le=\write3 +\hypert@ks=\toks11 +) +\hyper@inputcheck=\read2 +) +(/usr/local/lib/tex/inputs/RevTeX/revtex.sty +Filename: revtex.sty, v3.0 <27 October 92> +(/usr/local/lib/tex/inputs/RevTeX/aps.sty +Filename: aps.sty, v3.0 <28 October 1992> +REVTeX message: NFSS not detected. Assuming OFSS. +(/usr/local/lib/tex/inputs/RevTeX/aps12.sty +Filename: aps12.sty, v3.0 <2 October 1992> +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\@indentflag=\count85 +\@eqtoeqnum=\dimen99 +\c@eqletter=\count86 +\c@equation=\count87 +\@testboxa=\box25 +\@testboxb=\box26 + (/usr/local/lib/tex/inputs/RevTeX/prabib.sty +Filename: prabib.sty, v3.0 <9/14/92> +\WidestRefLabelThusFar=\dimen100 +) +\c@figure=\count88 +\c@table=\count89 +\c@tablenote=\count90 +\@Ldec=\dimen101 +\@Rdec=\dimen102 +)) (/usr/local/lib/tex/inputs/hypertex/revtex.hty +(/usr/local/lib/tex/inputs/hypertex/aps.hty +(/usr/local/lib/tex/inputs/hypertex/prabib.hty))) (Anomalkap.aux) [1 + +] +(Anomalkap.toc) +\tf@toc=\write4 + [2] [3] [4] [5] [6] [7] +Overfull \hbox (9.95148pt too wide) detected at line 359 + [] + +\hbox(87.00085+81.00085)x468.0 +.\glue 0.0 +.\glue 0.0 plus 1000.0 +.\hbox(87.00085+81.00085)x477.95148 +..\mathon +..\twlmi G +..\hbox(5.46666+0.0)x6.95146, shifted 1.79999 +...\egtmi R +..\twlrm ( +..\twlmi p +..etc. +.\glue 0.0 plus 1000.0 + +[8] [9] [10] [11] 'subsection.A' duplicate 'subsection.B' duplicate [12] +[13] 'subsection.C' duplicate [14] [15] 'subsection.D' duplicate [16] +'subsection.A' duplicate 'subsection.A@' duplicate [17] +'subsection.B' duplicate 'subsection.B@' duplicate [18] +'subsection.C' duplicate 'subsection.C@' duplicate [19] +'subsection.D' duplicate 'subsection.D@' duplicate [20] [21] [22] [23] [24] +[25] [26] (Anomalkap.aux) ) +Here is how much of TeX's memory you used: + 672 strings out of 11975 + 8828 string characters out of 87114 + 43334 words of memory out of 262141 + 2584 multiletter control sequences out of 9500 + 20236 words of font info for 76 fonts, out of 100000 for 255 + 14 hyphenation exceptions out of 607 + 15i,12n,25p,332b,198s stack positions out of 300i,40n,60p,3000b,4000s + +Output written on Anomalkap.dvi (26 pages, 88872 bytes). diff --git a/support/hypertex/tanmoy/examples/Anomalkap.tex b/support/hypertex/tanmoy/examples/Anomalkap.tex new file mode 100644 index 0000000000..234613653f --- /dev/null +++ b/support/hypertex/tanmoy/examples/Anomalkap.tex @@ -0,0 +1,1252 @@ +\documentstyle[preprint,aps]{revtex} +%\documentstyle[prd,aps]{revtex} +\begin{document} +%\draft + +\title{Perturbative analysis for Kaplan's lattice chiral fermions} + + +\author{S. Aoki and H. Hirose} +\address{Institute of Physics, University of Tsukuba, Tsukuba +Ibaraki-305, Japan} + +\date{\today} + +\maketitle + +\begin{abstract} +Perturbation theory for lattice fermions with domain wall mass terms +is developed and is applied to +investigate the chiral Schwinger model formulated on the lattice +by Kaplan's method. +We calculate the effective action for gauge fields to one loop, +and find that it contains a longitudinal component even for anomaly-free cases. +From the effective action we obtain +gauge anomalies and Chern-Simons current without ambiguity. +We also show that the current corresponding to the fermion number +has a non-zero divergence and it flows off the wall into the extra +dimension. +Similar results are obtained for a proposal +by Shamir, who used a constant mass term with free boundaries +instead of domain walls. +\end{abstract} +\pacs{11.15Ha, 11.30Rd, 11.90.+t} + +\narrowtext + +\newpage +\tableofcontents +\newpage + +\section{Introduction} +\label{sec:int} + +Construction of chiral gauge theories is one of the long-standing +problems of lattice field theories. Because of the fermion doubling +phenomenon, +a naively discretized lattice fermion field yields $2^d$ fermion modes, half of +one chirality and half of the other, so that the theory is non-chiral. +Several lattice approaches have been proposed to define chiral gauge theories, +but so far none of them have been proven to work successfully. + +Kaplan has proposed a new approach\cite{KP} to this problem. +He suggested that it may be possible to simulate the behavior of massless +chiral fermions in 2k dimensions by +a lattice theory of massive fermions in 2k+1 dimensions if +the fermion mass has a shape of a domain wall in the +2k+1-th dimension. +He showed for the weak gauge coupling limit +that massless chiral states arise as zero-modes bound to +the 2k-dimensional domain wall while all doublers can be given large gauge +invariant masses. If the chiral fermion content that appears +on the domain wall +is anomalous the 2k-dimensional gauge current flows off the wall +into the extra dimension so that the theory can not be 2k-dimensional. +Therefore he argued that +this approach possibly simulates the 2k-dimensional chiral fermions +only for anomaly-free cases. + +His idea was tested for smooth external gauge fields. +Jansen\cite{Jan} showed numerically +that in the case of the chiral Schwinger model in 2 dimensions +with three fermions of charge 3, 4, and 5 the anomalies +in the gauge currents cancel on the wall. +The Chern-Simons current far away from the domain wall +was calculated in Ref.\ \cite{CS}. It is shown that +the 2k+1-th component of the current is non-zero +in the positive mass region +and zero in the negative mass region +such that the derivative of the current cancels +the 2k-dimensional gauge anomaly on the wall, as was argued in Ref.\ \cite{KP}. + +In the continuum perturbation theory +Frolov and Slavnov\cite{FS} proposed a gauge invariant regularization +of the standard model through an infinite tower of regulator fields. +Some similarity between their proposal and the Kaplan's approach +was pointed out by Narayanan and Neuberger\cite{Neu}. +It has been also shown that +the chiral fermion determinant can be nonperturbatively defined as an +overlap of two vacua\cite{Neu2}, which can be extended to lattice theories. +Using Narayanan and Neuberger's point of view, +we observed in Ref.\ \cite{AK} that +non-gauge (chiral) anomalies are correctly reproduced within +the Frolov and Slavnov's regularization method. + +The results above provide positive indications that Kaplan's method for chiral +fermion may work. +There exists, however, several potential problems in his approach. +Since the original 2k+1-dimensional model is vector-like, +there always exists an anti-chiral mode, localized on an anti-domain wall +formed by periodicity of the extra dimension. +If the chiral mode and the anti-chiral mode are paired into +a Dirac mode, this approach fails to simulate chiral gauge theories. +Without dynamical gauge fields, the overlap between the chiral mode and +the anti-chiral mode is suppressed as $O (e^{-L})$ where $L$ is the size of the +extra dimension. If gauge fields become dynamical, the overlap +depends on the gauge coupling. In the original paper\cite{KP} +the strong coupling limit of the gauge coupling in the extra dimension +was proposed to suppress the overlap. However, +a mean-field calculation\cite{Alt} +in this limit indicated that the chiral mode disappears and the model becomes +vector-like. + +More recently Distler and Rey\cite{Dis} pointed out that +the Kaplan's method may have a problem in reproducing fermion number +non-conservation expected in the standard model. +Using the 2-dimensional chiral Schwinger model +they argued that either the 2-dimensional fermion number current is exactly +conserved or the light degree of freedom flows off the wall into the +extra dimension so that the model can not be 2-dimensional. + +In this paper we carry out a detailed perturbative analysis of the Kaplan's +proposal for smooth background gauge fields on a finite lattice +taking the chiral Schwinger model in 2-dimensions as a concrete example. +In sect.\ \ref{sec:model}, +we formulate the lattice perturbation theory for +the Kaplan's method with the periodic boundary condition. +Since translational invariance is violated by domain wall mass terms, +usual Feynman rules in the momentum space can not be used except +in the regions far away from the domain wall\cite{CS}. +To perform perturbative calculations near or on the wall, +we use the Feynman rules in real space of the extra dimension, +as proposed in ref.\ \cite{Neu}. +We calculate the fermion propagator for the periodic boundary condition, +which reproduces the fermion propagator in ref.\cite{Neu} +near the origin of the extra dimension. +A similar calculation is also made for the constant fermion mass +with {\it free} boundaries in the 2k+1-th dimension. +As shown by Shamir\cite{Sham} the constant mass term +with this boundary condition +can also produce the chiral zero mode on the 2k-dimensional +boundary. +The results are similar but simpler than those by the Kaplan's method. +In sect.\ \ref{sec:2dim}, +using the Feynman rules of sect.\ \ref{sec:model} +we calculate a fermion one-loop effective action for the U(1) gauge field +of the chiral Schwinger model simulated by the Kaplan's method. +We find that the effective action +contains the longitudinal component as well as +parity-odd terms, +and that this longitudinal component, which +breaks gauge invariance, remains non-zero even for anomaly-free cases. +This result is compared with those of the conventional Wilson fermion +formulation of this model\cite{chiral}. +In sect.\ \ref{sec:anomaly} +we derive gauge anomalies as well as the Chern-Simons current +from the effective action without ambiguity. +Then we show that the current corresponding to +the fermion number has a non-zero divergence +and the fermion number current flows off the walls into the extra dimension. +In sect.\ \ref{sec:concl}, we give our conclusions and discussions. + +\section{Action, Fermion Propagator and Chiral Zero Modes} +\label{sec:model} + +\subsection{Lattice Action} +We consider a vector gauge theory in D=2k+1 dimensions with +a domain wall mass term. For later convenience we use the +notation of ref.\cite{Neu}, where the fermionic action is written in terms of +a d=2k dimensional theory with infinitely many flavors. +Our action is denoted as +\begin{equation} +S= S_G + S_F . +\end{equation} +The action for gauge field $S_G$ is given by +\begin{eqnarray} +S_G & =& \beta \sum_{n,\mu>\nu}\sum_s {\rm Re}\{ {\rm Tr} [U_{\mu\nu}(n,s)]\} + \nonumber \\ +& +& \beta_D \sum_{n,\mu}\sum_s {\rm Re} \{ {\rm Tr} [U_{\mu D}(n,s)]\} +\end{eqnarray} +where $\mu$, $\nu$ run from 1 to $d$, +$n$ is a point on a d-dimensional lattice and $s$ a coordinate in the +extra dimension, +$\beta$ is the inverse gauge coupling for plaquettes $U_{\mu\nu}$ +and $\beta_D$ that for plaquettes $U_{\mu D}$. +In general we can take $\beta \not= \beta_D$. +The fermionic part of the action $S_F$ is given by +\widetext +\begin{eqnarray} +S_F & = & {1\over 2}\sum_{n,\mu}\sum_s \bar\psi_s(n)\gamma_\mu +[U_{s,\mu}(n)\psi_s(n+\mu ) - U^\dagger_{s,\mu}(n-\mu)\psi_s(n-\mu ) ] + \nonumber \\ + &+& \sum_n \sum_{s,t} \bar\psi_s(n) [ M_0 P_R + M_0^\dagger P_L]_{st} +\psi_t(n) +\nonumber \\ + & + & {1\over 2}\sum_{n,\mu}\sum_s \bar\psi_s(n) +[U_{s,\mu}(n)\psi_s(n+\mu ) + U^\dagger_{s,\mu}(n-\mu)\psi_s(n-\mu ) + -2\psi_s(n) ] +\label{actionf} +\end{eqnarray} +where $s$, $t$ are considered as flavor indices, +$P_{R/L} = (1 \pm \gamma_{2k+1})/2$, +\narrowtext +\begin{mathletters} +\begin{eqnarray} +(M_0)_{st} & = & U_{s,D}(n)\delta_{s+1,t}- a(s)\delta_{st} + \\ +(M_0^\dagger)_{st} & = & U^\dagger_{s-1,D}(n)\delta_{s-1,t}- a(s)\delta_{st} , +\end{eqnarray} +\end{mathletters} +and $U_{s,\mu}(n)$, $U_{s,D}(n)$ are link variables for gauge fields. +We consider the above model with periodic boundaries +in the extra dimension, +so that $s$, $t$ run from $-L$ to $L-1$, and we take +\begin{equation} +a(s) = 1 - m_0[ {\rm sign}(s+{1\over 2}) \cdot {\rm sign}(L-s- +{1\over 2})] += \left\{ +\begin{array}{ll} +1-m_0, & -{1\over 2} < s < L-{1\over 2} \\ +1+m_0, & -L-{1\over 2} < s < -{1\over 2} +\end{array} +\right. +\end{equation} +for $-L \leq s < L $. It is easy to see\cite{Neu} that $S_F$ above is +identical to the Kaplan's action in D=2k+1 dimensions\cite{KP} +with the Wilson parameter $r=1$. In fact the second term +in eq.\ (\ref{actionf}) can be rewritten as +\begin{eqnarray} +& {1\over 2}& \bar\psi_s\gamma_D [U_{s,D}\psi_{s+1}-U_{s-1,D}\psi_{s-1}] + \nonumber \\ +&+& {1\over 2}\bar\psi_s[U_{s,D}\psi_{s+1}+U_{s-1,D}\psi_{s-1} +-2\psi_s] + M(s) \bar\psi_s \psi_s +\end{eqnarray} +with $M(s)=m_0 [ {\rm sign}(s+1/2) \cdot {\rm sign}(L-s-1/2)]$. +Note that our action is slightly different from that of ref.\cite{Neu}: +we have the D-th component of the link variable $U_{s,D}(n)$ +and all link variables have $s$ dependence. With the gauge fixing condition +$U_{s,D}(n) =1$ for all $s$ and $n$\cite{Dis}, +our action becomes almost identical to that of ref.\cite{Neu}, but +still the $s$ dependence exists in our link variables in d dimensions. +The model in ref.\cite{Neu} corresponds to our model at +$\beta_D =\infty$, where $s$ dependences of gauge fields are +completely suppressed, and the model at $\beta_D = 0$ was +investigated by the mean field method\cite{Alt}. + +\subsection{Chiral Zero Modes} +We now consider chiral zero modes of the action $S_F$ in +the weak coupling limit , i.e. $\forall U_{s,\mu} = \forall U_{s,D}=1$. +According to ref.\cite{Neu}, the right-handed zero modes are given +by zero modes of the operator $M$ and the left-handed zero modes +by those of the operator $M^\dagger$, where +\begin{equation} +(M)_{st} = (M_0)_{st} + {\nabla (p)\over 2}\delta_{st}, \ +(M^\dagger )_{st} = (M_0^\dagger )_{st} + {\nabla (p)\over 2}\delta_{st} +\end{equation} +with $\nabla (p)\equiv \sum_{\mu=1}^d 2 [\cos (p_\mu a) - 1 ]$ +in momentum space of d dimensions. +It is noted that $ 0 \leq -\nabla(p) \leq 4d$ and zero modes exist +if and only if $ -\nabla (p) \le 2m_0$\cite{CS}. +Hereafter we only consider the case that $ 0 < m_0 < 2$. +In this range of $m_0$, there is only one right-handed zero mode $u_R$ +satisfying $ M \cdot u_R = 0$, which is given by +\begin{equation} +u_R(s) = \left\{ \begin{array}{ll} +\displaystyle (1-\nabla (p)/2-m_0)^s C_0^{-1} & \mbox{for $s \geq 0$} \\ + & \\ +\displaystyle (1-\nabla (p)/2+m_0)^s C_0^{-1} & \mbox{for $s < 0$} +\end{array} \right. +\end{equation} +where the d-dimensional momentum $p$ has to be restricted to +$ 0 \leq m_0+\nabla (p) /2 $ so that +$(1-\nabla/ 2 -m_0) \leq 1$. The normalization constant $C_0$ takes the value +\begin{equation} +{1-(1-\nabla (p)/2-m_0)^L\over m_0+\nabla (p)/2} + +{1-(1-\nabla (p)/2+m_0)^{-L}\over m_0 - \nabla (p)/2} . +\end{equation} +This zero mode is localized around $s=0$. +On a finite lattice (i.e. $L\not= \infty$) with the periodic boundary +condition, there exists another zero mode $u_L$ with the opposite +chirality satisfying $ M\cdot u_L = 0 $, which is given by +$ u_L(s) = u_R(L-t-1)$ and is localized around $s=L$. +The overlap between the two zero modes vanishes exponentially as +$L\rightarrow \infty$; +\begin{eqnarray} +\sum_{s=-L}^{L-1} u_R(s) u_L(s) & =& C_0^{-2} L\times + (1-{\nabla (p)\over2}-m_0)^L + \nonumber \\ +&\times & +(1-{\nabla (p)\over 2}+m_0)^{-L} +\longrightarrow 0, +\end{eqnarray} +We illustrate the shape of the two zero modes $u_R$ and $u_L$ +at $m_0= 0.1$ and 0.5 for $ p =0$ in Fig.\ \ref{zero}. + +\subsection{Fermion Propagator and Zero Modes} +The fermion propagator in d-dimensional momentum space and +in real D-th space has been obtained in ref.\cite{Neu} for +the infinite D-th space(i.e. $L=\infty$ ). +It is not difficult to obtain +the fermion propagator for a finite lattice with +periodic boundaries. We have +\begin{eqnarray} +S_F(p)_{st} & = &- \left[ [(i\sum_\mu \gamma_\mu \bar p_\mu+ M ) G_L (p)]_{st} +P_L \right. + \nonumber \\ +& + & +\left. [(i\sum_\mu \gamma_\mu \bar p_\mu+ M^\dagger ) G_R (p)]_{st}P_R \right] +\label{fprop} +\end{eqnarray} +where +\begin{equation} +G_L (p) ={1\over \bar p^2 + M^\dagger M }, +\quad +G_R (p) ={1\over \bar p^2 + M M^\dagger } +\end{equation} +with $\bar p_\mu = \sin (p_\mu a)$ . +Explicit expressions for $G_L$ and $G_R$ are complicated in general, +but they become simple for large $L$ where we neglect terms of order +$O(e^{-cL})$ with $c > 0$. +We obtain +\widetext +\begin{equation} +G_L(p)_{st} = +\left\{ \begin{array}{ll} +B e^{-\alpha_+|s-t|} + (A_L-B) e^{-\alpha_+(s+t)} + +(A_R-B) e^{-\alpha_+(2L-s-t)}, +& (s,t \ge 0) \\ + & \\ +A_Le^{-\alpha_+s+\alpha_-t} +A_Re^{-\alpha_+(L-s)-\alpha_-(L+t)}, +& (s\ge 0,\ t\le 0) \\ + & \\ +A_Le^{\alpha_-s-\alpha_+t} + A_Re^{-\alpha_-(L+s)-\alpha_+(L-t)}, +& (s\le 0,\ t\ge 0) \\ + & \\ +C e^{-\alpha_-|s-t|}+ (A_L-C) e^{\alpha_-(s+t)} + +(A_R-C) e^{-\alpha_-(2L+s+t)}, +& (s,t \le 0) +\end{array} \right. +\label{gl} +\end{equation} +\begin{equation} +G_R(p)_{st} = +\left\{ \begin{array}{ll} +B e^{-\alpha_+|s-t|} + (A_R-B) e^{-\alpha_+(s+t+2)} + +(A_L-B) e^{-\alpha_+(2L-s-t-2)}, +& (s,t \ge -1) \\ + & \\ +A_Re^{-\alpha_+(s+1)+\alpha_-(t+1)} +A_Le^{-\alpha_+(L-s-1)-\alpha_-(L+t+1)}, +& (s\ge -1,\ t\le -1) \\ + & \\ +A_Re^{\alpha_-(s+1)-\alpha_+(t+1)} +A_Le^{-\alpha_-(L+s+1)-\alpha_+(L-t-1)}, +& (s\le -1,\ t\ge -1) \\ + & \\ +C e^{-\alpha_-|s-t|} + (A_R-C) e^{\alpha_-(s+t+2)} + +(A_L-C) e^{-\alpha_-(2L+s+t+2)}, +& (s,t \le -1) +\end{array} \right. +\label{gr} +\end{equation} +\narrowtext where +\begin{mathletters} +\begin{equation} +a_{\pm} = 1 -{\nabla (p)\over 2}\mp m_0 +\end{equation} +\begin{equation} +\alpha_{\pm} = {\rm arccosh} [{1\over 2}(a_{\pm}+{1+\bar p^2\over a_{\pm}})] +\geq 0, +\end{equation} +\begin{equation} +A_L = {1\over a_+ e^{\alpha_+} - a_-e^{-\alpha_-}}, \qquad +A_R ={1\over a_- e^{\alpha_-}- a_+e^{-\alpha_+}} +\end{equation} +\begin{equation} +B = {1\over 2 a_+ {\rm sinh} \alpha_+}, \qquad +C = {1\over 2 a_- {\rm sinh} \alpha_-} . +\end{equation} +\end{mathletters} + +For $|s|, |t| \ll L$ the propagator above coincides with +that of ref.\cite{Neu}. +From the form of $A_L$, $A_R$, $B$ and $C$, +it is easy to see\cite{Neu} +that singularities occur only in $A_L$ at $p=0$; +\begin{equation} +A_L \longrightarrow {m_0(4-m_0^2) \over 4 p^2 a^2 }, +\qquad p\rightarrow 0 . +\end{equation} +Therefore the propagator $G_L$ describes a massless right-handed +fermion around $s,t = 0$ and $G_R$ a massless left-handed fermion +around $|s|,|t| = L$, which correspond to the two zero modes in the +previous subsection. +Later we use the above forms of the fermion propagator +to calculate fermion one-loop diagrams. +It is also noted that the fermion propagator away from the two domain walls +approaches the Wilson fermion propagator +with a {\it constant} mass term, i.e. , +\begin{eqnarray} +S_F(p) & \rightarrow +& \int {dp_D\over 2\pi} +{e^{ia p_D(s-t)} \over i\gamma\cdot p + i\gamma_D p_D \pm m_0 +-\nabla (p) +1-\cos (p_D a)} +\label{wil} +\end{eqnarray} +for $1 \ll |s|, |t|, |L-s|, |L-t|$ with $s\cdot t > 0$, where $+m_0$ is taken +for $s,t > 0$ and $-m_0$ for $s,t < 0$. +Therefore the calculation in ref.\cite{CS} is valid in this region +of $s$ and $t$. + +Before closing this subsection, we give the form of propagator for the Shamir's +free boundary fermions\cite{Sham}. +This is again given by eq.(\ref{fprop}) +with $M_{st}=\delta_{s+1,t}-a_+ \delta_{s,t}$ +and $M^\dagger_{st}=\delta_{s-1,t}-a_+ \delta_{s,t}$. +For large $L$, it becomes\cite{Sham} +\begin{equation} +G_L(p)_{st} = +B e^{-\alpha_+|s-t|} + A'_L e^{-\alpha_+(s+t)} ++A'_Re^{\alpha_+(s+t-2L)} +\label{shl} +\end{equation} +\begin{equation} +G_R(p)_{st} = +B e^{-\alpha_+|s-t|}+ A'_R e^{-\alpha_+(s+t)} + +A'_Le^{\alpha_+(s+t-2L)} , +\label{shr} +\end{equation} +where +\begin{equation} +A'_L = B {1-a_+e^{-\alpha_+}\over a_+e^{\alpha_+}-1}, \qquad +A'_R = - Be^{-2\alpha_+} +\end{equation} +and now $ 0 \le s,t \le L$. +Singularities occur only in $A'_L$ at $p=0$ such that +\begin{equation} +A'_L \rightarrow {m_0(2-m_0)\over p^2 a^2} . +\end{equation} +Thus, the propagator describes a right-handed massless +fermion around one boundary at $s,t = 0$ and +a left-handed massless around the other boundary at $s,t = L$. + +\subsection{Fermion Feynman Rules } +In this subsection, we write down the lattice Feynman rules for fermions +relevant for fermion one-loop calculations, +which will be performed in the next section. +We first choose the axial gauge fixing $U_{s,D}=1$. +Although the full gauge symmetries in D dimensions are lost, +the theory is still invariant under gauge +transformations independent of $s$ \cite{Dis}. +We consider the limit of small d-dimensional gauge coupling, and take +\begin{equation} +U_{s,\mu}(n) = exp[i a g A_\mu (s, n+\mu/2)] +\end{equation} +where $a$ is the lattice spacing, and +$g \propto 1/\sqrt\beta$ +is the gauge coupling constant whose mass dimension is $2-D/2$ +(mass dimension of the gauge fields $A_\mu$ is $D/2-1$). +It is noted that the other gauge coupling $g_s \propto 1/\sqrt{\beta_s}$ +is not necessarily small and can be made arbitrary large. +We consider Feynman rules in momentum space for the physical +d dimensions but in real space for the extra dimension. +\begin{itemize} +\item The fermion propagator is given by +\begin{equation} +< \psi_s (-p) \bar\psi_t (p) > = S_F(p)_{st}. +\end{equation} +where $S_F$ has been given in eq.(\ref{fprop}) with +eqs.(\ref{gl},\ref{gr}) for the Kaplan's fermions or with +eqs.(\ref{shl},\ref{shr}) for the Shamir's fermions. + +\item The fermion vertex coupled to a single gauge field is given by +\begin{equation} +ag \bar\psi_s(q) \partial_\mu [ S_F^{-1}({q+p\over 2})]_{ss} +A_\mu(s,p-q)\psi_s(-p). +\end{equation} +Here +$\partial_\mu S_F^{-1}(q) = \displaystyle {\partial S_F^{-1}(q)\over +\partial (q_\mu a)} = iC_\mu(q)\gamma_\mu + S_\mu (q)$ with +$C_\mu (q)= \cos (q_\mu a)$ and $S_\mu (q)= \sin (q_\mu a)$. +From this form of the vertex it is easy to see that +the fermion tadpole diagram for an external gauge field vanishes identically. +\item The fermion vertex with two gauge fields is given by +\begin{equation} +- a^2 {g^2\over 2} +\bar\psi_s(q) [\partial^2_\mu S_F^{-1}({q+p\over 2})]_{ss} +A^2_\mu(s,p-q)\psi_s(-p) +\end{equation} +where $A_\mu^2(s,p) = A_\mu (s,p-p_1) A_\mu(s,p_1)$ with $p$ and $p_1$ fixed. +\end{itemize} + +\section{Perturbative Calculations for the Chiral Schwinger Model} +\label{sec:2dim} +In the following two sections +we analyze the chiral Schwinger model +formulated via the Kaplan's method for lattice chiral fermions. +Using the Feynman rules of the previous section +for $D=3$, +we calculate the effective action for external gauge fields, +from which we +derive gauge anomalies, Chern-Simons current, and anomaly of the +fermion number current. +We perform the calculations for the Shamir's method in parallel +with those for the Kaplan's method. + +\subsection{Effective Action at Fermion One-Loop} +Since $ [ A_\mu, A_\nu ]=0$ for U(1) gauge fields, all diagrams with +odd number of external gauge fields vanishes identically. +Furthermore diagrams with four or more external gauge fields +are all convergent. Therefore only the diagrams with two external gauge +fields are potentially divergent. The effective action +for two external gauge fields is denoted by +\begin{eqnarray} +S_{eff}^{(2)} & \equiv & -{g^2\over 2}\sum_{p,s,t} +A_\mu (s,p) A_\nu (t,-p) I^{\mu\nu}(p)_{st} + \nonumber \\ +&=& -{g^2\over 2}\sum_{p,s,t} A_\mu (s,p) A_\nu (t,-p) + [I_a^{(2)} + I_b^{(2)}]^{\mu\nu} _{st}, +\end{eqnarray} +where +\begin{eqnarray} +[I_a^{(2)}]^{\mu\nu} _{st} & = & +\int_{-\pi/a}^{\pi/a} {d^2 q\over (2\pi)^2} +{\rm tr} \left\{[\partial_\mu S_F^{-1}(q+{p\over 2})\cdot S_F(q+p)]_{st} + \right. \nonumber \\ +& \times & \left. +[\partial_\nu S_F^{-1}(q+{p\over 2})\cdot S_F(q)]_{ts}\right\}\times a^2 +\end{eqnarray} +and +\begin{equation} +[I_b^{(2)}]^{\mu\nu} _{st} = -\delta_{st} \delta_{\mu\nu} +\int_{-\pi/a}^{\pi/a} {d^2 q\over (2\pi)^2} +{\rm tr} [\partial_\mu^2 S_F^{-1}(q)\cdot S_F(q)]_{ss} \times a^2 +\end{equation} +with tr meaning trace over spinor indices. + +\subsection{Evaluation of Zero Mode Contributions} +To evaluate $I^{\mu\nu}(p)$ we decompose it into two parts as +\begin{equation} +I^{\mu\nu}(p) = I^{\mu\nu}_0(p)+ [I^{\mu\nu}(p)-I^{\mu\nu}_0(p)] +\end{equation} +where $I^{\mu\nu}_0$ is the contribution of zero modes and +$I^{\mu\nu}-I_0^{\mu\nu}$ is the remaining contribution. +For $I_0^{\mu\nu}$ we replace the integrand of $I^{\mu\nu}$ +with that in the $a\rightarrow 0$ limit, and we obtain +\begin{eqnarray} +I^{\mu\nu}_0(p)_{st} & = & +\sum_X \int_{-\nabla (q)\le 2m_0} {d^2 q\over (2\pi)^2} + \nonumber \\ +& \times & +{\rm tr} \left[ +i\gamma_\mu (-i\gamma_\alpha (q+p)_\alpha a ) G_X^0(q+p)_{st} P_X + \right. \nonumber \\ +& \times & +\left. +i\gamma_\nu (-i\gamma_\beta (q+p)_\beta a ) G_X^0(q+p)_{ts} P_X] +\right] \times a^2 , +\end{eqnarray} +with $X=L$ for $|s|,|t| \approx 0$, or $X=R$ for $|s|,|t| \approx L$. +The zero mode propagators $G_X^0$ are given by +\begin{equation} +G_X^0(q)_{st} = \lim_{a\rightarrow 0} G_X(q)_{st} += {1\over q^2 a^2 } F_X (s,t) +\end{equation} +where $ F_X(s,t) = F_X(t,s)$ and +\widetext +\begin{equation} +F_L(s,t) = {m_0(4-m_0^2)\over 4 } \times \left\{ +\begin{array} {ll} + (1- m_0)^{s+t} & \mbox{\ for $s,t \ge 0$ } \\ + & \\ + (1- m_0)^s(1+m_0)^t & \mbox{\ for $s \ge 0$ and $t < 0$ } \\ + & \\ + (1+m_0) ^{s+t} & \mbox{\ for $s,t \le 0$ } +\end{array} \right. +\end{equation} +\begin{equation} +F_R(s,t) = {m_0(4-m_0^2)\over 4 } \times \left\{ +\begin{array} {ll} + (1- m_0)^{2L-s-t-2} & \mbox{\ for $s,t \ge 0$ } \\ + & \\ + (1- m_0)^{L-s-1} (1+m_0)^{-L-t-1} & \mbox{\ for $s \ge 0$ and $t < 0$ } \\ + & \\ + (1+m_0) ^{-2L-s-t-2} & \mbox{\ for $s,t \le 0$ } +\end{array} \right. +\end{equation} +\narrowtext for the Kaplan's fermion with the domain wall mass terms, and +\begin{mathletters} +\begin{eqnarray} +F_L(s,t) &=& m_0 (2-m_0) (1-m_0)^{s+t} + \\ +F_R(s,t) &=& m_0 (2-m_0) (1-m_0)^{2L-s-t} +\end{eqnarray} +\end{mathletters} +for the Shamir's fermion with the constant mass terms and free boundaries. + +We evaluate $I^{\mu\nu}_0(p)$ in the $a\rightarrow 0$ limit. +In this limit +\begin{eqnarray} +\displaystyle +&\displaystyle \lim_{a\rightarrow 0}& \int_{-\nabla (q)\le 2m_0} +{d^2 q\over (2\pi)^2} +{\rm tr}[P_X\gamma_\mu\gamma_\alpha\gamma_\nu\gamma_\beta ] +{(q+p)_\alpha q_\beta \over (q+p)^2 q^2} + \nonumber \\ +& = & \displaystyle + \int_{-\infty}^{\infty} {d^2 q\over (2\pi)^2} +{\rm tr}[P_X\gamma_\mu\gamma_\alpha\gamma_\nu\gamma_\beta ] +{(q+p)_\alpha q_\beta \over (q+p)^2 q^2} + \nonumber \\ +& = & \displaystyle +{1\over 2\pi}\left[ \delta_X +i\epsilon^{\mu\alpha}{p_\nu p_\mu\over p^2} + +(\delta^{\mu\nu}-{p_\mu p_\nu\over p^2})-{\delta^{\mu\nu}\over 2}\right] , +\end{eqnarray} +therefore we obtain +\begin{eqnarray} +\lim_{a\rightarrow 0} I^{\mu\nu}_0(p) & = & +\sum_X {1\over 2\pi}[\delta_X i\epsilon^{\mu\alpha}{p_\nu p_\mu\over p^2} + +(\delta^{\mu\nu}-{p_\mu p_\nu\over p^2})-{\delta^{\mu\nu}\over 2}] + \nonumber \\ +&\times & F_X(s,t)^2 +\end{eqnarray} +where $\delta_L=1$ and $\delta_R=-1$. +It is noted that $F_X$ satisfies +\begin{equation} +\sum_{t}F_X(s,t)^2 = F_X(s,s) , \qquad +\sum_{s,t}F_X(s,t)^2 =1 . +\label{sumf} +\end{equation} + +\subsection{Evaluation of Remaining Contributions} +We consider the remaining terms in $I^{\mu\nu}$. +Since the combination $I^{\mu\nu}(p) - I^{\mu\nu}_0(p)$ is infra-red finite, +we can change the integration variable from $q$ to $ q a$ +and take the $a\rightarrow 0$ limit in the integrand. Thus we obtain +\begin{equation} +\lim_{a\rightarrow 0} I^{\mu\nu}(p) - I^{\mu\nu}_0(p) + =I^{\mu\nu} (0) = {1\over 2\pi}\cdot +[i \epsilon^{\mu\nu}\Gamma_{CS} +\delta^{\mu\nu} K] +\end{equation} +where +\begin{eqnarray} +\Gamma_{CS}(s,t)& = & {\epsilon^{\mu\nu}\over i} +2\pi +\int {d^2q\over (2\pi)^2} {\rm tr}\left\{ [\partial_\mu S_F^{-1}(q)S_F(q)]_{st} + \right. \nonumber \\ +& \times & \left. +[\partial_\nu S_F^{-1}(q)S_F(q)]_{ts}\right\} +\label{gcs} +\end{eqnarray} +and +\begin{eqnarray} +& \displaystyle K (s,t) = 2\pi +\int {d^2q\over (2\pi)^2}\left[ +{\rm tr}\left\{ [\partial_\mu S_F^{-1}(q)S_F(q)]_{st} + \right. \right. \nonumber \\ +& \times \left. \left. +[\partial_\mu S_F^{-1}(q)S_F(q)]_{ts}\right\} +- \delta_{st}{\rm tr} [\partial_\mu^2 S_F^{-1}(q)S_F(q)]_{ss} \right] . +\end{eqnarray} +Here no summation over $\mu$, $\nu$ is implied. + +The parity-odd term $\Gamma_{CS}$ is the coefficient function of +a 3-dimensional Chern-Simons term in the axial gauge\cite{Dis}, +which satisfies $\Gamma_{CS}(s,t)= - \Gamma_{CS}(t,s)$. +It is easy to show that +\begin{eqnarray} +& \displaystyle \sum_t \Gamma_{CS}(s,t) =-{ \epsilon^{\mu\nu}\over i} +\int {d^2q\over 2\pi} {\rm tr}\left\{ \partial_\mu S_F^{-1}(q)\partial_\nu +S_F(q)\right\}_{ss} + \nonumber \\ +& = \displaystyle {\epsilon^{\mu\nu}\over i} \left[ \int {dq_\mu \over 2\pi} +{\rm tr}\left\{ \partial_\mu S_F^{-1}(q)\cdot S_F(q)\right\}_{ss} +\right]_{q_\nu =\epsilon}^\pi \nonumber +\end{eqnarray} +This would be zero if there were +no infra-red singularities in $S_F$. +However, because of the contribution from zero modes, +$S_F$ is singular at $q=0$. Therefore +\widetext +\begin{eqnarray} +\sum_t \Gamma_{CS}(s,t) & = & - \sum_t\Gamma_{CS}(t,s) + = \displaystyle +4 \lim_{\epsilon\rightarrow 0} \left[ \int_{\epsilon}^{\pi/2} +{dq_\mu\over 2\pi}\sum_X \delta_X +[S_\nu (q) C_\mu (q) G_X^0 (q)]_{ss}\right]_{q_\nu =\epsilon}^{\pi /2} + \nonumber \\ +&=& \displaystyle +-4 \sum_X \delta_X F_X(s,s) +\lim_{\epsilon\rightarrow 0} \int_{\epsilon}^{\pi/2} {dq_\mu\over 2\pi} +{\epsilon\over q_\mu^2 + \epsilon^2} + \nonumber \\ +& = & \displaystyle +-\sum_X 2\delta_X +{F_X(s,s)\over\pi} \left[\tan^{-1}{q\over\epsilon}\right]_{\epsilon}^{\pi/2} + \nonumber \\ +& = & \displaystyle +-\sum_X {\delta_X\over 2} F_X(s,s) , +\label{sum} +\end{eqnarray} +\narrowtext where $F_X(s,t)$ is given in the previous subsection. + +Since $S_F$ becomes the Wilson fermion propagator with constant mass term +for $1 \ll |s|,|t|, |L-s|, |L-t|$ with $s\cdot t > 0$ [see eq.(\ref{wil}) ], +it becomes +\begin{eqnarray} & +\sum_{s,t}\Gamma_{CS}^{\mu\nu}(s,t)A_\mu(s,p) A_\mu(t,-p) +\longrightarrow + \nonumber \\ +& -\epsilon^{\mu\nu} \int dp_3 A_\mu(p_3,p)p_3 A_\mu (-p_3,-p) +\displaystyle \int {d^3 q\over (2\pi)^2} + \nonumber \\ +& \times +{\rm tr}\left\{ [\partial_\mu S_F^{-1}\cdot S_F ] +[\partial_3 S_F^{-1}\cdot S_F ] [\partial_\nu S_F^{-1}\cdot S_F ] +\right\} , +\label{cst} +\end{eqnarray} +which coincides with the result of ref.\cite{CS}. This is a good check of our +calculation. From Ref.\ \cite{CS} we obtain +\begin{equation} += \epsilon^{\mu\nu} \int dp_3 A_\mu(p_3,p)p_3 A_\nu (-p_3,-p) +\times \left\{ +\begin{array}{ll} +\displaystyle 1 & \mbox{\quad for $+m_0$} \\ + & \\ +0 & \mbox{\quad for $-m_0$} +\end{array} . +\right. \nonumber +\end{equation} + +The parity-even term $K$ satisfies +$K(s,t)=K(t,s)$ and +\begin{eqnarray} + & \sum_{t}& K(s,t) = \sum_t K(t,s) + \nonumber \\ +& = & \displaystyle +- \int {d^2 q\over (2\pi)^2} +{\rm tr}\left\{ +[\partial_\mu S_F^{-1}\cdot\partial_\mu S_F]_{ss} + [\partial_\mu^2 S_F^{-1} +\cdot S_F ]_{ss} \right\} + \nonumber \\ + & = & \sum_X {1\over 2}\cdot F_X (s,s) +\label{sumk} +\end{eqnarray} +The derivation of the last equality is similar to that of eq.(\ref{sum}). + + +\subsection{Total Contributions} +Combining the above contributions we finally obtain +\widetext +\begin{eqnarray} +S_{eff}^{(2)} &=& +-{g^2\over 4\pi} \sum_{s,t} \int d^2 x \left\{ +\sum_X F_X(s,t)^2 +[A_\mu(s,x)(\delta^{\mu\nu}-{\partial_\mu\partial_\nu \over \Box}) A_\nu (t,x)] + \right. + \nonumber \\ +&+& +[K(s,t)- \sum_X {1\over 2}\cdot F_X(s,t)^2 ] A_\mu (s,x) A_\mu (t,x) + \nonumber \\ + &+& \left. +\sum_X i\delta_X F_X(s,t)^2 [{\partial_\mu\over \Box } +A_\mu (s,x)\epsilon^{\alpha\nu}\partial_\alpha A_\nu (t,x) ]+ +i\Gamma_{CS}(s,t) \epsilon^{\mu\nu} A_\mu(s,x) A_\nu(t,x) +\right\} . +\label{eff} +\end{eqnarray} +\narrowtext +This is the main result of this paper. +It is noted that the above formula is valid for both the Kaplan's and +the Shamir's methods. +The following consequences can be drawn from eq.\ (\ref{eff}) above. + +The Parity-odd terms, which are proportional to $\epsilon^{\alpha\nu}$, +are unambiguously defined, contrary to the case of the continuum regularization +for anomaly free chiral gauge theories\cite{FS} +which only regulates the parity even terms\cite{Neu,AK}. +These parity-odd terms break gauge invariance in the 2-dimensional sense. + +For {\it anomalous} chiral Schwinger model, +the parity-odd term with $X=R$ is localized around $s=0$ +and that for $X=L$ is localized around $s=L$. +The effective action above for anomalous chiral Schwinger model via +the Kaplan's method or the Shamir's variation is different from the one +via the usual Wilson fermion in 2 dimensions\cite{chiral}: +The term proportional to $\Gamma_{CS}$, which can not be evaluated analytically +for $s$ dependent gauge fields, is special for chiral fermions +from 3-dimensional theories, and the presence of this term prevents us from +concluding whether the anomalous chiral Schwinger model can be consistently +defined via the Kaplan's (Shamir's) method. + +For anomaly free cases such that $\sum_R g_R^2 = \sum_L g_L^2$, +the parity-odd terms are exactly cancelled {\it locally} in $s$ space. +Here $g_{R(L)}$ is the coupling constant of a fermion with positive +(negative) $m_0$ which generate a right-handed (left-handed) zero mode +around $s=0$. The simplest but non-trivial example is +a Pythagorean case, $g_R=3, 4$ and $g_L = 5$\cite{Dis}. +Even for these anomaly free cases, +the longitudinal term, whose coefficient is $K-F^2/2$, +remains non-zero in the effective action, +so that gauge invariance in the {\it 2-dimensional} sense is +violated. +In this regard +the form of the effective action via the Kaplan's +(Shamir's) method is similar to +the one via the usual Wilson fermion\cite{chiral}. + +Let us consider the effective action for $s$ independent gauge fields +as in ref.\cite{Neu}. +Since $\sum_{\mu ,\nu }\epsilon^{\mu\nu} A_\mu(x) A_\nu(x) = 0$ +for $s$ independent gauge fields, the Chern-Simons term vanishes. +The other parity-odd term is cancelled between the two zero modes +since $\sum_{X,s,t} \delta_X F_X(s,t)^2=0$. +The longitudinal term also vanishes due to the identity +\begin{equation} +\sum_{t}[K(s,t)-{F_X(s,t)^2\over 2}] = +\sum_{t}[{F_X(s,t)^2\over 2}-{F_X(s,t)^2\over 2}] = 0 +\end{equation} +[see eqs.\ (\ref{sumf}) and (\ref{sumk})]. +Therefore the effective action becomes +\begin{equation} +S_{eff}^{(2)} = +-2\times {g^2\over 4\pi} \int d^2 x +[ A_\mu(x)(\delta^{\mu\nu}-{\partial_\mu\partial_\nu \over \Box}) A_\nu (x)]. +\end{equation} +This effective action is transverse and thus gauge invariant +in the 2-dimensional sense. Both zero modes around $s=0$ and $s=L$ +equally contribute so that a factor 2 appears in the above result. +This is consistent with the general formula derived in +ref.\cite{Neu2}. +The anomalous chiral Schwinger model can not be simulated +by the Kaplan's (Shamir's) method with the $s$-independent gauge fields, +since the gauge fields see {\it both} of the zero modes so that +it fails to reproduce the parity-odd term, expected to exist\cite{JR} + +\section{Anomalies in the Chiral Schwinger Model} +\label{sec:anomaly} + +\subsection{Currents and their Divergence} + +From the effective action obtained in the previous section, we +can calculate the vacuum expectation values of various currents +in the presence of back-ground gauge fields. +Let us define the fermion number current as +\begin{equation} +\langle J_\mu^g (s, x) \rangle += {\delta S_{eff}^{(2)} \over g\delta A_\mu (s, x) } +\end{equation} +where the index $g$ in the current explicitly shows the charge of the +fermion. +From eq. (\ref{eff}) we obtain +\widetext +\begin{eqnarray} + J_\mu^g(s,x) &=& i{g\over 4\pi}\sum_t + [ \sum_X \delta_X F_X(s,t)^2(\epsilon^{\alpha\nu}\partial_\mu ++\epsilon^{\alpha\mu}\partial_\nu ){\partial_\alpha\over \Box}A_\nu (t, x) +-2\Gamma_{CS}\epsilon^{\mu\nu} A_\nu (t,x)] + \nonumber \\ +&-& {g\over 4\pi}\sum_t +[2\sum_X F_X(s,t)^2 +(\delta^{\mu\nu}-{\partial_\mu\partial_\nu \over \Box}) A_\nu (t,x) ++ +(2 K(s,t)- \sum_X F_X(s,t)^2 ) A_\mu (t,x) ] + \nonumber \\ +& \equiv & J_\mu^{g,odd}+ J_\mu^{g,even} +\label{current} +\end{eqnarray} +\narrowtext +where $J_\mu^{g,odd}$ is a parity-odd current (the first two +terms) and $J_\mu^{g,even}$ is a parity-even current (the last two +terms). Hereafter +all $J_\mu$ should be understood as vacuum expectation values, +though $\langle \qquad\rangle$ is suppressed. +From the fermion number current +the gauge current for a fermion with charge $g$ is easily constructed as +$ J_\mu^G (s,x) \equiv g J_\mu^g (s,x)$. + +Divergences of the parity-odd and parity-even currents become +\begin{eqnarray} +\partial_\mu J_\mu^{g,odd}(s,x) + &= & i {g\over 4\pi} \sum_t[\sum_X \delta_XF_X(s,t)^2- 2\Gamma_{CS}(s,t)] + \nonumber \\ +&\times & \epsilon^{\mu\nu} \partial_\mu A_\nu (t,x) , +\end{eqnarray} +\begin{eqnarray} +\partial_\mu J^\mu_{g,even}(s,x) + & = & {g\over 4\pi} \sum_t [\sum_X F_X(s,t)^2- 2K(s,t)] + \nonumber \\ +&\times & \partial_\mu A_\mu (t,x) . +\end{eqnarray} + +\subsection{Gauge invariance} + +As mentioned in Sect.\ \ref{sec:model}, +the action in $A_3 = 0$ gauge is invariant +under $s$ independent gauge transformation. This invariance implies +$\sum_{s} \partial_\mu J_\mu^G (s,x) = 0$. This identity is satisfied in +our calculation of the effective action, since +\begin{eqnarray} + \sum_s & [\sum_X\delta_XF_X(s,t)^2- 2\Gamma_{CS}(s,t)] + \nonumber \\ +&= \sum_X \delta_X [F_X(t,t)-F_X(t,t)] =0 + \label{sum0a} +\end{eqnarray} +\begin{eqnarray} + \sum_s & [\sum_X F_X(s,t)^2- 2 K(s,t)] + \nonumber \\ +&= \sum_X [F_X(t,t)-F_X(t,t)] =0 +\label{sum0b} +\end{eqnarray} +from eqs.(\ref{sumf},\ref{sum},\ref{sumk}). + +\subsection{Gauge Anomalies} +The gauge anomaly for a fermion with a charge $g$, denoted $T_g$, is defined by +$ T_g = g\partial_\mu J_\mu^{g,odd}$, and it becomes +\begin{equation} +T_g (s,x) = \sum_t g^2 C(s,t)\times T^0(t,x) +\end{equation} +where +\begin{equation} +T^0(t,x) = +i{1\over 4\pi} \epsilon^{\mu\nu} \partial_\mu A_\nu (t,x) +\end{equation} +is the gauge anomaly of a {\it 2-dimensional} theory, and +\begin{equation} +C(s,t) = \sum_X \delta_XF_X(s,t)^2-2 \Gamma_{CS}(s,t) +\end{equation} +represents the spread of the gauge anomaly over the 3rd direction +due to the spread of zero modes. +This spread of the anomaly has been observed in a numerical +computation\cite{Jan}. +It is noted that the divergence of the gauge current $J_\mu^G$ also contains +parity-even contributions, given by +\begin{equation} +\sum_t D(s,t)\times {g^2\over 4\pi} \partial_\mu A_\mu(t,x) +\end{equation} +where $ D(s,t) = \sum_X F_X(s,t)^2-2 K(s,t)$. + +The one-loop integral (\ref{gcs}) defining +$\Gamma_{CS}$ is +too complicated to calculate analytically. +For $t$-independent gauge fields $A_\mu (t,x) = A_\mu (x)$ +there is a considerable simplification and +we obtain +\begin{equation} +T_g (s,x) = g^2C(s)\times T^0(x) +\end{equation} +where +\begin{equation} +T^0(x)= i{1\over 4\pi} \epsilon^{\mu\nu} \partial_\mu A_\nu (x) +\end{equation} +and +\widetext +\begin{eqnarray} +C(s) &=& \sum_t C(s,t) = 2 \sum_X \delta_X F_X(s,s) + \nonumber \\ +&=& {m_0(4-m_0^2)\over 2} +\times \left\{ +\begin{array}{ll} +\left[ (1-m_0)^{2s}-(1-m_0)^{2(L-s-1)} \right] & \mbox{\ for $s \ge 0$} \\ + & \\ +\left[ (1+m_0)^{2s}-(1+m_0)^{-2(L+s+1)}\right] & \mbox{\ for $s \le 0$} +\end{array} +\right. . +\end{eqnarray} +\narrowtext +for the Kaplan's method. We plot $C(s)$ as a function of $s$ +at $m_0= 0.1$ and 0.5 in Fig.\ref{anomalyK}. +For the Shamir's method, we obtain +\begin{equation} +C(s) = 2m_0(2-m_0)\cdot +\left[ (1-m_0)^{2s}-(1-m_0)^{2(L-s)} \right] +\end{equation} +and plot this in Fig.\ref{anomalyS}. +It is noted that there is no parity-even contribution in $\partial_\mu J_\mu^G$ +since $\sum_t D(s,t) = 0$ in this case. + +\subsection{Chern-Simons Current} +From the 3-dimensional point of view, the gauge anomaly should be cancelled +in such a way that $T_g ++ \partial_3 gJ_3^{CS}(s,x)=0$\cite{KP,CS}, where $J_3^{CS}$ is the +third component of the Chern-Simons current for the 3-dimensional +vector gauge theory. With our gauge fixing the effective action does not +depends on $A_3$, and it is difficult to calculate $J_3^{CS}$ analytically +except in the region away from domain-walls\cite{CS}. +However, for $t$-independent gauge fields, +we can obtain the Chern-Simons current everywhere via the relation +$\partial_3 gJ^3_{g,odd}(s,x) = -T_g$, which becomes +\begin{equation} +J_3^{CS}(s+{1\over 2},x)-J_3^{CS}(s-{1\over 2},x) = g^2C(s)\times T^0 (x). +\end{equation} +Taking $J_3^{CS}(s+{1\over 2},x)= g^2 I(s)\cdot T^0 (x)$, we obtain +\begin{equation} +I(s+{1\over 2})-I(s-{1\over 2}) = C(s) . +\end{equation} +We have to solve this equation with the boundary condition +$ I(s)\rightarrow -2$ as $s\rightarrow +\infty$\cite{CS}. +For a finite $s$ space $s\rightarrow +\infty$ means +$ 1\ll s \ll L$. + +For the Kaplan's method we obtain +\widetext +\begin{equation} +I(s-{1\over 2})=\left\{ +\begin{array}{ll} +\displaystyle +{2+m_0\over 2}\cdot [(1-m_0)^{2s}+(1-m_0)^{2(L-s)}]-2 & \mbox{\quad +$0\le s\le L$} \\ + & \\ +\displaystyle -{2-m_0\over 2}\cdot +[(1+m_0)^{2s}+(1+m_0)^{-2(L+s)}] & \mbox{\quad $ -L\le s\le 0$} +\end{array} +\right. . +\end{equation} +\narrowtext +This solution automatically satisfies the other boundary condition +that $ I(s)\rightarrow 0$ as $\rightarrow -\infty$\cite{CS}. +Again $\rightarrow -\infty$ means $ 1\ll -s \ll L$ for a finite $s$ space. +We plot $I(s)$ as a function of $s$ at $m_0=0.1$ and 0.5 in Fig.\ \ref{CSK}. +For the Shamir's method we obtain +\begin{eqnarray} +I(s-{1\over 2}) &= 2[(1-m_0)^{2s}+(1-m_0)^{2(L-s+1)}]-2 + \nonumber \\ + & \qquad \qquad \mbox{for $0\le s\le L-1$}, +\end{eqnarray} +which is plotted in Fig.\ \ref{CSS}. + +\subsection{Pythagorean Chiral Schwinger Model and +Anomaly in Fermion Number Current} + +Let us consider the Pythagorean chiral Schwinger model\cite{Dis}. +In this model there are +two right-handed fermions with charges $g_1$ and $g_2$, and +one left-handed fermion with charge $g_3$. +Formulation of this model via the Kaplan's method has already been discussed +in ref.\cite{KP,Jan,Dis} +( an extension to the Shamir's method is straightforward ). +We assign $+m_0$ for fermions with charge $g_1$ and $g_2$, and +$-m_0$ for a fermion with charge $g_3$. The value of $|m_0|$ should +be equal for all fermions, as will be seen below. + +The theory has a $U(1)^3$ symmetry\cite{Dis} corresponding to independent phase +rotations of three fermions. The corresponding currents are +\begin{equation} +\left\{ +\begin{array}{lll} +J_\mu^G &=& g_1 J_\mu^{g_1}+g_2 J_\mu^{g_2}+g_3 J_\mu^{g_3} \\ + & & \\ +J_\mu^R &=& g_2 J_\mu^{g_1}-g_1 J_\mu^{g_2} \\ + & & \\ +J_\mu^F &=& J_\mu^{g_1}+J_\mu^{g_2}+J_\mu^{g_3} +\end{array} +\right. +\end{equation} +The first one is the gauge current, whose divergence becomes +\begin{equation} +\partial_\mu J_\mu^G(s,x) = (g_1^2+g_2^2-g_3^2)\times \sum_t C(s,t)\cdot + T^0(t,x). +\end{equation} +Therefore, if $g_1^2+g_2^2 = g_3^2$ (Pythagorean relation) is satisfied +and if all fermions +have the same value of $|m_0|$ to give the same $C(s,t)$, +this current is conserved and there is no gauge anomaly for any +background gauge fields. +The second current is non-anomalous, since +\begin{equation} +\partial_\mu J_\mu^R (s, x)=(g_2\cdot g_1 - g_1\cdot g_2)\sum_t +C(s,t)\cdot T^0(t,x) = 0 . +\end{equation} + +The third current, which corresponds to the fermion number of the theory, +is anomalous, since +\begin{equation} +\partial_\mu J_\mu^F (s, x)=( g_1 + g_2 - g_3)\times\sum_t C(s,t) \cdot +T^0(t,x) . +\end{equation} +The Kaplan's method as well as the Shamir's one +successfully give a non-zero divergence for the fermion number current, though +the coefficient $C(s,t)$ has a finite width. +For $t$-independent gauge fields, this anomaly becomes +\begin{equation} +( g_1 + g_2 - g_3)\cdot C(s)\cdot T^0(x) +\end{equation} +where $C(s)$ is almost localized at $s=0$ and at $s=L$ as seen in +Fig.\ref{anomalyK} and Fig.\ref{anomalyS}. +Since the fermion number is conserved in the 3-dimensional +theory, the third component of the fermion number current should satisfy +$\partial_3 J_3^F + ( g_1 + g_2 - g_3)\cdot C(s)\cdot T^0(x) = 0$\cite{Dis}. +Therefore we obtain +\begin{equation} +J_3^F(s,x)= (g_1+g_2-g_3)\cdot I(s)\cdot T^0(x) . +\end{equation} + +\section{conclusions} +\label{sec:concl} +In this paper we have formulated a lattice perturbative expansion for +the Kaplan's chiral fermion theories, extending the suggestion +by Narayanan and Neuberger\cite{Neu}. +Applying our perturbative technique to the chiral Schwinger model +formulated via the Kaplan's or the Shamir's method, +we have calculates the fermion one-loop effective action for gauge fields. +The effective action contains parity-odd terms and +longitudinal terms, both of which break 2-dimensional gauge invariance, +and the anomaly of the gauge current is obtained from the effective action. +The gauge anomaly is calculable in the Kaplan's (Shamir's) +method if the perturbative expansion is carefully formulated. +For the anomaly-free Pythagorean chiral Schwinger model, +the fermion number current is anomalous. To obtain this anomaly +the fermion number current should not be summed over $s$, in contrast +to the case of the continuum calculation\cite{AK}, where +the anomaly comes from an infinite summation over $s$. + +The main conclusions drawn from the results are as follows. + +\begin{enumerate} +\item +Anomaly of the fermion number current is shown to be +non-zero in this method, though the current flows off walls +into the extra dimension. +Since the current is external we feel that this +does not affect the dynamics of the model +and therefore does not spoil the 2-dimensional nature of the chiral +zero mode, contrary to the suggestion of Ref.\cite{Dis}. +The 3-dimensional nature of the Kaplan's (Shamir's) +formulation manifests itself only in the +non-conservation of the fermion number, which is expected to occur in Nature. + +\item Two-dimensional gauge invariance at low energy +can not be assured by the Kaplan's (Shamir's) method, +except for $s$-independent +gauge fields, even for anomaly-free cases. +This is similar to the situation with +lattice chiral gauge theories formulated with the ordinary Wilson mass +term\cite{chiral}. +In this point the Kaplan's (Shamir's) method does not seem better than the +conventional approaches. +At this moment it is not clear whether this violation of gauge invariance +spoils the whole program of this method. In particular the effects of the +longitudinal component of gauge fields has to be analyzed further. + +\item If the theory is anomaly free and gauge fields are +$s$-independent\cite{Neu}, the gauge invariance as a 2-dimensional theory +can be maintained. However, the gauge fields feel both of the zero modes +even in the $L\rightarrow \infty$ limit, and the fermion loop contribution +to the effective action is twice as large as the one expected from a single +chiral fermion. Therefore we have to take a square-root of +the fermion determinant +to obtain the correct contribution. +For fermion quantities such as the fermion number current, however, +it seems possible +to separate the contribution of the chiral zero mode at $s=0$ from +that of the anti-chiral zero mode at $s=L$, as seen in the previous section. +\end{enumerate} + +Perturbative calculations performed in +this paper can be extended to 4+1 dimensional theories. Of course +actual calculations become much more complicated and difficult +because of severe ultra-violet divergences in 4+1 dimensions than +in 2+1 dimensions. +Work in this direction is in progress. + +\acknowledgements +We would like to think Prof. Ukawa for discussions and the careful reading of +the manuscript. + +After finishing this work, a new paper by Narayanan and Neuberger\cite{Neu3} +appeared. In the paper +the gauge anomaly for the chiral Schwinger model was calculated +semi-analytically via the overlap formula of ref.\cite{Neu2}. + + +\begin{references} +\bibitem{KP}D.\ B.\ Kaplan, Phys.\ Lett.\ {\bf B288}, 342 (1992). + +\bibitem{Jan}K.\ Jansen, Phys.\ Lett.\ {\bf B288}, 348 (1992). + +\bibitem{CS}M.\ F.\ L.\ Golterman, K.\ Jansen, and D.\ B.\ Kaplan, +Phys.\ Lett.\ {\bf B301}, 219 (1993). + +\bibitem{FS}S.\ A.\ Frolov and A.\ A.\ Slavnov, +Phys.\ Lett.\ {\bf B309}, 344 (1993). + +\bibitem{Neu}R.\ Narayanan and H.\ Neuberger, +Phys.\ Lett.\ {\bf B302}, 62 (1993). + +\bibitem{Neu2}R.\ Narayanan and H.\ Neuberger, RU-93-25, +Rutgers University preprint, July 1993. + +\bibitem{AK}S.\ Aoki and Y.\ Kikukawa, UTHEP-258/KUNS-1204, +University of Tsukuba preprint, June 1993. + +\bibitem{Alt}C.\ P.\ Korthals-Altes, S.\ Nicolis and J.\ Prades, +CPT-93/P.2920, Center de Physique Th\'{e}orique preprint, June 1993. + +\bibitem{Dis}J.\ Distler and S.-J.\ Rey, PUPT-1386/NSF-ITP-93-66/SNUTP 93-27, +Princeton University preprint, May 1993. + +\bibitem{Sham}Y.\ Shamir, WIS-93/20/FEB-PH, Weizmann Institute preprint, +February 1993. + +\bibitem{chiral}S.\ Aoki, Phys.\ Rev\ Lett.\ {\bf 60} 2109 (1988); +K.\ Funakubo and T.\ Kashiwa,{\it ibid} {\bf 60} 2113 (1988); +T.\ D.\ Kieu, D.\ Sen, S.-S.\ Xue, {\it ibid} {\bf 60} 2117 (1988); +S.\ Aoki, Phys.\ Rev.\ {\bf D38} 618 (1988). + +\bibitem{JR}R.\ Jackiw and R.\ Rajaraman, +Phys.\ Rev\ Lett.\ {\bf 54} 1219 (1985). + +\bibitem{Neu3}R.\ Narayanan and H.\ Neuberger, RU-93-34, +Rutgers University preprint, August 1993. + +\end{references} + +\newpage + +\begin{figure} +\caption{ Two zero modes $u_L$ and $u_R$ +as a function of $s$ at +$m_0=0.1$ and 0.5 for $p_1=p_2=0$. We take $L=100$.} +\label{zero} +\end{figure} + +\begin{figure} +\caption{ The coefficient of the anomaly $C(s)$ +for the Kaplan's method as a function of $s$ +at $m_0=0.1$ and 0.5 for $L=100$.} +\label{anomalyK} +\end{figure} + +\begin{figure} +\caption{ The coefficient of the anomaly $C(s)$ +for the Shamir's method +as a function of $s$ at $m_0=0.1$ and 0.5 for $L=100$.} +\label{anomalyS} +\end{figure} + +\begin{figure} +\caption{The coefficient of the Chern-Simons current $I(s)$ +for the Kaplan's method as a function of $s$ +at $m_0=0.1$ and 0.5 for $L=100$.} +\label{CSK} +\end{figure} + +\begin{figure} +\caption{ The coefficient of the Chern-Simons current $I(s)$ +for the Shamir's method as a function of $s$ +at $m_0=0.1$ and 0.5 for $L=100$.} +\label{CSS} +\end{figure} + +\end{document} +\bye diff --git a/support/hypertex/tanmoy/examples/Anomalkap.toc b/support/hypertex/tanmoy/examples/Anomalkap.toc new file mode 100644 index 0000000000..f1c82fd707 --- /dev/null +++ b/support/hypertex/tanmoy/examples/Anomalkap.toc @@ -0,0 +1,18 @@ +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {i}}{\hbox {\hskip 1pt\relax \uppercase {i}}}\hskip -1pt\relax }Introduction}{3} +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {ii}}{\hbox {\hskip 1pt\relax \uppercase {ii}}}\hskip -1pt\relax }Action, Fermion Propagator and Chiral Zero Modes}{5} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{A}{\hbox {\hskip 1pt\relax A}}\hskip -1pt\relax }Lattice Action}{5} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{B}{\hbox {\hskip 1pt\relax B}}\hskip -1pt\relax }Chiral Zero Modes}{7} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{C}{\hbox {\hskip 1pt\relax C}}\hskip -1pt\relax }Fermion Propagator and Zero Modes}{8} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{D}{\hbox {\hskip 1pt\relax D}}\hskip -1pt\relax }Fermion Feynman Rules }{10} +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {iii}}{\hbox {\hskip 1pt\relax \uppercase {iii}}}\hskip -1pt\relax }Perturbative Calculations for the Chiral Schwinger Model}{11} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{A@}{\hbox {\hskip 1pt\relax A}}\hskip -1pt\relax }Effective Action at Fermion One-Loop}{12} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{B@}{\hbox {\hskip 1pt\relax B}}\hskip -1pt\relax }Evaluation of Zero Mode Contributions}{12} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{C@}{\hbox {\hskip 1pt\relax C}}\hskip -1pt\relax }Evaluation of Remaining Contributions}{14} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{D@}{\hbox {\hskip 1pt\relax D}}\hskip -1pt\relax }Total Contributions}{16} +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {iv}}{\hbox {\hskip 1pt\relax \uppercase {iv}}}\hskip -1pt\relax }Anomalies in the Chiral Schwinger Model}{17} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{A@@}{\hbox {\hskip 1pt\relax A}}\hskip -1pt\relax }Currents and their Divergence}{17} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{B@@}{\hbox {\hskip 1pt\relax B}}\hskip -1pt\relax }Gauge invariance}{18} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{C@@}{\hbox {\hskip 1pt\relax C}}\hskip -1pt\relax }Gauge Anomalies}{19} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{D@@}{\hbox {\hskip 1pt\relax D}}\hskip -1pt\relax }Chern-Simons Current}{20} +\contentsline {subsection}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{subsection}{E}{\hbox {\hskip 1pt\relax E}}\hskip -1pt\relax }Pythagorean Chiral Schwinger Model and Anomaly in Fermion Number Current}{21} +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{\uppercase {v}}{\hbox {\hskip 1pt\relax \uppercase {v}}}\hskip -1pt\relax }conclusions}{23} diff --git a/support/hypertex/tanmoy/examples/README b/support/hypertex/tanmoy/examples/README new file mode 120000 index 0000000000..59a23c461d --- /dev/null +++ b/support/hypertex/tanmoy/examples/README @@ -0,0 +1 @@ +../README \ No newline at end of file diff --git a/support/hypertex/tanmoy/examples/ambjorn.aux b/support/hypertex/tanmoy/examples/ambjorn.aux new file mode 100644 index 0000000000..56ee1cd5e4 --- /dev/null +++ b/support/hypertex/tanmoy/examples/ambjorn.aux @@ -0,0 +1,30 @@ +\relax +\citation{bcm} +\citation{mp} +\citation{bcm} +\citation{bcm} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{1}{\hbox {\hskip 1pt\relax 1}}\hskip -1pt\relax }Introduction}{3}} +\newlabel{*1}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{1}{1}}{3}} +\newlabel{*2}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{2}{2}}{3}} +\newlabel{*3}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{3}{3}}{3}} +\newlabel{*4}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{4}{4}}{3}} +\citation{ppf} +\citation{parisi,kp,smm} +\@writefile{lot}{\string\contentsline\space {table}{\string\numberline\space {1}{\ignorespaces Statistics collected at various $\beta $. In all measurements $\lambda = 10$}}{4}} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{2}{\hbox {\hskip 1pt\relax 2}}\hskip -1pt\relax }Numerical method}{4}} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{3}{\hbox {\hskip 1pt\relax 3}}\hskip -1pt\relax }Scaling of the string tension}{5}} +\newlabel{*5}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{5}{5}}{5}} +\newlabel{*6}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{6}{6}}{5}} +\newlabel{*7}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{7}{7}}{5}} +\newlabel{*7a}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{8}{8}}{5}} +\citation{gutbrod} +\citation{bcm} +\newlabel{*8}{{\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{equation}{9}{9}}{6}} +\@writefile{toc}{\string\contentsline\space {section}{\string\numberline\space {\relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{4}{\hbox {\hskip 1pt\relax 4}}\hskip -1pt\relax }Conclusions}{6}} +\bibcite{bcm}{1} +\bibcite{mp}{2} +\bibcite{parisi}{3} +\bibcite{kp}{4} +\bibcite{smm}{5} +\bibcite{ppf}{6} +\bibcite{gutbrod}{7} diff --git a/support/hypertex/tanmoy/examples/ambjorn.dvi b/support/hypertex/tanmoy/examples/ambjorn.dvi new file mode 100644 index 0000000000..595b217744 Binary files /dev/null and b/support/hypertex/tanmoy/examples/ambjorn.dvi differ diff --git a/support/hypertex/tanmoy/examples/ambjorn.hrf b/support/hypertex/tanmoy/examples/ambjorn.hrf new file mode 100644 index 0000000000..659cbc3425 --- /dev/null +++ b/support/hypertex/tanmoy/examples/ambjorn.hrf @@ -0,0 +1,36 @@ +\def \hyperj@nk {{}{page}{1}} +\def \hyperj@nk {{}{page}{2}} +\def \hypernoname {{}{section}{1}} +\def \hypernoname {{}{equation}{1}} +\def \hypernoname {{}{equation}{2}} +\def \hypernoname {{}{equation}{3}} +\def \hypernoname {{}{equation}{4}} +\def \hyperj@nk {{}{page}{3}} +\def \hypernoname {{}{section}{2}} +\def \hypernoname {{}{table}{1}} +\def \hypernoname {{}{section}{3}} +\def \hyperj@nk {{}{page}{4}} +\def \hypernoname {{}{equation}{5}} +\def \hypernoname {{}{equation}{6}} +\def \hypernoname {{}{equation}{7}} +\def \hypernoname {{}{equation}{8}} +\def \hyperj@nk {{}{page}{5}} +\def \hypernoname {{}{equation}{9}} +\def \hypernoname {{}{footnote}{1}} +\def \hypernoname {{}{section}{4}} +\def \hyperj@nk {{}{page}{6}} +\def \hypernoname {{}{enumiv}{1}} +\def \hypernoname {{}{reference}{1}} +\def \hypernoname {{}{enumiv}{2}} +\def \hypernoname {{}{reference}{2}} +\def \hypernoname {{}{enumiv}{3}} +\def \hypernoname {{}{reference}{3}} +\def \hypernoname {{}{enumiv}{4}} +\def \hypernoname {{}{reference}{4}} +\def \hypernoname {{}{enumiv}{5}} +\def \hypernoname {{}{reference}{5}} +\def \hypernoname {{}{enumiv}{6}} +\def \hypernoname {{}{reference}{6}} +\def \hypernoname {{}{enumiv}{7}} +\def \hypernoname {{}{reference}{7}} +\def \hyperj@nk {{}{page}{7}} diff --git a/support/hypertex/tanmoy/examples/ambjorn.log b/support/hypertex/tanmoy/examples/ambjorn.log new file mode 100644 index 0000000000..6df6af7e69 --- /dev/null +++ b/support/hypertex/tanmoy/examples/ambjorn.log @@ -0,0 +1,41 @@ +This is TeX, C Version 3.141 (format=lplain 93.1.26) 6 JUL 1994 17:16 +**ambjorn +(ambjorn.tex +LaTeX Version 2.09 <25 March 1992> +(/usr/local/lib/tex/inputs/hypertex/lhyper.tex +(/usr/local/lib/tex/inputs/hypertex/hyperbasics.tex +\hyperf@le=\read1 + (ambjorn.hrf) +\hyperf@le=\write3 +\hypert@ks=\toks11 +) +\hyper@inputcheck=\read2 +) +(/usr/local/lib/tex/inputs/LaTeX/sty/article.sty +Standard Document Style `article' <14 Jan 92>. +(/usr/local/lib/tex/inputs/LaTeX/sty/art12.sty) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +) +(/usr/local/lib/tex/inputs/hypertex/article.hty) (ambjorn.aux) [1 + +] +(ambjorn.toc) +\tf@toc=\write4 + [2] [3] [4] [5] [6] [7] (ambjorn.aux) ) +Here is how much of TeX's memory you used: + 324 strings out of 11979 + 3418 string characters out of 87164 + 35152 words of memory out of 262141 + 2258 multiletter control sequences out of 9500 + 18996 words of font info for 72 fonts, out of 100000 for 255 + 14 hyphenation exceptions out of 607 + 15i,8n,17p,272b,220s stack positions out of 300i,40n,60p,3000b,4000s + +Output written on ambjorn.dvi (7 pages, 20296 bytes). diff --git a/support/hypertex/tanmoy/examples/ambjorn.tex b/support/hypertex/tanmoy/examples/ambjorn.tex new file mode 100644 index 0000000000..9ddcdea665 --- /dev/null +++ b/support/hypertex/tanmoy/examples/ambjorn.tex @@ -0,0 +1,383 @@ +%Paper: hep-lat/9405022 +%From: AMBJORN@nbivax.nbi.dk +%Date: Wed, 25 May 1994 15:01:51 +0200 +\input lhyper +\documentstyle[12pt]{article} +\textwidth 150mm +\textheight 235mm +\newcommand{\rf}[1]{(\ref{#1})} +%\newcommand{\beq}{\begin{equation}} +%\newcommand{\eeq}{\end{equation}} +\newcommand{\bea}{\begin{eqnarray}} +\newcommand{\eea}{\end{eqnarray}} +\newcommand{\g}{\gamma} +\renewcommand{\l}{\lambda} +\renewcommand{\b}{\beta} +\renewcommand{\a}{\alpha} +\newcommand{\n}{\nu} +\newcommand{\m}{\mu} +\newcommand{\th}{\theta} +\newcommand{\ep}{\varepsilon} +\newcommand{\om}{\omega} +\newcommand{\sg}{\sigma} +\newcommand{\k}{\kappa} +\newcommand{\vph}{\varphi} +\newcommand{\oh}{\frac{1}{2}} +\newcommand{\oq}{\frac{1}{4}} +\newcommand{\dt}{\triangle t} +\newcommand{\fdt}{\frac{1}{\triangle t^2}} +\newcommand{\dg}{\dagger} +\newcommand{\non}{\nonumber \\} +\newcommand{\tr}{{\rm Tr}\;} +\newcommand{\ra}{\right\rangle} +\newcommand{\la}{\left\langle} +\newcommand{\sgn}{{\rm sgn}} + +\newcommand{\cD}{{\cal D}} +\newcommand{\cS}{{\cal S}} +\newcommand{\cM}{{\cal M}} +\newcommand{\cK}{{\cal K}} +\newcommand{\cT}{{\cal T}} +\newcommand{\cN}{{\cal N}} +\newcommand{\cL}{{\cal L}} +\newcommand{\cO}{{\cal O}} +\newcommand{\cR}{{\cal R}} +% +\newcommand{\noi}{\noindent} +\newcommand{\no}{\nonumber} +\newcommand{\Vqq}{V_{q\bar{q}}} +% +\def\void{} +%\def\labelmark{\marginpar{\small\labelname}} +\def\labelmark{} + +\newenvironment{formula}[1]{\def\labelname{#1} +\ifx\void\labelname\def\junk{\begin{displaymath}} +\else\def\junk{\begin{equation}\label{\labelname}}\fi\junk}% +{\ifx\void\labelname\def\junk{\end{displaymath}} +\else\def\junk{\end{equation}}\fi\junk\labelmark\def\labelname{}} + +\newenvironment{formulas}[1]{\def\labelname{#1} +\ifx\void\labelname\def\junk{\begin{displaymath}\begin{array}{lll}} +\else\def\junk{\begin{equation}\label{\labelname}\left. +\begin{array}{lll}}\fi\def\arraystretch{1.5}\junk}% +{\ifx\void\labelname\def\junk{\end{array}\end{displaymath}} +\else\def\junk{\end{array}\right.\end{equation}} +\fi\junk\labelmark\def\labelname{}\def\junk{} +\def\arraystretch{1}} + +\newcommand{\beq}{\begin{formula}} +\newcommand{\eeq}{\end{formula}} +\newcommand{\beqv}{\begin{formula}{}} + +\begin{document} +\topmargin 0pt +\oddsidemargin 5mm +\headheight 0pt +\headsep 0pt +\topskip 9mm + +\hfill NBI-HE-94-30 + +\hfill March 1994 + +\begin{center} +\vspace{24pt} +{\large \bf Scaling with a modified Wilson action which suppresses\\ + Z$_2$ artifacts in SU(2) lattice gauge theories} + +\vspace{24pt} + +{\sl J. Ambj\o rn } and {\sl G. Thorleifsson} + +\vspace{6pt} + + The Niels Bohr Institute\\ +Blegdamsvej 17, DK-2100 Copenhagen \O , Denmark\\ + + +\end{center} + +\vspace{24pt} + +\addtolength{\baselineskip}{0.20\baselineskip} +\vfill + +\begin{center} +{\bf Abstract} +\end{center} + +\vspace{12pt} + +\noindent +A modified Wilson action which suppresses plaquettes which take +negative values is used to study the scaling behavior of the +string tension. The use of the $\b_E$ scheme gives good agreement +with asymptotic two loop results. + + +\vfill + +\newpage +\tableofcontents +\newpage + + +\section{Introduction} +The simplest and most popular choice of a gauge lattice action is +the one proposed by Wilson, which for the group $SU(2)$ reads: +\beq{*1} +S_W (U_l) = \b \sum_{\Box} (1 -\oh \tr U_\Box ), +\eeq +where $\b = 4/g^2$, $U_l \in SU(2)$ is the link variable +defined on the link $l \equiv (x,\m)$, while $\Box \equiv (x,\m\n)$ +refers to the location and orientation of the corresponding plaquette. +$U_\Box$ is the standard plaquette variable: +\beq{*2} +U_\Box \equiv U_{x,\m\n} = U_{x,\m}U_{x+\m,\n}U^\dg_{x+\n,\m}U^\dg_{x,\n}. +\eeq + +In any Monte Carlo simulation the crucial question is whether the +field configurations generated provide an adequate representation +of the continuum physics. The naive continuum limit can only +be obtained for $\oh \tr U_\Box \approx 1$. Especially +any lattice configurations which locally have some $U_\Box$'s where +$\oh \tr U_\Box \approx -1$ are lattice artifacts which a priori +have nothing to do with continuum configurations. A complete suppression +of such configurations should not change any continuum physics. For +the values of $\b$ where one performs the Monte +Carlo simulations such local $Z_2$ fluctuations are not at all rare if +$S_W$ is used. It is thus very important to make sure that these fluctuations +have no impact on continuum observables. The easiest way to do so is to +modify the lattice action in such a way that these small-scale fluctuations +are suppressed, without influencing plaquettes where $\tr U_\Box > 0$. +This can be done by modifying the Wilson action as follows \cite{bcm}: +\beq{*3} +S=S_W+S_\l, +\eeq +where $S_W$ is the standard Wilson action \rf{*1}, while $S_\l$ is +\beq{*4} +S_\l = \l \sum_{\Box} [1-\sgn( \tr U_\Box)]. +\eeq + +The action \rf{*3} was studied for $\l =\infty$ in \cite{mp} while +the phase structure in the $(\b,\l)$ plane was studied in \cite{bcm}. +For a fixed $\l$ one would expect the same continuum limit for +$\b \to \infty$ and also the same identification $\b = 4/g^2$. +However, as shown in \cite{bcm} there is a marked difference +between, say, Creutz ratios, measured for $\l =0$ (the Wilson action) +and for $\l =0.5$ in the case of $\b=2.5$. +One would expect the difference to be even more pronounced with increasing +$\l$. This illustrates that plaquettes with negative values may +play an important role for the range of $\b$'s where the scaling of +pure $SU(2)$ lattice gauge theories is usually studied, and one could +be worried about the relation to continuum physics. The fact that one gets +acceptable agreement with continuum scaling relations could be fortuitous +since one would expect the action $S$ to reproduce continuum physics +better for large $\l$. One purpose of this article is to show that +we indeed get the correct scaling relations for large $\l$ and that there +is no reason to expect the plaquettes with negative values which appear +in the Wilson action to play any important role for $\b \geq 2.2$. +Another purpose is to test whether the $\l$ modification of the action +may improve the approach to scaling for the reasons mentioned above. + +\section{Numerical method} + +The numerical simulations were performed using a standard +Metropolis algorithm to update the gauge fields, combined +with an overrelaxation algorithm to +decrease the autocorrelations. For every Metropolis sweep +we performed 4 overrelaxation steps. +Lattice size +$12^4$ with periodic boundary conditions was used and we +measured +all Wilson loops up to the size $6 \times 6$. +In order to improve the statistics we modified the +configurations using the Parisi trick +\cite{ppf} before measuring. Unlike in the case of +$\lambda = 0$ the integration involved in the Parisi trick +had to be performed numerically and was thus costly in +computer time. But the gain in the statistics did more than +compensate for that. + +The choice of parameters was $\lambda = 10$, which was +sufficient to suppress all negative plaquettes, and +$\beta \in [1.0,2.5]$. +We found a scaling window for $\beta \in +[1.5,1.9]$ and concentrated the simulations in +that interval. Usually 1000 sweeps where used for +thermalization and the number of sweeps used +for measuring, for various $\beta$, +is shown in table 1. Measurements were performed +every fifth sweep and the errors were estimated by +using the jackknife method. + +\begin{table} +\begin{center} +\begin{tabular}{c|c|c} +$\beta$ & No. of sweeps & No. of measurements \\ \hline +1.5 & 55250 & 11050 \\ +1.6 & 65250 & 13050 \\ +1.7 & 63750 & 12750 \\ +1.8 & 88750 & 17750 \\ +1.9 & 45000 & 9000 + + + +\end{tabular} +\caption{Statistics collected at various $\beta$. In all measurements +$\lambda = 10$} +\end{center} +\end{table} + + + + + +\section{Scaling of the string tension} +The $\b$-values in the scaling window are even smaller +than the ones used for the standard Wilson action. If one wants to +test scaling by comparing with the perturbative two-loop result +using the identification $\b = 4/g^2$ +it is doomed to fail. We clearly need a suitable effective coupling +which we can use instead of $g^2$. Here we will use the +so-called $\b_E$ scheme \cite{parisi,kp,smm}. This scheme is simple +and well suited to deal with ``perturbations'' of the Wilson +action, like the ones given by \rf{*3}-\rf{*4}. Let us define +\beq{*5} +\b_E = \frac{3}{4} \frac{1}{1-\la \oh \tr U_\Box \ra}. +\eeq +{}From weak coupling expansions ($\b \to \infty,~~\l$ fixed), it is seen that +\beq{*6} +\b_E \to \b~~~~~{\rm for}~~~~ \b \to \infty. +\eeq +It is consistent to use the $g_E=4/\b_E$ in the two loop $\b$-function +since $g_E$ is a function of $g$ and the two first coefficients of the +$\b$-function are invariant under a non-singular coupling constant +redefinition. The use of $\b_E$ in the two loop $\b$-function +is known to diminish scaling violations in a variety of situations: +The string tension in $SU(2)$ and $SU(3)$ gauge theories, +the mass gap in the $SU(2)$ and $SU(3)$ chiral models and the +deconfining transition temperature $T_c$, again for $SU(2)$ and $SU(3)$ +gauge theories, just to mention some. We will now show that the method +works well for the modified Wilson action with $\l=10$. + +Let us first note that for $\l =10$ the $\b$-range $1.4-1.9$ is mapped +into the $\b_E$-range $1.837-2.104$, which should compared to the +corresponding map for the ordinary Wilson action where the +$\b$-range $2.2-2.5$ is mapped into the $\b_E$-range $1.741-2.154$. +{}From the measurements of Wilson loops mentioned in the last section +we extract the string tension using the simplest method: If $W(R,T)$ +denotes a $R \times T$ Wilson loop we first form +\beq{*7} +V_{eff} (R,T) = \log [W(R,T)/W(R,T-1)]. +\eeq +For $T \to \infty$ $V_{eff} (R,T)$ should go to the ground state static +quark potential $\Vqq(R)$. We have available $T \leq 6$ and the results +agree within error bars for $T=5-6$. We have used these values as $\Vqq(R)$ +for $R \leq 6$. Next $\Vqq(R)$ is fitted to the form: +\beq{*7a} +\Vqq(R) = C - \frac{E}{R} + \sg R +\eeq +and the error bars for $\sg$ are mainly coming from +systematic errors arising +from fits with various lower cuts in $R$. It is clear that with the +limited range of $R$ and $T$'s available to us nothing will be gained +by applying some of the many more elaborate schemes of fitting which are +available. + +$\log \sg(\b_E)$ is finally plotted in fig. 1 against $\b_E$. The curve +shown is the one obtained from the two-loop $\b$-function, according to +which the scaling of the lattice string tension +$\sg(\b_E) = \sg_{cont} a^2(\b_E)$ is governed by the two-loop scaling +of the lattice spacing $a(\b_E)^2$: +\beq{*8} + a^2(\b_E) = \Lambda^{-2} +\left( \frac{6\pi^2}{11} \b_E\right)^{102/121} +\exp\left[-\frac{6\pi^2}{11} \b_E\right]. +\eeq +It is clear that scaling is reasonable well satisfied in the given +range of $\b_E$. + +It is interesting to compare these results with the corresponding +ones obtained by using the ordinary Wilson action. The range of $\b$ +which gives the same range of $\b_E$ as were used for the +modified action will be $2.3 \le \b \le 2.5$. In this range it is +well known that naive application of scaling does not work particularly +well, and to get a fair comparison with the results for the modified +action we use again the $\b_E$ coupling constant transformation. +We now follow the same method as in the case of the modified action +and extract the string tension\footnote{The data used +for $\b=2.4$ and 2.5 are taken from \cite{gutbrod}.}. The result is +shown as a function of $\b_E$ in fig. 1. The use of $\b_E$ has +improved the scaling considerable compared to +the use of $\b$ as a coupling constant, as already mentioned, and it +is apparent from fig.1 that agreement with the two-loop scaling +is as good for the Wilson action as for the modified action. + + +\section{Conclusions} +The suppression of negative valued plaquettes should not change the +continuum limit of pure $SU(2)$ lattice gauge theories since these +configurations are pure lattice artifacts. Naively one might even +expect a smoother approach to the continuum limit if such a suppression +is implemented. The modified Wilson action \rf{*3} indeed suppresses +negative valued plaquettes for large values of $\l$ and it is possible +to approach continuum physics for much smaller values of $\b$. However, +for these small values of $\b$ the relation between the continuum +coupling constant $g^2$ and $\b$ is not a simple one and in order to +extract the scaling behavior one has to use a modified coupling constant +closer reflecting the physics of the system. The $\b_E$-scheme is such +a prescription and using it we have found good agreement with continuum +physics. From these results it seems clear that +the theory with modified Wilson action +belongs to the same universality class as the theory defined by the +ordinary Wilson action when $\b$ is sufficiently large. The worry +mentioned in \cite{bcm} is thus ruled out. In addition it seems +that the approach to scaling is not dramatically improved +compared to the situation for ordinary Wilson action. Indirectly +this indicates that negative plaquette excitations play no important +role in the scaling region for the ordinary Wilson action, at least +when we discuss observables like the string tension. However, +one would expect that the modified Wilson action is +considerable better when it comes to the measurements of +topological objects like instantons. + +\vspace{24pt} + +\noindent +{\bf Acknowledgement} We thank V. Mitrjushkin for discussions and +many useful suggestions. Part of the computations were performed +at UNI-C and were made possible by a grant from the +Danish Ministry of Research and Technology. + + + +\vspace{24pt} + +\addtolength{\baselineskip}{-0.20\baselineskip} + + +\begin{thebibliography}{99} +\bibitem{bcm}V. G. Bornyakov, M. Creutz and V.K. Mitrjushkin, Phys.Rev. D44 +(1991) 3918. +\bibitem{mp}G. Mack and E. Pietarinen, Nucl.Phys. B205, (1982) 141. +\bibitem{parisi}G. Parisi, Proceedings of the XX$^th$ conference +on high energy physics, Madison 1980. +\bibitem{kp}F. Karsch and R. Petronzio, Phys.Lett. 139B (1984) 403. +\bibitem{smm}S. Samuel, O. Martin and K. Moriarty, Phys.Lett. 153B +(1985) 87. +\bibitem{ppf}G. Parisi, R. Petronzio and F. Rapuano, Phys.Lett. 126B +(1983) 418. +\bibitem{gutbrod}F. Gutbrod, Z.Phys. C37 (1987) 143. +\end{thebibliography} + + +\vspace{36pt} + +\noindent +{\bf Figure 1:} The measured string tension using the modified +action (upper curve) and the ordinary Wilson action (lower curve) +as functions of $\beta_E$. + +\end{document} diff --git a/support/hypertex/tanmoy/examples/ambjorn.toc b/support/hypertex/tanmoy/examples/ambjorn.toc new file mode 100644 index 0000000000..ae167251e4 --- /dev/null +++ b/support/hypertex/tanmoy/examples/ambjorn.toc @@ -0,0 +1,4 @@ +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{1}{\hbox {\hskip 1pt\relax 1}}\hskip -1pt\relax }Introduction}{3} +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{2}{\hbox {\hskip 1pt\relax 2}}\hskip -1pt\relax }Numerical method}{4} +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{3}{\hbox {\hskip 1pt\relax 3}}\hskip -1pt\relax }Scaling of the string tension}{5} +\contentsline {section}{\numberline {\relax \let \hyper@@@ \relax \let \hyper@@@ \relax \let \hyper@@@ \hyper@ \hyperpr@ref {}{section}{4}{\hbox {\hskip 1pt\relax 4}}\hskip -1pt\relax }Conclusions}{6} diff --git a/support/hypertex/tanmoy/fleqn.hty b/support/hypertex/tanmoy/fleqn.hty new file mode 100644 index 0000000000..25ce02344e --- /dev/null +++ b/support/hypertex/tanmoy/fleqn.hty @@ -0,0 +1,34 @@ +\let\hypernoname=\relax +\def\equation{\@beginparpenalty\predisplaypenalty + \@endparpenalty\postdisplaypenalty +\let\hyper@n@=\hyperdef +\let\hyperdef=\hyper@nique\refstepcounter{equation}% +\let\hyperdef=\hyper@n@ +\trivlist \item[]\leavevmode +\let\hyper@qn@=\theequation +\def\theequation{\hyperdef\hypernoname{equation}{\hyper@qn@}{\hyper@qn@}}% + \hbox to\linewidth\bgroup $\m@th% $ TO MAKE DOLLAR NESTING OK + \displaystyle +\hskip\mathindent} + +\def\eqnarray{\stepcounter{equation}% + \let\hyper@qn@=\theequation + \hyper@nique\hypernoname{equation}{\hyper@qn@}{}% + \edef\@currentlabel{% + \hyper@\hyperpr@ref\hypernoname{\hyper@qn@}}% +\global\@eqnswtrue +\global\@eqcnt\z@\tabskip\mathindent\let\\=\@eqncr +\abovedisplayskip\topsep\ifvmode\advance\abovedisplayskip\partopsep\fi +\belowdisplayskip\abovedisplayskip +\belowdisplayshortskip\abovedisplayskip +\abovedisplayshortskip\abovedisplayskip +$$% +\def\theequation{\hyperdef\hypernoname{equation}{\hyper@qn@}{\hyper@qn@}}% +\edef\@currentlabel{% +\hyper@\hyperpr@ref\noexpand\hypernoname{\noexpand\hyper@qn@}}% +\m@th\halign +to\linewidth\bgroup\@eqnsel\hskip\@centering$\displaystyle\tabskip\z@ + {##}$&\global\@eqcnt\@ne \hskip 2\arraycolsep \hfil${##}$\hfil + &\global\@eqcnt\tw@ \hskip 2\arraycolsep $\displaystyle{##}$\hfil + \tabskip\@centering&\llap{##}\tabskip\z@\cr} + diff --git a/support/hypertex/tanmoy/ghostview-1.5-hacked/COPYING b/support/hypertex/tanmoy/ghostview-1.5-hacked/COPYING new file mode 100644 index 0000000000..6757284672 --- /dev/null +++ b/support/hypertex/tanmoy/ghostview-1.5-hacked/COPYING @@ -0,0 +1,416 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + + + + + + + + + + + + + + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + + + + + + + + + + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + + + + + + + + + + + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + + + + + + + + + + + + + + + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/support/hypertex/tanmoy/ghostview-1.5-hacked/Dir.c b/support/hypertex/tanmoy/ghostview-1.5-hacked/Dir.c new file mode 100644 index 0000000000..ed26312aa0 --- /dev/null +++ b/support/hypertex/tanmoy/ghostview-1.5-hacked/Dir.c @@ -0,0 +1,163 @@ +/* + * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Software Research Associates not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Software Research Associates + * makes no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Erik M. van der Poel + * Software Research Associates, Inc., Tokyo, Japan + * erik@sra.co.jp + */ + +#include + +#ifdef SEL_FILE_IGNORE_CASE +#include +#endif /* def SEL_FILE_IGNORE_CASE */ + +#include "SFinternal.h" + +#if defined(SVR4) || defined(SYSV) || defined(USG) || defined(__osf__) +#include +#else /* defined(SVR4) || defined(SYSV) || defined(USG) */ +#include +#define dirent direct +#endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ + +#include + +#if defined(SVR4) || defined(SYSV) || defined(USG) +extern void qsort(); +#endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ + +#ifdef SEL_FILE_IGNORE_CASE +int +SFcompareEntries(p, q) + SFEntry *p; + SFEntry *q; +{ + register char *r, *s; + register char c1, c2; + + r = p->real; + s = q->real; + + c1 = *r++; + if (islower(c1)) { + c1 = toupper(c1); + } + c2 = *s++; + if (islower(c2)) { + c2 = toupper(c2); + } + + while (c1 == c2) { + if (!c1) { + return strcmp(p->real, q->real); + } + c1 = *r++; + if (islower(c1)) { + c1 = toupper(c1); + } + c2 = *s++; + if (islower(c2)) { + c2 = toupper(c2); + } + } + + return c1 - c2; +} +#else /* def SEL_FILE_IGNORE_CASE */ +int +SFcompareEntries(p, q) + SFEntry *p; + SFEntry *q; +{ + return strcmp(p->real, q->real); +} +#endif /* def SEL_FILE_IGNORE_CASE */ + +int +SFgetDir(dir) + SFDir *dir; +{ + SFEntry *result = NULL; + int alloc = 0; + int i; + DIR *dirp; + struct dirent *dp; + char *str; + int len; + int maxChars; + struct stat statBuf; + + maxChars = strlen(dir->dir) - 1; + + dir->entries = NULL; + dir->nEntries = 0; + dir->nChars = 0; + + result = NULL; + i = 0; + + dirp = opendir("."); + if (!dirp) { + return 1; + } + + (void) stat(".", &statBuf); + dir->mtime = statBuf.st_mtime; + + (void) readdir(dirp); /* throw away "." */ + +#ifndef S_IFLNK + (void) readdir(dirp); /* throw away ".." */ +#endif /* ndef S_IFLNK */ + + while (dp = readdir(dirp)) { + if (i >= alloc) { + alloc = 2 * (alloc + 1); + result = (SFEntry *) XtRealloc((char *) result, + (unsigned) (alloc * sizeof(SFEntry))); + } + result[i].statDone = 0; + str = dp->d_name; + len = strlen(str); + result[i].real = XtMalloc((unsigned) (len + 2)); + (void) strcat(strcpy(result[i].real, str), " "); + if (len > maxChars) { + maxChars = len; + } + result[i].shown = result[i].real; + i++; + } + +#if defined(SVR4) || defined(SYSV) || defined(USG) + qsort((char *) result, (unsigned) i, sizeof(SFEntry), SFcompareEntries); +#else /* defined(SVR4) || defined(SYSV) || defined(USG) */ + qsort((char *) result, i, sizeof(SFEntry), SFcompareEntries); +#endif /* defined(SVR4) || defined(SYSV) || defined(USG) */ + + dir->entries = result; + dir->nEntries = i; + dir->nChars = maxChars + 1; + + closedir(dirp); + + return 0; +} diff --git a/support/hypertex/tanmoy/ghostview-1.5-hacked/Draw.c b/support/hypertex/tanmoy/ghostview-1.5-hacked/Draw.c new file mode 100644 index 0000000000..28bd17b772 --- /dev/null +++ b/support/hypertex/tanmoy/ghostview-1.5-hacked/Draw.c @@ -0,0 +1,920 @@ +/* + * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, provided + * that the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Software Research Associates not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. Software Research Associates + * makes no representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + * + * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Erik M. van der Poel + * Software Research Associates, Inc., Tokyo, Japan + * erik@sra.co.jp + */ + +#include +#include "SFinternal.h" +#include "xstat.h" +#include +#include +#include + +#define SF_DEFAULT_FONT "9x15" + +#ifdef ABS +#undef ABS +#endif +#define ABS(x) (((x) < 0) ? (-(x)) : (x)) + +typedef struct { + char *fontname; +} TextData, *textPtr; + +int SFcharWidth, SFcharAscent, SFcharHeight; + +int SFcurrentInvert[3] = { -1, -1, -1 }; + +static GC SFlineGC, SFscrollGC, SFinvertGC, SFtextGC; + +static XtResource textResources[] = { + {XtNfont, XtCFont, XtRString, sizeof (char *), + XtOffset(textPtr, fontname), XtRString, SF_DEFAULT_FONT}, +}; + +static XFontStruct *SFfont; + +static int SFcurrentListY; + +static XtIntervalId SFscrollTimerId; + +SFinitFont() +{ + TextData *data; + + data = XtNew(TextData); + + XtGetApplicationResources(selFileForm, (XtPointer) data, textResources, + XtNumber(textResources), (Arg *) NULL, ZERO); + + SFfont = XLoadQueryFont(SFdisplay, data->fontname); + if (!SFfont) { + SFfont = XLoadQueryFont(SFdisplay, SF_DEFAULT_FONT); + if (!SFfont) { + char sbuf[256]; + + (void) sprintf(sbuf, "XsraSelFile: can't get font %s", + SF_DEFAULT_FONT); + + XtAppError(SFapp, sbuf); + } + } + + SFcharWidth = (SFfont->max_bounds.width + SFfont->min_bounds.width) / 2; + SFcharAscent = SFfont->max_bounds.ascent; + SFcharHeight = SFcharAscent + SFfont->max_bounds.descent; +} + +SFcreateGC() +{ + XGCValues gcValues; + XRectangle rectangles[1]; + + gcValues.foreground = SFfore; + + SFlineGC = XtGetGC( + selFileLists[0], + (XtGCMask) + GCForeground | + 0, + &gcValues + ); + + SFscrollGC = XtGetGC( + selFileLists[0], + (XtGCMask) + 0, + &gcValues + ); + + gcValues.function = GXinvert; + gcValues.plane_mask = (SFfore ^ SFback); + + SFinvertGC = XtGetGC( + selFileLists[0], + (XtGCMask) + GCFunction | + GCPlaneMask | + 0, + &gcValues + ); + + gcValues.foreground = SFfore; + gcValues.background = SFback; + gcValues.font = SFfont->fid; + + SFtextGC = XCreateGC( + SFdisplay, + XtWindow(selFileLists[0]), + (unsigned long) + GCForeground | + GCBackground | + GCFont | + 0, + &gcValues + ); + + rectangles[0].x = SFlineToTextH + SFbesideText; + rectangles[0].y = 0; + rectangles[0].width = SFcharsPerEntry * SFcharWidth; + rectangles[0].height = SFupperY + 1; + + XSetClipRectangles( + SFdisplay, + SFtextGC, + 0, + 0, + rectangles, + 1, + Unsorted + ); +} + +SFclearList(n, doScroll) + int n; + int doScroll; +{ + SFDir *dir; + + SFcurrentInvert[n] = -1; + + XClearWindow(SFdisplay, XtWindow(selFileLists[n])); + + XDrawSegments(SFdisplay, XtWindow(selFileLists[n]), SFlineGC, SFsegs, + 2); + + if (doScroll) { + dir = &(SFdirs[SFdirPtr + n]); + + if ((SFdirPtr + n < SFdirEnd) && dir->nEntries && dir->nChars) { + XawScrollbarSetThumb( + selFileVScrolls[n], + (float) (((double) dir->vOrigin) / + dir->nEntries), + (float) (((double) ((dir->nEntries < SFlistSize) + ? dir->nEntries : SFlistSize)) / + dir->nEntries) + ); + + XawScrollbarSetThumb( + selFileHScrolls[n], + (float) (((double) dir->hOrigin) / dir->nChars), + (float) (((double) ((dir->nChars < + SFcharsPerEntry) ? dir->nChars : + SFcharsPerEntry)) / dir->nChars) + ); + } else { + XawScrollbarSetThumb(selFileVScrolls[n], (float) 0.0, + (float) 1.0); + XawScrollbarSetThumb(selFileHScrolls[n], (float) 0.0, + (float) 1.0); + } + } +} + +static +SFdeleteEntry(dir, entry) + SFDir *dir; + SFEntry *entry; +{ + register SFEntry *e; + register SFEntry *end; + int n; + int idx; + + idx = entry - dir->entries; + + if (idx < dir->beginSelection) { + dir->beginSelection--; + } + if (idx <= dir->endSelection) { + dir->endSelection--; + } + if (dir->beginSelection > dir->endSelection) { + dir->beginSelection = dir->endSelection = -1; + } + + if (idx < dir->vOrigin) { + dir->vOrigin--; + } + + XtFree(entry->real); + + end = &(dir->entries[dir->nEntries - 1]); + + for (e = entry; e < end; e++) { + *e = *(e + 1); + } + + if (!(--dir->nEntries)) { + return; + } + + n = dir - &(SFdirs[SFdirPtr]); + if ((n < 0) || (n > 2)) { + return; + } + + XawScrollbarSetThumb( + selFileVScrolls[n], + (float) (((double) dir->vOrigin) / dir->nEntries), + (float) (((double) ((dir->nEntries < SFlistSize) ? + dir->nEntries : SFlistSize)) / dir->nEntries) + ); +} + +static +SFwriteStatChar(name, last, statBuf) + char *name; + int last; + struct stat *statBuf; +{ + name[last] = SFstatChar(statBuf); +} + +static int +SFstatAndCheck(dir, entry) + SFDir *dir; + SFEntry *entry; +{ + struct stat statBuf; + char save; + int last; + + /* + * must be restored before returning + */ + save = *(dir->path); + *(dir->path) = 0; + + if (!SFchdir(SFcurrentPath)) { + last = strlen(entry->real) - 1; + entry->real[last] = 0; + entry->statDone = 1; + if ( + (!stat(entry->real, &statBuf)) + +#ifdef S_IFLNK + + || (!lstat(entry->real, &statBuf)) + +#endif /* ndef S_IFLNK */ + + ) { + if (SFfunc) { + char *shown; + + shown = NULL; + if (SFfunc(entry->real, &shown, &statBuf)) { + if (shown) { + int len; + + len = strlen(shown); + entry->shown = XtMalloc( + (unsigned) (len + 2) + ); + (void) strcpy(entry->shown, + shown); + SFwriteStatChar( + entry->shown, + len, + &statBuf + ); + entry->shown[len + 1] = 0; + } + } else { + SFdeleteEntry(dir, entry); + + *(dir->path) = save; + return 1; + } + } + SFwriteStatChar(entry->real, last, &statBuf); + } else { + entry->real[last] = ' '; + } + } + + *(dir->path) = save; + return 0; +} + +static +SFdrawStrings(w, dir, from, to) + register Window w; + register SFDir *dir; + register int from; + register int to; +{ + register int i; + register SFEntry *entry; + int x; + + x = SFtextX - dir->hOrigin * SFcharWidth; + + if (dir->vOrigin + to >= dir->nEntries) { + to = dir->nEntries - dir->vOrigin - 1; + } + for (i = from; i <= to; i++) { + entry = &(dir->entries[dir->vOrigin + i]); + if (!(entry->statDone)) { + if (SFstatAndCheck(dir, entry)) { + if (dir->vOrigin + to >= dir->nEntries) { + to = dir->nEntries - dir->vOrigin - 1; + } + i--; + continue; + } + } + XDrawImageString( + SFdisplay, + w, + SFtextGC, + x, + SFtextYoffset + i * SFentryHeight, + entry->shown, + strlen(entry->shown) + ); + if (dir->vOrigin + i == dir->beginSelection) { + XDrawLine( + SFdisplay, + w, + SFlineGC, + SFlineToTextH + 1, + SFlowerY + i * SFentryHeight, + SFlineToTextH + SFentryWidth - 2, + SFlowerY + i * SFentryHeight + ); + } + if ( + (dir->vOrigin + i >= dir->beginSelection) && + (dir->vOrigin + i <= dir->endSelection) + ) { + SFcompletionSegs[0].y1 = SFcompletionSegs[1].y1 = + SFlowerY + i * SFentryHeight; + SFcompletionSegs[0].y2 = SFcompletionSegs[1].y2 = + SFlowerY + (i + 1) * SFentryHeight - 1; + XDrawSegments( + SFdisplay, + w, + SFlineGC, + SFcompletionSegs, + 2 + ); + } + if (dir->vOrigin + i == dir->endSelection) { + XDrawLine( + SFdisplay, + w, + SFlineGC, + SFlineToTextH + 1, + SFlowerY + (i + 1) * SFentryHeight - 1, + SFlineToTextH + SFentryWidth - 2, + SFlowerY + (i + 1) * SFentryHeight - 1 + ); + } + } +} + +SFdrawList(n, doScroll) + int n; + int doScroll; +{ + SFDir *dir; + Window w; + + SFclearList(n, doScroll); + + if (SFdirPtr + n < SFdirEnd) { + dir = &(SFdirs[SFdirPtr + n]); + w = XtWindow(selFileLists[n]); + XDrawImageString( + SFdisplay, + w, + SFtextGC, + SFtextX - dir->hOrigin * SFcharWidth, + SFlineToTextV + SFaboveAndBelowText + SFcharAscent, + dir->dir, + strlen(dir->dir) + ); + SFdrawStrings(w, dir, 0, SFlistSize - 1); + } +} + +SFdrawLists(doScroll) + int doScroll; +{ + int i; + + for (i = 0; i < 3; i++) { + SFdrawList(i, doScroll); + } +} + +static +SFinvertEntry(n) + register int n; +{ + XFillRectangle( + SFdisplay, + XtWindow(selFileLists[n]), + SFinvertGC, + SFlineToTextH, + SFcurrentInvert[n] * SFentryHeight + SFlowerY, + SFentryWidth, + SFentryHeight + ); +} + +static unsigned long +SFscrollTimerInterval() +{ + static int maxVal = 200; + static int varyDist = 50; + static int minDist = 50; + int t; + int dist; + + if (SFcurrentListY < SFlowerY) { + dist = SFlowerY - SFcurrentListY; + } else if (SFcurrentListY > SFupperY) { + dist = SFcurrentListY - SFupperY; + } else { + return (unsigned long) 1; + } + + t = maxVal - ((maxVal / varyDist) * (dist - minDist)); + + if (t < 1) { + t = 1; + } + + if (t > maxVal) { + t = maxVal; + } + + return (unsigned long) t; +} + +static void +SFscrollTimer(p, id) + XtPointer p; + XtIntervalId *id; +{ + SFDir *dir; + int save; + int n; + + n = (int) p; + + dir = &(SFdirs[SFdirPtr + n]); + save = dir->vOrigin; + + if (SFcurrentListY < SFlowerY) { + if (dir->vOrigin > 0) { + SFvSliderMovedCallback(selFileVScrolls[n], n, + dir->vOrigin - 1); + } + } else if (SFcurrentListY > SFupperY) { + if (dir->vOrigin < dir->nEntries - SFlistSize) { + SFvSliderMovedCallback(selFileVScrolls[n], n, + dir->vOrigin + 1); + } + } + + if (dir->vOrigin != save) { + if (dir->nEntries) { + XawScrollbarSetThumb( + selFileVScrolls[n], + (float) (((double) dir->vOrigin) / dir->nEntries), + (float) (((double) ((dir->nEntries < SFlistSize) ? + dir->nEntries : SFlistSize)) / dir->nEntries) + ); + } + } + + if (SFbuttonPressed) { + SFscrollTimerId = XtAppAddTimeOut(SFapp, + SFscrollTimerInterval(), SFscrollTimer, (XtPointer) n); + } +} + +static int +SFnewInvertEntry(n, event) + register int n; + register XMotionEvent *event; +{ + register int x, y; + register int new; + static int SFscrollTimerAdded = 0; + + x = event->x; + y = event->y; + + if (SFdirPtr + n >= SFdirEnd) { + return -1; + } else if ( + (x >= 0) && (x <= SFupperX) && + (y >= SFlowerY) && (y <= SFupperY) + ) { + register SFDir *dir = &(SFdirs[SFdirPtr + n]); + + if (SFscrollTimerAdded) { + SFscrollTimerAdded = 0; + XtRemoveTimeOut(SFscrollTimerId); + } + + new = (y - SFlowerY) / SFentryHeight; + if (dir->vOrigin + new >= dir->nEntries) { + return -1; + } + return new; + } else { + if (SFbuttonPressed) { + SFcurrentListY = y; + if (!SFscrollTimerAdded) { + SFscrollTimerAdded = 1; + SFscrollTimerId = XtAppAddTimeOut(SFapp, + SFscrollTimerInterval(), SFscrollTimer, + (XtPointer) n); + } + } + + return -1; + } +} + +/* ARGSUSED */ +void +SFenterList(w, n, event) + Widget w; + register int n; + register XEnterWindowEvent *event; +{ + register int new; + + /* sanity */ + if (SFcurrentInvert[n] != -1) { + SFinvertEntry(n); + SFcurrentInvert[n] = -1; + } + + new = SFnewInvertEntry(n, (XMotionEvent *) event); + if (new != -1) { + SFcurrentInvert[n] = new; + SFinvertEntry(n); + } +} + +/* ARGSUSED */ +void +SFleaveList(w, n, event) + Widget w; + register int n; + XEvent *event; +{ + if (SFcurrentInvert[n] != -1) { + SFinvertEntry(n); + SFcurrentInvert[n] = -1; + } +} + +/* ARGSUSED */ +void +SFmotionList(w, n, event) + Widget w; + register int n; + register XMotionEvent *event; +{ + register int new; + + new = SFnewInvertEntry(n, event); + + if (new != SFcurrentInvert[n]) { + if (SFcurrentInvert[n] != -1) { + SFinvertEntry(n); + } + SFcurrentInvert[n] = new; + if (new != -1) { + SFinvertEntry(n); + } + } +} + +/* ARGSUSED */ +void +SFvFloatSliderMovedCallback(w, n, fnew) + Widget w; + int n; + float *fnew; +{ + int new; + + new = (*fnew) * SFdirs[SFdirPtr + n].nEntries; + + SFvSliderMovedCallback(w, n, new); +} + +/* ARGSUSED */ +void +SFvSliderMovedCallback(w, n, new) + Widget w; + int n; + int new; +{ + int old; + register Window win; + SFDir *dir; + + dir = &(SFdirs[SFdirPtr + n]); + + old = dir->vOrigin; + dir->vOrigin = new; + + if (old == new) { + return; + } + + win = XtWindow(selFileLists[n]); + + if (ABS(new - old) < SFlistSize) { + if (new > old) { + XCopyArea( + SFdisplay, + win, + win, + SFscrollGC, + SFlineToTextH, + SFlowerY + (new - old) * SFentryHeight, + SFentryWidth + SFlineToTextH, + (SFlistSize - (new - old)) * SFentryHeight, + SFlineToTextH, + SFlowerY + ); + XClearArea( + SFdisplay, + win, + SFlineToTextH, + SFlowerY + (SFlistSize - (new - old)) * + SFentryHeight, + SFentryWidth + SFlineToTextH, + (new - old) * SFentryHeight, + False + ); + SFdrawStrings(win, dir, SFlistSize - (new - old), + SFlistSize - 1); + } else { + XCopyArea( + SFdisplay, + win, + win, + SFscrollGC, + SFlineToTextH, + SFlowerY, + SFentryWidth + SFlineToTextH, + (SFlistSize - (old - new)) * SFentryHeight, + SFlineToTextH, + SFlowerY + (old - new) * SFentryHeight + ); + XClearArea( + SFdisplay, + win, + SFlineToTextH, + SFlowerY, + SFentryWidth + SFlineToTextH, + (old - new) * SFentryHeight, + False + ); + SFdrawStrings(win, dir, 0, old - new); + } + } else { + XClearArea( + SFdisplay, + win, + SFlineToTextH, + SFlowerY, + SFentryWidth + SFlineToTextH, + SFlistSize * SFentryHeight, + False + ); + SFdrawStrings(win, dir, 0, SFlistSize - 1); + } +} + +/* ARGSUSED */ +void +SFvAreaSelectedCallback(w, n, pnew) + Widget w; + int n; + int pnew; +{ + SFDir *dir; + int new; + + dir = &(SFdirs[SFdirPtr + n]); + + new = dir->vOrigin + + (((double) pnew) / SFvScrollHeight) * dir->nEntries; + + if (new > dir->nEntries - SFlistSize) { + new = dir->nEntries - SFlistSize; + } + + if (new < 0) { + new = 0; + } + + if (dir->nEntries) { + float f; + + f = ((double) new) / dir->nEntries; + + XawScrollbarSetThumb( + w, + f, + (float) (((double) ((dir->nEntries < SFlistSize) ? + dir->nEntries : SFlistSize)) / dir->nEntries) + ); + } + + SFvSliderMovedCallback(w, n, new); +} + +/* ARGSUSED */ +void +SFhSliderMovedCallback(w, n, new) + Widget w; + int n; + float *new; +{ + SFDir *dir; + int save; + + dir = &(SFdirs[SFdirPtr + n]); + save = dir->hOrigin; + dir->hOrigin = (*new) * dir->nChars; + if (dir->hOrigin == save) { + return; + } + + SFdrawList(n, SF_DO_NOT_SCROLL); +} + +/* ARGSUSED */ +void +SFhAreaSelectedCallback(w, n, pnew) + Widget w; + int n; + int pnew; +{ + SFDir *dir; + int new; + + dir = &(SFdirs[SFdirPtr + n]); + + new = dir->hOrigin + + (((double) pnew) / SFhScrollWidth) * dir->nChars; + + if (new > dir->nChars - SFcharsPerEntry) { + new = dir->nChars - SFcharsPerEntry; + } + + if (new < 0) { + new = 0; + } + + if (dir->nChars) { + float f; + + f = ((double) new) / dir->nChars; + + XawScrollbarSetThumb( + w, + f, + (float) (((double) ((dir->nChars < SFcharsPerEntry) ? + dir->nChars : SFcharsPerEntry)) / dir->nChars) + ); + + SFhSliderMovedCallback(w, n, &f); + } +} + +/* ARGSUSED */ +void +SFpathSliderMovedCallback(w, client_data, new) + Widget w; + XtPointer client_data; + float *new; +{ + SFDir *dir; + int n; + XawTextPosition pos; + int SFdirPtrSave; + + SFdirPtrSave = SFdirPtr; + SFdirPtr = (*new) * SFdirEnd; + if (SFdirPtr == SFdirPtrSave) { + return; + } + + SFdrawLists(SF_DO_SCROLL); + + n = 2; + while (SFdirPtr + n >= SFdirEnd) { + n--; + } + + dir = &(SFdirs[SFdirPtr + n]); + + pos = dir->path - SFcurrentPath; + + if (!strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir))) { + pos -= strlen(SFstartDir); + if (pos < 0) { + pos = 0; + } + } + + XawTextSetInsertionPoint(selFileField, pos); +} + +/* ARGSUSED */ + +void +SFpathAreaSelectedCallback(w, client_data, pnew) + Widget w; + XtPointer client_data; + int pnew; +{ + int new; + float f; + + new = SFdirPtr + (((double) pnew) / SFpathScrollWidth) * SFdirEnd; + + if (new > SFdirEnd - 3) { + new = SFdirEnd - 3; + } + + if (new < 0) { + new = 0; + } + + f = ((double) new) / SFdirEnd; + + XawScrollbarSetThumb( + w, + f, + (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / + SFdirEnd) + ); + + SFpathSliderMovedCallback(w, (XtPointer) NULL, &f); +} + +Boolean +SFworkProc() +{ + register SFDir *dir; + register SFEntry *entry; + + for (dir = &(SFdirs[SFdirEnd - 1]); dir >= SFdirs; dir--) { + if (!(dir->nEntries)) { + continue; + } + for ( + entry = &(dir->entries[dir->nEntries - 1]); + entry >= dir->entries; + entry-- + ) { + if (!(entry->statDone)) { + (void) SFstatAndCheck(dir, entry); + return False; + } + } + } + + SFworkProcAdded = 0; + + return True; +} diff --git a/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.ad b/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.ad new file mode 100644 index 0000000000..1c6085d899 --- /dev/null +++ b/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.ad @@ -0,0 +1,251 @@ +! Ghostview.ad -- Application defaults file for ghostview. +! Copyright (C) 1992 Timothy O. Theisen +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 2 of the License, or +! (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +! GNU General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program; if not, write to the Free Software +! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +! +! Author: Tim Theisen Systems Programmer +! Internet: tim@cs.wisc.edu Department of Computer Sciences +! UUCP: uwvax!tim University of Wisconsin-Madison +! Phone: (608)262-0438 1210 West Dayton Street +! FAX: (608)262-9777 Madison, WI 53706 + +! This file is part of the hacked version of the ghostview package +! which is distributed under the terms of the gnu license. The +! modification referred to above is by Tanmoy Bhattacharya, +! on Nov 17, 1994. Neither the modification, +! nor the original program provides any warranty. + +! All of the button labels and actions are determined in this file. +! It should be easy to adapt to any language. +! To use a different version of ghostscript, you can add the resource +! *Ghostview.interpreter: /my/very/own/gs + +*input: True +*allowShellResize: True +*ShapeStyle: Oval +*Font: -adobe-new century schoolbook-medium-r-normal--*-140-*-*-p-*-iso8859-1 +*Text*Font: -adobe-courier-medium-r-normal--*-140-*-*-m-*-iso8859-1 +*ghostviewButton.Label: Ghostview +*copyright.Label: Copyright... +*quit.Label: Quit +*fileButton.Label: File +*open.Label: Open... +*reopen.Label: Reopen +*printwhole.Label: Print... +*printmarked.Label: Print marked pages... +*save.Label: Save marked pages... +*pageButton.Label: Page +*next.Label: Next +*show.Label: Redisplay +*prev.Label: Previous +*center.Label: Center +*mark.Label: Mark +*unmark.Label: Unmark +*magstepButton.Label: Magstep +*orientationButton.Label: Orientation +*portrait.Label: Portrait +*landscape.Label: Landscape +*upsidedown.Label: Upside-down +*seascape.Label: Seascape +*swap.Label: Swap Landscape +*pagemediaButton.Label: Media +*pageview.useBottom: True +*pageview.useRight: True +*MenuButton.baseTranslations: #replace \n\ + : highlight() \n\ + : reset() \n\ + ! : reset() PopupMenu() \n\ + ! Shift: reset() PopupMenu() \n\ + ! Lock : reset() PopupMenu() \n\ + ! Lock Shift: reset() PopupMenu() \n\ + !Ctrl : reset() PopupMenu() \n\ + !Ctrl Shift: reset() PopupMenu() \n\ + !Ctrl Lock : reset() PopupMenu() \n\ + !Ctrl Lock Shift: reset() PopupMenu() +*MenuButton.translations: #replace \n\ + : highlight() \n\ + : reset() \n\ + ! : reset() PopupMenu() \n\ + ! Shift: reset() PopupMenu() \n\ + ! Lock : reset() PopupMenu() \n\ + ! Lock Shift: reset() PopupMenu() \n\ + !Ctrl : reset() PopupMenu() \n\ + !Ctrl Shift: reset() PopupMenu() \n\ + !Ctrl Lock : reset() PopupMenu() \n\ + !Ctrl Lock Shift: reset() PopupMenu() +*SimpleMenu.baseTranslations: #replace \n\ + : highlight() \n\ + : unhighlight() \n\ + : highlight() \n\ + : MenuPopdown() GhostviewForce() notify() unhighlight() \n\ + : MenuPopdown() GhostviewDefault() notify() unhighlight() +*SimpleMenu.translations: #replace \n\ + : highlight() \n\ + : unhighlight() \n\ + : highlight() \n\ + : MenuPopdown() GhostviewForce() notify() unhighlight() \n\ + : MenuPopdown() GhostviewDefault() notify() unhighlight() +*okay.Label: Okay +*cancel.Label: Cancel +*dismiss.Label: Dismiss +*Ghostview.busyCursor: target +Ghostview.baseTranslations: #replace \n\ + : GhostviewCheckFile() \n\ + WM_PROTOCOLS: GhostviewDeleteWindow() +Ghostview.translations: #replace \n\ + : GhostviewCheckFile() \n\ + WM_PROTOCOLS: GhostviewDeleteWindow() +*TopLevelShell.baseTranslations: #replace \n\ + WM_PROTOCOLS: GhostviewDismiss() +*TopLevelShell.translations: #replace \n\ + WM_PROTOCOLS: GhostviewDismiss() +*TransientShell.baseTranslations: #replace \n\ + WM_PROTOCOLS: GhostviewDismiss() +*TransientShell.translations: #replace \n\ + WM_PROTOCOLS: GhostviewDismiss() +*zoom.form.baseTranslations: #replace \n\ + Q: GhostviewDeleteZoom() +*zoom.form.translations: #replace \n\ + Q: GhostviewDeleteZoom() +*zoom.baseTranslations: #replace \n\ + WM_PROTOCOLS: GhostviewDeleteWindow() +*zoom.translations: #replace \n\ + WM_PROTOCOLS: GhostviewDeleteWindow() +*Ghostview.baseTranslations: #replace \n\ + : message() \n\ + : notify(0) \n\ + : GhostviewEraseLocator() \n\ + : notify(0) \n\ + : notify(180 180 200 200) \n\ + : notify(120 120 300 300) \n\ + : notify(90 90 400 400) +*Ghostview.translations: #replace \n\ + : message() \n\ + : notify(0) \n\ + : GhostviewEraseLocator() \n\ + : notify(0) \n\ + : notify(180 180 200 200) \n\ + : notify(120 120 300 300) \n\ + : notify(90 90 400 400) +*toc.baseTranslations: #replace \n\ + : focus-in() \n\ + : focus-out() \n\ + : select-start() \n\ + : extend-adjust() \n\ + : extend-end(PRIMARY, CUT_BUFFER0) \n\ + : select-start() \n\ + : extend-adjust() \n\ + : extend-end(PRIMARY, CUT_BUFFER0) GhostviewShow() \n\ + : extend-start() \n\ + : extend-adjust() \n\ + : extend-end(PRIMARY, CUT_BUFFER0) +*toc.translations: #replace \n\ + : focus-in() \n\ + : focus-out() \n\ + : select-start() \n\ + : extend-adjust() \n\ + : extend-end(PRIMARY, CUT_BUFFER0) \n\ + : select-start() \n\ + : extend-adjust() \n\ + : extend-end(PRIMARY, CUT_BUFFER0) GhostviewShow() \n\ + : extend-start() \n\ + : extend-adjust() \n\ + : extend-end(PRIMARY, CUT_BUFFER0) +*Form.baseTranslations: #replace \n\ + C: GhostviewCenter() \n\ + Q: GhostviewQuit() \n\ + O: GhostviewOpen() \n\ + R: GhostviewReopen() \n\ + S: GhostviewSave() \n\ + ShiftP: GhostviewPrintWhole() \n\ + P: GhostviewPrintMarked() \n\ + BackSpace: GhostviewPrevious() \n\ + Delete: GhostviewPrevious() \n\ + B: GhostviewBack() \n\ + Prior: GhostviewPrevious() \n\ + space: GhostviewNext() \n\ + Return: GhostviewNext() \n\ + F: GhostviewNext() \n\ + Next: GhostviewNext() \n\ + Tab: GhostviewNext() \n\ + period: GhostviewShow() \n\ + CtrlL: GhostviewShow() \n\ + M: GhostviewMark() \n\ + N: GhostviewUnmark() \n\ + 0: GhostviewSetMagstep(0) \n\ + 1: GhostviewSetMagstep(1) \n\ + 2: GhostviewSetMagstep(2) \n\ + 3: GhostviewSetMagstep(3) \n\ + 4: GhostviewSetMagstep(4) \n\ + 5: GhostviewSetMagstep(5) \n\ + +: GhostviewIncreaseMagstep() \n\ + -: GhostviewDecreaseMagstep() \n\ + U: GhostviewScrollUp() \n\ + D: GhostviewScrollDown() \n\ + K: GhostviewScrollUp() \n\ + J: GhostviewScrollDown() \n\ + H: GhostviewScrollLeft() \n\ + L: GhostviewScrollRight() \n\ + ShiftUp: GhostviewForce() GhostviewSetOrientation(portrait) \n\ + ShiftRight: GhostviewForce() GhostviewSetOrientation(landscape) \n\ + ShiftDown: GhostviewForce() GhostviewSetOrientation(upside-down) \n\ + ShiftLeft: GhostviewForce() GhostviewSetOrientation(seascape) \n\ + Up: GhostviewDefault() GhostviewSetOrientation(portrait) \n\ + Right: GhostviewDefault() GhostviewSetOrientation(landscape) \n\ + Down: GhostviewDefault() GhostviewSetOrientation(upside-down) \n\ + Left: GhostviewDefault() GhostviewSetOrientation(seascape) +*Form.translations: #replace \n\ + C: GhostviewCenter() \n\ + Q: GhostviewQuit() \n\ + O: GhostviewOpen() \n\ + R: GhostviewReopen() \n\ + S: GhostviewSave() \n\ + ShiftP: GhostviewPrintWhole() \n\ + P: GhostviewPrintMarked() \n\ + BackSpace: GhostviewPrevious() \n\ + Delete: GhostviewPrevious() \n\ + B: GhostviewBack() \n\ + Prior: GhostviewPrevious() \n\ + space: GhostviewNext() \n\ + Return: GhostviewNext() \n\ + F: GhostviewNext() \n\ + Next: GhostviewNext() \n\ + Tab: GhostviewNext() \n\ + period: GhostviewShow() \n\ + CtrlL: GhostviewShow() \n\ + M: GhostviewMark() \n\ + N: GhostviewUnmark() \n\ + 0: GhostviewSetMagstep(0) \n\ + 1: GhostviewSetMagstep(1) \n\ + 2: GhostviewSetMagstep(2) \n\ + 3: GhostviewSetMagstep(3) \n\ + 4: GhostviewSetMagstep(4) \n\ + 5: GhostviewSetMagstep(5) \n\ + +: GhostviewIncreaseMagstep() \n\ + -: GhostviewDecreaseMagstep() \n\ + U: GhostviewScrollUp() \n\ + D: GhostviewScrollDown() \n\ + K: GhostviewScrollUp() \n\ + J: GhostviewScrollDown() \n\ + H: GhostviewScrollLeft() \n\ + L: GhostviewScrollRight() \n\ + ShiftUp: GhostviewForce() GhostviewSetOrientation(portrait) \n\ + ShiftRight: GhostviewForce() GhostviewSetOrientation(landscape) \n\ + ShiftDown: GhostviewForce() GhostviewSetOrientation(upside-down) \n\ + ShiftLeft: GhostviewForce() GhostviewSetOrientation(seascape) \n\ + Up: GhostviewDefault() GhostviewSetOrientation(portrait) \n\ + Right: GhostviewDefault() GhostviewSetOrientation(landscape) \n\ + Down: GhostviewDefault() GhostviewSetOrientation(upside-down) \n\ + Left: GhostviewDefault() GhostviewSetOrientation(seascape) diff --git a/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.c b/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.c new file mode 100644 index 0000000000..4d427ac80d --- /dev/null +++ b/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.c @@ -0,0 +1,2029 @@ +/* + * Ghostview.c -- Ghostview widget. + * Copyright (C) 1992 Timothy O. Theisen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Tim Theisen Systems Programmer + * Internet: tim@cs.wisc.edu Department of Computer Sciences + * UUCP: uwvax!tim University of Wisconsin-Madison + * Phone: (608)262-0438 1210 West Dayton Street + * FAX: (608)262-9777 Madison, WI 53706 + */ + +/* This file is part of the hacked version of the ghostview package */ +/* which is distributed under the terms of the gnu license. The */ +/* modification referred to above is by Tanmoy Bhattacharya, */ +/* on Nov 17, 1994. Neither the modification, */ +/* nor the original program provides any warranty. */ + +#include +#include +#include +#include +#include +#include "GhostviewP.h" +#include "pdf.h" +#include + +#ifndef XlibSpecificationRelease +typedef char *XPointer; +#endif + +#include +#ifdef SIGNALRETURNSINT +#define SIGVAL int +#else +#define SIGVAL void +#endif + +#ifdef NON_BLOCKING_IO +#include +/* if POSIX O_NONBLOCK is not available, use O_NDELAY */ +#if !defined(O_NONBLOCK) && defined(O_NDELAY) +#define O_NONBLOCK O_NDELAY +#endif +#endif + +#include +/* BSD 4.3 errno.h does not declare errno */ +extern int errno; +/* Both error returns are checked for non-blocking I/O. */ +/* Manufacture the other error code if only one exists. */ +#if !defined(EWOULDBLOCK) && defined(EAGAIN) +#define EWOULDBLOCK EAGAIN +#endif +#if !defined(EAGAIN) && defined(EWOULDBLOCK) +#define EAGAIN EWOULDBLOCK +#endif + +#ifndef VMS +/* GV_BUFSIZ is set to the minimum POSIX PIPE_BUF to ensure that + * nonblocking writes to ghostscript will work properly. + */ +#define GV_BUFSIZ 1024*1024 +#else /* VMS */ +/* +** GV_BUFSIZ is the maximum length line we can handle, so we up it to 1024 +*/ +#define GV_BUFSIZ 1024*1024 +#endif /* VMS */ + +static void ComputeXdpi(); +static void ComputeYdpi(); + +static XtResource resources[] = { +#define offset(field) XtOffsetOf(GhostviewRec, ghostview.field) + { XtNarguments, XtCArguments, XtRString, sizeof(String), + offset(arguments), XtRString, (XtPointer)NULL }, + { XtNbottomMargin, XtCMargin, XtRInt, sizeof(int), + offset(bottom_margin), XtRImmediate, (XtPointer)0 }, + { XtNbusyCursor, XtCCursor, XtRCursor, sizeof(XtPointer), + offset(busy_cursor), XtRString, "watch" }, + { XtNcallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(callback), XtRCallback, (XtPointer)NULL }, + { XtNcursor, XtCCursor, XtRCursor, sizeof(XtPointer), + offset(cursor), XtRString, "crosshair" }, + { XtNfilename, XtCFilename, XtRString, sizeof(String), + offset(filename), XtRString, (XtPointer)NULL }, + { XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), + offset(foreground), XtRString, XtDefaultForeground}, + { XtNinterpreter, XtCInterpreter, XtRString, sizeof(String), + offset(interpreter), XtRString, "gs" }, + { XtNleftMargin, XtCMargin, XtRInt, sizeof(int), + offset(left_margin), XtRImmediate, (XtPointer)0 }, + { XtNllx, XtCBoundingBox, XtRInt, sizeof(int), + offset(llx), XtRImmediate, (XtPointer)0 }, + { XtNlly, XtCBoundingBox, XtRInt, sizeof(int), + offset(lly), XtRImmediate, (XtPointer)0 }, + { XtNmessageCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(message_callback), XtRCallback, (XtPointer)NULL }, + { XtNorientation, XtCOrientation, XtRPageOrientation, + sizeof(XtPageOrientation), offset(orientation), XtRImmediate, + (XtPointer)XtPageOrientationPortrait }, + { XtNoutputCallback, XtCCallback, XtRCallback, sizeof(XtPointer), + offset(output_callback), XtRCallback, (XtPointer)NULL }, + { XtNpalette, XtCPalette, XtRPalette, sizeof(XtPalette), + offset(palette), XtRImmediate, (XtPointer)XtPaletteColor }, + { XtNquiet, XtCQuiet, XtRBoolean, sizeof(Boolean), + offset(quiet), XtRImmediate, (XtPointer)True }, + { XtNrightMargin, XtCMargin, XtRInt, sizeof(int), + offset(right_margin), XtRImmediate, (XtPointer)0 }, + { XtNsafer, XtCSafer, XtRBoolean, sizeof(Boolean), + offset(safer), XtRImmediate, (XtPointer)True }, + { XtNtopMargin, XtCMargin, XtRInt, sizeof(int), + offset(top_margin), XtRImmediate, (XtPointer)0 }, + { XtNuseBackingPixmap, XtCUseBackingPixmap, XtRBoolean, sizeof(Boolean), + offset(use_bpixmap), XtRImmediate, (XtPointer)True }, + { XtNurx, XtCBoundingBox, XtRInt, sizeof(int), + offset(urx), XtRImmediate, (XtPointer)612 }, + { XtNury, XtCBoundingBox, XtRInt, sizeof(int), + offset(ury), XtRImmediate, (XtPointer)792 }, + { XtNxdpi, XtCResolution, XtRFloat, sizeof(float), + offset(xdpi), XtRCallProc, (XtPointer)ComputeXdpi }, + { XtNydpi, XtCResolution, XtRFloat, sizeof(float), + offset(ydpi), XtRCallProc, (XtPointer)ComputeYdpi }, +#undef offset +}; + +static void Message(); +static void Notify(); +static void Input(); +static void Output(); + +static void ClassInitialize(); +static void ClassPartInitialize(); +static void Initialize(); +static void Realize(); +static void Destroy(); +static void Resize(); +static Boolean SetValues(); +static XtGeometryResult QueryGeometry(); + +static void Layout(); +static Boolean ComputeSize(); +static void ChangeSize(); +static Boolean Setup(); +static void StartInterpreter(); +static void StopInterpreter(); +static void InterpreterFailed(); + +static XtActionsRec actions[] = +{ + {"message", Message}, + {"notify", Notify}, +}; + +/* notify takes zero to four parameters. The first two give the width and + * height of the zoom requested in the default user coordinate system. + * If they are omitted, a default value of 72 is provided. If the second + * parameter is omitted, the zoom area is assumed to be a square. + * The next two parameters give the desired resolution of the zoom window. + * If they are omitted, a default value of 300 is provided. If the four + * parameter is omitted, the y resolution is assumed to be equal to the + * x resolution. + */ +static char translations[] = +": message() \n\ +: notify(72) \n\ +: notify(108) \n\ +: notify(144) \n\ +"; + +GhostviewClassRec ghostviewClassRec = { + { /* core fields */ + /* superclass */ (WidgetClass) &coreClassRec, + /* class_name */ "Ghostview", + /* widget_size */ sizeof(GhostviewRec), + /* class_initialize */ ClassInitialize, + /* class_part_initialize */ ClassPartInitialize, + /* class_inited */ FALSE, + /* initialize */ Initialize, + /* initialize_hook */ NULL, + /* realize */ Realize, + /* actions */ actions, + /* num_actions */ XtNumber(actions), + /* resources */ resources, + /* num_resources */ XtNumber(resources), + /* xrm_class */ NULLQUARK, + /* compress_motion */ TRUE, + /* compress_exposure */ TRUE, + /* compress_enterleave */ TRUE, + /* visible_interest */ FALSE, + /* destroy */ Destroy, + /* resize */ Resize, + /* expose */ NULL, + /* set_values */ SetValues, + /* set_values_hook */ NULL, + /* set_values_almost */ XtInheritSetValuesAlmost, + /* get_values_hook */ NULL, + /* accept_focus */ NULL, + /* version */ XtVersion, + /* callback_private */ NULL, + /* tm_table */ translations, + /* query_geometry */ QueryGeometry, + /* display_accelerator */ XtInheritDisplayAccelerator, + /* extension */ NULL + }, + { /* ghostview fields */ + /* ghostview */ NULL, + /* gv_colors */ NULL, + /* next */ NULL, + /* page */ NULL, + /* done */ NULL + } +}; + +WidgetClass ghostviewWidgetClass = (WidgetClass)&ghostviewClassRec; + +/* Procedures that compute the default xdpi and ydpi from display parameters */ + +static void +ComputeXdpi(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + static float xdpi; + xdpi = 25.4 * WidthOfScreen(XtScreen(w)) / WidthMMOfScreen(XtScreen(w)); + value->addr = (XtPointer) &xdpi; +} + +static void +ComputeYdpi(w, offset, value) + Widget w; + int offset; + XrmValue *value; +{ + static float ydpi; + ydpi = 25.4 * HeightOfScreen(XtScreen(w)) / HeightMMOfScreen(XtScreen(w)); + value->addr = (XtPointer) &ydpi; +} + +/* Message action routine. + * Passes ghostscript message events back to application via + * the message callback. It also marks the interpreter as + * being not busy at the end of page, and stops the interpreter + * when it send a "done" message. + */ +static void +Message(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; /* unused */ + Cardinal *num_params; /* unused */ +{ + GhostviewWidget gvw = (GhostviewWidget) w; + GhostviewWidgetClass gvc = (GhostviewWidgetClass) XtClass(w); + + gvw->ghostview.mwin = event->xclient.data.l[0]; + if (event->xclient.message_type == + XmuInternAtom(XtDisplay(w), gvc->ghostview_class.page)) { + gvw->ghostview.busy = False; + XDefineCursor(XtDisplay(gvw), XtWindow(gvw), gvw->ghostview.cursor); + XtCallCallbackList(w, gvw->ghostview.message_callback, "Page"); + } else if (event->xclient.message_type == + XmuInternAtom(XtDisplay(w), gvc->ghostview_class.done)) { + StopInterpreter(w); + XtCallCallbackList(w, gvw->ghostview.message_callback, "Done"); + } +} + +/* Notify action routine. + * Calculates where the user clicked in the default user coordinate system. + * Call the callbacks with the point of click and size of zoom window + * requested. + */ +static void +Notify(w, event, params, num_params) + Widget w; + XEvent *event; + String *params; + Cardinal *num_params; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + GhostviewReturnStruct ret_val; + + /* notify takes zero to four parameters. The first two give the width and + * height of the zoom requested in the default user coordinate system. + * If they are omitted, a default value of 72 is provided. If the second + * parameter is omitted, the zoom area is assumed to be a square. + * The next two parameters give the desired resolution of the zoom window. + * If they are omitted, a default value of 300 is provided. If the four + * parameter is omitted, the y resolution is assumed to be equal to the + * x resolution. + */ + switch (*num_params) { + case 0: + ret_val.width = ret_val.height = 72; + ret_val.xdpi = ret_val.ydpi = 300; + break; + case 1: + ret_val.width = ret_val.height = atoi(params[0]); + ret_val.xdpi = ret_val.ydpi = 300; + break; + case 2: + ret_val.width = atoi(params[0]); + ret_val.height = atoi(params[1]); + ret_val.xdpi = ret_val.ydpi = 300; + break; + case 3: + ret_val.width = atoi(params[0]); + ret_val.height = atoi(params[1]); + ret_val.xdpi = ret_val.ydpi = atoi(params[2]); + break; + default: + ret_val.width = atoi(params[0]); + ret_val.height = atoi(params[1]); + ret_val.xdpi = atoi(params[2]); + ret_val.ydpi = atoi(params[3]); + break; + } + + switch (gvw->ghostview.orientation) { + case XtPageOrientationPortrait: + ret_val.psx = gvw->ghostview.llx + + event->xbutton.x * 72.0 / gvw->ghostview.xdpi; + ret_val.psy = gvw->ghostview.ury - + event->xbutton.y * 72.0 / gvw->ghostview.ydpi; + break; + case XtPageOrientationLandscape: + ret_val.psx = gvw->ghostview.llx + + event->xbutton.y * 72.0 / gvw->ghostview.ydpi; + ret_val.psy = gvw->ghostview.lly + + event->xbutton.x * 72.0 / gvw->ghostview.xdpi; + break; + case XtPageOrientationUpsideDown: + ret_val.psx = gvw->ghostview.urx - + event->xbutton.x * 72.0 / gvw->ghostview.xdpi; + ret_val.psy = gvw->ghostview.lly + + event->xbutton.y * 72.0 / gvw->ghostview.ydpi; + break; + case XtPageOrientationSeascape: + ret_val.psx = gvw->ghostview.urx - + event->xbutton.y * 72.0 / gvw->ghostview.ydpi; + ret_val.psy = gvw->ghostview.ury - + event->xbutton.x * 72.0 / gvw->ghostview.xdpi; + break; + } + XtCallCallbackList(w, gvw->ghostview.callback, (XtPointer) &ret_val); +} + +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif + +static Boolean broken_pipe = False; + +static SIGVAL +CatchPipe(i) + int i; +{ + broken_pipe = True; +#ifdef SIGNALRETURNSINT + return 0; +#endif +} + +#ifndef VMS + +/* Input - Feed data to ghostscript's stdin. + * Write bytes to ghostscript using non-blocking I/O. + * Also, pipe signals are caught during writing. The return + * values are checked and the appropriate action is taken. I do + * this at this low level, because it may not be appropriate for + * SIGPIPE to be caught for the overall application. + */ + +static void +Input(client_data, source, id) + XtPointer client_data; + int *source; + XtInputId *id; +{ + Widget w = (Widget) client_data; + GhostviewWidget gvw = (GhostviewWidget) w; + int bytes_written; + SIGVAL (*oldsig)(); + + oldsig = signal(SIGPIPE, CatchPipe); + +#ifdef NON_BLOCKING_IO + do { +#endif + + if (gvw->ghostview.buffer_bytes_left == 0) { + + /* Get a new section if required */ + if (gvw->ghostview.ps_input && gvw->ghostview.bytes_left == 0) { + struct record_list *ps_old = gvw->ghostview.ps_input; + gvw->ghostview.ps_input = ps_old->next; + if (ps_old->close) fclose(ps_old->fp); + XtFree((char *)ps_old); + } + + /* Have to seek at the beginning of each section */ + if (gvw->ghostview.ps_input && + gvw->ghostview.ps_input->seek_needed) { + if (gvw->ghostview.ps_input->len > 0) + fseek(gvw->ghostview.ps_input->fp, + gvw->ghostview.ps_input->begin, SEEK_SET); + gvw->ghostview.ps_input->seek_needed = False; + gvw->ghostview.bytes_left = gvw->ghostview.ps_input->len; + } + + if (gvw->ghostview.bytes_left > GV_BUFSIZ) { + gvw->ghostview.buffer_bytes_left = + fread(gvw->ghostview.input_buffer, + sizeof (char), GV_BUFSIZ, + gvw->ghostview.ps_input->fp); + } else if (gvw->ghostview.bytes_left > 0) { + gvw->ghostview.buffer_bytes_left = + fread(gvw->ghostview.input_buffer, + sizeof (char), gvw->ghostview.bytes_left, + gvw->ghostview.ps_input->fp); + } else { + gvw->ghostview.buffer_bytes_left = 0; + } + if (gvw->ghostview.bytes_left > 0 && + gvw->ghostview.buffer_bytes_left == 0) { + InterpreterFailed(w); /* Error occurred */ + } + gvw->ghostview.input_buffer_ptr = gvw->ghostview.input_buffer; + gvw->ghostview.bytes_left -= gvw->ghostview.buffer_bytes_left; + } + + if (gvw->ghostview.buffer_bytes_left > 0) { + bytes_written = write(gvw->ghostview.interpreter_input, + gvw->ghostview.input_buffer_ptr, + gvw->ghostview.buffer_bytes_left); + + if (broken_pipe) { + broken_pipe = False; + InterpreterFailed(w); /* Something bad happened */ + } else if (bytes_written == -1) { + if ((errno != EWOULDBLOCK) && (errno != EAGAIN)) { + InterpreterFailed(w); /* Something bad happened */ + } + } else { + gvw->ghostview.buffer_bytes_left -= bytes_written; + gvw->ghostview.input_buffer_ptr += bytes_written; + } + } +#ifdef NON_BLOCKING_IO + } while(gvw->ghostview.ps_input && + gvw->ghostview.buffer_bytes_left == 0); +#endif + signal(SIGPIPE, oldsig); + if (gvw->ghostview.ps_input == NULL && + gvw->ghostview.buffer_bytes_left == 0) { + if (gvw->ghostview.interpreter_input_id != None) { + XtRemoveInput(gvw->ghostview.interpreter_input_id); + gvw->ghostview.interpreter_input_id = None; + } + } +} + +/* Output - receive I/O from ghostscript's stdout and stderr. + * Pass this to the application via the output_callback. */ +static void +Output(client_data, source, id) + XtPointer client_data; + int *source; + XtInputId *id; +{ + Widget w = (Widget) client_data; + GhostviewWidget gvw = (GhostviewWidget) w; + char buf[GV_BUFSIZ+1]; + int bytes = 0; + + if (*source == gvw->ghostview.interpreter_output) { + bytes = read(gvw->ghostview.interpreter_output, buf, GV_BUFSIZ); + if (bytes == 0) { /* EOF occurred */ + close(gvw->ghostview.interpreter_output); + gvw->ghostview.interpreter_output = -1; + XtRemoveInput(gvw->ghostview.interpreter_output_id); + return; + } else if (bytes == -1) { + InterpreterFailed(w); /* Something bad happened */ + return; + } + } else if (*source == gvw->ghostview.interpreter_error) { + bytes = read(gvw->ghostview.interpreter_error, buf, GV_BUFSIZ); + if (bytes == 0) { /* EOF occurred */ + close(gvw->ghostview.interpreter_error); + gvw->ghostview.interpreter_error = -1; + XtRemoveInput(gvw->ghostview.interpreter_error_id); + return; + } else if (bytes == -1) { + InterpreterFailed(w); /* Something bad happened */ + return; + } + } + if (bytes > 0) { + buf[bytes] = '\0'; + pdf_process(buf); + if (*buf) { + XtCallCallbackList(w, gvw->ghostview.output_callback, (XtPointer) buf); + } + else { + bytes = 0; + } + } +} + +#endif /* VMS */ + +/* Register the type converter required for the PageOrientation. */ +/* Register the type converter required for the Palette. */ +/* This routine is called exactly once. */ +static void +ClassInitialize() +{ + XtSetTypeConverter(XtRString, XtRPageOrientation, + XmuCvtStringToPageOrientation, NULL, 0, + XtCacheAll, NULL); + XtSetTypeConverter(XtRString, XtRPalette, + XmuCvtStringToPalette, NULL, 0, + XtCacheAll, NULL); +} + +/* Get atoms needed to communicate with ghostscript. */ +/* This routine is called once per display. */ +static void +ClassPartInitialize(class) + WidgetClass class; +{ + GhostviewWidgetClass gvc = (GhostviewWidgetClass)class; + gvc->ghostview_class.ghostview = XmuMakeAtom("GHOSTVIEW"); + gvc->ghostview_class.gv_colors = XmuMakeAtom("GHOSTVIEW_COLORS"); + gvc->ghostview_class.next = XmuMakeAtom("NEXT"); + gvc->ghostview_class.page = XmuMakeAtom("PAGE"); + gvc->ghostview_class.done = XmuMakeAtom("DONE"); +} + +/* Initialize private state. */ + +static void +Initialize(request, new, args, num_args) + Widget request, new; + ArgList args; /* unused */ + Cardinal *num_args; /* unused */ +{ + XGCValues values; + XtGCMask mask; + GhostviewWidget ngvw = (GhostviewWidget) new; + GhostviewWidget rgvw = (GhostviewWidget) request; + + values.foreground = new->core.background_pixel; + mask = GCForeground; + ngvw->ghostview.gc = XtGetGC(new, mask, &values); + ngvw->ghostview.mwin = None; + ngvw->ghostview.disable_start = False; + ngvw->ghostview.interpreter_pid = -1; + ngvw->ghostview.input_buffer = NULL; + ngvw->ghostview.bytes_left = 0; +#ifndef VMS + ngvw->ghostview.input_buffer_ptr = NULL; + ngvw->ghostview.buffer_bytes_left = 0; +#endif + ngvw->ghostview.ps_input = NULL; + ngvw->ghostview.interpreter_input = -1; + ngvw->ghostview.interpreter_output = -1; +#ifndef VMS + ngvw->ghostview.interpreter_error = -1; + ngvw->ghostview.interpreter_input_id = None; + ngvw->ghostview.interpreter_output_id = None; + ngvw->ghostview.interpreter_error_id = None; +#else /* VMS */ + memset(ngvw->ghostview.interpreter_input_iosb, 0, 8); + memset(ngvw->ghostview.interpreter_output_iosb, 0, 8); + ngvw->ghostview.output_buffer = NULL; +#endif /* VMS */ + ngvw->ghostview.gs_width = 0; + ngvw->ghostview.gs_height = 0; + ngvw->ghostview.changed = False; + ngvw->ghostview.busy = False; + + /* Compute window size */ + Layout(new, (rgvw->core.width == 0), (rgvw->core.height == 0)); +} + +/* Create Window and start interpreter if needed */ +static void +Realize(w, valueMask, attributes) + Widget w; + Mask *valueMask; + XSetWindowAttributes *attributes; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + + if (gvw->ghostview.cursor != None) { + attributes->cursor = gvw->ghostview.cursor; + *valueMask |= CWCursor; + } + + XtCreateWindow(w, (unsigned int) InputOutput, (Visual *) CopyFromParent, + *valueMask, attributes); + + Setup(w); +} + +/* Destroy routine: kill the interpreter and release the GC */ +static void +Destroy(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + + StopInterpreter(w); + XtReleaseGC(w, gvw->ghostview.gc); + if (gvw->ghostview.input_buffer) XtFree(gvw->ghostview.input_buffer); +#ifdef VMS + if (gvw->ghostview.output_buffer) XtFree(gvw->ghostview.output_buffer); +#endif /* VMS */ + if (gvw->core.background_pixmap != XtUnspecifiedPixmap) + XFreePixmap(XtDisplay(w), gvw->core.background_pixmap); +} + +/* Process resize request. Requested size cannot be changed. + * NOTE: This routine may be called before the widget is realized. + * (It was a surprise to me.) + * If the widget is realized, start a new interpreter by calling Setup(). + * If Setup() actually started a new interpreter and it is taking input + * from stdin, send a refresh message to the application. This is the + * only way that the application can be notified that it needs to resend + * the input because someone forced a new window size on the widget. + */ +static void +Resize(w) + Widget w; +{ + Layout(w, False, False); + if (!XtIsRealized(w)) return; + if (Setup(w)) { + GhostviewWidget gvw = (GhostviewWidget) w; + if (gvw->ghostview.filename == NULL) { + XtCallCallbackList(w, gvw->ghostview.message_callback, "Refresh"); + } + } +} + +/* SetValues routine. Set new private state, based on changed values + * in the widget. Always returns False, because redisplay is never needed. + */ +static Boolean +SetValues(current, request, new) + Widget current, request, new; +{ + GhostviewWidget cgvw = (GhostviewWidget) current; + GhostviewWidget rgvw = (GhostviewWidget) request; + GhostviewWidget ngvw = (GhostviewWidget) new; + String cfilename; + String rfilename; + String carguments; + String rarguments; + + cfilename = cgvw->ghostview.filename; + if (cfilename == NULL) cfilename = "(null)"; + rfilename = rgvw->ghostview.filename; + if (rfilename == NULL) rfilename = "(null)"; + carguments = cgvw->ghostview.arguments; + if (carguments == NULL) carguments = "(null)"; + rarguments = rgvw->ghostview.arguments; + if (rarguments == NULL) rarguments = "(null)"; + + if (XtIsRealized(new) && !ngvw->ghostview.busy && + (cgvw->ghostview.cursor != ngvw->ghostview.cursor)) { + XDefineCursor(XtDisplay(new), XtWindow(new), ngvw->ghostview.cursor); + } + if (XtIsRealized(new) && ngvw->ghostview.busy && + (cgvw->ghostview.busy_cursor != ngvw->ghostview.busy_cursor)) { + XDefineCursor(XtDisplay(new), XtWindow(new), + ngvw->ghostview.busy_cursor); + } + if (cgvw->core.background_pixel != rgvw->core.background_pixel) { + XGCValues values; + XtGCMask mask; + + XtReleaseGC(current, cgvw->ghostview.gc); + values.foreground = new->core.background_pixel; + mask = GCForeground; + ngvw->ghostview.gc = XtGetGC(new, mask, &values); + } + if ((cgvw->core.width != rgvw->core.width) || + (cgvw->core.height != rgvw->core.height) || + (cgvw->core.background_pixel != rgvw->core.background_pixel) || + (cgvw->ghostview.foreground != rgvw->ghostview.foreground) || + (cgvw->ghostview.palette != rgvw->ghostview.palette) || + strcmp(cgvw->ghostview.interpreter, rgvw->ghostview.interpreter) || + strcmp(carguments, rarguments) || + (cgvw->ghostview.quiet != rgvw->ghostview.quiet) || + (cgvw->ghostview.safer != rgvw->ghostview.safer) || + strcmp(cfilename, rfilename) || + (cgvw->ghostview.orientation != rgvw->ghostview.orientation) || + (cgvw->ghostview.use_bpixmap != rgvw->ghostview.use_bpixmap) || + (cgvw->ghostview.xdpi != rgvw->ghostview.xdpi) || + (cgvw->ghostview.ydpi != rgvw->ghostview.ydpi) || + (cgvw->ghostview.bottom_margin != rgvw->ghostview.bottom_margin) || + (cgvw->ghostview.left_margin != rgvw->ghostview.left_margin) || + (cgvw->ghostview.right_margin != rgvw->ghostview.right_margin) || + (cgvw->ghostview.top_margin != rgvw->ghostview.top_margin) || + (cgvw->ghostview.llx != rgvw->ghostview.llx) || + (cgvw->ghostview.lly != rgvw->ghostview.lly) || + (cgvw->ghostview.urx != rgvw->ghostview.urx) || + (cgvw->ghostview.ury != rgvw->ghostview.ury)) { + + ngvw->ghostview.changed = True; + Layout(new, True, True); + } + + if (ngvw->ghostview.changed && XtIsRealized(current)) Setup(new); + return(False); +} + +/* Function Name: QueryGeometry + * Description: This tells the parent what size we would like to be + * given certain constraints. + * Arguments: w - the widget. + * intended - what the parent intends to do with us. + * requested - what we want to happen. + */ + +static XtGeometryResult +QueryGeometry(w, intended, requested) +Widget w; +XtWidgetGeometry *intended, *requested; +{ + Dimension new_width, new_height; + Boolean change, width_req, height_req; + + width_req = intended->request_mode & CWWidth; + height_req = intended->request_mode & CWHeight; + + if (width_req) + new_width = intended->width; + else + new_width = w->core.width; + + if (height_req) + new_height = intended->height; + else + new_height = w->core.height; + + requested->request_mode = 0; + +/* + * We only care about our height and width. + */ + + if (!width_req && !height_req) + return(XtGeometryYes); + + change = ComputeSize(w, !width_req, !height_req, &new_width, &new_height); + + requested->request_mode |= CWWidth; + requested->width = new_width; + requested->request_mode |= CWHeight; + requested->height = new_height; + + if (change) + return(XtGeometryAlmost); + return(XtGeometryYes); +} + +/* Layout the widget. */ + +static void +Layout(w, xfree, yfree) + Widget w; + Boolean xfree, yfree; +{ + Dimension width = w->core.width; + Dimension height = w->core.height; + Boolean different_size = ComputeSize(w, xfree, yfree, &width, &height); + if (different_size) ChangeSize(w, width, height); +} + +/* Compute new size of window, sets xdpi and ydpi if necessary. + * returns True if new window size is different */ +static Boolean +ComputeSize(w, xfree, yfree, width, height) + Widget w; + Boolean xfree, yfree; /* Am I allowed to change width or height */ + Dimension *width, *height; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + Dimension new_width = *width; + Dimension new_height = *height; + float newxdpi, newydpi; + Boolean change; + + if (xfree && yfree) { + /* width and height can be changed, calculate window size according */ + /* to xpdi and ydpi */ + switch (gvw->ghostview.orientation) { + case XtPageOrientationPortrait: + case XtPageOrientationUpsideDown: + new_width = (gvw->ghostview.urx - gvw->ghostview.llx) / 72.0 * + gvw->ghostview.xdpi + 0.5; + new_height = (gvw->ghostview.ury - gvw->ghostview.lly) / 72.0 * + gvw->ghostview.ydpi + 0.5; + break; + case XtPageOrientationLandscape: + case XtPageOrientationSeascape: + new_width = (gvw->ghostview.ury - gvw->ghostview.lly) / 72.0 * + gvw->ghostview.xdpi + 0.5; + new_height = (gvw->ghostview.urx - gvw->ghostview.llx) / 72.0 * + gvw->ghostview.ydpi + 0.5; + break; + } + } else if (xfree) { + /* height is fixed. Preserve aspect ratio by recomputing */ + /* ydpi and xdpi */ + switch (gvw->ghostview.orientation) { + case XtPageOrientationPortrait: + case XtPageOrientationUpsideDown: + newydpi = gvw->core.height * 72.0 / + (gvw->ghostview.ury - gvw->ghostview.lly); + newxdpi = newydpi * gvw->ghostview.xdpi / gvw->ghostview.ydpi; + gvw->ghostview.xdpi = newxdpi; + gvw->ghostview.ydpi = newydpi; + new_width = (gvw->ghostview.urx - gvw->ghostview.llx) / 72.0 * + gvw->ghostview.xdpi + 0.5; + break; + case XtPageOrientationLandscape: + case XtPageOrientationSeascape: + newydpi = gvw->core.height * 72.0 / + (gvw->ghostview.urx - gvw->ghostview.llx); + newxdpi = newydpi * gvw->ghostview.xdpi / gvw->ghostview.ydpi; + gvw->ghostview.xdpi = newxdpi; + gvw->ghostview.ydpi = newydpi; + new_width = (gvw->ghostview.ury - gvw->ghostview.lly) / 72.0 * + gvw->ghostview.xdpi + 0.5; + break; + } + } else if (yfree) { + /* width is fixed. Preserve aspect ratio by recomputing */ + /* xdpi and ydpi */ + switch (gvw->ghostview.orientation) { + case XtPageOrientationPortrait: + case XtPageOrientationUpsideDown: + newxdpi = gvw->core.width * 72.0 / + (gvw->ghostview.urx - gvw->ghostview.llx); + newydpi = newxdpi * gvw->ghostview.ydpi / gvw->ghostview.xdpi; + gvw->ghostview.xdpi = newxdpi; + gvw->ghostview.ydpi = newydpi; + new_height = (gvw->ghostview.ury - gvw->ghostview.lly) / 72.0 * + gvw->ghostview.ydpi + 0.5; + break; + case XtPageOrientationLandscape: + case XtPageOrientationSeascape: + newxdpi = gvw->core.width * 72.0 / + (gvw->ghostview.ury - gvw->ghostview.lly); + newydpi = newxdpi * gvw->ghostview.ydpi / gvw->ghostview.xdpi; + gvw->ghostview.xdpi = newxdpi; + gvw->ghostview.ydpi = newydpi; + new_height = (gvw->ghostview.urx - gvw->ghostview.llx) / 72.0 * + gvw->ghostview.ydpi + 0.5; + break; + } + } else { + /* height and width are fixed. Just have to live with it. */ + switch (gvw->ghostview.orientation) { + case XtPageOrientationPortrait: + case XtPageOrientationUpsideDown: + gvw->ghostview.xdpi = gvw->core.width * 72.0 / + (gvw->ghostview.urx - gvw->ghostview.llx); + gvw->ghostview.ydpi = gvw->core.height * 72.0 / + (gvw->ghostview.ury - gvw->ghostview.lly); + break; + case XtPageOrientationLandscape: + case XtPageOrientationSeascape: + gvw->ghostview.xdpi = gvw->core.width * 72.0 / + (gvw->ghostview.ury - gvw->ghostview.lly); + gvw->ghostview.ydpi = gvw->core.height * 72.0 / + (gvw->ghostview.urx - gvw->ghostview.llx); + break; + } + } + + change = (new_width != *width) || (new_height != *height); + *width = new_width; + *height = new_height; + return (change); +} + +/* Function Name: ChangeSize. + * Description: Request a size change. + * Arguments: w - the widget to try change the size of. + */ + +static void +ChangeSize(w, width, height) +Widget w; +Dimension width, height; +{ + XtWidgetGeometry request, reply; + Boolean changed = False; + + request.request_mode = CWWidth | CWHeight; + request.width = width; + request.height = height; + + switch ( XtMakeGeometryRequest(w, &request, &reply) ) { + case XtGeometryYes: + changed = True; + break; + case XtGeometryNo: + break; + case XtGeometryAlmost: + ComputeSize(w, (request.height != reply.height), + (request.width != reply.width), + &(reply.width), &(reply.height)); + request = reply; + switch (XtMakeGeometryRequest(w, &request, &reply) ) { + case XtGeometryYes: + changed = True; + break; + case XtGeometryNo: + break; + case XtGeometryAlmost: + request = reply; + ComputeSize(w, FALSE, FALSE, &(request.width), &(request.height)); + request.request_mode = CWWidth | CWHeight; + XtMakeGeometryRequest(w, &request, &reply); + changed = True; + break; + } + break; + } + + /* If success, setup the widet for the new size. */ + if (changed && XtIsRealized(w)) Setup(w); +} + +/* Catch the alloc error when there is not enough resources for the + * backing pixmap. Automatically shut off backing pixmap and let the + * user know when this happens. + */ +static Boolean alloc_error; +static XErrorHandler oldhandler; + +static int +catch_alloc (dpy, err) +Display *dpy; +XErrorEvent *err; +{ + if (err->error_code == BadAlloc) { + alloc_error = True; + } + if (alloc_error) return 0; + return oldhandler(dpy, err); +} + +/* Setup - sets up the backing pixmap, and GHOSTVIEW property and + * starts interpreter if needed. + * NOTE: the widget must be realized before calling Setup(). + * Returns True if a new interpreter was started, False otherwise. + */ + +static Boolean +Setup(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + GhostviewWidgetClass gvc = (GhostviewWidgetClass) XtClass(w); + char buf[GV_BUFSIZ]; + Pixmap bpixmap; + XSetWindowAttributes xswa; + + if (!gvw->ghostview.changed && + (gvw->core.width == gvw->ghostview.gs_width) && + (gvw->core.height == gvw->ghostview.gs_height)) return False; + + StopInterpreter(w); + + if ((gvw->core.width != gvw->ghostview.gs_width) || + (gvw->core.height != gvw->ghostview.gs_height) || + (!gvw->ghostview.use_bpixmap)) { + if (gvw->core.background_pixmap != XtUnspecifiedPixmap) { + XFreePixmap(XtDisplay(w), gvw->core.background_pixmap); + gvw->core.background_pixmap = XtUnspecifiedPixmap; + XSetWindowBackgroundPixmap(XtDisplay(w), XtWindow(w), None); + } + } + + if (gvw->ghostview.use_bpixmap) { + if (gvw->core.background_pixmap == XtUnspecifiedPixmap) { + /* Get a Backing Pixmap, but be ready for the BadAlloc. */ + XSync(XtDisplay(w), False); /* Get to known state */ + oldhandler = XSetErrorHandler(catch_alloc); + alloc_error = False; + bpixmap = XCreatePixmap(XtDisplay(w), XtWindow(w), + gvw->core.width, gvw->core.height, + gvw->core.depth); + XSync(XtDisplay(w), False); /* Force the error */ + if (alloc_error) { + XtCallCallbackList(w, gvw->ghostview.message_callback, + "BadAlloc"); + if (bpixmap != None) { + XFreePixmap(XtDisplay(w), bpixmap); + XSync(XtDisplay(w), False); /* Force the error */ + bpixmap = None; + } + } + oldhandler = XSetErrorHandler(oldhandler); + if (bpixmap != None) { + gvw->core.background_pixmap = bpixmap; + XSetWindowBackgroundPixmap(XtDisplay(w), XtWindow(w), + gvw->core.background_pixmap); + } + } else { + bpixmap = gvw->core.background_pixmap; + } + } else { + if (gvw->core.background_pixmap != XtUnspecifiedPixmap) { + XFreePixmap(XtDisplay(w), gvw->core.background_pixmap); + gvw->core.background_pixmap = XtUnspecifiedPixmap; + XSetWindowBackgroundPixmap(XtDisplay(w), XtWindow(w), None); + } + bpixmap = None; + } + + if (bpixmap != None) { + xswa.backing_store = NotUseful; + XChangeWindowAttributes(XtDisplay(w), XtWindow(w), + CWBackingStore, &xswa); + } else { + xswa.backing_store = Always; + XChangeWindowAttributes(XtDisplay(w), XtWindow(w), + CWBackingStore, &xswa); + } + + gvw->ghostview.gs_width = gvw->core.width; + gvw->ghostview.gs_height = gvw->core.height; + + sprintf(buf, "%d %d %d %d %d %d %g %g %d %d %d %d", + bpixmap, gvw->ghostview.orientation, + gvw->ghostview.llx, gvw->ghostview.lly, + gvw->ghostview.urx, gvw->ghostview.ury, + gvw->ghostview.xdpi, gvw->ghostview.ydpi, + gvw->ghostview.left_margin, gvw->ghostview.bottom_margin, + gvw->ghostview.right_margin, gvw->ghostview.top_margin); + XChangeProperty(XtDisplay(w), XtWindow(w), + XmuInternAtom(XtDisplay(w), gvc->ghostview_class.ghostview), + XA_STRING, 8, PropModeReplace, + (unsigned char *)buf, strlen(buf)); + + sprintf(buf, "%s %d %d", + gvw->ghostview.palette == XtPaletteMonochrome ? "Monochrome" : + gvw->ghostview.palette == XtPaletteGrayscale ? "Grayscale" : + gvw->ghostview.palette == XtPaletteColor ? "Color" : "?", + gvw->ghostview.foreground, gvw->core.background_pixel); + XChangeProperty(XtDisplay(w), XtWindow(w), + XmuInternAtom(XtDisplay(w), gvc->ghostview_class.gv_colors), + XA_STRING, 8, PropModeReplace, + (unsigned char *)buf, strlen(buf)); + + XSync(XtDisplay(w), False); /* Be sure to update properties */ + StartInterpreter(w); + return True; +} + +#ifndef VMS + +/* This routine starts the interpreter. It sets the DISPLAY and + * GHOSTVIEW environment variables. The GHOSTVIEW environment variable + * contains the Window that ghostscript should write on. + * + * This routine also opens pipes for stdout and stderr and initializes + * application input events for them. If input to ghostscript is not + * from a file, a pipe for stdin is created. This pipe is setup for + * non-blocking I/O so that the user interface never "hangs" because of + * a write to ghostscript. + */ +static void +StartInterpreter(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + int std_in[2]; + int std_out[2]; + int std_err[2]; + char buf[GV_BUFSIZ]; +#define NUM_ARGS 100 + char *argv[NUM_ARGS]; + char *arguments = NULL; + char *cptr; + int argc = 0; + int ret; + + StopInterpreter(w); + + /* Clear the window before starting a new interpreter. */ + if (gvw->core.background_pixmap != XtUnspecifiedPixmap) { + XFillRectangle(XtDisplay(w), gvw->core.background_pixmap, + gvw->ghostview.gc, + 0, 0, gvw->core.width, gvw->core.height); + } + XClearArea(XtDisplay(w), XtWindow(w), + 0, 0, gvw->core.width, gvw->core.height, False); + + if (gvw->ghostview.disable_start) return; + + argv[argc++] = gvw->ghostview.interpreter; + argv[argc++] = "-sDEVICE=x11"; + argv[argc++] = "-dNOPAUSE"; + if (gvw->ghostview.quiet) argv[argc++] = "-dQUIET"; + if (gvw->ghostview.safer) argv[argc++] = "-dSAFER"; + argv[argc++] = "gvpdf.pro"; + if (gvw->ghostview.arguments) { + cptr = arguments = XtNewString(gvw->ghostview.arguments); + while (isspace(*cptr)) cptr++; + while (*cptr) { + argv[argc++] = cptr; + while (*cptr && !isspace(*cptr)) cptr++; + if (*cptr) *cptr++ = '\0'; + if (argc + 2 >= NUM_ARGS) { + fprintf(stderr, "Too many arguments to interpreter.\n"); + exit(1); + } + while (isspace(*cptr)) cptr++; + } + } + argv[argc++] = "-"; + argv[argc++] = NULL; + + if (gvw->ghostview.filename == NULL) { + ret = pipe(std_in); + if (ret == -1) { + perror("Could not create pipe"); + exit(1); + } + } else if (strcmp(gvw->ghostview.filename, "-")) { + std_in[0] = open(gvw->ghostview.filename, O_RDONLY, 0); + } + ret = pipe(std_out); + if (ret == -1) { + perror("Could not create pipe"); + exit(1); + } + ret = pipe(std_err); + if (ret == -1) { + perror("Could not create pipe"); + exit(1); + } + + gvw->ghostview.changed = False; + gvw->ghostview.busy = True; + XDefineCursor(XtDisplay(gvw), XtWindow(gvw), gvw->ghostview.busy_cursor); +#if defined(SYSV) || defined(USG) +#define vfork fork +#endif + gvw->ghostview.interpreter_pid = vfork(); + + if (gvw->ghostview.interpreter_pid == 0) { /* child */ + close(std_out[0]); + close(std_err[0]); + dup2(std_out[1], 1); + close(std_out[1]); + dup2(std_err[1], 2); + close(std_err[1]); + sprintf(buf, "%d", XtWindow(w)); + setenv("GHOSTVIEW", buf, True); + setenv("DISPLAY", XDisplayString(XtDisplay(w)), True); + if (gvw->ghostview.filename == NULL) { + close(std_in[1]); + dup2(std_in[0], 0); + close(std_in[0]); + } else if (strcmp(gvw->ghostview.filename, "-")) { + dup2(std_in[0], 0); + close(std_in[0]); + } + execvp(argv[0], argv); + sprintf(buf, "Exec of %s failed", argv[0]); + perror(buf); + _exit(1); + } else { + if (gvw->ghostview.filename == NULL) { +#ifdef NON_BLOCKING_IO + int result; +#endif + close(std_in[0]); + +#ifdef NON_BLOCKING_IO + result = fcntl(std_in[1], F_GETFL, 0); + result = result | O_NONBLOCK; + result = fcntl(std_in[1], F_SETFL, result); +#endif + gvw->ghostview.interpreter_input = std_in[1]; + gvw->ghostview.interpreter_input_id = None; + } else if (strcmp(gvw->ghostview.filename, "-")) { + close(std_in[0]); + } + close(std_out[1]); + gvw->ghostview.interpreter_output = std_out[0]; + gvw->ghostview.interpreter_output_id = + XtAppAddInput(XtWidgetToApplicationContext(w), std_out[0], + (XtPointer)XtInputReadMask, Output, (XtPointer)w); + close(std_err[1]); + gvw->ghostview.interpreter_error = std_err[0]; + gvw->ghostview.interpreter_error_id = + XtAppAddInput(XtWidgetToApplicationContext(w), std_err[0], + (XtPointer)XtInputReadMask, Output, (XtPointer)w); + } + if (arguments) XtFree(arguments); +} + +/* Stop the interperter, if present, and remove any Input sources. */ +/* Also reset the busy state. */ +static void +StopInterpreter(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + if (gvw->ghostview.interpreter_pid >= 0) { + kill(gvw->ghostview.interpreter_pid, SIGTERM); + wait(0); + gvw->ghostview.interpreter_pid = -1; + } + if (gvw->ghostview.interpreter_input >= 0) { + close(gvw->ghostview.interpreter_input); + gvw->ghostview.interpreter_input = -1; + if (gvw->ghostview.interpreter_input_id != None) { + XtRemoveInput(gvw->ghostview.interpreter_input_id); + gvw->ghostview.interpreter_input_id = None; + } + while (gvw->ghostview.ps_input) { + struct record_list *ps_old = gvw->ghostview.ps_input; + gvw->ghostview.ps_input = ps_old->next; + if (ps_old->close) fclose(ps_old->fp); + XtFree((char *)ps_old); + } + } + if (gvw->ghostview.interpreter_output >= 0) { + close(gvw->ghostview.interpreter_output); + gvw->ghostview.interpreter_output = -1; + XtRemoveInput(gvw->ghostview.interpreter_output_id); + } + if (gvw->ghostview.interpreter_error >= 0) { + close(gvw->ghostview.interpreter_error); + gvw->ghostview.interpreter_error = -1; + XtRemoveInput(gvw->ghostview.interpreter_error_id); + } + gvw->ghostview.busy = False; + XDefineCursor(XtDisplay(gvw), XtWindow(gvw), gvw->ghostview.cursor); +} + +#endif /* VMS */ + +/* The interpeter failed, Stop what's left and notify application */ +static void +InterpreterFailed(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + StopInterpreter(w); + XtCallCallbackList(w, gvw->ghostview.message_callback, "Failed"); +} + +/* + * Public Routines + */ + +/* GhostviewDisableInterpreter: + * Stop any interpreter and disable new ones from starting. + */ +void +GhostviewDisableInterpreter(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + gvw->ghostview.disable_start = True; + if (XtIsRealized(w)) StopInterpreter(w); +} + +/* GhostviewDisableInterpreter: + * Allow an interpreter to start and start one if the widget is + * currently realized. + */ +void +GhostviewEnableInterpreter(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + gvw->ghostview.disable_start = False; + if (XtIsRealized(w)) StartInterpreter(w); +} + +/* GhostviewIsInterpreterReady: + * Returns True if the interpreter is ready for new input. + */ +Boolean +GhostviewIsInterpreterReady(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + return gvw->ghostview.interpreter_pid != -1 && + !gvw->ghostview.busy && + gvw->ghostview.ps_input == NULL; +} + +/* GhostviewIsInterpreterRunning: + * Returns True if the interpreter is running. + */ +Boolean +GhostviewIsInterpreterRunning(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + return gvw->ghostview.interpreter_pid != -1; +} + +/* GhostviewGetBackingPixmap: + * Returns the current backing pixmap. + */ +Pixmap +GhostviewGetBackingPixmap(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + if (gvw->core.background_pixmap != XtUnspecifiedPixmap) + return(gvw->core.background_pixmap); + else + return(None); +} + +#ifndef VMS + +/* GhostviewSendPS: + * Queue a portion of a PostScript file for output to ghostscript. + * fp: FILE * of the file in question. NOTE: if you have several + * Ghostview widgets reading from the same file. You must open + * a unique FILE * for each widget. + * SendPS does not actually send the PostScript, it merely queues it + * for output. + * begin: position in file (returned from ftell()) to start. + * len: number of bytes to write. + * + * If an interpreter is not running, nothing is queued and + * False is returned. + */ +Boolean +GhostviewSendPS(w, fp, begin, len, close) + Widget w; + FILE *fp; + long begin; + unsigned int len; + Bool close; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + struct record_list *ps_new; + + if (gvw->ghostview.interpreter_input < 0) return False; + ps_new = (struct record_list *) XtMalloc(sizeof (struct record_list)); + ps_new->fp = fp; + ps_new->begin = begin; + ps_new->len = len; + ps_new->seek_needed = True; + ps_new->close = close; + ps_new->next = NULL; + + if (gvw->ghostview.input_buffer == NULL) { + gvw->ghostview.input_buffer = XtMalloc(GV_BUFSIZ); + } + + if (gvw->ghostview.ps_input == NULL) { + gvw->ghostview.input_buffer_ptr = gvw->ghostview.input_buffer; + gvw->ghostview.bytes_left = len; + gvw->ghostview.buffer_bytes_left = 0; + gvw->ghostview.ps_input = ps_new; + gvw->ghostview.interpreter_input_id = + XtAppAddInput(XtWidgetToApplicationContext(w), + gvw->ghostview.interpreter_input, + (XtPointer)XtInputWriteMask, Input, (XtPointer)w); + } else { + struct record_list *p = gvw->ghostview.ps_input; + while (p->next != NULL) { + p = p->next; + } + p->next = ps_new; + } + return True; +} + +#endif /* VMS */ + +/* GhostviewNextPage: + * Tell ghostscript to start the next page. + * Returns False if ghostscript is not running, or not ready to start + * another page. + * If another page is started. Sets the busy flag and cursor. + */ +Boolean +GhostviewNextPage(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + GhostviewWidgetClass gvc = (GhostviewWidgetClass) XtClass(w); + XEvent event; + + if (gvw->ghostview.interpreter_pid < 0) return False; + if (gvw->ghostview.mwin == None) return False; + + if (!gvw->ghostview.busy) { + gvw->ghostview.busy = True; + XDefineCursor(XtDisplay(gvw), XtWindow(gvw), + gvw->ghostview.busy_cursor); + + event.xclient.type = ClientMessage; + event.xclient.display = XtDisplay(w); + event.xclient.window = gvw->ghostview.mwin; + event.xclient.message_type = + XmuInternAtom(XtDisplay(w), gvc->ghostview_class.next); + event.xclient.format = 32; + XSendEvent(XtDisplay(w), gvw->ghostview.mwin, False, 0, &event); + XFlush(XtDisplay(w)); /* And push it out */ + return True; + } else { + return False; + } +} + +#define done(type, value) \ + { \ + if (toVal->addr != NULL) { \ + if (toVal->size < sizeof(type)) { \ + toVal->size = sizeof(type); \ + return False; \ + } \ + *(type*)(toVal->addr) = (value); \ + } \ + else { \ + static type static_val; \ + static_val = (value); \ + toVal->addr = (XPointer)&static_val; \ + } \ + toVal->size = sizeof(type); \ + return True; \ + } + +/* PageOrienation Conversion Routine. + * Returns True if Conversion is successful. + */ +Boolean +XmuCvtStringToPageOrientation(dpy, args, num_args, fromVal, toVal, data) + Display *dpy; + XrmValue *args; /* unused */ + Cardinal *num_args; /* unused */ + XrmValue *fromVal; + XrmValue *toVal; + XtPointer *data; /* unused */ +{ + static XrmQuark XrmQEportrait; + static XrmQuark XrmQElandscape; + static XrmQuark XrmQEupsideDown; + static XrmQuark XrmQEseascape; + static int haveQuarks; + XrmQuark q; + char *str = (XPointer) fromVal->addr; + char lowerName[1000]; + + if (str == NULL) return False; + + if (!haveQuarks) { + XrmQEportrait = XrmStringToQuark(XtEportrait); + XrmQElandscape = XrmStringToQuark(XtElandscape); + XrmQEupsideDown = XrmStringToQuark(XtEupsideDown); + XrmQEseascape = XrmStringToQuark(XtEseascape); + haveQuarks = 1; + } + + XmuCopyISOLatin1Lowered(lowerName, str); + + q = XrmStringToQuark(lowerName); + + if (q == XrmQEportrait) + done(XtPageOrientation, XtPageOrientationPortrait); + if (q == XrmQElandscape) + done(XtPageOrientation, XtPageOrientationLandscape); + if (q == XrmQEupsideDown) + done(XtPageOrientation, XtPageOrientationUpsideDown); + if (q == XrmQEseascape) + done(XtPageOrientation, XtPageOrientationSeascape); + + XtDisplayStringConversionWarning(dpy, str, XtRPageOrientation); + return False; +} + +/* Palette Conversion Routine. + * Returns True if Conversion is successful. + */ +Boolean +XmuCvtStringToPalette(dpy, args, num_args, fromVal, toVal, data) + Display *dpy; + XrmValue *args; /* unused */ + Cardinal *num_args; /* unused */ + XrmValue *fromVal; + XrmValue *toVal; + XtPointer *data; /* unused */ +{ + static XrmQuark XrmQEmonochrome; + static XrmQuark XrmQEgrayscale; + static XrmQuark XrmQEcolor; + static int haveQuarks; + XrmQuark q; + char *str = (XPointer) fromVal->addr; + char lowerName[1000]; + + if (str == NULL) return False; + + if (!haveQuarks) { + XrmQEmonochrome = XrmStringToQuark(XtEmonochrome); + XrmQEgrayscale = XrmStringToQuark(XtEgrayscale); + XrmQEcolor = XrmStringToQuark(XtEcolor); + haveQuarks = 1; + } + + XmuCopyISOLatin1Lowered(lowerName, str); + + q = XrmStringToQuark(lowerName); + + if (q == XrmQEmonochrome) + done(XtPalette, XtPaletteMonochrome); + if (q == XrmQEgrayscale) + done(XtPalette, XtPaletteGrayscale); + if (q == XrmQEcolor) + done(XtPalette, XtPaletteColor); + + XtDisplayStringConversionWarning(dpy, str, XtRPalette); + return False; +} + +#ifdef VMS + +/* +** VMS specific include files +*/ +#include +#include +#include +#include +#include +#include +#include "vms_types.h" + +#define ERR_SIGNAL(s) if(!((s) & 1))lib$signal((s), 0, 0) +#define XtEFN 23 + +struct g_l_i +{ + GhostviewWidget w; + struct g_l_i *next; +}; + +typedef struct g_l_i GhostListItem, *GLI_p; + +static GhostListItem glhead = {(GhostviewWidget) -1, NULL}; +static GLI_p GL = &glhead; +static size_t GLI_Size = sizeof(GhostListItem); +static XtInputId EventId; + +/* +** This routine is passed to XtAppAddInput(). It is called whenever the event +** flag number XtEFN is set and the Xt main loop becomes idle. It clears the +** event flag and then scans all the ghostview widgets for completed I/O +** requests, processing each as they are found. We have to do them all because +** there is no way to have Xt dispatch them individually without a window of +** vulnerability that can cause missed events, or by using a separate event +** flag for each I/O stream. Event flags are, unfortunately, a limited +** resource. +*/ +static Boolean +IOProcess() +{ + GhostviewWidget gvw; + GLI_p cur; + + /* + ** Before we process any I/O's, clear the event flag. + */ + sys$clref(XtEFN); + /* + ** Scan all the ghostview widgets and check for completed I/O's + */ + for(cur = GL->next; cur; cur = cur->next){ + /* + ** Get the widget and check for I/O complete on either mailbox. + */ + gvw = cur->w; + if(gvw->ghostview.interpreter_input_iosb[0])Input(gvw); + if(gvw->ghostview.interpreter_output_iosb[0])Output(gvw); + } +} + +/* +** This is an AST routine. It is called asynchronously whenever one of our +** mailbox I/O's completes. +*/ +static void +IOComplete(client_data) + XtPointer client_data; +{ + /* + ** Set the event flag to tell Xt to call IOProcess. + */ + sys$setef(XtEFN); +} + +static void +GLInsert(w) + GhostviewWidget w; +{ + GLI_p new; + int first; + + /* + ** Insert this widget after the list head + */ + first = (GL->next == NULL); + new = XtMalloc(GLI_Size); + new->w = w; + new->next = GL->next; + GL->next = new; + /* + ** If this is the first item on the list, call XtAppAddInput() + */ + if(first)EventId = XtAppAddInput(XtWidgetToApplicationContext(w), XtEFN, 0, + IOProcess, 0); +} + +static void +GLRemove(w) + GhostviewWidget w; +{ + GLI_p prev, cur; + int last = 0; + + /* + ** Find and remove this widget from the list. + */ + prev = GL; + cur = prev->next; + while(cur && cur->w != w){ + prev = cur; + cur = cur->next; + } + if(cur){ + prev->next = cur->next; + XtFree(cur); + last = (GL->next == NULL); + } + /* + ** If this was the last item on the list, call XtRemoveInput() + */ + if(last)XtRemoveInput(EventId); +} + +/* Input - Feed data to ghostscript's stdin. + * Write bytes to ghostscript using non-blocking I/O. + * Also, pipe signals are caught during writing. The return + * values are checked and the appropriate action is taken. I do + * this at this low level, because it may not be appropriate for + * SIGPIPE to be caught for the overall application. + */ + +static void +Input(gvw) + GhostviewWidget gvw; +{ + int stat, bbytes; + char *ch; + + /* + ** Check for error on previous I/O. + */ + stat = gvw->ghostview.interpreter_input_iosb[0]; + if(stat != SS$_NORMAL){ + InterpreterFailed(gvw); + } else { + + /* Get a new section if required */ + + if (gvw->ghostview.ps_input && gvw->ghostview.bytes_left == 0) { + struct record_list *ps_old = gvw->ghostview.ps_input; + gvw->ghostview.ps_input = ps_old->next; + if (ps_old->close) fclose(ps_old->fp); + XtFree((char *)ps_old); + } + if(gvw->ghostview.ps_input){ + /* Have to seek at the beginning of each section */ + if (gvw->ghostview.ps_input->seek_needed) { + if (gvw->ghostview.ps_input->len > 0) + fseek(gvw->ghostview.ps_input->fp, + gvw->ghostview.ps_input->begin, SEEK_SET); + gvw->ghostview.ps_input->seek_needed = False; + gvw->ghostview.bytes_left = gvw->ghostview.ps_input->len; + } + /* + ** Read a line from the file. + */ + ch = fgets(gvw->ghostview.input_buffer, GV_BUFSIZ, + gvw->ghostview.ps_input->fp); + if(!ch){ + /* + ** Error, EOF when there's supposed to be data left. + */ + InterpreterFailed(gvw); + } else { + /* + ** Write it to the mailbox. + */ + bbytes = strlen(gvw->ghostview.input_buffer); + gvw->ghostview.bytes_left -= bbytes; + stat = sys$qio(0, (short)gvw->ghostview.interpreter_input, + IO$_WRITEVBLK, &gvw->ghostview.interpreter_input_iosb, + IOComplete, 0, gvw->ghostview.input_buffer, bbytes, + 0, 0, 0, 0); + ERR_SIGNAL(stat); + } + } + } +} + +/* Output - receive I/O from ghostscript's stdout and stderr. + * Pass this to the application via the output_callback. */ +static void +Output(gvw) + GhostviewWidget gvw; +{ + char buf[GV_BUFSIZ+1]; + int bytes, stat; + + stat = gvw->ghostview.interpreter_output_iosb[0]; + bytes = gvw->ghostview.interpreter_output_iosb[1]; + if (stat == SS$_NORMAL) { + /* + ** Got a message. If line complete, pass to the output_callback. + ** + ** HACK ALERT, if bytes is -1 nothing happens, but an I/O is queued. + ** This is our first time code, since Xt doesn't queue the I/O for us + ** under VMS, just watches for completion. In StartInterpreter We setup + ** an IOSB with a success status and -1 bytes so Xt will call us the + ** first time to get the I/O queued. + */ + if (bytes == 0) { + strcpy(buf, "\n"); + } else if (bytes == 1) { + buf[0] = gvw->ghostview.output_buffer[0]; + buf[1] = '\0'; + } else if (bytes > 1) { + /* + ** Copy the message to a local buffer and pass it to the callback. + */ + memcpy(buf, gvw->ghostview.output_buffer, bytes); + buf[bytes] = '\0'; + } + if(bytes >= 0)XtCallCallbackList(gvw, gvw->ghostview.output_callback, + (XtPointer) buf); + /* + ** Queue a new read to the mailbox + */ + stat = sys$qio(0, (short)gvw->ghostview.interpreter_output, + IO$_READVBLK, &gvw->ghostview.interpreter_output_iosb, IOComplete, + 0, gvw->ghostview.output_buffer, GV_BUFSIZ, 0, 0, 0, 0); + ERR_SIGNAL(stat); + } else { + InterpreterFailed(gvw); /* Something bad happened */ + } +} + +/* This routine starts the interpreter. It sets the DISPLAY and + * GHOSTVIEW environment variables. The GHOSTVIEW environment variable + * contains the Window that ghostscript should write on. + * + * This routine also opens pipes for stdout and stderr and initializes + * application input events for them. If input to ghostscript is not + * from a file, a pipe for stdin is created. This pipe is setup for + * non-blocking I/O so that the user interface never "hangs" because of + * a write to ghostscript. + */ +static void +StartInterpreter(w) + Widget w; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + char buf[GV_BUFSIZ]; + char cmd[512]; + int ret; + short ch1, ch2; + char in_mbx_name[65], out_mbx_name[65]; + long pid, nowait = CLI$M_NOWAIT; + const $DESCRIPTOR(ghostview_desc, "GHOSTVIEW"); + const $DESCRIPTOR(display_desc, "DECW$DISPLAY"); + const $DESCRIPTOR(lnt_desc, "LNM$PROCESS"); + $DESCRIPTOR(in_desc, ""); + $DESCRIPTOR(out_desc, ""); + $DESCRIPTOR(lnm_desc, ""); + $DESCRIPTOR(cmd_desc, cmd); + ITEM_LIST_3_T(gv_list, 1) = {{{0, LNM$_STRING, buf, NULL}}, 0}; + ITEM_LIST_3_T(dis_list, 1) = {{{0, LNM$_STRING, NULL, NULL}}, 0}; + ITEM_LIST_3_T(dvi_list, 1) = {{{64, DVI$_DEVNAM, NULL, NULL}}, 0}; + IOSB_GET_T dvi_iosb; + + /* + ** Stop interpreter if running + */ + StopInterpreter(w); + /* + ** Clear the window before starting a new interpreter. + */ + if (gvw->core.background_pixmap != XtUnspecifiedPixmap) { + XFillRectangle(XtDisplay(w), gvw->core.background_pixmap, + gvw->ghostview.gc, + 0, 0, gvw->core.width, gvw->core.height); + } + XClearArea(XtDisplay(w), XtWindow(w), + 0, 0, gvw->core.width, gvw->core.height, False); + /* + ** Check for disabled. + */ + if (gvw->ghostview.disable_start) return; + /* + ** Build Ghostscript startup command + */ + strcpy(cmd, gvw->ghostview.interpreter); + strcat(cmd, " \"-sDEVICE=x11\" \"-dNOPAUSE\" "); + if (gvw->ghostview.quiet) strcat(cmd, "\"-dQUIET\" "); + if (gvw->ghostview.safer) strcat(cmd, "\"-dSAFER\" "); + if (gvw->ghostview.arguments) { + strcat(cmd, gvw->ghostview.arguments); + strcat(cmd, " "); + } + strcat(cmd, "\"-\" "); + + /* + ** Determine input source. + */ + if (gvw->ghostview.filename == NULL) { + /* + ** Create a mailbox to feed input to Ghostscript and get its name. + */ + ret = sys$crembx(0, &ch1, GV_BUFSIZ, GV_BUFSIZ, 0, 0, 0, 0); + ERR_SIGNAL(ret); + dvi_list.item[0].buffer_p = in_mbx_name; + ret = sys$getdvi(0, ch1, 0, &dvi_list, &dvi_iosb, 0, 0, 0); + ERR_SIGNAL(ret); ERR_SIGNAL(dvi_iosb.status); + in_mbx_name[64] = '\0'; + in_desc.dsc$a_pointer = in_mbx_name; + in_desc.dsc$w_length = strlen(in_mbx_name); + } else { + /* + ** Set up file name to give Ghostscript as standard input. + */ + in_desc.dsc$a_pointer = gvw->ghostview.filename; + in_desc.dsc$w_length = strlen(gvw->ghostview.filename); + } + /* + ** Create mailbox to receive Ghostscript's output + */ + ret = sys$crembx(0, &ch2, GV_BUFSIZ, GV_BUFSIZ, 0, 0, 0, 0); + ERR_SIGNAL(ret); + dvi_list.item[0].buffer_p = out_mbx_name; + ret = sys$getdvi(0, ch2, 0, &dvi_list, &dvi_iosb, 0, 0, 0); + ERR_SIGNAL(ret); ERR_SIGNAL(dvi_iosb.status); + out_mbx_name[64] = '\0'; + out_desc.dsc$a_pointer = out_mbx_name; + out_desc.dsc$w_length = strlen(out_mbx_name); + /* + ** Create GHOSTVIEW and DECW$DISPLAY logical names. + ** + ** We use CRELNM rather than LIB$SET_LOGICAL because we want these to be + ** user mode and go away when the program exits. It doesn't matter that we + ** may set them multiple times, as with the mailbox logicals, since once + ** Ghostscript starts we don't need them any more. + */ + sprintf(buf, "%d", XtWindow(w)); + gv_list.item[0].buffer_size = strlen(buf); + ret = sys$crelnm(0, &lnt_desc, &ghostview_desc, 0, &gv_list); + ERR_SIGNAL(ret); + dis_list.item[0].buffer_p = XDisplayString(XtDisplay(w)); + dis_list.item[0].buffer_size = strlen(dis_list.item[0].buffer_p); + ret = sys$crelnm(0, &lnt_desc, &display_desc, 0, &dis_list); + ERR_SIGNAL(ret); + /* + ** Spawn Ghostscript process + */ + gvw->ghostview.changed = False; + gvw->ghostview.busy = True; + cmd_desc.dsc$w_length = strlen(cmd); + ret = lib$spawn(&cmd_desc, &in_desc, &out_desc, &nowait, 0, &pid, 0, 0, + 0, 0, 0, 0, 0); + ERR_SIGNAL(ret); + XDefineCursor(XtDisplay(gvw), XtWindow(gvw), gvw->ghostview.busy_cursor); + /* + ** Everything worked, initialize IOSBs and save info about interpretter. + */ + gvw->ghostview.interpreter_pid = pid; + if (gvw->ghostview.filename == NULL) { + gvw->ghostview.interpreter_input = ch1; + gvw->ghostview.interpreter_input_iosb[0] = 0; + } + gvw->ghostview.interpreter_output = ch2; + if (gvw->ghostview.output_buffer == NULL) { + gvw->ghostview.output_buffer = XtMalloc(GV_BUFSIZ); + } + GLInsert(gvw); + /* + ** Fake a completed I/O so Output will get called to queue the first I/O. + */ + gvw->ghostview.interpreter_output_iosb[0] = SS$_NORMAL; + gvw->ghostview.interpreter_output_iosb[1] = -1; + IOComplete(); +} + +/* Stop the interperter, if present, and remove any Input sources. */ +/* Also reset the busy state. */ +static void +StopInterpreter(w) + Widget w; +{ + int ret; + + GhostviewWidget gvw = (GhostviewWidget) w; + if (gvw->ghostview.interpreter_pid >= 0) { + ret = sys$delprc(&gvw->ghostview.interpreter_pid, 0); + if(ret != SS$_NORMAL && ret != SS$_NONEXPR)lib$signal(ret, 0, 0); + gvw->ghostview.interpreter_pid = -1; + } + if (gvw->ghostview.interpreter_input >= 0) { + (void) sys$dassgn(gvw->ghostview.interpreter_input); + gvw->ghostview.interpreter_input = -1; + while (gvw->ghostview.ps_input) { + struct record_list *ps_old = gvw->ghostview.ps_input; + gvw->ghostview.ps_input = ps_old->next; + if (ps_old->close) fclose(ps_old->fp); + XtFree((char *)ps_old); + } + } + if (gvw->ghostview.interpreter_output >= 0) { + (void) sys$dassgn(gvw->ghostview.interpreter_output); + gvw->ghostview.interpreter_output = -1; + } + gvw->ghostview.busy = False; + XDefineCursor(XtDisplay(gvw), XtWindow(gvw), gvw->ghostview.cursor); + GLRemove(gvw); +} + +/* GhostviewSendPS: + * Queue a portion of a PostScript file for output to ghostscript. + * fp: FILE * of the file in question. NOTE: if you have several + * Ghostview widgets reading from the same file. You must open + * a unique FILE * for each widget. + * SendPS does not actually send the PostScript, it merely queues it + * for output. + * begin: position in file (returned from ftell()) to start. + * len: number of bytes to write. + * + * If an interpreter is not running, nothing is queued and + * False is returned. + */ +Boolean +GhostviewSendPS(w, fp, begin, len, close) + Widget w; + FILE *fp; + long begin; + unsigned int len; + Bool close; +{ + GhostviewWidget gvw = (GhostviewWidget) w; + struct record_list *ps_new; + + if (gvw->ghostview.interpreter_input < 0) return False; + if(len != 0){ + ps_new = (struct record_list *) XtMalloc(sizeof (struct record_list)); + ps_new->fp = fp; + ps_new->begin = begin; + ps_new->len = len; + ps_new->seek_needed = True; + ps_new->close = close; + ps_new->next = NULL; + + if (gvw->ghostview.input_buffer == NULL) { + gvw->ghostview.input_buffer = XtMalloc(GV_BUFSIZ); + } + + if (gvw->ghostview.ps_input == NULL) { + gvw->ghostview.bytes_left = len; + gvw->ghostview.ps_input = ps_new; + /* + ** Fake a completed I/O so Input will get called to queue the + ** first I/O. + */ + gvw->ghostview.interpreter_input_iosb[0] = SS$_NORMAL; + gvw->ghostview.interpreter_input_iosb[1] = -1; + IOComplete(); + } else { + struct record_list *p = gvw->ghostview.ps_input; + while (p->next != NULL) { + p = p->next; + } + p->next = ps_new; + } + } + return True; +} +#endif /* VMS */ diff --git a/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.h b/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.h new file mode 100644 index 0000000000..d6f6fa5780 --- /dev/null +++ b/support/hypertex/tanmoy/ghostview-1.5-hacked/Ghostview.h @@ -0,0 +1,210 @@ +/* + * Ghostview.h -- Public header file for Ghostview widget. + * Copyright (C) 1992 Timothy O. Theisen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Tim Theisen Systems Programmer + * Internet: tim@cs.wisc.edu Department of Computer Sciences + * UUCP: uwvax!tim University of Wisconsin-Madison + * Phone: (608)262-0438 1210 West Dayton Street + * FAX: (608)262-9777 Madison, WI 53706 + */ + +#ifndef _Ghostview_h +#define _Ghostview_h +/* Be sure that FILE* is defined */ +#include + +/**************************************************************** + * + * Ghostview widget + * + ****************************************************************/ + +/* Resources: + + Name Class RepType Default Value + ---- ----- ------- ------------- + arguments Arguments String NULL + background Background Pixel XtDefaultBackground + border BorderColor Pixel XtDefaultForeground + borderWidth BorderWidth Dimension 1 + bottomMargin Margin int 0 + busyCursor Cursor Cursor watch + callback Callback Pointer NULL + cursor Cursor Cursor crosshair + destroyCallback Callback Pointer NULL + filename Filename String "-" + foreground Foreground Pixel XtDefaultForeground + height Height Dimension 0 + interpreter Interpreter String "gs" + leftMargin Margin int 0 + llx BoundingBox Int 0 + lly BoundingBox Int 0 + mappedWhenManaged MappedWhenManaged Boolean True + messageCallback Callback Pointer NULL + orientation Orientation PageOrientation Portrait + outputCallback Callback Pointer NULL + palette Palette Palette Color + quiet Quiet Boolean True + rightMargin Margin int 0 + safer Safer Boolean True + topMargin Margin int 0 + urx BoundingBox Int 612 + ury BoundingBox Int 792 + useBackingPixmap UseBackingPixmap Boolean True + width Width Dimension 0 + x Position Position 0 + xdpi Resolution Float ** + y Position Position 0 + ydpi Resolution Float ** + + ** automatically calculated from display parameters if width and + height are not set. + +*/ + +/* define any special resource names here that are not in */ + +#define XtNbusyCursor "busyCursor" +#define XtNcursor "cursor" +#define XtNfilename "filename" +#define XtNinterpreter "interpreter" +#define XtNmessageCallback "messageCallback" +#define XtNoutputCallback "outputCallback" +#define XtNpalette "palette" +#define XtNarguments "arguments" +#define XtNquiet "quiet" +#define XtNsafer "safer" +#define XtNllx "llx" +#define XtNlly "lly" +#define XtNurx "urx" +#define XtNury "ury" +#define XtNuseBackingPixmap "useBackingPixmap" +#define XtNxdpi "xdpi" +#define XtNydpi "ydpi" +#define XtNrightMargin "rightMargin" +#define XtNleftMargin "leftMargin" +#define XtNbottomMargin "bottomMargin" +#define XtNtopMargin "topMargin" + +#define XtCBoundingBox "BoundingBox" +#define XtCFilename "Filename" +#define XtCInterpreter "Interpreter" +#define XtCPalette "Palette" +#define XtCArguments "Arguments" +#define XtCQuiet "Quiet" +#define XtCSafer "Safer" +#define XtCResolution "Resolution" +#define XtCUseBackingPixmap "UseBackingPixmap" + +/****************************************************************************** + * XmuCvtStringToPageOrientation + */ +/* Number represents clockwise rotation of the paper in degrees */ +typedef enum { + XtPageOrientationPortrait = 0, /* Normal portrait orientation */ + XtPageOrientationLandscape = 90, /* Normal landscape orientation */ + XtPageOrientationUpsideDown = 180, /* Don't think this will be used much */ + XtPageOrientationSeascape = 270 /* Landscape rotated the other way */ +} XtPageOrientation; +#define XtEportrait "portrait" +#define XtElandscape "landscape" +#define XtEupsideDown "upside-down" +#define XtEseascape "seascape" +#define XtRPageOrientation "PageOrientation" +extern Boolean XmuCvtStringToPageOrientation(); + +/****************************************************************************** + * XmuCvtStringToPalette + */ +typedef enum { + XtPaletteMonochrome, + XtPaletteGrayscale, + XtPaletteColor +} XtPalette; +#define XtEmonochrome "monochrome" +#define XtEgrayscale "grayscale" +#define XtEcolor "color" +#define XtRPalette "Palette" +extern Boolean XmuCvtStringToPalette(); + +/* declare specific GhostviewWidget class and instance datatypes */ + +typedef struct _GhostviewClassRec* GhostviewWidgetClass; +typedef struct _GhostviewRec* GhostviewWidget; + +/* declare the class constant */ + +extern WidgetClass ghostviewWidgetClass; + +/* Public routines */ + +extern void GhostviewEnableInterpreter( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern void GhostviewDisableInterpreter( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern Boolean GhostviewIsInterpreterReady( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern Boolean GhostviewIsInterpreterRunning( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern Pixmap GhostviewGetBackingPixmap( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +extern Boolean GhostviewSendPS( +#if NeedFunctionPrototypes + Widget /* widget */, + FILE* /* fp */, + long /* begin */, + unsigned int /* len */, + Bool /* close */ +#endif +); + +extern Boolean GhostviewNextPage( +#if NeedFunctionPrototypes + Widget /* w */ +#endif +); + +/* The structure returned by the regular callback */ + +typedef struct _GhostviewReturnStruct { + int width, height; + int psx, psy; + float xdpi, ydpi; +} GhostviewReturnStruct; + +#endif /* _Ghostview_h */ diff --git a/support/hypertex/tanmoy/ghostview-1.5-hacked/GhostviewP.h b/support/hypertex/tanmoy/ghostview-1.5-hacked/GhostviewP.h new file mode 100644 index 0000000000..0749b2dc34 --- /dev/null +++ b/support/hypertex/tanmoy/ghostview-1.5-hacked/GhostviewP.h @@ -0,0 +1,120 @@ +/* + * GhostviewP.h -- Private header file for Ghostview widget. + * Copyright (C) 1992 Timothy O. Theisen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Author: Tim Theisen Systems Programmer + * Internet: tim@cs.wisc.edu Department of Computer Sciences + * UUCP: uwvax!tim University of Wisconsin-Madison + * Phone: (608)262-0438 1210 West Dayton Street + * FAX: (608)262-9777 Madison, WI 53706 + */ + +#ifndef _GhostviewP_h +#define _GhostviewP_h + +#include "Ghostview.h" +#include +#include +#include + +typedef struct { + AtomPtr ghostview; + AtomPtr gv_colors; + AtomPtr next; + AtomPtr page; + AtomPtr done; +} GhostviewClassPart; + +typedef struct _GhostviewClassRec { + CoreClassPart core_class; + GhostviewClassPart ghostview_class; +} GhostviewClassRec; + +extern GhostviewClassRec ghostviewClassRec; + +/* structure to describe section of file to send to ghostscript */ +struct record_list { + FILE *fp; + long begin; + unsigned int len; + Boolean seek_needed; + Boolean close; + struct record_list *next; +}; + +typedef struct { + /* resources */ + Pixel foreground; + Cursor cursor; + Cursor busy_cursor; + XtCallbackList callback; + XtCallbackList message_callback; + XtCallbackList output_callback; + String interpreter; + Boolean quiet; + Boolean safer; + Boolean use_bpixmap; + String arguments; + String filename; + XtPageOrientation orientation; + XtPalette palette; + float xdpi; + float ydpi; + int llx; + int lly; + int urx; + int ury; + int left_margin; + int bottom_margin; + int right_margin; + int top_margin; + /* private state */ + GC gc; /* GC used to clear window */ + Window mwin; /* destination of ghostsript messages */ + Boolean disable_start; /* whether to fork ghostscript */ + int interpreter_pid;/* pid of ghostscript, -1 if none */ + struct record_list *ps_input; /* pointer it gs input queue */ + char *input_buffer; /* pointer to input buffer */ + unsigned int bytes_left; /* bytes left in section */ +#ifndef VMS + char *input_buffer_ptr; /* pointer into input buffer */ + unsigned int buffer_bytes_left; /* bytes left in buffer */ +#endif + int interpreter_input; /* fd gs stdin, -1 if None */ + int interpreter_output; /* fd gs stdout, -1 if None */ +#ifndef VMS + int interpreter_error; /* fd gs stderr, -1 if None */ + XtInputId interpreter_input_id; /* XtInputId for above */ + XtInputId interpreter_output_id; /* XtInputId for above */ + XtInputId interpreter_error_id; /* XtInputId for above */ +#else /* VMS */ + short interpreter_input_iosb[4]; /* I/O Status Blocks */ + short interpreter_output_iosb[4]; /* for each mailbox */ + char *output_buffer; /* pointer to output buffer */ +#endif /* VMS */ + Dimension gs_width; /* Width of window at last Setup() */ + Dimension gs_height; /* Height of window at last Setup() */ + Boolean busy; /* Is gs busy drawing? */ + Boolean changed; /* something changed since Setup()? */ +} GhostviewPart; + +typedef struct _GhostviewRec { + CorePart core; + GhostviewPart ghostview; +} GhostviewRec; + +#endif /* _GhostviewP_h */ diff --git a/support/hypertex/tanmoy/ghostview-1.5-hacked/HISTORY b/support/hypertex/tanmoy/ghostview-1.5-hacked/HISTORY new file mode 100644 index 0000000000..36d008228d --- /dev/null +++ b/support/hypertex/tanmoy/ghostview-1.5-hacked/HISTORY @@ -0,0 +1,453 @@ +==================== ghostview 1.5 HACKED (25 Jul 93) ===================== + + Hacked by tanmoy@qcd.lanl.gov to support pdfmarks (alpha release) + +==================== ghostview 1.5 (25 Jul 93) ===================== + + 1. Minimize comparison is DSC scanner to further speed it up. + + 2. Modify MenuButton translations to popup menu under any combination + of modifiers. + + 3. Change all occurances of .Translation to .translation to allow #augment + and #override to work properly. + + 4. Rename ghostview widget "preload" resource to "arguments". + + 5. Add foreground and palette resources to Ghostview widget. + Allow user to set the palette from the command line. + Remove special visual and special cmap code. + + 6. Remove Standard Color Map installation code. + + 7. Sync the connection just after setting the properties to ensure they + are set when gs starts. Flush the next page event to ensure ghostscript + starts right away. + + 8. Fix up bug in pasting of arguments into exec() call. + + 9. Add safer resource and make it the default. + +10. Apply HOME directory selfile fix from Erik van der Poel. + +11. Invoke ad2c with sh, so it work properly with for people using VPATH. + +12. Improve comment scanner. Avoid allocating 0 bytes when %%Pages: 0 + is present. Blank lines are counted with the section that they follow. + This is necessary one one decides that the current section being scanned + belong somewhere else. + +13. Various portability patches. (For Alpha-OSF/1 in particular.) + +==================== ghostview 1.4.1 ( 2 Nov 92) ===================== + + 1. Fix a couple of bugs introduced into the PostScript comment scanner. + - Change isblank() to blank() to avoid name clash. + - Upgrade blank() to call not DSC comments blank lines. + - Avoid core dump by guarding against garbage bewteen the %%EndSetup + and first %%Page. + - Collsaped sections (Documents, Files, ProcSets, etc.) are no longer + returned as a comment line. They are now properly recognized. + - Avoid looping by truncating line buffer at EOF. + + 2. Synchronize X connection before trying to force error associated with + backing pixmap. + + 3. Add as another keyboard accelerator for Next. + +==================== ghostview 1.4 (11 Oct 92) ===================== + + 1. Merge in VMS support from Terry Poot . + + 2. Force the Alloc error to occur immediately after trying to allocate + the backing pixmap. Deal with it as best as we can. + + 3. Withdraw unused function GhostviewGetInputFileDescriptor(). + + 4. Use XCOMM trick from X11R5 to make Imakefile more portable. + + 5. Renamed ghostview.h to gv.h and Ghostview.ad.h to app-defaults.h to + avoid limitations in VMS file names. + + 6. Correct problem where ghostscript interpreter was not being killed + when the popup zoom window was dismissed. + + 7. Propagate error messages about alloc failures and interpreter failures + in both main and zoom windows back to the information window. + + 8. Catch X errors and gracefully die if one occurs. + + 9. Relayout ghostview whenever the document requests a new orientation or + page media. + +10. Allow for multipage encapsulated PostScript figures. + +11. More upgrades to PostScript scanner. + - Comment section now terminated by %X where X is unprintable. + - Length of section is now properly computed when there is an + included document. + - Cleaned up misuse of global variables. + - Ignore comments within %%Begin(End)Feature, %%Begin(End)File, + %%Begin(End)Font, %%Begin(End)ProcSet, %%Begin(End)Resource. + - Change enum {LLX, LLY, URX, URY} to #defines to avoid confusing some + compilers. + +12. Pay attention to ordinal number on %%Page comment to detect included + figures without %%Begin(End)Document guards. + +13. Added reopen button. + +14. Small POSIX change in Dir.c + +15. Make installStdCmap false by default. + +16. Fix error where wrong pages were being saved or printed when descending + page order is used. + +17. Be sure to discard old backing pixmap if new alloc fails. + +==================== ghostview 1.3-terry (30 May 92) ===================== + + 1. Rework the DSC comment scanner to return the length of the section as + well as the start and end position. + + 2. Rework sending PostScript input down the pipe to eliminate a gross + efficiency problem. I/O is done in 512 byte buffers rather than + line by line. As many buffers as possible are sent before returning + from routine. + + 3. Change Path.c to include to get and define + getuid in terms of uid_t. + + 4. Added #defines for memset() and memcpy() for use when BSD4_2 is defined. + +==================== ghostview 1.3 (12 May 92) ===================== + + 1. Fix bug where EPSF figures with a %%Page comment would cause ghostview + to use garbage for the orientation or media. + + 2. Redid waiting for form to change size before reattaching the chains the X + way. (Previous algorithm used a subsidiary event loop. It was prone + to getting stuck with the wrong app-defaults.) The new algorithm uses + timer events with exponential backoff. + + 3. Added Prior and Next keys to page back and forward. + + 4. Added GhostviewCheckFile action and bound it to MapNotify. Ghostview will + now redraw the current page on deiconify when the file has changed. + + 5. Added application resource for the name of the PRINER environment variable. + Default is LPDEST for SYSV and PRINTER for BSD. Also changed printer + command to default to lp for SYSV and lpr for BSD. + + 6. Change Print Marked Pages to mark the current selection or current page + when no pages are marked. It unmarks any page that it marked after sending + output to the print command. Also, change Print Marked Pages to call + print whole when there was no table of contents. This allows people to + print a EPSF figure without having to press Shift P. + + 7. Automatically center page within viewport. autoCenter app-default or + -nocenter can be used to disable this behavior. Add Center to Page menu + and GhostviewCenter action and bind it to the C key. + + 8. Reworked the way that popup zoom windows work. The notify event contains + both the window size desired and resolution desired. This allows much + greater flexibility in the zoom windows. Changed the default zooms to + be all 500x500 pixels at 200, 300, and 400 dpi. Popup zoom windows can + be dismissed with the new dismiss button or pressing Q within the window. + + 9. Added -page