Newsgroups: comp.archives Path: utzoo!utgpu!news-server.csri.toronto.edu!ox.com!emv From: cgl@infidel.LANL.GOV (Chris Langton) Subject: [comp.theory.cell-automata] Cellsim Bug Fix Message-ID: <1991Feb4.211245.1999@ox.com> Followup-To: comp.theory.cell-automata Sender: emv@ox.com (Edward Vielmetti) Reply-To: cgl@infidel.LANL.GOV (Chris Langton) Organization: The Internet References: <9102041416.AA11875@infidel.lanl.gov> Date: Mon, 4 Feb 1991 21:12:45 GMT Approved: emv@ox.com (Edward Vielmetti) X-Original-Newsgroups: comp.theory.cell-automata Archive-name: theory/cell-automata/cellsim/1991-02-04 Archive: archive.cs.rpi.edu:/cellsim/cellsim_2.5.tar.Z [128.213.10.18] Original-posting-by: cgl@infidel.LANL.GOV (Chris Langton) Original-subject: Cellsim Bug Fix Reposted-by: emv@ox.com (Edward Vielmetti) Cellsim Bug Fix ======== This message is to announce the availability of a patch for Cellsim, which fixes a problem encountered when running under SunOS 4.1 or newer. The patch itself is appended at the end of this message. This bug causes cellsim to hang --- and freezes the whole window system --- if the cursor is moved out of the control panel while a run is in progress. Cellsim Distribution List ------------------------- This message is being sent to the CA mail-list. We are maintaining a Cellsim distribution list, in order to keep Cellsim users up to date on new releases and bug fixes. If you would like to be on this list, please send a message to cgl@t13.lanl.gov. You will get two copies of this message if you are on both lists - sorry! For those unfamiliar with Cellsim --------------------------------- Cellsim is a SunView-based cellular automata simulator, which can run on a lattice of size up to 512x512. It can perform calculations locally on a Sun workstation, or on a Connection Machine supercomputer (either directly or through the network). On the CM, it is possible to do some non-CA extensions, such as floating-point calculations and so on. And of course, you'll get some fantastic speed on the CM. Cellsim is still available for anonymous FTP, from archive.cs.rpi.edu (128.213.10.18), in the directory "cellsim". The tarfile "cellsim_2.5.tar.Z" contains the latest version of Cellsim, V2.5 There are also some patches available in subdirectories there, but the tarfile currently available has ALREADY HAD THE PATCHES INSTALLED. (Sorry to shout, but I want to be sure no one misses that). The future of Cellsim --------------------- Cellsim was written by a few different authors, and the source-code is really pretty ugly and getting hard to maintain at this point. I am planning on eventually releasing a new, totally rewritten version, that will probably run under X-windows (but which will be much easier to port to other platforms than Cellsim is). One of my main motivations for doing so is to take advantage of several ideas I have for optimizing the calculations on the Connection Machine, and taking advantage of some of the CM's features that are not tapped into by the current Cellsim. I realize that not everyone has access to a CM, so future Cellsims will still be able to run the calculations locally as well. The problem and the patch ------------------------- Many people have noticed a pretty terrible bug in Cellsim, when running on SunOS 4.1 or newer. The problem is that, if you start running a rule, and move the mouse cursor outside of the Cellsim window while the rule is running, SunView will essentially hang. You won't be able to select any other windows, or stop the run by clicking on the left mouse-button as you should be able to. **NOTE: You should install this patch, even if you don't yet use SunOS 4.1, since in the future you may upgrade, and it's best to be prepared. Also, any future patches to Cellsim may rely on this one being already installed. With the help of someone at Sun (Matthew Stier, to whom I am *very* grateful for his help), I've fixed the problem in Cellsim. Apparently, something was changed in the event-handler or notifier in the SunView libraries when 4.1 came out. Actually, I'm not sure if Cellsim *should* have worked even under 3.5 -- it may have been using an undocumented property of SunView. I'm not familiar enough with the low-level details of SunView, and I didn't write that part of Cellsim, so I'm not sure about it. Three routines in the "cellscr.c" file need to be changed, to fix the problem. These routines are check_button(), set_run_mode(), and unset_run_mode(). I've appended a patch at the end of this message, which you can apply to your copy of cellscr.c (you will then need to recompile Cellsim). To use the patch, save everything between the "==cut here==" labels into a file. Assuming you call the file "4.1_patchfile", in the same directory with cellscr.c, you can apply the patch by doing: patch cellscr.c 4.1_patchfile You should see a message indicating that 2 hunks succeeded. Patch will make a backup copy of your original cellscr.c, called "cellscr.c.orig", and will create a new, modified cellscr.c with the patches installed. You should then be able to recompile Cellsim. If you don't have the "patch" command, you can get a copy of the three routines that were modified, via one of 2 methods: 1. Through anonymous FTP to archive.cs.rpi.edu (128.213.10.18). Use the login name "anonymous", and your e-mail address as a password. Look in the directory "cellsim/patch2", for a file named "4.1_cellscr.c". You can replace your "cellscr.c" file with this version, assuming you haven't made any local changes to your cellscr.c. If you *have* modified your cellscr.c file already, then you should get the file "4.1_functions". This file contains only the three functions that were changed. You should manually replace the old versions of these routines in your cellscr.c file with these new versions. The patchfile is also in the FTP archive, although you shouldn't need it, since it's appended below. 2. If you aren't able to FTP, then send me a note requesting either of the above files, and I will send it to you. I'm awfully busy lately, so please use FTP if you can. A linker bug ------------ Some people are encountering linker errors when trying to load in computed-function rules (getting "ld: -T" errors). I haven't figured this one out yet -- hopefully soon. Actually, someone else had that problem more than a year ago, and we solved it then. The problem is, I don't remember how we solved it, and I've moved so many times since then, I can't find the bug-report where I recorded the solution! If the person who had this problem is reading this, and remembers how we fixed it, could you please let me know? Thanks. :-) I realize I probably should have waited and fixed both bugs at once with one patch, but the SunView problem is so severe, I wanted to make this patch available as soon as possible. Also, I don't know if many people are encountering the linker problem; it seems pretty rare. Disclaimer ---------- I feel I better add this -- despite the fact that it is a tool for doing computations on the Connection Machine (and Sun workstations), Cellsim is in no way supported by Thinking Machines Corporation. I worked on Cellsim for quite some time before joining TMC. If you have any questions/comments/complaints about Cellsim, please direct them to me (hiebeler@think.com) or Chris Langton (cgl@t13.lanl.gov), and not to Thinking Machines Corporation or Los Alamos National Laboratory. Here is the patch, below. Use everything between the "===cut here===" delimiters (there is one at both ends -- don't forget to delete my signature at the end). ===cut here=== *** cellscr_orig.c Thu Jan 31 08:36:19 1991 --- cellscr.c Thu Jan 31 08:39:09 1991 *************** *** 1707,1723 **** set_run_mode() { /* disable panel & canvas input */ - int fd; /* window file descriptor */ frame_mask = *((Inputmask *) window_get(frame, WIN_PICK_INPUT_MASK)); ! window_set(frame, WIN_CONSUME_PICK_EVENT, MS_LEFT, 0); panel_mask = *((Inputmask *) window_get(panel, WIN_PICK_INPUT_MASK)); ! window_set(panel, WIN_CONSUME_PICK_EVENT, WIN_NO_EVENTS, 0); canvas_mask = *((Inputmask *) window_get(canvas, WIN_PICK_INPUT_MASK)); ! window_set(canvas, WIN_CONSUME_PICK_EVENT, WIN_NO_EVENTS, 0); ! fd = (int) window_get(frame, WIN_FD); ! fcntl(fd, F_SETFL, FNDELAY); ! /* set non-blocking mode */ } --- 1707,1719 ---- set_run_mode() { /* disable panel & canvas input */ frame_mask = *((Inputmask *) window_get(frame, WIN_PICK_INPUT_MASK)); ! window_set(frame, WIN_CONSUME_PICK_EVENT, WIN_NO_EVENTS, 0); panel_mask = *((Inputmask *) window_get(panel, WIN_PICK_INPUT_MASK)); ! window_set(panel, WIN_CONSUME_PICK_EVENT, MS_LEFT, 0); canvas_mask = *((Inputmask *) window_get(canvas, WIN_PICK_INPUT_MASK)); ! window_set(canvas, WIN_CONSUME_PICK_EVENT, MS_LEFT, 0); } *************** *** 1732,1746 **** check_button() { /* return TRUE iff the left button has * been pressed */ ! int err, button; Event event; ! do { /* check all events in pending queue */ ! err = window_read_event(frame, &event); ! button = ((err == 0) && (event_is_up(&event)) && (event_id(&event) == MS_LEFT)); ! } while ((err == 0) && !button); /* if no events remain, err will equal -1 */ ! return (button); } --- 1728,1762 ---- check_button() { /* return TRUE iff the left button has * been pressed */ ! int err, button1, button2; ! int fd1, ff1, fd2, ff2; Event event; ! ! /* set non-blocking mode in panel */ ! fd1 = (int) window_get(panel, WIN_FD); ! ff1 = fcntl(fd1, F_GETFL, 0); ! fcntl(fd1, F_SETFL, FNDELAY); ! /* non-blocking mode in canvas */ ! fd2 = (int) window_get(canvas, WIN_FD); ! ff2 = fcntl(fd2, F_GETFL, 0); ! fcntl(fd2, F_SETFL, FNDELAY); ! do { ! err = window_read_event(panel, &event); ! button1 = ((err == 0) && (event_is_up(&event)) && (event_id(&event) == MS_LEFT)); ! } while ((err == 0) && !button1); ! do { ! err = window_read_event(canvas, &event); ! button2 = ((err == 0) && (event_is_up(&event)) && ! (event_id(&event) == MS_LEFT)); ! } while ((err == 0) && !button2); /* if no events remain, err will equal -1 */ ! ! /* Restore blocking mode in panel and canvas */ ! fcntl(fd1, F_SETFL, ff1); ! fcntl(fd2, F_SETFL, ff2); ! /* if button was pressed in either panel or canvas, return 1 */ ! return (button1 | button2); } ===cut here=== -- Dave Hiebeler | Internet: hiebeler@think.com Thinking Machines Corporation | Phone: (617) 234-4070 (work) 245 First Street | Cambridge, MA 02142 USA |