OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /or1k/trunk/insight/itcl/itcl/mac
    from Rev 578 to Rev 1765
    Reverse comparison

Rev 578 → Rev 1765

/itclMacApplication.r
0,0 → 1,99
/*
* tclMacApplication.r --
*
* This file creates resources for use Tcl Shell application.
* It should be viewed as an example of how to create a new
* Tcl application using the shared Tcl libraries.
*
* Copyright (c) 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* SCCS: @(#) tclMacApplication.r 1.1 96/09/11 21:12:54
*/
 
#include <Types.r>
#include <SysTypes.r>
 
/*
* The folowing include and defines help construct
* the version string for Tcl.
*/
 
#define RESOURCE_INCLUDED
#include "tcl.h"
#include "itcl.h"
#include "itclPatch.h"
 
/* Should really have one of these in itcl too, but for now... */
 
#if (TCL_RELEASE_LEVEL == 0)
# define RELEASE_LEVEL alpha
#elif (TCL_RELEASE_LEVEL == 1)
# define RELEASE_LEVEL beta
#elif (TCL_RELEASE_LEVEL == 2)
# define RELEASE_LEVEL final
#endif
 
#if (TCL_RELEASE_LEVEL == 2)
# define MINOR_VERSION (ITCL_MINOR_VERSION * 16) + TCL_RELEASE_SERIAL
#else
# define MINOR_VERSION ITCL_MINOR_VERSION * 16
#endif
 
resource 'vers' (1) {
ITCL_MAJOR_VERSION, MINOR_VERSION,
RELEASE_LEVEL, 0x00, verUS,
ITCL_PATCH_LEVEL,
 
};
 
resource 'vers' (2) {
ITCL_MAJOR_VERSION, MINOR_VERSION,
RELEASE_LEVEL, 0x00, verUS,
ITCL_PATCH_LEVEL,
 
};
 
#define ITCL_APP_CREATOR 'ITcL'
 
type ITCL_APP_CREATOR as 'STR ';
resource ITCL_APP_CREATOR (0, purgeable) {
 
};
 
/*
* The 'kind' resource works with a 'BNDL' in Macintosh Easy Open
* to affect the text the Finder displays in the "kind" column and
* file info dialog. This information will be applied to all files
* with the listed creator and type.
*/
 
resource 'kind' (128, "Itcl kind", purgeable) {
ITCL_APP_CREATOR,
0, /* region = USA */
{
'APPL', "Itcl Shell",
}
};
 
/*
* The following resource is used when creating the 'env' variable in
* the Macintosh environment. The creation mechanisim looks for the
* 'STR#' resource named "Tcl Environment Variables" rather than a
* specific resource number. (In other words, feel free to change the
* resource id if it conflicts with your application.) Each string in
* the resource must be of the form "KEYWORD=SOME STRING". See Tcl
* documentation for futher information about the env variable.
*
* A good example of something you may want to set is: "TCL_LIBRARY=My
* disk:etc."
*/
resource 'STR#' (128, "Tcl Environment Variables") {
{ "SCHEDULE_NAME=Agent Controller Schedule",
"SCHEDULE_PATH=Lozoya:System Folder:Tcl Lib:Tcl-Scheduler"
};
};
 
itclMacApplication.r Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: itclMacLibrary.r =================================================================== --- itclMacLibrary.r (nonexistent) +++ itclMacLibrary.r (revision 1765) @@ -0,0 +1,154 @@ +/* + * tclMacLibrary.r -- + * + * This file creates resources used by the Tcl shared library. + * Many thanks go to "Jay Lieske, Jr." who + * wrote the initial version of this file. + * + * Copyright (c) 1996 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * SCCS: @(#) tclMacLibrary.r 1.3 96/09/12 17:40:07 + */ + +#include +#include + +/* + * The folowing include and defines help construct + * the version string for Tcl. + */ + +#define RESOURCE_INCLUDED +#include "tcl.h" +#include "itcl.h" + +#if (TCL_RELEASE_LEVEL == 0) +# define RELEASE_LEVEL alpha +#elif (TCL_RELEASE_LEVEL == 1) +# define RELEASE_LEVEL beta +#elif (TCL_RELEASE_LEVEL == 2) +# define RELEASE_LEVEL final +#endif + +#if (TCL_RELEASE_LEVEL == 2) +# define MINOR_VERSION (ITCL_MINOR_VERSION * 16) + TCL_RELEASE_SERIAL +#else +# define MINOR_VERSION ITCL_MINOR_VERSION * 16 +#endif + +resource 'vers' (1) { + ITCL_MAJOR_VERSION, MINOR_VERSION, + RELEASE_LEVEL, 0x00, verUS, + ITCL_PATCH_LEVEL, + ITCL_PATCH_LEVEL ", by Michael McLennan © Lucent Technologies, Inc." +}; + +resource 'vers' (2) { + ITCL_MAJOR_VERSION, MINOR_VERSION, + RELEASE_LEVEL, 0x00, verUS, + ITCL_PATCH_LEVEL, + "Itcl Shell " ITCL_PATCH_LEVEL " © 1993-1998" +}; + + +/* + * Currently the creator for all Tcl/Tk libraries and extensions + * should be 'TclL'. This will allow those extension and libraries + * to use the common icon for Tcl extensions. However, this signature + * still needs to be approved by the signature police at Apple and may + * change. + */ +#define ITCL_CREATOR 'ITcL' +#define TCL_LIBRARY_RESOURCES 2000 +#define ITCL_LIBRARY_RESOURCES 2000 + +/* + * The 'BNDL' resource is the primary link between a file's + * creator/type and its icon. This resource acts for all Tcl shared + * libraries; other libraries will not need one and ought to use + * custom icons rather than new file types for a different appearance. + */ + +resource 'BNDL' (TCL_LIBRARY_RESOURCES, "Tcl bundle", purgeable) +{ + ITCL_CREATOR, + 0, + { /* array TypeArray: 2 elements */ + /* [1] */ + 'FREF', + { /* array IDArray: 1 elements */ + /* [1] */ + 0, TCL_LIBRARY_RESOURCES + }, + /* [2] */ + 'ICN#', + { /* array IDArray: 1 elements */ + /* [1] */ + 0, TCL_LIBRARY_RESOURCES + } + } +}; + +resource 'FREF' (TCL_LIBRARY_RESOURCES, purgeable) +{ + 'shlb', 0, "" +}; + +type ITCL_CREATOR as 'STR '; +resource ITCL_CREATOR (0, purgeable) { + "Itcl Library " ITCL_PATCH_LEVEL " © 1993-1998" +}; + +/* + * The 'kind' resource works with a 'BNDL' in Macintosh Easy Open + * to affect the text the Finder displays in the "kind" column and + * file info dialog. This information will be applied to all files + * with the listed creator and type. + */ + +resource 'kind' (TCL_LIBRARY_RESOURCES, "Itcl kind", purgeable) { + ITCL_CREATOR, + 0, /* region = USA */ + { + 'shlb', "Itcl Library" + } +}; + + +/* + * The -16397 string will be displayed by Finder when a user + * tries to open the shared library. The string should + * give the user a little detail about the library's capabilities + * and enough information to install the library in the correct location. + * A similar string should be placed in all shared libraries. + */ +resource 'STR ' (-16397, purgeable) { + "Itcl Library\n\n" + "This is one of the libraries needed to run the Itcl flavor of the Tool Command Language programs. " + "To work properly, it should be placed in the ŒTool Command Languageč folder " + "within the Extensions folder." +}; + +/* + * The mechanisim below loads Tcl source into the resource fork of the + * application. The example below creates a TEXT resource named + * "Init" from the file "init.tcl". This allows applications to use + * Tcl to define the behavior of the application without having to + * require some predetermined file structure - all needed Tcl "files" + * are located within the application. To source a file for the + * resource fork the source command has been modified to support + * sourcing from resources. In the below case "source -rsrc {Init}" + * will load the TEXT resource named "Init". + */ + +#include "itclMacTclCode.r" + +data 'TEXT' (ITCL_LIBRARY_RESOURCES+1,"pkgIndex",purgeable, preload) { + "# Tcl package index file, version 1.0\n" + "package ifneeded Itcl 3.0 [list load [file join $dir itcl30[info sharedlibextension]] Itcl]\n" +}; + +
itclMacLibrary.r Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: itclMacResource.r =================================================================== --- itclMacResource.r (nonexistent) +++ itclMacResource.r (revision 1765) @@ -0,0 +1,94 @@ +/* + * tclMacResource.r -- + * + * This file creates resources for use in a simple shell. + * This is designed to be an example of using the Tcl libraries + * statically in a Macintosh Application. For an example of + * of using the dynamic libraries look at tclMacApplication.r. + * + * Copyright (c) 1993-94 Lockheed Missle & Space Company + * Copyright (c) 1994-96 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * SCCS: @(#) tclMacResource.r 1.14 96/09/11 21:14:36 + */ + +#include +#include + +/* + * The folowing include and defines help construct + * the version string for Tcl. + */ + +#define RESOURCE_INCLUDED +#include "tcl.h" +#include "itcl.h" +#include "itclPatch.h" + +#if (TCL_RELEASE_LEVEL == 0) +# define RELEASE_LEVEL alpha +#elif (TCL_RELEASE_LEVEL == 1) +# define RELEASE_LEVEL beta +#elif (TCL_RELEASE_LEVEL == 2) +# define RELEASE_LEVEL final +#endif + +#if (TCL_RELEASE_LEVEL == 2) +# define MINOR_VERSION (ITCL_MINOR_VERSION * 16) + TCL_RELEASE_SERIAL +#else +# define MINOR_VERSION ITCL_MINOR_VERSION * 16 +#endif + +resource 'vers' (1) { + ITCL_MAJOR_VERSION, MINOR_VERSION, + RELEASE_LEVEL, 0x00, verUS, + ITCL_PATCH_LEVEL, + ITCL_PATCH_LEVEL ", by Michael McLennan © Lucent Technologies, Inc." +}; + +resource 'vers' (2) { + ITCL_MAJOR_VERSION, MINOR_VERSION, + RELEASE_LEVEL, 0x00, verUS, + ITCL_PATCH_LEVEL, + "Simple Itcl Shell " ITCL_PATCH_LEVEL " © 1993-1998" +}; + +#define TCL_LIBRARY_RESOURCES 1000 +#define ITCL_LIBRARY_RESOURCES 2000 + +/* + * The mechanisim below loads Tcl source into the resource fork of the + * application. The example below creates a TEXT resource named + * "Init" from the file "init.tcl". This allows applications to use + * Tcl to define the behavior of the application without having to + * require some predetermined file structure - all needed Tcl "files" + * are located within the application. To source a file for the + * resource fork the source command has been modified to support + * sourcing from resources. In the below case "source -rsrc {Init}" + * will load the TEXT resource named "Init". + */ +read 'TEXT' (TCL_LIBRARY_RESOURCES, "Init", purgeable, preload) ":::tcl" TCL_VERSION ":library:init.tcl"; +read 'TEXT' (ITCL_LIBRARY_RESOURCES, "itcl", purgeable,preload) "::library:itcl.tcl"; + +/* + * The following resource is used when creating the 'env' variable in + * the Macintosh environment. The creation mechanisim looks for the + * 'STR#' resource named "Tcl Environment Variables" rather than a + * specific resource number. (In other words, feel free to change the + * resource id if it conflicts with your application.) Each string in + * the resource must be of the form "KEYWORD=SOME STRING". See Tcl + * documentation for futher information about the env variable. + * + * A good example of something you may want to set is: "TCL_LIBRARY=My + * disk:etc." + */ + +resource 'STR#' (128, "Tcl Environment Variables") { + { "SCHEDULE_NAME=Agent Controller Schedule", + "SCHEDULE_PATH=Lozoya:System Folder:Tcl Lib:Tcl-Scheduler" + }; +}; +
itclMacResource.r Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: itclStaticApplication.r =================================================================== --- itclStaticApplication.r (nonexistent) +++ itclStaticApplication.r (revision 1765) @@ -0,0 +1,26 @@ +/* + * itkStaticPkgIndex.r -- + * + * This file creates resources which bind in the static version of the + * pkgIndex files. + * + * Copyright (c) 1996 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * SCCS: @(#) tkMacLibrary.r 1.5 96/10/03 17:54:21 + */ + +#include +#include +#include + +#define ITCL_LIBRARY_RESOURCES 2500 + +#include "itclMacTclCode.r" + +data 'TEXT' (ITCL_LIBRARY_RESOURCES+20,"itcl:pkgIndex",purgeable, preload) { + "# Tcl package index file, version 1.0\n" + "package ifneeded Itcl 2.2 {load {} Itcl}\n" +};
itclStaticApplication.r Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: tclMacAppInit.c =================================================================== --- tclMacAppInit.c (nonexistent) +++ tclMacAppInit.c (revision 1765) @@ -0,0 +1,227 @@ +/* + * tclMacAppInit.c -- + * + * Provides a version of the Tcl_AppInit procedure for the example shell. + * + * Copyright (c) 1993-1994 Lockheed Missle & Space Company, AI Center + * Copyright (c) 1995-1997 Sun Microsystems, Inc. + * + * See the file "license.terms" for information on usage and redistribution + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * + * SCCS: @(#) tclMacAppInit.c 1.20 97/07/28 11:03:58 + */ + +/* include tclInt.h for access to namespace API */ +#include "tclInt.h" + +#include "tclInt.h" +#include "tclPort.h" +#include "tclMac.h" +#include "tclMacInt.h" + +#include "itcl.h" + +#if defined(THINK_C) +# include +#elif defined(__MWERKS__) +# include +short InstallConsole _ANSI_ARGS_((short fd)); +#endif + +#ifdef TCL_TEST +EXTERN int TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +EXTERN int Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +#endif /* TCL_TEST */ + +/* + * Forward declarations for procedures defined later in this file: + */ + +static int MacintoshInit _ANSI_ARGS_((void)); + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * Main program for tclsh. This file can be used as a prototype + * for other applications using the Tcl library. + * + * Results: + * None. This procedure never returns (it exits the process when + * it's done. + * + * Side effects: + * This procedure initializes the Macintosh world and then + * calls Tcl_Main. Tcl_Main will never return except to exit. + * + *---------------------------------------------------------------------- + */ + +void +main( + int argc, /* Number of arguments. */ + char **argv) /* Array of argument strings. */ +{ + char *newArgv[2]; + + if (MacintoshInit() != TCL_OK) { + Tcl_Exit(1); + } + + argc = 1; + newArgv[0] = "itclsh"; + newArgv[1] = NULL; + Tcl_Main(argc, newArgv, Tcl_AppInit); +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. + * Most applications, especially those that incorporate additional + * packages, will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error + * message in interp->result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit( + Tcl_Interp *interp) /* Interpreter for application. */ +{ + if (Tcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + +#ifdef TCL_TEST + if (Tcltest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init, + (Tcl_PackageInitProc *) NULL); + if (TclObjTest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#endif /* TCL_TEST */ + + /* + * Call the init procedures for included packages. Each call should + * look like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. + */ + if (Itcl_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticPackage(interp, "Itcl", Itcl_Init, Itcl_SafeInit); + + /* + * This is itclsh, so import all [incr Tcl] commands by + * default into the global namespace. Fix up the autoloader + * to do the same. + */ + if (Tcl_Import(interp, Tcl_GetGlobalNamespace(interp), + "::itcl::*", /* allowOverwrite */ 1) != TCL_OK) { + return TCL_ERROR; + } + + if (Tcl_Eval(interp, "auto_mkindex_parser::slavehook { _%@namespace import -force ::itcl::* }") != TCL_OK) { + return TCL_ERROR; + } + + /* + * Call Tcl_CreateCommand for application-specific commands, if + * they weren't already created by the init procedures called above. + * Each call would loo like this: + * + * Tcl_CreateCommand(interp, "tclName", CFuncCmd, NULL, NULL); + */ + + /* + * Specify a user-specific startup script to invoke if the application + * is run interactively. On the Mac we can specifiy either a TEXT resource + * which contains the script or the more UNIX like file location + * may also used. (I highly recommend using the resource method.) + */ + + Tcl_SetVar(interp, "tcl_rcRsrcName", "itclshrc", TCL_GLOBAL_ONLY); + /* Tcl_SetVar(interp, "tcl_rcFileName", "~/.itclshrc", TCL_GLOBAL_ONLY); */ + + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * + * MacintoshInit -- + * + * This procedure calls initalization routines to set up a simple + * console on a Macintosh. This is necessary as the Mac doesn't + * have a stdout & stderr by default. + * + * Results: + * Returns TCL_OK if everything went fine. If it didn't the + * application should probably fail. + * + * Side effects: + * Inits the appropiate console package. + * + *---------------------------------------------------------------------- + */ + +static int +MacintoshInit() +{ +#if GENERATING68K && !GENERATINGCFM + SetApplLimit(GetApplLimit() - (TCL_MAC_68K_STACK_GROWTH)); +#endif + MaxApplZone(); + +#if defined(THINK_C) + + /* Set options for Think C console package */ + /* The console package calls the Mac init calls */ + console_options.pause_atexit = 0; + console_options.title = "\pTcl Interpreter"; + +#elif defined(__MWERKS__) + + /* Set options for CodeWarrior SIOUX package */ + SIOUXSettings.autocloseonquit = true; + SIOUXSettings.showstatusline = true; + SIOUXSettings.asktosaveonclose = false; + InstallConsole(0); + SIOUXSetTitle("\pTcl Interpreter"); + +#elif defined(applec) + + /* Init packages used by MPW SIOW package */ + InitGraf((Ptr)&qd.thePort); + InitFonts(); + InitWindows(); + InitMenus(); + TEInit(); + InitDialogs(nil); + InitCursor(); + +#endif + + Tcl_MacSetEventProc((Tcl_MacConvertEventPtr) SIOUXHandleOneEvent); + + /* No problems with initialization */ + return TCL_OK; +}
tclMacAppInit.c Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: itclMacTclCode.r =================================================================== --- itclMacTclCode.r (nonexistent) +++ itclMacTclCode.r (revision 1765) @@ -0,0 +1,32 @@ +/* + * itclMacTclCode.r + * + * This file includes the Itcl code that is needed to startup Tcl. + * It is to be included either in the resource fork of the shared library, or in the + * resource fork of the application for a statically bound application. + * + * Jim Ingham + * Lucent Technologies 1996 + * + */ + +#include +#include + + + +#define ITCL_LIBRARY_RESOURCES 2500 + +/* + * The mechanisim below loads Tcl source into the resource fork of the + * application. The example below creates a TEXT resource named + * "Init" from the file "init.tcl". This allows applications to use + * Tcl to define the behavior of the application without having to + * require some predetermined file structure - all needed Tcl "files" + * are located within the application. To source a file for the + * resource fork the source command has been modified to support + * sourcing from resources. In the below case "source -rsrc {Init}" + * will load the TEXT resource named "Init". + */ + +read 'TEXT' (ITCL_LIBRARY_RESOURCES, "itcl", purgeable,preload) "::library:itcl.tcl";
itclMacTclCode.r Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: pkgIndex.tcl =================================================================== --- pkgIndex.tcl (nonexistent) +++ pkgIndex.tcl (revision 1765) @@ -0,0 +1,3 @@ +# Tcl package index file, version 1.0 + +package ifneeded Itcl 3.0 [list load [file join $dir itcl30[info sharedlibextension]] Itcl]
pkgIndex.tcl Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.