Esempio n. 1
0
void OpenSkins( void )
{
    DmOpenRef           dbRef;
    DmSearchStateType   stateInfo;
    UInt16              cardNo;
    LocalID             dbID;
    Err                 err;

    resourceDBList = ListCreate();

    if ( resourceDBList == NULL )
        return;

    err = DmGetNextDatabaseByTypeCreator( true, &stateInfo,
            (UInt32) SkinResourceType, (UInt32) ViewerAppID,
            false, &cardNo, &dbID );

    while ( err == errNone ) {
        dbRef = DmOpenDatabase( cardNo, dbID, dmModeReadOnly );
        if ( dbRef != NULL )
            ListAppend( resourceDBList, dbRef );

        err = DmGetNextDatabaseByTypeCreator( false, &stateInfo,
                (UInt32) SkinResourceType, (UInt32) ViewerAppID, false,
                &cardNo, &dbID );
    }
}
Esempio n. 2
0
Boolean
HandleMenuOpenEvent(EventType *event)
{
  DmSearchStateType searchState;
  UInt16 cardNo;
  LocalID dbID;
  Boolean needsSeparator=false;
  if (DmGetNextDatabaseByTypeCreator(true, &searchState, 0, UNICHAT_APP_CREATOR, true, &cardNo, &dbID) != dmErrCantFind) {
    MenuAddItem(MENUITEM_exams, MENUITEM_chat, 'C', "UniChat");
    needsSeparator=true;
  }
  if (DmGetNextDatabaseByTypeCreator(true, &searchState, 0, UNIMENSA_APP_CREATOR, true, &cardNo, &dbID) != dmErrCantFind) {
    MenuAddItem(MENUITEM_exams, MENUITEM_mensa, 'M', "UniMensa");
    needsSeparator=true;
  }

  if (needsSeparator) {
    Char tmpSep[2];
    tmpSep[0]=MenuSeparatorChar;
    tmpSep[1]=0;
    MenuAddItem(MENUITEM_exams, MENUITEM_addsep, 0, tmpSep);
  }

  if (TNPalmOSVersion() < 0x04000000) {
    // No attention manager available, we do not work around that (yet?)
    MenuHideItem(MENUITEM_alarm);
  }
  
  return true;
}
Esempio n. 3
0
/**********************************************************************
 * Function: getDatabase
 * Description: pass the function the necessare database information,
 * and it will either open an existing database or create a new one if 
 * neccessary. "created" will be true if a new database was created
 * *******************************************************************/ 
Err getDatabaseByTypeCreatorName (DmOpenRef * DBptr, UInt32 type, 
	UInt32 creator, UInt32 mode, char *name) {
	 
    Err errors;
    LocalID id;
    UInt16 cardNum, attr;
    DmSearchStateType srch;
    Char db_name[32];
 
	errors = DmGetNextDatabaseByTypeCreator(true, &srch, type, creator,  false, 
		&cardNum, &id);

    while(!errors && id) {
		*DBptr =  DmOpenDatabase (cardNum, id, mode);
        DmDatabaseInfo (cardNum, id, db_name, &attr, NULL, NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL);
		if(StrCompare(name, db_name) == 0) {
            attr |= dmHdrAttrBackup;
            DmSetDatabaseInfo (cardNum, id, NULL, &attr, NULL, NULL, NULL, NULL,
                    NULL, NULL, NULL, NULL, NULL);
            return 0;
		}
		if(*DBptr) DmCloseDatabase(*DBptr);
		errors = DmGetNextDatabaseByTypeCreator(false, &srch, type, creator,  false, 
			&cardNum, &id);
    } 
	return 1; 
} 
Esempio n. 4
0
Int16 GotoAddress(Int16 index)
{
    GoToParamsPtr theGotoPointer;
    DmSearchStateType searchInfo;
    UInt16 cardNo;
    LocalID dbID;
    UInt32 addrID = AddrGotoCreatorId[(int)gPrefsR.addrapp];

    theGotoPointer = MemPtrNew(sizeof(GoToParamsType));
    if (!theGotoPointer) return -1;
    /* Set the owner of the pointer to be the
       system. This is required because all memory
       allocated by our application is freed when
       the application quits. Our application will
       quit the next time through our event
       handler.
    */
    
    if ((MemPtrSetOwner(theGotoPointer, 0) == 0) &&
        (DmGetNextDatabaseByTypeCreator(true, &searchInfo, 0,
                                        addrID, true, &cardNo, &dbID)
         == 0)) {

        // copy all the goto information into the
        // GotoParamsPtr structure
        theGotoPointer->searchStrLen = 0;
        theGotoPointer->dbCardNo = cardNo;
        theGotoPointer->dbID = dbID;
        theGotoPointer->recordNum = index;
        theGotoPointer->matchPos = 0;
        theGotoPointer->matchFieldNum = 0;
        theGotoPointer->matchCustom = 0;

        if ((DmGetNextDatabaseByTypeCreator
             (true, &searchInfo,
            sysFileTApplication, addrID, true, &cardNo, &dbID) == 0)) {
            SysUIAppSwitch(cardNo, dbID,
                           sysAppLaunchCmdGoTo,
                           (MemPtr) theGotoPointer);
			/*
			 * return from address? (fatal?)
            SysAppLaunch(cardNo, dbID, sysAppLaunchFlagNewThread,
                           sysAppLaunchCmdGoTo,
                           (MemPtr) theGotoPointer, &ret);
			*/
            return 0;
        }
    }

	MemPtrFree(theGotoPointer);
    return -1;
}
Esempio n. 5
0
/*----------------------------------------CIRexxApp::copyScriptFromFindResult-+
|                                                                             |
+----------------------------------------------------------------------------*/
void CIRexxApp::copyScriptFromFindResult(GoToParamsPtr pGoToParams)
{
   Err err;
   LocalID dbID;
   UInt16 cardNo = 0;
   DmOpenRef dbP;
   DmSearchStateType searchState;
   MemHandle hRecord;

   if ((err = DmGetNextDatabaseByTypeCreator(
       true, &searchState, 'data', CREATORID, true, &cardNo, &dbID)) != errNone) {
      return;
   }
   if ((dbP = DmOpenDatabase(cardNo, dbID, dmModeReadOnly)) == 0) {
      return;
   }
   if (!(hRecord = DmQueryRecord(dbP, pGoToParams->recordNum))) {
      DmCloseDatabase(dbP);
      return;
   }
   Char * p = (char *)MemHandleLock(hRecord);
   UInt32 size = MemHandleSize(hRecord);
   if (p[size - 1] == '\0') { --size; }
   emptyScript();
   appendScript(p, size);
   MemHandleUnlock(hRecord);
   DmCloseDatabase(dbP);
   return;
}
Esempio n. 6
0
/* Finds and opens database,
 * calls plugin specific code to create new item,
 * then fills in GoTo parameters.
 */
static UInt16
PickBooger(KleenexPtr kleenexP)
{
    DmOpenRef dbR;
    DmSearchStateType searchstate;
    UInt32 creatorID, dbtype;
    UInt16 cardNo;
    LocalID dbID;
    Boolean closedb = false;
    UInt16 err, index;

    /* Check for the correct version */
    if (!((kleenexP->version) & IBVERSION_ORIG))
        return (boogerErrorVersionMismatch);

    /* Open the database */
    if (DmGetNextDatabaseByTypeCreator(true, &searchstate, DB_TYPE,
                                       DB_CREATOR, true, &cardNo, &dbID))
        return (1);

    if ((dbR = DmOpenDatabase(cardNo, dbID, dmModeReadWrite))) {
        closedb = true;

    } else if (DmGetLastErr() == dmErrAlreadyOpenForWrites) {
        dbR = NULL;
        while ((dbR = DmNextOpenDatabase(dbR))) {
            DmOpenDatabaseInfo(dbR, &dbID, NULL, NULL, &cardNo, NULL);
            DmDatabaseInfo(cardNo, dbID, NULL, NULL, NULL, NULL, NULL, NULL,
                           NULL, NULL, NULL, &dbtype, &creatorID);
            if ((dbtype == DB_TYPE) && (creatorID == DB_CREATOR))
                break;
        }
        if (!dbR)
            return (1);
    }

    /* Call plugin specific routine to create item in database */
    err = DoTheBoogie(kleenexP, dbR, &index);

    /* Close the database */
    if (closedb)
        DmCloseDatabase(dbR);

    /* Did it work? */
    if (err)
        return (1);

    /* Load the GoTo parameters */
    if (!(kleenexP->booger.cmdPBP = MemPtrNew(sizeof(GoToParamsType))))
        return (1);
    MemSet(kleenexP->booger.cmdPBP, sizeof(GoToParamsType), 0);
    ((GoToParamsType *)(kleenexP->booger.cmdPBP))->dbCardNo = cardNo;
    ((GoToParamsType *)(kleenexP->booger.cmdPBP))->dbID = dbID;
    ((GoToParamsType *)(kleenexP->booger.cmdPBP))->recordNum = index;
    MemPtrSetOwner(kleenexP->booger.cmdPBP, 0);

    return (errNone);
}
Esempio n. 7
0
void AlarmSetTrigger (UInt32 alarmTime, UInt32 ref) 
{
	UInt16 cardNo;
	LocalID dbID;
	DmSearchStateType searchInfo;

	DmGetNextDatabaseByTypeCreator (true, &searchInfo, 
                                    sysFileTApplication, sysFileCDatebook, true, &cardNo, &dbID);

	AlmSetAlarm (cardNo, dbID, ref, alarmTime, true);
}
Esempio n. 8
0
static Err AppStartLoadSkin() {
	Err err = errNone;

	// if skin defined, check if the db still exists
	if (gPrefs->skin.dbID) {
		UInt32 type, creator;

		// check if the DB still exists
		DmSearchStateType state;
		UInt16 cardNo;
		LocalID dbID;
		Boolean found = false;
		err = DmGetNextDatabaseByTypeCreator(true, &state, 'skin', appFileCreator, false, &cardNo, &dbID);
		while (!err && dbID && !found) {
			found = (cardNo == gPrefs->skin.cardNo && dbID == gPrefs->skin.dbID);
			err = DmGetNextDatabaseByTypeCreator(false, &state, 'skin', appFileCreator, false, &cardNo, &dbID);
		}

		if (found) {
			// remember to check version for next revision of the skin
			err = DmDatabaseInfo (gPrefs->skin.cardNo, gPrefs->skin.dbID, gPrefs->skin.nameP, 0, 0, 0, 0, 0, 0, 0,0, &type, &creator);
			if (!err)
				if (type != 'skin' || creator != appFileCreator)
					err = dmErrInvalidParam;
		}
		
		if (!found || err)
			MemSet(&(gPrefs->skin),sizeof(SkinInfoType),0);
	}

	// No skin ? try to get the first one
	if (!gPrefs->skin.dbID) {
		DmSearchStateType stateInfo;

		err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, 'skin', appFileCreator, false, &gPrefs->skin.cardNo, &gPrefs->skin.dbID);
		if (!err)
			err = DmDatabaseInfo (gPrefs->skin.cardNo, gPrefs->skin.dbID, gPrefs->skin.nameP, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	}
	
	return err;
}
Esempio n. 9
0
void Plugin_Search ( void ) {
#if 0
	// The following code will locate our plug-in resource (which may be in our own
	// resource file or in a separate PRC file to be opened by type and creator as
	// demonstrated below)
	DmSearchStateType   searchState;
	UInt16              tempCardNo[32];
	MemHandle           tempPlugInResH;				// handle to our plug-in resource
	Boolean             newSearch = true;
	LocalID             tempPlugInDbID[32];
	Err                 theErr = 0;
  UInt8               i = 0;

  Plug_ParamBlock     plugInParamBlock;

	// The following code could be modified to iterate through
	// multiple (separate) plug-in database(s), if desired...
  do {
    theErr = DmGetNextDatabaseByTypeCreator(newSearch, &searchState, kPlugInFileType, 
        kPlugInFileCreator, false /* all versions */, &tempCardNo[i], &tempPlugInDbID[i]);
    newSearch = false;
    if ( !theErr ) i++;
  } while ( !theErr );

	if (theErr) { // no plug-in database found
		tempPlugInDbID = 0;
		gPlugInDbRef = 0;

	}	else {      // we found a plug-in database
		if (tempPlugInDbID) {				// open the plug-in database
			gPlugInDbRef = DmOpenDatabase(tempCardNo, tempPlugInDbID, dmModeReadOnly);
		}
	}

	// Get a handle to our plug-in resource
	tempPlugInResH = DmGetResource(kPlugInResourceType, kFirstPlugInResID);

	// Make sure we found it
	if (!tempPlugInResH)
		return 1;

	// Lock down the plug-in so it doesn't move
	gPlugInResP = (Plug_Main *) MemHandleLock(tempPlugInResH);
	
  plugInParamBlock.eType = cmdStartup;
  plugInParamBlock.hostVersion = plugVersion;
  (*gPlugInResP)(&plugInParamBlock);

#endif
	return 0;
}
Esempio n. 10
0
UInt32 AlarmGetTrigger (UInt32* refP) 
{
	UInt16 		cardNo;
	LocalID 		dbID;
	UInt32		alarmTime = 0;	
	DmSearchStateType searchInfo;

	DmGetNextDatabaseByTypeCreator (true, &searchInfo, 
                                    sysFileTApplication, sysFileCDatebook, true, &cardNo, &dbID);

	alarmTime = AlmGetAlarm (cardNo, dbID, refP);

	return (alarmTime);
}
Esempio n. 11
0
//! @todo do something with ErrFindDatabaseByNameTypeCreator()
static Err ErrFindDatabaseByNameTypeCreator(const char* dbName, UInt32 type, UInt32 creator, LocalID *dbId)
{
    Err                 err;
    DmSearchStateType   stateInfo;
    UInt16              cardNo = 0;
    char                dbNameBuf[dmDBNameLength];

    Assert(dbName);
    Assert(StrLen(dbName)<dmDBNameLength);
    Assert(dbId);

    err = DmGetNextDatabaseByTypeCreator(true, &stateInfo, type, creator, 0, &cardNo, dbId);
    while (errNone == err)
    {
        MemSet(dbNameBuf, sizeof(dbName), 0);
        DmDatabaseInfo(cardNo, *dbId, dbNameBuf, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL);

        if (0==StrCompare(dbName, dbNameBuf))
            return errNone;
        err = DmGetNextDatabaseByTypeCreator(false, &stateInfo, type, creator, 0, &cardNo, dbId);
    }
    return dmErrCantFind;
}
Esempio n. 12
0
/* Initialize internal lists of user font prcs */
void InitializeUserFontDBs( void )
{
    DmSearchStateType   stateInfo;
    UInt16              cardNo;
    LocalID             dbID;
    Err                 err;
    DBEntryType*        dbListEntry;

    userFontDBList = ListCreate();

    if ( userFontDBList == NULL )
        return;

    err = DmGetNextDatabaseByTypeCreator( true, &stateInfo,
              (UInt32) UserFontResourceType, (UInt32) ViewerAppID,
              false, &cardNo, &dbID );

    while ( err == errNone ) {
        dbListEntry = SafeMemPtrNew( sizeof( DBEntryType ) );
        err = DmDatabaseInfo( cardNo, dbID, dbListEntry->name, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL );
        if ( err == errNone ) {
            dbListEntry->cardNo = cardNo;
            dbListEntry->dbID   = dbID;
            dbListEntry->onVFS  = false;
            ListAppend( userFontDBList, dbListEntry );
        }
        else {
            SafeMemPtrFree( dbListEntry );
        }
        err = DmGetNextDatabaseByTypeCreator( false, &stateInfo,
                (UInt32) UserFontResourceType, (UInt32) ViewerAppID, false,
                &cardNo, &dbID );
    }
    SortAndMakeUserFontNameList();
}
Err sbuFindSyncBmr( UInt *theCardNum, LocalID *theDbID ) {

   UInt              cardNo;
   LocalID           dbID;
   DmSearchStateType searchState;

   DmGetNextDatabaseByTypeCreator( true, &searchState, sysFileTApplication,
                                   SYNC_BMR_ID, true, &cardNo, &dbID );

   ErrFatalDisplayIf( !dbID, "required component missing" );

   *theCardNum = cardNo;  // return the card number
   *theDbID    = dbID;    // return the database id

   return 0;

} // sbuFindSyncBmr()
Esempio n. 14
0
void
unhookHoldSwitch(void)
{
	Err err;
	UInt32 val;

	err = FtrGet(sysFtrCreator, sysFtrNumNotifyMgrVersion, &val);
	if (!err && val) {
		UInt16 CardNo;
		LocalID dbID;
		DmSearchStateType state;
		DmGetNextDatabaseByTypeCreator(true, &state, 'appl',
		    GetCreatorID(), true, &CardNo, &dbID);
		SysNotifyUnregister(CardNo, dbID,
		    sonySysNotifyHoldStatusChangeEvent,
		    sysNotifyNormalPriority);
		holdCB = NULL;
	}
}
Esempio n. 15
0
/* Fills in 'booger' structure for return to calling app */
static UInt16
BlowNose(KleenexPtr kleenexP)
{
    DmSearchStateType searchstate;

    if (DmGetNextDatabaseByTypeCreator(true, &searchstate, sysFileTApplication,
                                       GOTO_ID, true,
                                       &kleenexP->booger.cardNo,
                                       &kleenexP->booger.dbID))
    {
        // App associated with plugin not found
        if (kleenexP->booger.cmdPBP) {
            MemPtrFree(kleenexP->booger.cmdPBP);
            kleenexP->booger.cmdPBP = NULL;
        }
        return (1);
    }
    kleenexP->booger.cmd = sysAppLaunchCmdGoTo;

    return (errNone);
}
/* Remove preferences from the Preferences database */
static void RemovePref
    (
    UInt16 prefID   /* preference to remove */
    )
{
    DmOpenRef           ref;
    DmSearchStateType   state;
    LocalID             dbID;
    UInt16              cardNo;
    Int16               index;

    DmGetNextDatabaseByTypeCreator( true, &state, 'sprf', 'psys', false,
        &cardNo, &dbID );
    ref = DmOpenDatabase( cardNo, dbID, dmModeReadWrite );
    if ( ref == NULL )
        return;

    index = DmFindResource( ref, ViewerAppID, prefID, NULL );
    if ( index != -1 )
        DmRemoveResource( ref, index );

     DmCloseDatabase( ref );
}
Esempio n. 17
0
/***************************************************************************
 * Function: cryptSwitch
 * Description: handles changing the system password based upon the 
 * password change screen. Basically checks that current password is correct,
 * checks that the new password was entered correctly, then re-encrypts the
 * databases based upon the new password.
 * ************************************************************************/ 
static void 
cryptSwitch (int v) 
{
	
		// total number of records to re-write
	UInt16 totalAItems = DmNumRecordsInCategory (AccountDB, dmAllCategories);
	UInt16 totalSItems = DmNumRecordsInCategory (SystemDB, dmAllCategories);
	MemPtr pac = NULL, scratch = NULL, scratch2 = NULL;
	UInt16 i = 0, senc = 0, aenc = 0;
	MemHandle rH;
	char s[5], a[5];
	StripPrefType prefs;	
	UInt16 prefsSize, prefsVersion;

	FormType *preF = FrmGetActiveForm ();
	FormType *f = FrmInitForm (pleaseWait);
	FrmDrawForm (f);
	
		// re-encrypt the password 
	if ((rH = DmGetRecord (PasswordDB, 0)))	
	{
		if ((scratch = MemPtrNew (getSCSize(sizeof(md_hash)))))			
		{
			PackPassword (scratch, &NewSysPass);			
			writeRecord (scratch, rH);
			MemPtrFree (scratch);
		}
		DmReleaseRecord (PasswordDB, 0, true);
	}
	
		// loop through the systems and re-encrypt
	for (i = 0; i < totalSItems; i++)
	{
		System_old sys;
		if ((rH = DmGetRecord (SystemDB, i)))	
		{
			pac = MemHandleLock (rH);
			if ((scratch = MemPtrNew (MemPtrSize (pac))))	
			{	
					// decrypt the system with old password
				switch (v)	
				{
					case 0:
						UnpackSystem_old (&sys, pac, scratch, SysPass,
										MemHandleSize (rH), true, 1);
										
						scratch2 = MemPtrNew (getSystemSize((System *)&sys, true));
						break;
					case 1:
						UnpackSystem_old (&sys, pac, scratch, SysPass,
										MemHandleSize (rH), true, 2);
						scratch2 = MemPtrNew (getSystemSize ((System *)&sys,true) );
						break;
					case 2:
						UnpackSystem_old (&sys, pac, scratch, SysPass,
										MemHandleSize (rH), true, 0);
						scratch2 = MemPtrNew (getSystemSize ((System *)&sys, true ));
						break;
				}
				if (scratch2)				
				{			
					PackSystem(scratch2, *((System *) &sys), &NewSysPass, true);
					MemHandleUnlock (rH);
					writeRecord (scratch2, rH);
					senc++;
					MemPtrFree (scratch2);
				}
				MemPtrFree (scratch);
			}
			DmReleaseRecord (SystemDB, i, true);
		}
	}
	
		// loop through the accounts and re-encrypt
	for (i = 0; i < totalAItems; i++)	
	{
		Account_old ac;
		Account ac_new;
		if ((rH = DmGetRecord (AccountDB, i)))
			
		{
			pac = MemHandleLock (rH);
			if ((scratch = MemPtrNew (MemPtrSize (pac))))
				
			{
				
					// decrypt the system with old password
				switch (v)	
				{
					case 0:
						UnpackAccount_old(&ac, pac, scratch, SysPass,
										 MemHandleSize (rH), true, true, 1);
						ChangeAccountFormat(i, &ac, &ac_new);
						scratch2 = MemPtrNew (getAccountSize(&ac_new, true));
						break; 
					case 1:
						UnpackAccount_old (&ac, pac, scratch, SysPass,
										 MemHandleSize (rH), true, true, 2);
						ChangeAccountFormat(i, &ac, &ac_new);
						scratch2 = MemPtrNew (getAccountSize(&ac_new, true));
						break; 
					case 2:
						UnpackAccount_old(&ac, pac, scratch, SysPass,
										 MemHandleSize (rH), true, true, 0);
						ChangeAccountFormat(i, &ac, &ac_new);
						scratch2 = MemPtrNew (getAccountSize(&ac_new,true));
						break; 
				}

				if (scratch2)
				{
					PackAccount(scratch2, ac_new, &NewSysPass, true);
					MemHandleUnlock (rH);
					writeRecord (scratch2, rH);
					aenc++;
					MemPtrFree (scratch2);
				}
				MemPtrFree (scratch);
			}
			DmReleaseRecord (AccountDB, i, true);
		}
	}
	FrmEraseForm (f);
	FrmDeleteForm (f);
	FrmSetActiveForm (preF);
		// close databases.
	DmCloseDatabase (SystemDB);
	DmCloseDatabase (AccountDB);
	DmCloseDatabase (PasswordDB);

	{
		UInt16 cardNo;
		UInt32 type;
		LocalID dbID;
		DmSearchStateType search;

		type = systemDBType;
		DmGetNextDatabaseByTypeCreator(true, &search, systemDBTypeOld, 
			StripCreator, true, &cardNo, &dbID);
		DmSetDatabaseInfo(cardNo, dbID, NULL, NULL, NULL, NULL, NULL,
			NULL, NULL, NULL, NULL, &type, NULL);
	
		type = accountDBType;
		DmGetNextDatabaseByTypeCreator(true, &search, accountDBTypeOld, 
			StripCreator, true, &cardNo, &dbID);
		DmSetDatabaseInfo(cardNo, dbID, NULL, NULL, NULL, NULL, NULL,
			NULL, NULL, NULL, NULL, &type, NULL);

		type = passwordDBType;
		DmGetNextDatabaseByTypeCreator(true, &search, passwordDBTypeOld, 
			StripCreator, true, &cardNo, &dbID);
		DmSetDatabaseInfo(cardNo, dbID, NULL, NULL, NULL, NULL, NULL,
			NULL, NULL, NULL, NULL,  &type, NULL);

	}

	prefsSize = sizeof (StripPrefType);
	prefsVersion = PrefGetAppPreferences (StripCreator, StripPrefID, &prefs, &prefsSize, true);
    if  (prefsVersion != StripVersionNumber) {
        prefs.smart_beaming = false;
        PrefSetAppPreferences (StripCreator, StripPrefID, StripVersionNumber,
            &prefs, sizeof (StripPrefType), true);
        prefsVersion = PrefGetAppPreferences (StripCreator, StripPrefID,
            &prefs, &prefsSize, true);
	} 

	StrIToA (s, senc);
	StrIToA (a, aenc);
	FrmCustomAlert (infoDialog, s, a, NULL);

	StopApplication ();
	SysReset ();
}
Esempio n. 18
0
void IntlInit(void)
{
	Err result;
	MemHandle localeCodeH;
	MemHandle tableListH;
	MemHandle featureTableH;
	ROMFtrTableType* featureTableP;
	ROMFtrCreatorType* creatorTableP;
	UInt16 creators;
	Boolean fastSort = true;
	Boolean fastSearch = true;
	Boolean fastAttr = true;
	UInt16 index;
	UInt32 intlFtrFlags;

#if (EMULATION_LEVEL == EMULATION_NONE)
	UInt16 systemCard;
	LocalID systemID;
	DmSearchStateType* searchStateP;
	MemHandle localeNameH;
	LocalID moduleID;
	DmOpenRef moduleRef;

	// Locate the system DB, so that we know where to look (which card)
	// for the locale module.
	searchStateP = (DmSearchStateType*)MemPtrNew(sizeof(DmSearchStateType));
	result = DmGetNextDatabaseByTypeCreator(	true,
															searchStateP,
															sysFileTSystem,
															sysFileCSystem,
															true,					// onlyLatestVers
															&systemCard,
															&systemID);
	ErrNonFatalDisplayIf((result != errNone) || (systemID == 0), "Can't find system DB");
	MemPtrFree((MemPtr)searchStateP);
	
	localeNameH = DmGetResource(strRsc, localeModuleNameStrID);
	ErrNonFatalDisplayIf(localeNameH == NULL, "Missing locale module name string");
	
	moduleID = DmFindDatabaseWithTypeCreator(	systemCard,
															(Char*)MemHandleLock(localeNameH),
															sysFileTLocaleModule,
															sysFileCSystem);
	MemHandleUnlock(localeNameH);
	
	if (moduleID != 0)
	{
		moduleRef = DmOpenDatabase(systemCard, moduleID, dmModeReadOnly | dmModeLeaveOpen);
		ErrNonFatalDisplayIf(moduleRef == 0, "Can't open locale module");
		
		if (ResLoadConstant(kIntlLMVersResID) != kIntlLMVersion)
		{
			DmCloseDatabase(moduleRef);
			moduleID = 0;
		}
	}
	
	// If we couldn't find the locale module, or it has the wrong version, then
	// default to the ROM locale's locale module.
	if (moduleID == 0)
	{
		SysNVParamsType* romParamsP;
		OmLocaleType romLocale;
		Char* overlayName;
		LocalID overlayID;
		DmOpenRef overlayRef;
		Char* systemName;
		
		// Open up the system overlay that corresponds to the ROM's locale.
		// Note that (assuming the ROM locale != current locale) we have to
		// try to open up the overlay explicitly, since the Overlay Mgr
		// won't be opening it automatically. We also have to handle the case
		// of a ROM built without overlays, in which case the ROM locale's
		// locale module name string is located in the base, which means we
		// have to make a low-level resource call to get it (otherwise we'll
		// get the string from the system overlay).
		romParamsP = (SysNVParamsType*)MemPtrNew(sizeof(SysNVParamsType));
		MemGetRomNVParams(romParamsP);
		romLocale.country = romParamsP->localeCountry;
		romLocale.language = romParamsP->localeLanguage;
		MemPtrFree((MemPtr)romParamsP);
		
		// Get the name of the system DB, so that we can construct the overlay
		// name.
		systemName = (Char*)MemPtrNew(dmDBNameLength);
		overlayName = (Char*)MemPtrNew(dmDBNameLength);

		result = DmDatabaseInfo(systemCard, systemID, systemName,
						NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
		ErrNonFatalDisplayIf(result != errNone, "Can't get system DB info");
		
		result = OmLocaleToOverlayDBName(systemName, &romLocale, overlayName);
		ErrNonFatalDisplayIf(result != errNone, "Can't make ROM locale system overlay name");
		
		overlayID = DmFindDatabaseWithTypeCreator(systemCard,
																overlayName,
																sysFileTOverlay,
																sysFileCSystem);
		MemPtrFree(systemName);
		MemPtrFree((MemPtr)overlayName);
		
		if (overlayID != 0)
		{
			overlayRef = DmOpenDatabase(systemCard, overlayID, dmModeReadOnly);
			ErrNonFatalDisplayIf(overlayRef == 0, "Can't open system overlay");
			
			// Now load the locale module name string from this overlay, and use
			// it to find the locale module.
			localeNameH = DmGet1Resource(strRsc, localeModuleNameStrID);
			ErrNonFatalDisplayIf(localeNameH == NULL, "Missing locale module name string");
			moduleID = DmFindDatabaseWithTypeCreator(	systemCard,
																	(Char*)MemHandleLock(localeNameH),
																	sysFileTLocaleModule,
																	sysFileCSystem);
			MemHandleUnlock(localeNameH);
			DmCloseDatabase(overlayRef);
		}
		else
		{
			// Assume it's a ROM built without overlays, in which case we need to
			// get the locale name handle from the system base.
			DmOpenRef sysRef = NULL;
			Int16 index;
			
			do
			{
				LocalID dbID;
				
				sysRef = DmNextOpenResDatabase(sysRef);
				
				if ((sysRef != NULL)
				 && (DmOpenDatabaseInfo(sysRef, &dbID, NULL, NULL, NULL, NULL) == errNone)
				 && (dbID == systemID))
				{
				 	break;
				}
			} while (sysRef != NULL);

			ErrNonFatalDisplayIf(sysRef == NULL, "Can't find system DB");
			index = DmFindResource(sysRef, strRsc, localeModuleNameStrID, NULL);
			ErrNonFatalDisplayIf(index == -1, "Missing locale module name string");
			localeNameH = DmGetResourceIndex(sysRef, index);
			ErrNonFatalDisplayIf(localeNameH == NULL, "Missing locale module name string");
			moduleID = DmFindDatabaseWithTypeCreator(	systemCard,
																	(Char*)MemHandleLock(localeNameH),
																	sysFileTLocaleModule,
																	sysFileCSystem);
		}
		
		// If we found the locale module DB, open it up and make sure it has
		// the right version.
		if (moduleID != 0)
		{
			moduleRef = DmOpenDatabase(systemCard, moduleID, dmModeReadOnly | dmModeLeaveOpen);
			if ((moduleRef == 0)
			 || (ResLoadConstant(kIntlLMVersResID) != kIntlLMVersion))
			{
				// Trigger fatal alert below. No need to close the DB in that case.
				moduleID = 0;
			}
			else
			{
				// We found a valid locale module, using the ROM locale, so set
				// the current locale to be the ROM locale.
				result = FtrSet(sysFtrCreator, sysFtrNumLanguage, romLocale.language);
				
				if (result == errNone)
				{
					result = FtrSet(sysFtrCreator, sysFtrNumCountry, romLocale.country);
				}
				
				ErrNonFatalDisplayIf(result != errNone, "Can't switch current locale to ROM locale");
			}
		}
		
		ErrFatalDisplayIf(moduleID == 0, "No valid locale module");
	}
	
	result = DmDatabaseProtect(systemCard, moduleID, true);
	if (result != dmErrROMBased)
	{
		ErrNonFatalDisplayIf(result != errNone, "Can't protect locale module");
	}
#else
	// Give the locale module code in the Simulator a chance to
	// initialize itself. If there's no such code (e.g. with latin) then the
	// routine in SimStubs.cp does nothing.
	StubPalmOSInitLocaleModule();
#endif

	// If there's a locale module code resource, load & call it now.
	localeCodeH = DmGet1Resource(kIntlLMCodeType, kIntlLMCodeResID);
	if (localeCodeH != NULL)
	{
		ProcPtr localeCodeP = (ProcPtr)MemHandleLock(localeCodeH);
		(*localeCodeP)();
		MemHandleUnlock(localeCodeH);
	}
	
	// If the IntlMgr data ptr hasn't been set up by the locale module code,
	// allocate it now.
	if (GIntlMgrGlobalsP == NULL)
	{
		UInt16 numCustomTransTables;
		MemPtr globalPtr;

		numCustomTransTables = ResLoadConstant(kIntlLMCustomTransCountID);
		ErrNonFatalDisplayIf(numCustomTransTables > kIntlMaxCustomTransliterations,
									"Too many custom transliterations");
		
		globalPtr = MemPtrNew(sizeof(IntlGlobalsType) + (numCustomTransTables * sizeof(void*)));
		ErrNonFatalDisplayIf(globalPtr == NULL, "Out of memory");
		
		MemSet(globalPtr, sizeof(IntlGlobalsType) + (numCustomTransTables * sizeof(void*)), 0);
		GIntlMgrGlobalsP = globalPtr;
		
		GIntlData->numCustomTransliterations = numCustomTransTables;
	}
	else
	{
		// If any of the sorting tables are already configured, we can't do
		// our fast sorting optimization.
		for (index = 0; index < kIntlMaxSortLevels; index++)
		{
			if (GIntlData->sortTables[index] != NULL)
			{
				fastSort = false;
				break;
			}
		}
		
		// If the word start or word match tables are already configured, we
		// can't do our fast word search optimization.
		
		if ((GIntlData->findWordStartTable != NULL)
		 || (GIntlData->findWordMatchTable != NULL))
		{
			fastSearch = false;
		}
		
		// If the character attribute table is already configured, we can't do
		// our fast attribute optimization.
		if (GIntlData->charAttrTable != NULL)
		{
			fastAttr = false;
		}
	}
	
	// Loop over all of the table resources, locking & setting up pointers in
	// the IntlMgr global data structure.
	tableListH = DmGet1Resource(kIntlLMTableListType, kIntlLMTableListResID);
	if (tableListH != NULL)
	{
		IntlLMTableEntryType* curTable;
		UInt8* globalsP = (UInt8*)GIntlMgrGlobalsP;
		IntlLMTableResType* tableListP = (IntlLMTableResType*)MemHandleLock(tableListH);
		
		for (index = 0, curTable = tableListP->resources; index < tableListP->numResources; index++, curTable++)
		{
			void** ptrLocation;
			MemHandle tableH;
			
			tableH = DmGet1Resource(curTable->resType, curTable->resID);
			ErrFatalDisplayIf(tableH == NULL, "Missing table resource from locale module");
			ErrFatalDisplayIf(curTable->tableIndex >= intlLMNumTableIndexes, "Invalid table index");
			
			ptrLocation = (void**)(globalsP + kIntlGlobalOffsets[curTable->tableIndex]);
			ErrFatalDisplayIf(*ptrLocation != NULL, "Resource overriding existing table ptr");
			*ptrLocation = MemHandleLock(tableH);
		}
		
		MemHandleUnlock(tableListH);
	}

	// Note that we can't check for the presence of tables here, as a table that
	// is required by a Text Mgr routine might be NULL if the locale module has
	// patched out that routine.
	
	// As an optimization, see if all of the sorting tables are byte-indexed 8-bit
	// values. If so, then replace the table ptrs with ptrs to the actual data,
	// and set the fast sorting intl mgr flag.
	for (index = 0; (index < kIntlMaxSortLevels) && fastSort; index++)
	{
		void* sortTable = GIntlData->sortTables[index];
		if (sortTable == NULL)
		{
			break;
		}
		else if (PrvGetByteIndexedTable(sortTable, 8) == NULL)
		{
			fastSort = false;
		}
	}
	
	if (fastSort)
	{
		GIntlData->intlFlags |= kByteSortingFlag;
		
		for (index = 0; index < kIntlMaxSortLevels; index++)
		{
			GIntlData->sortTables[index] = PrvGetByteIndexedTable(GIntlData->sortTables[index], 8);
		}
	}
	
	// As an optimization, see if all of the searching tables are byte-indexed 8-bit
	// values. If so, then replace the table ptrs with ptrs to the actual data,
	// and set the fast searching intl mgr flag. Note that PrvGetByteIndexedTable
	// will return NULL if findWordMatchTable is NULL, which is OK because then
	// TxtFindString must be patched out anyway. The findWordStartTable is optional,
	// and thus it can either be NULL or a byte indexed byte table.
	if ((fastSearch)
	 && ((GIntlData->findWordStartTable == NULL)
	  || (PrvGetByteIndexedTable(GIntlData->findWordStartTable, 8) != NULL))
	 && (PrvGetByteIndexedTable(GIntlData->findWordMatchTable, 8) != NULL))
	{
		GIntlData->intlFlags |= kByteSearchingFlag;

		GIntlData->findWordStartTable = PrvGetByteIndexedTable(GIntlData->findWordStartTable, 8);
		GIntlData->findWordMatchTable = PrvGetByteIndexedTable(GIntlData->findWordMatchTable, 8);
	}
	
	// As an optimization, see if the character attribute table is a byte-indexed
	// table of 16-bit values. If so, then replace the table ptr with a ptr to
	// the data, and set the kByteCharAttrFlag flag.
	if (fastAttr && (PrvGetByteIndexedTable(GIntlData->charAttrTable, 16) != NULL))
	{
		GIntlData->intlFlags |= kByteCharAttrFlag;
		GIntlData->charAttrTable = PrvGetByteIndexedTable(GIntlData->charAttrTable, 16);
	
	// As an optimization, see if the character attribute table is a stage index map
	// table of 16-bit values. If so, then replace the table ptr with a ptr to
	// the sub-table offsets, set up the result table ptr, and set the
	// kStageCharAttrFlag flag.
	}
	else if (fastAttr && PrvGetStageIndexMapTable(GIntlData->charAttrTable, 16))
	{
		GIntlData->intlFlags |= kStageCharAttrFlag;
		GIntlData->charAttrTable = PrvGetStageIndexMapTable(GIntlData->charAttrTable, 16);
	}
	
	// If there's a doubleCharTable, we want to (a) verify that it's a byte-indexed
	// byte table, and (b) set up the pointer now.
	if (GIntlData->doubleCharTable != NULL)
	{
		void* tableP = PrvGetByteIndexedTable(GIntlData->doubleCharTable, 8);
		ErrNonFatalDisplayIf(tableP == NULL, "Double-char table isn't byte-indexed byte table");
		GIntlData->doubleCharTable = tableP;
	}
	
	// Load the 'feat' resource from the locale module, and use it to initialize
	// various locale-specific features. Typically this includes sysFtrNumCharEncodingFlags,
	// sysFtrNumEncoding, sysFtrDefaultFont, and sysFtrDefaultBoldFont.
	// Try to load the 'feat' resource.
	featureTableH = DmGet1Resource(sysResTFeatures, kIntlLMFeatureResID);
	ErrFatalDisplayIf(featureTableH == NULL, "Missing feature table");
	featureTableP = (ROMFtrTableType*)MemHandleLock(featureTableH);
	creatorTableP = featureTableP->creator;
	
	for (creators = 0; creators < featureTableP->numEntries; creators++)
	{
		UInt16 features;
		
		for (features = 0; features < creatorTableP->numEntries; features++)
		{
			result = FtrSet(	creatorTableP->creator,
									creatorTableP->feature[features].num,
									creatorTableP->feature[features].value);
			ErrNonFatalDisplayIf(result != errNone, "Can't set locale feature");
		}
		
		// Advance to next creator table.
		creatorTableP = (ROMFtrCreatorType*)((UInt8*)creatorTableP
								+ sizeof(ROMFtrCreatorType)
								+ (creatorTableP->numEntries * sizeof(ROMFtrFeatureType)));
	}
	
	MemHandleUnlock(featureTableH);
	
	// Now, set up our internal kByteSearchingFlag flag based on the sysFtrNumCharEncodingFlags
	// feature value. This means that sysFtrNumCharEncodingFlags is read-only, since if
	// anybody uses FtrSet to change the settings of the flags, that won't update
	// our internal flag(s).
	if ((FtrGet(sysFtrCreator, sysFtrNumCharEncodingFlags, &intlFtrFlags) == errNone)
	 && ((intlFtrFlags & charEncodingOnlySingleByte) != 0))
	{
		GIntlData->intlFlags |= kSingleByteOnlyFlag;
	}
	
	// Finally set the bit that tells everybody we're ready to support IntlMgr/TextMgr calls.
	FtrSet(sysFtrCreator, sysFtrNumIntlMgr, intlMgrExists);
} // IntlInit
Esempio n. 19
0
void OpenTransliterations( void )
{
    DmSearchStateType   stateInfo;
    Err                 err;
    UInt16              i;
    UInt16              cardNo;
    LocalID             dbID;
    Char                temp[ 100 ];

    XlitEntry*          entry;

    if ( alreadyOpened )
        return;

    alreadyOpened = true;

    numXlits    = 0;

    xlitDataList = ListCreate();

    err = DmGetNextDatabaseByTypeCreator( true, &stateInfo,
            (UInt32) XlitDBType, (UInt32) ViewerAppID,
            false, &cardNo, &dbID );

    while ( err == errNone ) {
        ProcessXlitDB( cardNo, dbID );

        err = DmGetNextDatabaseByTypeCreator( false, &stateInfo,
                (UInt32) SkinResourceType, (UInt32) ViewerAppID, false,
                &cardNo, &dbID );
    }

    if ( 0 < numXlits ) {
        xlitData = SafeMemPtrNew( sizeof( XlitEntry ) * numXlits );
        i        = 0;

        entry  = ListFirst( xlitDataList );
        while ( entry != NULL ) {
            xlitData[ i++ ] = *entry;

            SafeMemPtrFree( entry );
            entry = ListNext( xlitDataList, entry );
        }
        SysInsertionSort( xlitData, numXlits, sizeof( XlitEntry ),
            XlitCompare, 0 );
    }
    ListDelete( xlitDataList );

    xlitNames = SafeMemPtrNew( ( numXlits + 1 ) * sizeof( Char* ) );

    SysCopyStringResource( temp, strNoTransliteration );
    xlitNames[ 0 ] = SafeMemPtrNew( 1 + StrLen( temp ) );
    StrCopy( xlitNames[ 0 ], temp );

    for ( i = 1 ; i < numXlits + 1 ; i++ ) {
        Char* name;
        name           = xlitData[ i - 1 ].header->name;
        xlitNames[ i ] = SafeMemPtrNew( 1 + StrLen( name ) );
        StrCopy( xlitNames[ i ], name );
    }
}
Esempio n. 20
0
/*------------------------------------------------------CIRexxApp::FindLaunch-+
|                                                                             |
+----------------------------------------------------------------------------*/
Err CIRexxApp::FindLaunch(FindParamsPtr pFindParams)
{
   //<<<JAL TODO: This is currently dependent on the Rexx category.
   //             I'm not sure if we'll ever need to change/add-to this,
   //             but if we do, then this code will have to be changed
   //             along with the GoTo command.
   Err err;
   LocalID dbID;
   UInt16 cardNo = 0;
   DmOpenRef dbP;
   DmSearchStateType searchState;
   UInt16 recordNum;
   MemHandle hRecord;
   UInt32 pos;
   UInt16 matchLength;
   Boolean match, full;
   RectangleType r;
   UInt32 type;
   UInt32 creator;

   // Open our database (should we search MemoPad and pedit, too?)
   // and do our Find.  We define the semantics of Find, so
   // instead of searching the whole records for the search string,
   // let's just search for scripts with the search string as their "name."
   if (FindDrawHeader(pFindParams, "Rexx Scripts")) {
      goto m_return;
   }
   if ((err = DmGetNextDatabaseByTypeCreator(
       true, &searchState, 'data', CREATORID, true, &cardNo, &dbID)) != errNone) {
      pFindParams->more = false;
      return errNone;
   }
   if ((err = DmDatabaseInfo(0, dbID, 0, 0, 0, 0, 0, 0, 0, 0, 0, &type, &creator)) != errNone ||
      (type != 'data' && creator != CREATORID)) {
      pFindParams->more = false;
      return errNone;
   }
   if ((dbP = DmOpenDatabase(cardNo, dbID, pFindParams->dbAccesMode)) == 0 || 
      DmGetAppInfoID(dbP) == 0) { /* if categories not initialized then CategoryGetName throws fatal error */ 
      pFindParams->more = false;
      return errNone;
   }
   UInt16 category;
   char categoryName[dmCategoryLength];
   for (category = 0; category < dmRecNumCategories; ++category) {
       CategoryGetName(dbP, category, categoryName);
       if (!StrCaselessCompare(categoryName, "REXX")) { break; }
   }
   if (category == dmRecNumCategories) { goto m_return; }
   // set it to dmAllCategories?

   UInt32 romVersion;
   FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);

   full = false;
   recordNum = pFindParams->recordNum;
   while (true) {

      // Because applications can take a long time to finish a Find when
      // the result may already be on the screen, or for other reasons,
      // users like to be able to stop the Find.  So, stop it if any event
      // is pending, i.e., if the user does something with the device.
      // Because actually checking if an event is pending slows the
      // search itself, just check it every so many records.
      if ((recordNum & 0x000f) == 0 && EvtSysEventAvail(true)) {
         pFindParams->more = true;
         break;
      }
      if (!(hRecord = DmQueryNextInCategory(dbP, &recordNum, category))) {
         pFindParams->more = false;
         break;
      }

      Char * p = (char *)MemHandleLock(hRecord);
      UInt32 isInternational;
      err = FtrGet(sysFtrCreator, sysFtrNumIntlMgr, &isInternational);
      if (err == errNone && isInternational) {
         match = TxtFindString(p, pFindParams->strToFind, &pos, &matchLength);
      } else {
         match = TxtGlueFindString(p, pFindParams->strToFind, &pos, &matchLength);
      }
      if (match) {
         // Add the match to the find paramter block.
         // If there is no room to display the match
         // then the following function will return true.
         full = FindSaveMatch(pFindParams, recordNum, (UInt16)pos, 0, 0, cardNo, dbID);
         if (!full) {
            // Get the bounds of the region where we will draw the results, and
            // display the title of the description neatly in that area.
            FindGetLineBounds(pFindParams, &r);
            Int16 x = r.topLeft.x + 1;
            Int16 y = r.topLeft.y;
            Int16 w = r.extent.x - 2;
            Char * cr = StrChr(p, linefeedChr);
            UInt16 titleLen = (cr == 0)? StrLen(p) : cr - p;
            Int16 fntWidthToOffset;
            if (romVersion >= sysMakeROMVersion(3, 1, 0, sysROMStageRelease, 0)) {
               fntWidthToOffset = FntWidthToOffset(p, titleLen, w, 0, 0);
            } else {
               fntWidthToOffset = FntGlueWidthToOffset(p, titleLen, w, 0, 0);
            }
            if (fntWidthToOffset == titleLen) {
               WinDrawChars(p, titleLen, x, y);
            } else {
               Int16 titleWidth;
               titleLen = FntWidthToOffset(p, titleLen, w - FntCharWidth(chrEllipsis), 0, &titleWidth);
               WinDrawChars(p, titleLen, x, y);
               WinDrawChar (chrEllipsis, x + titleWidth, y);
            }
            ++pFindParams->lineNumber;
         }
      }
      MemHandleUnlock(hRecord);
      if (full) { break; }
      ++recordNum;
   }

m_return:
   DmCloseDatabase(dbP);
   return errNone;
}
Esempio n. 21
0
void Plugin_Search ( void ) {
	DmSearchStateType   searchState;
	UInt16              tempCardNo;
	MemHandle           tempPlugInResH;				// handle to our plug-in resource
	Boolean             newSearch = true;
	LocalID             tempPlugInDbID = 0;
	Err                 theErr = 0;
  UInt8               curPlug = 0;
  MemHandle           nameH;
  Char               *nameP;
  
  Plug_ParamBlock     plugInParamBlock;

  do {
    DEBUGINFO("Top of loop.");
    theErr = DmGetNextDatabaseByTypeCreator(newSearch, &searchState, kPlugInFileType, 
        kPlugInFileCreator, false /* all versions */, &tempCardNo, &tempPlugInDbID);
    newSearch = false;
    
    DEBUGINFO("After search.");
    
    if ( !theErr ) {
      DEBUGINFO("No error.");
      DEBUGINFO("abba 6");
      PluginListP[curPlug] = (Plug_InternalRef *)MemPtrNew(sizeof(Plug_InternalRef));
      DEBUGINFO("abba 7");
      PluginListP[curPlug]->gPlugInDbRef = DmOpenDatabase(tempCardNo, tempPlugInDbID, dmModeReadOnly);
      DEBUGINFO("abba 3");
      tempPlugInResH = DmGetResource(kPlugInResourceType, kFirstPlugInResID);
      DEBUGINFO("abba 4");
      if ( !tempPlugInResH ) continue;
      DEBUGINFO("abba 5");

      // Get a lock on the code resource.      
      DEBUGINFO("abba");
      PluginListP[curPlug]->gPlugInResP = (Plug_Main *)MemHandleLock(tempPlugInResH);
      DEBUGINFO("abba");
      
      // Get the plugin's long name.
      DEBUGINFO("abba");
      nameH = DmGet1Resource ( 'tAIN', 1000 );
      DEBUGINFO("abba");
      if ( nameH ) {
      DEBUGINFO("abba");
        nameP = MemHandleLock(nameH);
        DEBUGINFO(nameP);
        StrCopy ( PluginListP[curPlug]->longname, nameP );
        MemHandleUnlock ( nameH );
      }
      
      DEBUGINFO("blorg");
      
      // Get the plugin's short (list) name.
      DEBUGINFO("abba");
      nameH = DmGet1Resource ( 'tSTR', 1 );
      DEBUGINFO("abba");
      if ( nameH ) {
      DEBUGINFO("abba");
        nameP = MemHandleLock(nameH);
        DEBUGINFO(nameP);
        StrCopy ( PluginListP[curPlug]->shortname, nameP );
        MemHandleUnlock ( nameH );
      }

      DEBUGINFO("shnee");

      // Send the plugin a startup event...
      plugInParamBlock.eType = cmdStartup;
      theErr = (*PluginListP[curPlug]->gPlugInResP) (&plugInParamBlock);
      
      DEBUGINFO("whoot");
      
      if ( theErr ) theErr = 0;
    }

  } while (!theErr);
}