home *** CD-ROM | disk | FTP | other *** search
- /*
- * main.c
- * Kick off program.
- *
- * Copyright (c) 1996 Systems Architecture Research Centre,
- * City University, London, UK.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * Written by Tim Wilkinson <tim@sarc.city.ac.uk>, February 1996.
- */
-
- #include <stdio.h>
- #include <assert.h>
- #include "gtypes.h"
- #include "classMethod.h"
- #include "baseClasses.h"
- #include "lookup.h"
- #include "object.h"
- #include "thread.h"
-
- #define MAIN "main"
- #define MAINSIG "([Ljava/lang/String;)V"
-
- extern classes* StringClass;
-
- /*
- * MAIN
- */
- main(int argc, char* argv[])
- {
- classes* class;
- void* func;
- object* args;
- stringClass** str;
- int i;
-
- /* Get the class name to start with */
- if (argc < 2) {
- fprintf(stderr, "No class specified.\n");
- exit(1);
- }
-
- /* Convert any '.' in name to '/' */
- classname2pathname(argv[1], argv[1]);
-
- /* Initialise */
- initialise();
-
- /* Build an array of strings as the arguments */
- args = alloc_objectarray(argc-2, StringClass->sig);
-
- /* Build each string and put into the array */
- str = (stringClass**)args->data;
- for (i = 2; i < argc; i++) {
- str[i-2] = (stringClass*)makeJavaString(argv[i], strlen(argv[i]));
- }
-
- /* Kick it */
- do_execute_java_class_method(argv[1], MAIN, MAINSIG, args);
- killThread(currentThread);
- /* This should never return */
- exit(1);
- }
-