# This patch is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 (later # version and earlier version not permitted), as published by the Free # Software Foundation; alternatively this patch can be used under the # following license: #- # Copyright (c) 2008 Xin LI # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # $Phantasm: delphijweb/research/freebsd/micropolis.diff,v 1.2 2008/01/13 08:01:17 delphij Exp $ diff --git a/Micropolis b/Micropolis index ed118a9..985cc67 100755 --- a/Micropolis +++ b/Micropolis @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh export SIMHOME=`pwd` echo "Starting Micropolis in $SIMHOME ... " res/sim $* diff --git a/src/sim/headers/sim.h b/src/sim/headers/sim.h index d6a31a1..f1b0f82 100644 --- a/src/sim/headers/sim.h +++ b/src/sim/headers/sim.h @@ -91,7 +91,6 @@ #include #include #include -#include #include #include #include @@ -103,9 +102,6 @@ #include #include #ifndef MSDOS -#ifndef HPUX -#include -#endif #include #include #include diff --git a/src/sim/makefile b/src/sim/makefile index 3497eb2..80726f6 100644 --- a/src/sim/makefile +++ b/src/sim/makefile @@ -1,9 +1,9 @@ -XINCLUDE = /usr/include/X11 +XINCLUDE = /usr/local/include/X11 TCLHOME = ../tcl TKHOME = ../tk TCLXHOME = ../tclx -TCLLIBRARY = /usr/local/lib/tcl -TKLIBRARY = /usr/local/lib/tk +TCLLIBRARY = ../tcl +TKLIBRARY = ../tk CC = gcc @@ -13,15 +13,13 @@ OPTFLAGS = -O3 #DEFINES = -DIS_LINUX -DIS_INTEL -DCAM -DNET DEFINES = -DIS_LINUX -DIS_INTEL -CFLAGS = $(OPTFLAGS) $(DEFINES) - #LDFLAGS = -Bstatic INSTALL = install -s INCLUDES = \ - -Iheaders \ - -I$(XPMHOME) \ + -I./headers \ + -I/usr/local/include \ -I$(XINCLUDE) \ -I$(TCLHOME) \ -I$(TCLXHOME)/src \ @@ -29,8 +27,11 @@ INCLUDES = \ CPPFLAGS = $(INCLUDES) +CFLAGS = $(OPTFLAGS) $(DEFINES) $(INCLUDES) + LIBS = $(TCLXHOME)/libtk.a \ $(TCLXHOME)/libtcl.a \ + -L/usr/local/lib \ -lm \ -lX11 \ -lXext \ diff --git a/src/sim/w_x.c b/src/sim/w_x.c index a6472a0..6dc49ee 100644 --- a/src/sim/w_x.c +++ b/src/sim/w_x.c @@ -878,8 +878,8 @@ DoResizeView(SimView *view, int w, int h) if (view->shminfo->shmid < 0) { perror("shmget"); fprintf(stderr, - "Darn, Micropolis can't share memory with X display \"%s\".\n", - view->x->display); + "Darn, Micropolis can't share memory with X display \"%s\" for %d bytes.\n", + view->x->display, view->line_bytes * view->m_height); goto FALL_BACK; } diff --git a/src/tcl/config b/src/tcl/config index 198d02e..1abfe0f 100755 --- a/src/tcl/config +++ b/src/tcl/config @@ -25,7 +25,7 @@ # Directory containing system include files: -set includeDir="/usr/include" +set includeDir="/usr/local/include" # Archive file containing object code for standard C library: diff --git a/src/tcl/tclunix.h b/src/tcl/tclunix.h index a4c5cab..7e302cb 100644 --- a/src/tcl/tclunix.h +++ b/src/tcl/tclunix.h @@ -100,8 +100,8 @@ * isn't generally declared in a header file anywhere. */ -extern int errno; -extern int sys_nerr; +//extern int errno; +//extern int sys_nerr; //#ifndef IS_LINUX //extern char *sys_errlist[]; //#endif diff --git a/src/tclx/config.mk b/src/tclx/config.mk index 22d43cb..a5fc4c5 100644 --- a/src/tclx/config.mk +++ b/src/tclx/config.mk @@ -53,7 +53,7 @@ TCL_UCB_DIR=../tcl TCL_TK_SHELL=wish TCL_TK_DIR=../tk TK_LIBRARY=/usr/local/lib/tk -XPM_LIBS=-L/usr/X11R6/lib -lXpm +XPM_LIBS=-L/usr/local/lib -lXpm #------------------------------------------------------------------------------ # Compiler debug/optimization/profiling flag to use. Not that if debugging or diff --git a/src/tclx/src/tclxfmat.c b/src/tclx/src/tclxfmat.c index 19d42c3..39a3937 100644 --- a/src/tclx/src/tclxfmat.c +++ b/src/tclx/src/tclxfmat.c @@ -121,6 +121,7 @@ ReturnFPMathError (interp) { char *errorMsg; +#if 0 switch (G_errorType) { case DOMAIN: errorMsg = "domain"; @@ -139,6 +140,9 @@ ReturnFPMathError (interp) errorMsg = "loss of significance"; break; } +#else + errorMsg = "error"; +#endif Tcl_AppendResult (interp, "floating point ", errorMsg, " error", (char *) NULL); G_gotTclFPMathErr = FALSE; /* Clear the flag. */ diff --git a/src/tclx/src/tclxid.c b/src/tclx/src/tclxid.c index b23d7bb..c185f94 100644 --- a/src/tclx/src/tclxid.c +++ b/src/tclx/src/tclxid.c @@ -239,7 +239,9 @@ Tcl_IdCmd (clientData, interp, argc, argv) " process group [set]", (char *) NULL); return TCL_ERROR; } +#if 0 setpgrp (); +#endif return TCL_OK; } Tcl_AppendResult (interp, tclXWrongArgs, argv [0], diff --git a/src/tclx/src/tclxint.h b/src/tclx/src/tclxint.h index 6a1dfee..6d3bc5f 100644 --- a/src/tclx/src/tclxint.h +++ b/src/tclx/src/tclxint.h @@ -67,7 +67,6 @@ # include #endif -#include #include /* * On some systems this is not included by tclUnix.h. diff --git a/src/tclx/src/tclxmath.c b/src/tclx/src/tclxmath.c index 9f967bf..0e759bb 100644 --- a/src/tclx/src/tclxmath.c +++ b/src/tclx/src/tclxmath.c @@ -16,6 +16,7 @@ *----------------------------------------------------------------------------- */ +#include #include "tclxint.h" extern int rand(); @@ -46,7 +47,7 @@ Tcl_MaxCmd (clientData, interp, argc, argv) int argc; char **argv; { - double value, maxValue = -MAXDOUBLE; + double value, maxValue = -NAN; int idx, maxIdx = 1; @@ -87,7 +88,7 @@ Tcl_MinCmd (clientData, interp, argc, argv) int argc; char **argv; { - double value, minValue = MAXDOUBLE; + double value, minValue = NAN; int idx, minIdx = 1; if (argc < 3) { diff --git a/src/tclx/src/tclxmerr.c b/src/tclx/src/tclxmerr.c index dc3596b..871d5d9 100644 --- a/src/tclx/src/tclxmerr.c +++ b/src/tclx/src/tclxmerr.c @@ -37,7 +37,7 @@ int matherr (except) struct exception *except; { - if (Tcl_MathError (except->name, except->type)) + if (Tcl_MathError (NULL, 0)) return 1; else return 0; diff --git a/src/tclx/tkucbsrc/makefile b/src/tclx/tkucbsrc/makefile index 47f45f9..95f0885 100644 --- a/src/tclx/tkucbsrc/makefile +++ b/src/tclx/tkucbsrc/makefile @@ -23,7 +23,7 @@ SHELL=/bin/sh #------------------------------------------------------------------------------ -CFLAGS= $(OPTIMIZE_FLAG) $(XCFLAGS) -I../src -I../$(TCL_TK_DIR) \ +CFLAGS= $(OPTIMIZE_FLAG) $(XCFLAGS) -I/usr/local/include -I../src -I../$(TCL_TK_DIR) \ -I../$(TCL_UCB_DIR) -I$(XHOME)/include \ $(MEM_DEBUG_FLAGS) $(SYS_DEP_FLAGS) \ -DTK_VERSION=\"2.2/\" diff --git a/src/tk/makefile b/src/tk/makefile index 344c37c..37989d2 100644 --- a/src/tk/makefile +++ b/src/tk/makefile @@ -29,12 +29,11 @@ CC = gcc -CFLAGS = -I. -I$(XINCLUDE) -I$(TCL_DIR) -O3 -DTK_VERSION=\"2.3\" -DUSE_XPM3 -DIS_LINUX -#CFLAGS = -I. -I$(XINCLUDE) -I$(TCL_DIR) -g -DTK_VERSION=\"2.3\" -DUSE_XPM3 -DIS_LINUX +CFLAGS = -I. -I/usr/local/include -I$(XINCLUDE) -I$(TCL_DIR) -O3 -DTK_VERSION=\"2.3\" -DUSE_XPM3 -DIS_LINUX TCL_DIR = ../tcl -XINCLUDE = /usr/include/X11 -XLIB = -L/usr/X11R6/lib -lX11 -lXpm +XINCLUDE = /usr/local/include/X11 +XLIB = -L/usr/local/lib -lX11 -lXpm LIBS = libtk.a $(TCL_DIR)/libtcl.a LINKS = $(LIBS)