Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!zephyr!tektronix!psueea!qiclab!sopwith!snoopy From: snoopy@sopwith.UUCP (Snoopy) Newsgroups: gnu.ghostscript.bug Subject: Re: Patches for ghostscript-1.3 for BSD. Message-ID: <237@sopwith.UUCP> Date: 4 Jul 89 16:48:23 GMT References: <8728.8907032240@oriona.doc.ic.ac.uk> Reply-To: snoopy@sopwith.UUCP (Snoopy) Distribution: gnu Organization: The Daisy Hill Puppy Farm Lines: 86 In article <8728.8907032240@oriona.doc.ic.ac.uk> lmjm%doc.imperial.ac.uk@NSFNET-RELAY.AC.UK (Lee McLoughlin) writes: |Here are some patches I needed to get gs working on a 4.2 BSD system. | |It still doesn't work fully. On doing | ./gs leta.ps |It creates an inital window. When I hit return it then creates |another window. On hitting return again it then draws in the second window! | |I've not yet looked into this problem. I suspect it is calling x_open(), x_close() and then x_open() again during startup, and that the x driver isn't keeping track of what window it is supposed to be using and thus starts a new one. Look in gs.c, gsmain.c, and gdevx.c for starters. To add multi-device support, I have it starting with the null device. |Ps: Where did all the example postscript files go? I had them around |but without them how are you supposed to test gs? I suspect what happened is that Peter used a script to automatically add the GNU copyright to all the files in release 1.0, and the script merrily added it to the example files, many of which were copyrighted by others (e.g. Adobe) who justifiably got upset. The Adobe Cookbook suggests both trying the programs and modifying them, so presumably they would not be upset about people having copies on their machines. The Adobe fileserver provides the code from the green book, I don't know if it provides the code from the cookbook (blue book). |+ |+ #ifndef SYS5 |+ long clock() |+ { |+ return 0; |+ } If you want the time functions to work, here is code for systems which provide gettimeofday(2). Put it in whatever gp-.c file (e.g. gp-bsd.c) you are using. /* Read the current date (in days since Jan. 1, 1980) */ /* and time (in milliseconds since midnight). */ void gs_get_clock(long *pdt) { long secs_since_1980; struct timeval tp; struct timezone tzp; struct tm *tm, *localtime(); if(gettimeofday(&tp, &tzp) == -1) { perror("Ghostscript: gettimeofday failed:"); gs_exit(1); } /* tp.tv_sec is #secs since Jan 1, 1970 */ /* subtract off number of seconds in 10 years */ /* leap seconds are not accounted for */ secs_since_1980 = tp.tv_sec - 60 * 60 * 24 * 365.25 * 10; /* adjust for timezone */ secs_since_1980 -= (tzp.tz_minuteswest * 60); /* adjust for daylight savings time - assume dst offset is 1 hour */ tm = localtime(&(tp.tv_sec)); if (tm->tm_isdst) secs_since_1980 += (60 * 60); /* divide secs by #secs/day to get #days (integer division truncates) */ pdt[0] = secs_since_1980 / (60 * 60 * 24); /* modulo + microsecs/1000 gives number of millisecs since midnight */ pdt[1] = (secs_since_1980 % (60 * 60 * 24)) * 1000 + tp.tv_usec / 1000; #ifdef DEBUG_CLOCK printf("tp.tv_sec = %d tp.tv_usec = %d pdt[0] = %d pdt[1] = %d\n", tp.tv_sec, tp.tv_usec, pdt[0], pdt[1]); #endif DEBUG_CLOCK } _____ .-----. /_____\ Snoopy ./ RIP \. /_______\ qiclab!sopwith!snoopy | | |___| parsely!sopwith!snoopy | tekecs | |___| sun!nosun!illian!sopwith!snoopy |_________| "I *was* the next man!" -Indy