示例#1
0
double Jxgetmouse::getYCoordinate (JavaVM * jvm_){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID jdoublegetYCoordinateID = curEnv->GetStaticMethodID(cls, "getYCoordinate", "()D" ) ;
if (jdoublegetYCoordinateID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "getYCoordinate");
}

                        jdouble res =  static_cast<jdouble>( curEnv->CallStaticDoubleMethod(cls, jdoublegetYCoordinateID ));
                        if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
return res;

}
示例#2
0
int DatatipCreate::createDatatipProgramIndex (JavaVM * jvm_, int polylineUid, int indexPoint){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID jintcreateDatatipProgramIndexjintintjintintID = curEnv->GetStaticMethodID(cls, "createDatatipProgramIndex", "(II)I" ) ;
if (jintcreateDatatipProgramIndexjintintjintintID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "createDatatipProgramIndex");
}

                        jint res =  static_cast<jint>( curEnv->CallStaticIntMethod(cls, jintcreateDatatipProgramIndexjintintjintintID ,polylineUid, indexPoint));
                        if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
return res;

}
示例#3
0
int Jxgetmouse::getWindowsID (JavaVM * jvm_){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID jintgetWindowsIDID = curEnv->GetStaticMethodID(cls, "getWindowsID", "()I" ) ;
if (jintgetWindowsIDID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "getWindowsID");
}

                        jint res =  static_cast<jint>( curEnv->CallStaticIntMethod(cls, jintgetWindowsIDID ));
                        if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
return res;

}
示例#4
0
void DatatipCreate::datatipSetInterp (JavaVM * jvm_, int datatipUid, bool interpMode){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID voiddatatipSetInterpjintintjbooleanbooleanID = curEnv->GetStaticMethodID(cls, "datatipSetInterp", "(IZ)V" ) ;
if (voiddatatipSetInterpjintintjbooleanbooleanID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "datatipSetInterp");
}

jboolean interpMode_ = (static_cast<bool>(interpMode) ? JNI_TRUE : JNI_FALSE);

                         curEnv->CallStaticVoidMethod(cls, voiddatatipSetInterpjintintjbooleanbooleanID ,datatipUid, interpMode_);
                        if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
}
示例#5
0
int ScilabOperations::add (JavaVM * jvm_, int idA, int idB){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID jintaddjintintjintintID = curEnv->GetStaticMethodID(cls, "add", "(II)I" ) ;
if (jintaddjintintjintintID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "add");
}

                        jint res =  static_cast<jint>( curEnv->CallStaticIntMethod(cls, jintaddjintintjintintID ,idA, idB));
                        if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
return res;

}
示例#6
0
bool Juigetfile::isMultipleSelection (JavaVM * jvm_){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID jbooleanisMultipleSelectionID = curEnv->GetStaticMethodID(cls, "isMultipleSelection", "()Z" ) ;
if (jbooleanisMultipleSelectionID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "isMultipleSelection");
}

                        jboolean res =  static_cast<jboolean>( curEnv->CallStaticBooleanMethod(cls, jbooleanisMultipleSelectionID ));
                        if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
return (res == JNI_TRUE);

}
示例#7
0
void SwingView::setHeadless (JavaVM * jvm_, bool headless){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID voidsetHeadlessjbooleanbooleanID = curEnv->GetStaticMethodID(cls, "setHeadless", "(Z)V" ) ;
if (voidsetHeadlessjbooleanbooleanID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "setHeadless");
}

jboolean headless_ = (static_cast<bool>(headless) ? JNI_TRUE : JNI_FALSE);

                         curEnv->CallStaticVoidMethod(cls, voidsetHeadlessjbooleanbooleanID ,headless_);
                        if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
}
示例#8
0
SOM_Scope Meeting*  SOMLINK getNewMeeting(PersistentAppointmentBookFactory *somSelf,
                                           Environment *ev, string name)
{
    PersistentMeeting                               *PstMeeting=NULL;
    somPersistenceDB2_PID_DB2                       *pidMeeting;         // DB2 PID for DB2 data store

    /* PersistentAppointmentBookFactoryData *somThis = PersistentAppointmentBookFactoryGetData(somSelf); */
    PersistentAppointmentBookFactoryMethodDebug("PersistentAppointmentBookFactory","getNewMeeting");

    initClass();

    // Prepare pid. It will be freed by IPO when the object is somFreed
    //********************************************************************* DB2 PID
    // Changes for DB2 Backing Store                                        DB2 PID
    //                                                                      DB2 PID
    // The following lines create the PID for using a DB2 backing store.    DB2 PID
    // The _set_dbalias set the database name/alias to be used.             DB2 PID
    // The _set_schema_mapper identifies the schema mapper to be used.      DB2 PID
    // The third part of the DB2 PID is a stream that contains the          DB2 PID
    // information that is needed to uniquely identify the object in the    DB2 PID
    // database.  In this case, we are using the contents of the string     DB2 PID
    // 'name' as the only key to the database.  If you had multiple keys    DB2 PID
    // to the database, you can append the additional key information by    DB2 PID
    // using subsequent write_<type> method calls to place the info in the  DB2 PID
    // stream.                                                              DB2 PID
    //********************************************************************* DB2 PID
    pidMeeting = new somPersistenceDB2_PID_DB2;                          // DB2 PID
    pidMeeting->_set_dbalias(ev, "CALENDAR");                            // DB2 PID
    pidMeeting->_set_schema_mapper(ev, "AppointmentMapper::smappt");     // DB2 PID
    pidMeeting->write_string(ev,name);                                   // DB2 PID

    // Create a PersistentDistributedAppointmentBook
    PstMeeting = (PersistentMeeting *)(((somPersistence_IPOFactory *)
                       _PersistentMeeting)->createIPO(ev,pidMeeting));

    // Exception checking is omitted here for the clarity purpose

    return((Meeting *)PstMeeting);
 }
示例#9
0
void Jxgetmouse::xgetmouse (JavaVM * jvm_, bool withMotion, bool withRelease){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID voidxgetmousejbooleanbooleanjbooleanbooleanID = curEnv->GetStaticMethodID(cls, "xgetmouse", "(ZZ)V" ) ;
if (voidxgetmousejbooleanbooleanjbooleanbooleanID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "xgetmouse");
}

jboolean withMotion_ = (static_cast<bool>(withMotion) ? JNI_TRUE : JNI_FALSE);

jboolean withRelease_ = (static_cast<bool>(withRelease) ? JNI_TRUE : JNI_FALSE);

                         curEnv->CallStaticVoidMethod(cls, voidxgetmousejbooleanbooleanjbooleanbooleanID ,withMotion_, withRelease_);
                        if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
}
示例#10
0
const GvNameEntry *
GvNameEntry::insert(const char *s)
{
    u_long		h = GvString::hash(s);
    u_long		i;
    GvNameEntry		*entry;
    GvNameEntry		*head;

	// Initialize the critical section.
	if (!lockerInit) { 
		InitializeCriticalSection(&locker); 
		lockerInit = TRUE;
	}
	//TRACE("Enter section\n");

    EnterCriticalSection(&locker); 

    if (nameTableSize == 0)
	    initClass();

    i = h % nameTableSize;
    entry = head = nameTable[i];

    while (entry != NULL) {
	if (entry->hashValue == h && entry->isEqual(s))
	    break;
	entry = entry->next;
    }

    if (entry == NULL) {

	int len = strlen(s) + 1;

	if (len >= CHUNK_SIZE)
	    s = strdup(s);

	else 
	{

	    if (chunk == NULL || chunk->bytesLeft < len) {
		struct GvNameChunk	*newChunk = new GvNameChunk;

		newChunk->curByte   = newChunk->mem;
		newChunk->bytesLeft = CHUNK_SIZE;
		newChunk->next      = chunk;

		chunk = newChunk;
	    }

	    strcpy(chunk->curByte, s);
	    s = chunk->curByte;

	    chunk->curByte   += len;
	    chunk->bytesLeft -= len;
	}

	entry = new GvNameEntry(s, h, head);
	nameTable[i] = entry;
    }

	LeaveCriticalSection(&locker);

    return entry;
}
示例#11
0
void D20StatusSystem::D20StatusInit(objHndl objHnd)
{
	static int debugLol = 0;
	Dispatcher * dispatcher = objects.GetDispatcher(objHnd);
	if (dispatcher != nullptr && (uint32_t)dispatcher != 0xFFFFFFFF)
	{
		return;
	}

	dispatcher = objects.dispatch.DispatcherInit(objHnd);

	objects.SetDispatcher(objHnd, (uint32_t)dispatcher);

	objects.dispatch.DispatcherClearPermanentMods(dispatcher);

	if (objects.IsCritter(objHnd))
	{
	//	hooked_print_debug_message("D20Status Init for %s", description.getDisplayName(objHnd));
		initClass(objHnd);

		initRace(objHnd);

		initFeats(objHnd);

	}
	else
	{
		logger->info("Attempted D20Status Init for non-critter {}", description.getDisplayName(objHnd));
		debugLol++;
		if (debugLol % 1000 == 1)
		{
			auto lololol = 0;
		}
	}

	initItemConditions(objHnd);

	d20StatusSys.D20StatusInitFromInternalFields(objHnd, dispatcher);

	d20ObjRegistrySys.Append(objHnd);

	if (*objects.d20.d20EditorMode != 0){ return; }

	if (objects.IsCritter(objHnd))
	{
		if (!objects.IsDeadNullDestroyed(objHnd))
		{
			int hpCur = static_cast<int>(objects.StatLevelGet(objHnd, stat_hp_current));
			uint32_t subdualDam = objects.getInt32(objHnd, obj_f_critter_subdual_damage);

			if (hpCur != -65535)
			{
				if (hpCur < 0)
				{
					if (feats.HasFeatCount(objHnd, FEAT_DIEHARD))
					{
						_ConditionAdd_NumArgs0(dispatcher, conds.ConditionDisabled);
					}
					else
					{
						_ConditionAdd_NumArgs0(dispatcher, conds.ConditionUnconscious);
					}
				}

				else
				{
					if (hpCur == 0)
					{
						_ConditionAdd_NumArgs0(dispatcher, conds.ConditionDisabled);
					}
					else if (subdualDam > hpCur)
					{
						_ConditionAdd_NumArgs0(dispatcher, conds.ConditionUnconscious);
					}
				}

			}
		}
	}
	return;
}
示例#12
0
GRMSGEXPORT coGRObjSetConnectionMsg::coGRObjSetConnectionMsg(const char *obj_name, const char *connPoint1, const char *connPoint2, int connected, int enabled, const char *obj_name2)
    : coGRObjMsg(SET_CONNECTIONPOINT, obj_name)
{
    initClass(connPoint1, connPoint2, connected, enabled, obj_name2);
}
示例#13
0
GRMSGEXPORT coGRObjSetConnectionMsg::coGRObjSetConnectionMsg(coGRMsg::Mtype type, const char *obj_name, const char *connPoint1, const char *connPoint2, int connected, int enabled, const char *obj_name2)
    : coGRObjMsg(type, obj_name)
{
    initClass(connPoint1, connPoint2, connected, enabled, obj_name2);
}
示例#14
0
void InterpretTest::callDynamicTest()
{
	ConstantPool * pool = new ConstantPool();
	Class * cls = initClass("Counter", pool);
	cls->addField("counter");
	const char code1[] = 
	{
		LOAD_LOCAL, 0x00, // PUSH this
		LOAD, 0x06, 0x00, //PUSH this[0]
		LOAD_LOCAL, 0x01, // PUSH value
		ADD,  // this[0] + value
		LOAD_LOCAL, 0x00, // PUSH this
		STORE, 0x06, 0x00, // this[0] = this[0] + value
		RET_VOID
	};
	const char code2[] = 
	{
		LOAD_LOCAL, 0x00, // PUSH this
		LOAD, 0x06, 0x00, //PUSH this[0]
		RET
	};
	const char code3[] = 
	{
		PUSH, 0x04, 0x00, // PUSH 0
		LOAD_LOCAL, 0x00, // PUSH this
		STORE, 0x06, 0x00,  // this[0] = 0
		RET_VOID
	};
	const char code[] =
	{
		NEW, 0x00, 0x00, //new Counter
		DUP, STORE_LOCAL, 0x00, //a = new Counter
		CALL_DYNAMIC, 0x03, 0x00, //a.init
		LOAD_LOCAL, 0x00,
		PUSH, 0x05, 0x00, //PUSH 3
		CALL_DYNAMIC, 0x01, 0x00, //a.increase(3)
		LOAD_LOCAL, 0x00,
		CALL_DYNAMIC, 0x02, 0x00, //a.getValue
		RET
	};
	Method * m = initMethod("callTest", code, sizeof(code), 0, 1, 0);
	Method * m1 = initMethod("increase", code1, sizeof(code1), 2, 0, 1);
	Method * m2 = initMethod("getValue", code2, sizeof(code2), 1, 1, 1);
	Method * m3 = initMethod("init", code3, sizeof(code3), 1, 1, 1);
	ClassLoader cl("");
	Interpret instance(&cl);
	ClassRef cr;
	memset(cr.name, 0x00, IDENTIFIER_LENGTH);
	sprintf(cr.name, "%s", cls->getName().c_str());
	pool->addItem(&cr, CLASS_REF); //0
	MethodRef mr;
	mr.params = m1->getParamCount();
	sprintf(mr.name, "%s", m1->getName().c_str());
	pool->addItem(&mr, METHOD_REF); //1
	mr.params = m2->getParamCount();
	sprintf(mr.name, "%s", m2->getName().c_str());
	pool->addItem(&mr, METHOD_REF); //2
	mr.params = m3->getParamCount();
	sprintf(mr.name, "%s", m3->getName().c_str());
	pool->addItem(&mr, METHOD_REF); //3
	IntConst i;
	i.value = 0;
	pool->addItem(&i, INT_CONST); //4
	i.value = 3;
	pool->addItem(&i, INT_CONST); //5
	FieldRef fr;
	memset(fr.name, 0x00, IDENTIFIER_LENGTH);
	sprintf(fr.name, "counter");
	pool->addItem(&fr, FIELD_REF); //6
	cls->addMethod(m);
	cls->addMethod(m1);
	cls->addMethod(m2);
	cls->addMethod(m3);
	cl.addClass(cls);
	assert(3 == instance.run(cls->getName().c_str(), m->getName().c_str()));
}
示例#15
0
文件: jam.c 项目: OPSF/uClinux
int main(int argc, char *argv[]) {
    Class *array_class, *main_class;
    Object *system_loader, *array;
    MethodBlock *mb;
    InitArgs args;
    int class_arg;
    char *cpntr;
    int status;
    int i;

    setDefaultInitArgs(&args);
    class_arg = parseCommandLine(argc, argv, &args);

    args.main_stack_base = &array_class;
    initVM(&args);

   if((system_loader = getSystemClassLoader()) == NULL) {
        printf("Cannot create system class loader\n");
        printException();
        exitVM(1);
    }

    mainThreadSetContextClassLoader(system_loader);

    for(cpntr = argv[class_arg]; *cpntr; cpntr++)
        if(*cpntr == '.')
            *cpntr = '/';

    if((main_class = findClassFromClassLoader(argv[class_arg], system_loader)) != NULL)
        initClass(main_class);

    if(exceptionOccurred()) {
        printException();
        exitVM(1);
    }

    mb = lookupMethod(main_class, SYMBOL(main), SYMBOL(_array_java_lang_String__V));
    if(!mb || !(mb->access_flags & ACC_STATIC)) {
        printf("Static method \"main\" not found in %s\n", argv[class_arg]);
        exitVM(1);
    }

    /* Create the String array holding the command line args */

    i = class_arg + 1;
    if((array_class = findArrayClass(SYMBOL(array_java_lang_String))) &&
           (array = allocArray(array_class, argc - i, sizeof(Object*))))  {
        Object **args = (Object**)ARRAY_DATA(array) - i;

        for(; i < argc; i++)
            if(!(args[i] = Cstr2String(argv[i])))
                break;

        /* Call the main method */
        if(i == argc)
            executeStaticMethod(main_class, mb, array);
    }

    /* ExceptionOccurred returns the exception or NULL, which is OK
       for normal conditionals, but not here... */
    if((status = exceptionOccurred() ? 1 : 0))
        printException();

    /* Wait for all but daemon threads to die */
    mainThreadWaitToExitVM();
    exitVM(status);
}
示例#16
0
void Juigetfile::uiputfile (JavaVM * jvm_, char const* const* mask, int maskSize, char const* const* description, int descriptionSize, char const* initialDirectory, char const* boxtTitle, bool multipleSelection){

JNIEnv * curEnv = NULL;
jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL);
jclass cls = initClass(curEnv);
if ( cls == NULL) {
throw GiwsException::JniCallMethodException(curEnv);
}

static jmethodID voiduiputfilejobjectArray_java_lang_Stringjava_lang_StringjobjectArray_java_lang_Stringjava_lang_Stringjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID = curEnv->GetStaticMethodID(cls, "uiputfile", "([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)V" ) ;
if (voiduiputfilejobjectArray_java_lang_Stringjava_lang_StringjobjectArray_java_lang_Stringjava_lang_Stringjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID == NULL) {
throw GiwsException::JniMethodNotFoundException(curEnv, "uiputfile");
}
jclass stringArrayClass = curEnv->FindClass("java/lang/String");

// create java array of strings.
jobjectArray mask_ = curEnv->NewObjectArray( maskSize, stringArrayClass, NULL);
if (mask_ == NULL)
{
throw GiwsException::JniBadAllocException(curEnv);
}

// convert each char * to java strings and fill the java array.
for ( int i = 0; i < maskSize; i++)
{
jstring TempString = curEnv->NewStringUTF( mask[i] );
if (TempString == NULL)
{
throw GiwsException::JniBadAllocException(curEnv);
}

curEnv->SetObjectArrayElement( mask_, i, TempString);

// avoid keeping reference on too many strings
curEnv->DeleteLocalRef(TempString);
}

// create java array of strings.
jobjectArray description_ = curEnv->NewObjectArray( descriptionSize, stringArrayClass, NULL);
if (description_ == NULL)
{
throw GiwsException::JniBadAllocException(curEnv);
}

// convert each char * to java strings and fill the java array.
for ( int i = 0; i < descriptionSize; i++)
{
jstring TempString = curEnv->NewStringUTF( description[i] );
if (TempString == NULL)
{
throw GiwsException::JniBadAllocException(curEnv);
}

curEnv->SetObjectArrayElement( description_, i, TempString);

// avoid keeping reference on too many strings
curEnv->DeleteLocalRef(TempString);
}
jstring initialDirectory_ = curEnv->NewStringUTF( initialDirectory );
if (initialDirectory != NULL && initialDirectory_ == NULL)
{
throw GiwsException::JniBadAllocException(curEnv);
}


jstring boxtTitle_ = curEnv->NewStringUTF( boxtTitle );
if (boxtTitle != NULL && boxtTitle_ == NULL)
{
throw GiwsException::JniBadAllocException(curEnv);
}


jboolean multipleSelection_ = (static_cast<bool>(multipleSelection) ? JNI_TRUE : JNI_FALSE);

                         curEnv->CallStaticVoidMethod(cls, voiduiputfilejobjectArray_java_lang_Stringjava_lang_StringjobjectArray_java_lang_Stringjava_lang_Stringjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID ,mask_, description_, initialDirectory_, boxtTitle_, multipleSelection_);
                        curEnv->DeleteLocalRef(stringArrayClass);
curEnv->DeleteLocalRef(mask_);
curEnv->DeleteLocalRef(description_);
curEnv->DeleteLocalRef(initialDirectory_);
curEnv->DeleteLocalRef(boxtTitle_);
if (curEnv->ExceptionCheck()) {
throw GiwsException::JniCallMethodException(curEnv);
}
}
示例#17
0
BOOL PUBLIC
InitGClass(REG(a0, struct __gClass *gc), REG(a1, APTR *functable), REG(a2, APTR mainpool), REG(a3, APTR gfxbase),
           REG(a6, struct ExecBase *ExecBase), REG(d0, APTR mathbase), REG(d1, APTR mathtrans), REG(d2, APTR utilitybase), REG(d3, APTR localebase),
           REG(d4, long magic))
{
#ifdef IGNITION_LITE_EDITION
    if (magic != MAKE_ID('I', 'G', 'N', '\0') && magic != MAKE_ID('I', 'G', 'L', '\0'))
        return FALSE;
#else
    if (magic != MAKE_ID('I', 'G', 'N', '\0'))
        return FALSE;
#endif

    SysBase = ExecBase;
    GfxBase = gfxbase;
    UtilityBase = utilitybase;
    MathIeeeDoubBasBase = mathbase;
    MathIeeeDoubTransBase = mathtrans;
    LocaleBase = localebase;

    gc->gc_Dispatch = dispatch;
    gc->gc_Draw = draw;
    gc->gc_FreeClass = freeClass;
    gc->gc_Interface = interface;
    gc->gc_InstSize = gc->gc_InstOffset + instanceSize;

    gcBase = functable;
    pool = mainpool;

    // Initialize function pointers
    AllocStringLength = functable[34];
    AllocString = functable[33];
    FreeString = functable[32];
    gDoMethodA = functable[31];
    gDoSuperMethodA = functable[30];
    SetHighColor = functable[29];
    SetColors = functable[28];
    FindColorPen = functable[27];
    DrawRect = functable[26];
    DrawLine = functable[25];
    gAreaMove = functable[24];
    gAreaDraw = functable[23];
    gAreaEnd = functable[22];
    GetDPI = functable[21];
    GetOffset = functable[20];
    FreeFontInfo = functable[19];
    SetFontInfoA = functable[18];
    CopyFontInfo = functable[17];
    NewFontInfoA = functable[16];
    DrawText = functable[15];
    OutlineLength = functable[14];
    OutlineHeight = functable[13];
    pixel = functable[12];
    mm = functable[11];
    CreateTerm = functable[10];
    DeleteTerm = functable[9];
    CopyTerm = functable[8];
    CalcTerm = functable[7];
    gInsertRemoveCellsTablePos = functable[6];
    gInsertRemoveCellsTerm = functable[5];
    TintColor = functable[4];
    gSuperDraw = functable[3];
    gGetLink = functable[2];
    SetLowColor = functable[1];
    SetOutlineColor = functable[0];

    if (!initClass(gc))
        return FALSE;

    return TRUE;
}
RandomMazeRunner::RandomMazeRunner ()
{
  // Call the static class initializer. It will run only the first
  // time it's called.
  initClass();
}
示例#19
0
文件: main.c 项目: fmccabe/l-and-o
/*
 * Go evaluator main program
 */
int main(int argc, char **argv) {
  int narg;

#ifdef HAVE_LOCALECONV
  setlocale(LC_ALL,"");		/* set up locale */
#endif

#ifdef LOCALEDIR
  bindtextdomain(PACKAGE,LOCALEDIR);
  textdomain(PACKAGE);
#endif

  initLogfile((char *) "-");
  initFileIo();        /* Set up special file handling */

  strMsg(entryPoint, NumberOf(entryPoint), "lo.boot@__boot"); /* standard entry point */

  if ((narg = getOptions(argc, argv)) < 0) {
    outMsg(logFile, _("usage: %s [-v] [-L log] [-g host:port] [-V] [-b boot:ver] [-m entry] [-r repo] [-d wd]"
                        " [-h sizeK] [-s sizeK] [-d rootdir] args ...\n"), argv[0]);
    exit(1);
  }

  // Set up repository directory
  if (uniIsLit(repoDir, "")) { // overridden?
    char *dir = getenv("LO_DIR"); /* pick up the installation directory */
    if (dir == NULL)
      dir = LODIR;                  /* Default installation path */
    uniCpy(repoDir, NumberOf(repoDir), dir);
  }

  // set up working directory
  if (uniIsLit(loCWD, "")) {
    char cbuff[MAXPATHLEN];
    char *cwd = getcwd(cbuff, NumberOf(cbuff)); /* compute current starting directory */
    if (cwd == NULL)
      syserr("cant determine current directory");
    else
      strMsg(loCWD, NumberOf(loCWD), "%s/", cwd);
  }

  if (loadManifest(repoDir) != Ok) {
    outMsg(logFile, "error in loading repository from %s", repoDir);
    exit(99);
  }

  /* IMPORTANT -- Keep the order of these set up calls */
  initGlobal(initHeapSize);    /* start up the global space */
  initClass();        /* Initialize the class handlers */
  initPrograms();      /* Initialize program handling */
  initDict();        /* Start up the dictionaries */
  install_escapes();      /* Initialize the escape table */
  initFiles();        /* initialize file tables */
  init_args(argv, argc, narg);    /* Initialize the argument list */
  init_time();        /* Initialize time stuff */

  setupSignals();

#ifdef EXECTRACE
  if (traceCount)
    atexit(dumpInsCount);
#endif

  bootstrap(entryPoint, bootPkg, bootVer);

  return EXIT_SUCCEED;          /* exit the lo system cleanly */
}
示例#20
0
PeParser::PeParser()
{
	initClass();
}