[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Some patches and comments for tcl-8.4.0

From: Mike Castle
Subject: [Help-smalltalk] Some patches and comments for tcl-8.4.0
Date: Tue, 22 Oct 2002 01:15:57 -0700
User-agent: Mutt/1.4i

The following is what I use to build smalltalk-2.0.7 against tcl/tk 8.4.0.

First, the calls to Tk_PhotoPutBlock changed.  However, a simple #define
will allow for the old calls to work.  Having it always #defined should be

Tcl_CmdProc has changed, where **argv is now const **argv.  Apparently
either CONST or CONST84 will work in place.  Should probably put a

#ifndef CONST84
#define CONST84

in the appropriate place.

Don't remember if it was that new const or other things wanting consts now,
but some internal gst functions got const added to them.  I only did the
minimal necessary to compile.  However, it probably would not be a bad idea
to audit the code and put more around where appropriate.  Then again, I
think const is strongly underused.

Finally, I don't understand why anyone would ever prototype static
functions (except in the case where there is recursion across multiple
functions).  In this case, I simply removed it.  Notice how the prototype
and the function itself had different declarations?  Sure, in the past they
worked, but it was completely accidental.  And the fact that they got out
of sync shows precisely how silly it is.  Why increase the workload when
there is no need?


patch -p1 << \EOF
diff -ru smalltalk-2.0.7.orig/blox/tk/BloxTK.c smalltalk-2.0.7/blox/tk/BloxTK.c
--- smalltalk-2.0.7.orig/blox/tk/BloxTK.c       2002-07-14 04:45:59.000000000 
+++ smalltalk-2.0.7/blox/tk/BloxTK.c    2002-10-22 00:27:36.000000000 -0700
@@ -67,6 +67,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <tcl.h>
 #include <tk.h>
@@ -80,7 +81,7 @@
 /* TCL callbacks */
 static int doCallback (ClientData clientData, Tcl_Interp * interp, int argc,
-                      char **argv);
+                      CONST84 char **argv);
 static int xpmFileMatch (Tcl_Channel channel, char *fileName,
                         char *formatString, int *widthPtr, int *heightPtr);
 static int xpmStringMatch (char *string, char *formatString, int *widthPtr,
@@ -107,7 +108,7 @@
-doCallback (ClientData clientData, Tcl_Interp * interp, int argc, char **argv)
+doCallback (ClientData clientData, Tcl_Interp * interp, int argc, CONST84 char 
   OOP oop, *args;
   int i;
@@ -270,9 +271,6 @@
 static void ParseNumericColor (char *str,
                               int *prgb);
-static void ParseXColor (char *str,
-                        int *prgb);
 ParseNumericColor (char *str, int *prgb)
diff -ru smalltalk-2.0.7.orig/libgst/callin.c smalltalk-2.0.7/libgst/callin.c
--- smalltalk-2.0.7.orig/libgst/callin.c        2002-07-14 04:45:50.000000000 
+++ smalltalk-2.0.7/libgst/callin.c     2002-10-22 00:34:11.000000000 -0700
@@ -555,7 +555,7 @@
 /* !!! Add in byteArray support sometime soon */
-_gst_string_to_oop (char *str)
+_gst_string_to_oop (const char *str)
   if (!_gst_smalltalk_initialized)
     gst_init_smalltalk ();
@@ -580,7 +580,7 @@
-_gst_symbol_to_oop (char *str)
+_gst_symbol_to_oop (const char *str)
   if (!_gst_smalltalk_initialized)
     gst_init_smalltalk ();
diff -ru smalltalk-2.0.7.orig/libgst/callin.h smalltalk-2.0.7/libgst/callin.h
--- smalltalk-2.0.7.orig/libgst/callin.h        2002-07-14 04:45:51.000000000 
+++ smalltalk-2.0.7/libgst/callin.h     2002-10-22 00:33:49.000000000 -0700
@@ -135,10 +135,10 @@
 extern OOP _gst_bool_to_oop (int b);
 extern OOP _gst_char_to_oop (char c);
 extern OOP _gst_class_name_to_oop (char *name);
-extern OOP _gst_string_to_oop (char *str);
+extern OOP _gst_string_to_oop (const char *str);
 extern OOP _gst_byte_array_to_oop (char *str,
                                   int n);
-extern OOP _gst_symbol_to_oop (char *str);
+extern OOP _gst_symbol_to_oop (const char *str);
 extern OOP _gst_c_object_to_oop (PTR co);
 extern OOP _gst_type_name_to_oop (char *name);
 extern void _gst_set_c_object (OOP oop, PTR co);
diff -ru smalltalk-2.0.7.orig/libgst/dict.c smalltalk-2.0.7/libgst/dict.c
--- smalltalk-2.0.7.orig/libgst/dict.c  2002-09-09 10:45:26.000000000 -0700
+++ smalltalk-2.0.7/libgst/dict.c       2002-10-22 00:27:36.000000000 -0700
@@ -1564,7 +1564,7 @@
-_gst_string_new (char *s)
+_gst_string_new (const char *s)
   gst_string string;
   int len;
diff -ru smalltalk-2.0.7.orig/libgst/dict.h smalltalk-2.0.7/libgst/dict.h
--- smalltalk-2.0.7.orig/libgst/dict.h  2002-07-14 04:45:51.000000000 -0700
+++ smalltalk-2.0.7/libgst/dict.h       2002-10-22 00:27:36.000000000 -0700
@@ -266,7 +266,7 @@
 /* Creates a String object starting from the NUL-terminated string
    S. */
-extern OOP _gst_string_new (char *s);
+extern OOP _gst_string_new (const char *s);
 /* Look in the Smalltalk dictionary for a class whose name is in the
    Symbol CLASSNAMEOOP. */
diff -ru smalltalk-2.0.7.orig/libgst/gstpub.h smalltalk-2.0.7/libgst/gstpub.h
--- smalltalk-2.0.7.orig/libgst/gstpub.h        2002-07-14 04:45:50.000000000 
+++ smalltalk-2.0.7/libgst/gstpub.h     2002-10-22 00:27:36.000000000 -0700
@@ -103,10 +103,10 @@
   OOP (*boolToOOP) __PROTO ((int b));
   OOP (*charToOOP) __PROTO ((char c));
   OOP (*classNameToOOP) __PROTO ((char *name));
-  OOP (*stringToOOP) __PROTO ((char *str));
+  OOP (*stringToOOP) __PROTO ((const char *str));
   OOP (*byteArrayToOOP) __PROTO ((char *str,
                                  int n));
-  OOP (*symbolToOOP) __PROTO ((char *str));
+  OOP (*symbolToOOP) __PROTO ((const char *str));
   OOP (*cObjectToOOP) __PROTO ((PTR co));
   OOP (*typeNameToOOP) __PROTO ((char *name));
   void (*setCObject) __PROTO ((OOP oop, PTR co));

     Mike Castle      address@hidden
    We are all of us living in the shadow of Manhattan.  -- Watchmen
fatal ("You are in a maze of twisty compiler features, all different"); -- gcc

reply via email to

[Prev in Thread] Current Thread [Next in Thread]