How can I run a Headless Squeak app?
Lex Spoon
lex at cc.gatech.edu
Fri Apr 23 14:20:37 UTC 1999
Bolot Kerimbaev <bolot at cc.gatech.edu> wrote:
> Open the image with the normal VM, do magic, then open image with headless.
>
> Now, magic: three ways:
>
> 1. specify .st file to run at start-up
> - but may not work: last time I checked the file name was not passed...
Bolot's right: we had some trouble with this on Unix at Tech. Apparently, the convention for passing parameters has evolved since Ian Piumarta originally added them to his VM.
Below is a patch that we've been using at Georgia Tech. With this applied to the sources, the startup mechanism seems to work fine.
Ian: whaddya think?
Lex
--- sqXWindow.c.orig Mon Mar 8 11:24:50 1999
+++ sqXWindow.c Mon Mar 29 17:42:58 1999
@@ -2426,22 +2426,22 @@
int attributeSize(int id)
{
- if (id + 1 >= initialArgc) return 0;
+ if (id+1 > initialArgc) return 0;
if (id < 0)
return strlen(getSpecialAttribute(-id));
else
- return strlen(initialArgv[id + 1]);
+ return strlen(initialArgv[id]);
}
int getAttributeIntoLength(int id, int byteArrayIndex, int length)
{
char *attrIndex= (char *)byteArrayIndex;
char *arg;
- if (id + 1>= initialArgc) return 0;
+ if (id+1 > initialArgc) return 0;
if (id < 0)
arg= getSpecialAttribute(-id);
else
- arg= initialArgv[id + 1];
+ arg= initialArgv[id];
while (length--)
*attrIndex++= *arg++;
return 0;
@@ -2554,8 +2554,11 @@
contextCacheEntries= stackCacheEntries;
#endif
+ /* skip VM name */
+ initialArgv[initialArgc++] = *argv;
+ argv++;
argc--;
- argv++; /* skip VM name */
+
while (argc && **argv == '-') /* more options to parse */
{
@@ -2663,16 +2666,25 @@
--argc;
}
+ /* get the image name */
if (argc)
{
strcpy(shortImageName, *argv);
initialArgv[initialArgc++]= *argv++;
--argc;
}
- initialArgv[initialArgc]= (char *)0;
-
if (0 == strstr(shortImageName, ".image"))
strcat(shortImageName, ".image");
+
+
+ /* the rest of the arguments are arguments for Squeak */
+ while(argc) {
+ initialArgv[initialArgc++]= *argv++;
+ --argc;
+ }
+
+ initialArgv[initialArgc]= (char *)0;
+
}
/*** Segmentation fault handler ***/
More information about the Squeak-dev
mailing list
|