Beispiel #1
0
/*!
	The assigner.
*/
Init const & Init::operator= (Init const & that)
{
	WatchError
	Alert(&that, eUndefAssigner);
    return *this;
	CatchError
}
Beispiel #2
0
Boolean itworked(short errcode)
/* Return TRUE if it worked, do an error message and return false if it didn't. Error
   strings for native C errors are in STR#1999, Mac errs in STR 2000-errcode, e.g
   2108 for not enough memory */

{
	if (errcode != 0) {
		short		 itemHit;
		Str255 		 errdesc;
		StringHandle strh;
	
		errdesc[0] = '\0';
		if (errcode > 0) GetIndString(errdesc,stdIOErrID,errcode);  /* STDIO file rres, etc */
		else {
			strh = GetString(2000-errcode);
			if (strh != (StringHandle) nil) {
				memcpy(errdesc,*strh,256);
				ReleaseResource((Handle)strh);
			}
		}
		if (errdesc[0] == '\0') {  /* No description found, just give the number */
			sprintf((char *)&errdesc[1],"a %d error occurred",errcode);
			errdesc[0] = strlen((char*)&errdesc[1]);
		}
		SetCursor(&qd.arrow);
		ParamText(errdesc,(StringPtr)"",gActivities[gTopactivity],(StringPtr)"");
		itemHit = Alert(errAlertID, (ModalFilterUPP)nil);
	}
	return(errcode==0);
}
Beispiel #3
0
void DoCommand(long mResult)
{
	short theItem;
	short theMenu;
	Str255		daName;
	short		daRefNum;
	
	theItem = LoWord(mResult);
	theMenu = HiWord(mResult);
	
	switch (theMenu)
	{
		case appleID:
		{
			if (theItem == 1)
			{
				Alert(rUserAlert, nil);
			}
			else
			{
				/* all non-About items in this menu are DAs */
				/* type Str255 is an array in MPW 3 */
				GetMenuItemText(GetMenuHandle(appleID), theItem, daName);
				daRefNum = OpenDeskAcc(daName);
			}
			break;
		}
		case fileID:
		{
			quit = 1;
			break;
		}
		case editID:
		{
			if (!SystemEdit(theItem-1)) // call Desk Manager to handle editing command if desk accessory window is the active window
			{
				switch (theItem) {
					case cutCommand:
						TECut(textH);
						break;
					case copyCommand:
						TECopy(textH);
						break;
					case pasteCommand:
						TEPaste(textH);
						break;
					case clearCommand:
						TEDelete(textH);
						break;
					default:
						break;
				}
			}
		}
		default:
			break;
	}
	
	HiliteMenu(0);
}
Beispiel #4
0
/*!
	The Dupllicator
*/
RandomValidSC::RandomValidSC(RandomValidSC const & that) :
	Init(that), mRnd(that.mRnd)
{
    WatchError
    Alert(&that, eUndefDuplicator);
    CatchError
}
Beispiel #5
0
PostLoadCommand SNSFLoader::Apply(RawFile* file)
{
	BYTE sig[4];
	file->GetBytes(0, 4, sig);
	if (memcmp(sig, "PSF", 3) == 0)
	{
		BYTE version = sig[3];
		if (version == SNSF_VERSION)
		{
			const wchar_t *complaint;
			size_t exebufsize = SNSF_MAX_ROM_SIZE;
			BYTE* exebuf = NULL;
			//memset(exebuf, 0, exebufsize);

			complaint = psf_read_exe(file, exebuf, exebufsize);
			if(complaint) 
			{ 
				Alert(complaint);
				delete[] exebuf;
				return KEEP_IT; 
			}
			//pRoot->UI_WriteBufferToFile(L"uncomp.smc", exebuf, exebufsize);

			wstring str = file->GetFileName();
			pRoot->CreateVirtFile(exebuf, exebufsize, str.data());
			return DELETE_IT;
		}
	}

	return KEEP_IT;
}
int ProjectFrame::OpenProject(const char *fname)
{
	bsString file;
	if (fname == 0)
	{
		const char *spc = ProjectItem::GetFileSpec(PRJNODE_PROJECT);
		const char *ext = ProjectItem::GetFileExt(PRJNODE_PROJECT);
		if (!BrowseFile(1, file, spc, ext))
			return 0;
		fname = file;
	}

	if (!CloseProject(1))
		return 0;

	theProject = new SynthProject;
	if (!theProject)
		return 0;

	theProject->AddRef();
	if (theProject->LoadProject(fname))
	{
		bsString msg;
		msg = "Could not load project: ";
		msg += theProject->WhatHappened();
		Alert(msg, "Ooops...");
		prjTree->RemoveAll();
		theProject->Release();
		theProject = 0;
		return 0;
	}
	InitPlayer();
	return 1;
}
Beispiel #7
0
ChainGrowth const & ChainGrowth::operator= (ChainGrowth const & that)
{
    WatchError
	Alert(&that, eUndefAssigner);
    return *this;
    CatchError
}
Beispiel #8
0
/*!
	The assigner.
*/
Move const & Move::operator= (Move const & that)
{
	WatchError
	Alert(&that, eUndefAssigner);
    return *this;
	CatchError
}
int ProjectFrame::SaveProjectAs()
{
	if (!theProject)
		return -1;

	bsString path;
	const char *spc = ProjectItem::GetFileSpec(PRJNODE_PROJECT);
	const char *ext = ProjectItem::GetFileExt(PRJNODE_PROJECT);
	if (!BrowseFile(0, path, spc, ext))
		return -1;
	if (theProject->SaveProject(path))
	{
		bsString msg;
		msg = "Could not save project: ";
		msg += theProject->WhatHappened();
		Alert(msg, "Ooops...");
		return -1;
	}
	bsString oldDir;
	bsString newDir;
	theProject->GetProjectDir(oldDir);
	theProject->SetProjectPath(path);
	theProject->GetProjectDir(newDir);
	if (oldDir.Length() > 0 && oldDir.Compare(newDir) != 0)
		theProject->CopyFiles(oldDir, newDir);
	return 0;
}
Beispiel #10
0
/*!
	The Dupllicator
*/
ChainGrowth::ChainGrowth(ChainGrowth const & that) :
	Init(that), mRnd(that.mRnd)
{
    WatchError
    Alert(&that, eUndefDuplicator);
    CatchError
}
Beispiel #11
0
/*!
	The assigner.
*/
ContactOrderObj const & ContactOrderObj::operator = (ContactOrderObj const & that)
{
	WatchError
	Alert(&that, eUndefAssigner);
	return *this;
	CatchError
}
Beispiel #12
0
/*!
	The assigner.
*/
SideChainCns const & SideChainCns::operator = (SideChainCns const & that)
{
	WatchError
	Alert(&that, eUndefAssigner);
	return *this;
	CatchError
}
// Parse a single resource
bool XML_ResourceFork::ParseResource(ResType Type, short ID)
{
    ResourceHandle = Get1Resource(Type,ID);
    if (ResourceHandle == NULL) {
        return false;
    }

    HLock(ResourceHandle);
    if (!DoParse()) {
        const char *Name = SourceName ? SourceName : "[]";
#ifdef TARGET_API_MAC_CARBON
        csprintf(
            temporary,
            "There were configuration-file parsing errors in resource %hd of object %s",
            ID,Name);
        SimpleAlert(kAlertStopAlert,temporary);
#else
        psprintf(
            ptemporary,
            "There were configuration-file parsing errors in resource %hd of object %s",
            ID,Name);
        ParamText(ptemporary,0,0,0);
        Alert(FatalErrorAlert,NULL);
#endif
        ExitToShell();
    }
    HUnlock(ResourceHandle);
    ReleaseResource(ResourceHandle);
    return true;
}
Beispiel #14
0
int dprintf(
	const char *format,
	...)
{
	char buffer[257]; /* [length byte] + [255 string bytes] + [null] */
	va_list arglist;
	int return_value;
	
	if (debug_status)
	{
		va_start(arglist, format);
		return_value= vsprintf(buffer+1, format, arglist);
		va_end(arglist);
		
		*buffer= strlen(buffer+1);
#ifdef DEBUG
		if (debugger_installed)
		{
			DebugStr((StringPtr)buffer);
		}
		else
#endif
		{
			ParamText((StringPtr)buffer, (StringPtr)"\p?", (StringPtr)"", (StringPtr)"");
			Alert(alrtNONFATAL_ERROR, (ModalFilterUPP) NULL);
			ParamText((StringPtr)"", (StringPtr)"", (StringPtr)"", (StringPtr)"");
		}
	}
	else
	{
Beispiel #15
0
RandomValidSC const & RandomValidSC::operator= (RandomValidSC const & that)
{
    WatchError
	Alert(&that, eUndefAssigner);
    return *this;
    CatchError
}
Beispiel #16
0
RandomStructured const & RandomStructured::operator= (RandomStructured const & that)
{
    WatchError
	Alert(&that, eUndefAssigner);
    return *this;
    CatchError
}
Beispiel #17
0
/*!
	The assigner.
*/
ACoreDistObj const & ACoreDistObj::operator = (ACoreDistObj const & that)
{
	WatchError
	Alert(&that, eUndefAssigner);
	return *this;
	CatchError
}
Beispiel #18
0
/*!
	The Dupllicator
*/
RandomStructured::RandomStructured(RandomStructured const & that) :
	Init(that), mRnd(that.mRnd)
{
    WatchError
    Alert(&that, eUndefDuplicator);
    CatchError
}
Beispiel #19
0
int Hsp3ExtLibInit( HSP3TYPEINFO *info )
{
	int i;
	STRUCTDAT *st;
	char tmp[1024];

	hspctx = info->hspctx;
	exinfo = info->hspexinfo;
	pmpval = exinfo->mpval;

	libmax = hspctx->hsphed->max_linfo / sizeof(LIBDAT);
	prmmax = hspctx->hsphed->max_finfo / sizeof(STRUCTDAT);

	hpidat = NULL;

	if ( Hsp3ExtAddPlugin() ) return 1;

	for(i=0;i<prmmax;i++) {
		st = GetPRM(i);
		if ( BindFUNC( st, NULL ) == 1 ) {
			sprintf( tmp,"No FUNC:%s",strp(st->nameidx) );
			Alert( tmp );
		}
	}
	return 0;
}
Beispiel #20
0
/*!
	Set the given argument in the term.
*/
Lnk FrR::setArg(Arg const & theArg)
{
	WatchError
	Alert(&theArg, eUndefArgs);	//	no args allowed.
	return InvLnk;
	CatchError
}
Beispiel #21
0
// Outside event handler because loading a dark library will automatically unload a defect map
bool MyFrame::LoadDarkHandler(bool checkIt)
{
    if (!pCamera || !pCamera->Connected)
    {
        Alert(_("You must connect a camera before loading a dark library"));
        m_useDarksMenuItem->Check(false);
        return false;
    }
    pConfig->Profile.SetBoolean("/camera/AutoLoadDarks", checkIt);
    if (checkIt)  // enable it
    {
        m_useDarksMenuItem->Check(true);
        if (pCamera->CurrentDefectMap)
            LoadDefectMapHandler(false);
        if (LoadDarkLibrary())
            return true;
        else
        {
            m_useDarksMenuItem->Check(false);
            return false;
        }
    }
    else
    {
        if (!pCamera->CurrentDarkFrame)
        {
            m_useDarksMenuItem->Check(false);      // shouldn't have gotten here
            return false;
        }
        pCamera->ClearDarks();
        m_useDarksMenuItem->Check(false);
        SetStatusText(_("Dark library unloaded"));
        return true;
    }
}
Beispiel #22
0
/*!
	The Dupllicator
*/
PCLFInit::PCLFInit(PCLFInit const & that) :
	Init(that), mPoints(that.mPoints)
{
    WatchError
    Alert(&that, eUndefDuplicator);
    CatchError
}
Beispiel #23
0
void City::Update(sf::Time *delta, float *playerX)
{
	UpdateRadar(*playerX);

	if (mAlertOn)
		Alert();
}
Beispiel #24
0
unsigned int
auth_resolve_groups(struct userlist *l, char *groups)
{

	char *group = NULL;
	unsigned int g, group_mask = 0;

	if (!groups || !*groups)
		return 0;

	while ((group = strtok(group?NULL:groups," "))) {
		for (g = 0; g < l->grpcnt; g++)
			if (!strcmp(l->groups[g], group))
				break;

		if (g == l->grpcnt) {
			Alert("No such group '%s' in userlist '%s'.\n",
				group, l->name);
			return 0;
		}

		group_mask |= (1 << g);
	}

	return group_mask;
}
Beispiel #25
0
BackBonePullMove::BackBonePullMove(BackBonePullMove const & that):Move(that)
{
    WatchError

    Alert(&that, eUndefDuplicator);

    CatchError
}
Beispiel #26
0
/* sends a log message when a backend goes down, and also sets last
 * change date.
 */
void set_backend_down(struct proxy *be)
{
	be->last_change = now.tv_sec;
	be->down_trans++;

	Alert("%s '%s' has no server available!\n", proxy_type_str(be), be->id);
	send_log(be, LOG_EMERG, "%s %s has no server available!\n", proxy_type_str(be), be->id);
}
Beispiel #27
0
/**\brief Creates a new Alert (Lua callable).
 */
int Hud::newAlert(lua_State *L) {
	int n = lua_gettop(L);  // Number of arguments
	if (n != 1)
		return luaL_error(L, "Got %d arguments expected 1 (message)", n);
	const char* msg = luaL_checkstring(L,1);
	Alert(msg);
	return 0;
}
Beispiel #28
0
DoublePullMove::DoublePullMove(DoublePullMove const & that):Move(that)
{
    WatchError

    Alert(&that, eUndefDuplicator);

    CatchError
}
Beispiel #29
0
long MoviesMainDialog::handleCommand(ushort nc, ushort id, HWND sender)
{
    switch (id) {
    case IDM_MOVIES_MOVIES:
    case ID_VIEW_MOVIES:
        if (NULL == udf_)
            return messageHandled;
        if (movies_.empty())
        {
            if (errNone != MoviesFromTheatres(movies_, *udf_))
            {
                Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
                return messageHandled;
            }
        }
        prepareMoviesList();
        setDisplayMode(showMovies);
        return messageHandled;
    case IDM_MOVIES_THEATERS:
    case ID_VIEW_THEATERS:
        if (NULL == udf_)
            return messageHandled;
        prepareTheatresList();
        setDisplayMode(showTheatres);
        return messageHandled;
    case ID_VIEW_UPDATE:
        if (errNone != MoviesFetchData())
            Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        return messageHandled;
    case ID_VIEW_CHANGE_LOCATION:
    {
        Preferences& prefs = *GetPreferences();
        char_t* loc = StringCopy(prefs.moviesLocation);
        if (IDOK == ChangeLocationDialog::showModal(loc, handle()))
        {
            free(prefs.moviesLocation);
            prefs.moviesLocation = loc;
            if (errNone != MoviesFetchData())
                Alert(IDS_ALERT_NOT_ENOUGH_MEMORY);
        }
        return messageHandled;
    }
    }
    return ModuleDialog::handleCommand(nc, id, sender);
}
Beispiel #30
0
// Initialization of string table routine
void InitTable()
{
	LIST *o;
	char tmp[MAX_SIZE];
	LANGLIST *e = NULL;
	LANGLIST *os_lang = NULL;
	char table_name[MAX_SIZE];
	if (MayaquaIsMinimalMode())
	{
		// Not to load in case of minimum mode
		return;
	}

	o = LoadLangList();
	if (o == NULL)
	{
LABEL_FATAL_ERROR:
		Alert("Fatal Error: The file \"hamcore.se2\" is missing or broken.\r\nPlease check hamcore.se2.\r\n\r\n(First, reboot the computer. If this problem occurs again, please reinstall VPN software files.)", NULL);
		exit(-1);
		return;
	}

	// Read the lang.config
	if (LoadLangConfigCurrentDir(tmp, sizeof(tmp)))
	{
		e = GetBestLangByName(o, tmp);
	}

	os_lang = GetBestLangForCurrentEnvironment(o);

	if (e == NULL)
	{
		e = os_lang;
	}

	if (e == NULL)
	{
		goto LABEL_FATAL_ERROR;
	}

	SaveLangConfigCurrentDir(e->Name);

	Copy(&current_lang, e, sizeof(LANGLIST));
	Copy(&current_os_lang, os_lang, sizeof(LANGLIST));

	current_lang.LangList = current_lang.LcidList = NULL;
	current_os_lang.LangList = current_os_lang.LcidList = NULL;

	// Read the corresponding string table
	Format(table_name, sizeof(table_name), "|strtable_%s.stb", current_lang.Name);
	if (LoadTable(table_name) == false)
	{
		goto LABEL_FATAL_ERROR;
	}

	FreeLangList(o);
}