Exemplo n.º 1
0
pascal boolean odbCountItems (odbref odb, bigstring bspath, long *count) {

	hdlhashtable htable;
	bigstring bsname;
	tyvaluerecord val;
	long ctitems;
	hdlhashnode hnode;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	if (!odbexpandtodotparams (bspath, &htable, bsname))
		return (false);
	
	if (!langsymbolreference (htable, bsname, &val, &hnode))
		return (false);
	
	if (!odbvaltotable (val, &htable, hnode))
		return (false);
	
	if (!hashcountitems (htable, &ctitems))
		return (false);
	
	*count = ctitems;
	
	return (true);
	} /*odbCountItems*/
Exemplo n.º 2
0
pascal boolean odbNewTable (odbref odb, bigstring bspath) {

	hdlhashtable htable;
	bigstring bsname;
	tyvaluerecord val;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	if (!odbexpandtodotparams (bspath, &htable, bsname))
		return (false);
	
	if (!langexternalnewvalue (idtableprocessor, nil, &val))
		return (false);
	
	if (!hashtableassign (htable, bsname, val)) {
	
		disposevaluerecord (val, true);
		
		return (false);
		}
	
	exemptfromtmpstack (&val);
	
	return (true);	
	} /*odbNewTable*/
Exemplo n.º 3
0
pascal boolean odbDefined (odbref odb, bigstring bspath) {

	/*
	4.1b5 dmb: new routine
	*/
	
	hdlhashtable htable;
	bigstring bsname;
	boolean fl;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	disablelangerror ();
	
	fl = odbexpandtodotparams (bspath, &htable, bsname);
	
	enablelangerror ();
	
	if (fl) {
		
		pushhashtable (htable);
		
		fl = hashsymbolexists (bsname);
		
		pophashtable ();
		}
	
	return (fl);
	} /*odbDefined*/
Exemplo n.º 4
0
static boolean gettitleverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
	
	/*
	6/24/92 dmb: get the title of the object or window indicated in hparam1.
	if it's  not an external value or a window, always return the empty string
	*/
	
	hdlwindowinfo hinfo;
	bigstring bstitle;
	boolean fl = false;
	
	flnextparamislast = true;
	
	if (!getwinparam (hparam1, 1, &hinfo))
		return (false);
	
	setemptystring (bstitle);
	
	if (hinfo != nil) {
		
		shellgetwindowtitle (hinfo, bstitle); // 7.24.97 dmb: was windowgettitle
		
		fl = true;
		}
	
	return (setstringvalue (bstitle, vreturned));
	} /*gettitleverb*/
Exemplo n.º 5
0
pascal boolean odbUpdateOdbref (WindowPtr w, odbref odb) {
	hdlcancoonrecord hc;
	
	setemptystring (bserror);
	
	hc = (hdlcancoonrecord) odb;
	
	if (w != NULL) {
		shellpushglobals (w);
	
		(*shellglobals.setsuperglobalsroutine) ();
		}
	
	(**hc).hdatabase = databasedata; /*current database*/
	
	(**hc).hroottable = roottable; /*current root table*/
	
	(**hc).hrootvariable = rootvariable; /*current root variable*/
	
	(**hc).shellwindow = shellwindow;
	
	(**hc).accesssing = true;
		
	if (w != NULL) {
		shellpopglobals ();
	
		(*shellglobals.setsuperglobalsroutine) ();	
		}
	
	return (true);
	} /*odbUpdateOdbref*/
Exemplo n.º 6
0
pascal boolean odbCloseFile (odbref odb) {
	
	/*
	1/22/91 dmb: added scan of new ccglobalsstack
	
	2/26/93 dmb: support shutdown scripts
	*/
	
	hdlcancoonrecord hc = (hdlcancoonrecord) odb;
	
	setemptystring (bserror);
	
	if (hc == nil) /*nothing to do*/
		return (true);
	
	setcancoonglobals (hc);
	
	if (!(**hc).accesssing)
		dbdispose (); /*do before clearing globals -- depends on databasedata*/
	
	disposecancoonrecord (hc);
	
	clearcancoonglobals ();
	
	return (true);
	} /*odbCloseFile*/
Exemplo n.º 7
0
pascal boolean odbNewFile (hdlfilenum fnum) {
	
	/*
	4.1b5 dmb: new routine. minimal db creation. does not leave it open
	*/
	
	tyversion2cancoonrecord info;
	dbaddress adr = nildbaddress;
	boolean fl;
	
	setemptystring (bserror);
	
	if (!dbnew (fnum))
		return (false);
	
	clearbytes (&info, sizeof (info));
	
	info.versionnumber = conditionalshortswap (cancoonversionnumber);
	
	fl = dbassign (&adr, sizeof (info), &info);
	
	if (fl) {
		
		dbsetview (cancoonview, adr);
		
		dbclose ();
		}
	
	cancoonglobals = nil;	/*if they've been set, they're out of date*/
	
	dbdispose ();
	
	return (fl);
	} /*odbNewFile*/
Exemplo n.º 8
0
static boolean opnavigationkey (byte chkey) {
	
	/*
	add chkey to the typing buffer bsselect, resetting the buffer 
	depending on elapsed time.  select the table entry that whose name 
	starts with a string equal to or greater than the resulting string.
	the net effect should be much like typing in standard file.
	
	note that statics  are used to retain information between calls.
	*/
	
	static bigstring bsselection;
	static long timelastkey = 0L;
	register byte c = chkey;
	register long timethiskey;
	hdlheadrecord hnode;
	
	timethiskey = appletevent.when;
	
	if ((timethiskey - timelastkey) > (2 * KeyThresh)) /*long enough gap, reset*/
		setemptystring (bsselection);
	
	timelastkey = timethiskey; /*set up for next time*/
	
	pushchar (chkey, bsselection);
	
	opfindhead ((**outlinedata).hbarcursor, bsselection, &hnode);
	
	opmoveto (hnode);
	
	return (true);
	} /*opnavigationkey*/
Exemplo n.º 9
0
boolean getfilecomment (FSSpec *pfs, bigstring bscomment) {
	
	DTPBRec dt;
	
	clearbytes (&dt, longsizeof (dt));
	
	setemptystring (bscomment); /*default return*/
	
	if (!hasdesktopmanager ((*pfs).vRefNum))
		return (false);
	
	dt.ioVRefNum = (*pfs).vRefNum;
	
	if (PBDTGetPath (&dt) != noErr)
		return (false);
	
	dt.ioNamePtr = (*pfs).name;
	
	dt.ioDirID = (*pfs).parID;
	
	dt.ioDTBuffer = (Ptr) bscomment + 1;
	
	dt.ioDTReqCount = lenbigstring;
	
	if (PBDTGetCommentSync (&dt) != noErr)
		return (false);
	
	setstringlength (bscomment, dt.ioDTActCount);
	
	return (true);
	} /*getfilecomment*/
Exemplo n.º 10
0
boolean filespectopath (const ptrfilespec fs, bigstring bspath) {
	
	//
	// 2006-09-09 creedon: for Mac, FSRef-ized
	//
	// 2.1a7 dmb: if it's a null filespec, return the empty string
	//
	// 1991-12-17 dmb: don't check for folderness if file doesn't exist-- we dont want to generate any errors here
	//
	// 1991-10-14 dmb: make sure folder paths end in :
	//
	// 1991-06-28 dmb:	when you resolve an alias of a volume, the fsspec has a parent dirid of 1.  we catch this as a
	//				special case here, and return the empty string as the path
	//
	
	#ifdef MACVERSION
	
		boolean flfolder;
		
		setemptystring (bspath);

		if (!directorytopath (fs, bspath))
			return (false);
		
		if (!fs->flags.flvolume) {
			
			bigstring bsfile;
			
			fsnametobigstring (&fs->name, bsfile);
			
			pushstring (bsfile, bspath);
			}
		
		if (fileexists (fs, &flfolder))
			if (flfolder)
				assurelastchariscolon (bspath);
		
		return (true);
		
	#endif

	#ifdef WIN95VERSION
	
		// 5.0d12 dmb: use GetFullPath to clean up 8.3 names
		char * fileptr;
		
		copyptocstring (fsname (fs), bspath);
		
		GetFullPathName (bspath, lenbigstring, bspath, &fileptr);

		convertcstring (bspath);
		
		nullterminate (bspath);

		return (true);
		
	#endif
	
	} // filespectopath
Exemplo n.º 11
0
pascal boolean odbOpenFile (hdlfilenum fnum, odbref *odb, boolean flreadonly) {
	
	hdlcancoonrecord hc = nil;
	dbaddress adr;
	short versionnumber;
	
	setemptystring (bserror);
	
	#ifndef isFrontier
	
		initlangcallbacks ();
	
	#endif
	
	if (!dbopenfile (fnum, flreadonly))
		return (false);
	
	dbgetview (cancoonview, &adr);
	
	if (!dbreference (adr, sizeof (versionnumber), &versionnumber))
		goto error;
	
	disktomemshort (versionnumber);
	
	if (!newcancoonrecord (&cancoonglobals))
		goto error;
	
	hc = cancoonglobals;
	
	(**hc).hdatabase = databasedata; /*result from dbopenfile*/
	
	switch (versionnumber) {
		
		case 2:
		case cancoonversionnumber:
			if (!loadversion2cancoonfile (adr, hc))
				goto error;
			
			*odb = (odbref) hc;
			
			return (true);
			
		default:
			alertdialog ((ptrstring) "\x59" "The version number of this database file is not recognized by this version of Frontier.");
			
			goto error;
		} /*switch*/
	
	error:
	
	dbdispose ();
	
	disposecancoonrecord (hc); /*checks for nil*/
	
	clearcancoonglobals ();
	
	return (false);
	} /*odbOpenFile*/
Exemplo n.º 12
0
pascal boolean odbSetValue (odbref odb, bigstring bspath, odbValueRecord *value) {

	hdlhashtable htable;
	bigstring bsname;
	tyvaluerecord val;
	tyvaluetype type = langexternalgetvaluetype (value->valuetype);
	
	setemptystring (bserror);
	
	#ifndef isFrontier
	
	if (type == externalvaluetype) {
		
		langerrormessage (canthandlethistypeerror);
		
		return (false);
		}
	
	#endif
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	if (!odbexpandtodotparams (bspath, &htable, bsname))
		return (false);
	
	if (type == (tyvaluetype) -1) {
	
		if (!setbinaryvalue (value->data.binaryvalue, value->valuetype, &val))
			return (false);
		}
	else {
	
		initvalue (&val, type);
		
		val.data.binaryvalue = value->data.binaryvalue;
		}
	
	if (!copyvaluerecord (val, &val))
		return (false);
	
	if (!hashtableassign (htable, bsname, val)) {
	
		disposevaluerecord (val, true);
		
		return (false);
		}
	
	exemptfromtmpstack (&val);
	
	return (true);	
	} /*odbSetValue*/
Exemplo n.º 13
0
pascal boolean odbDelete (odbref odb, bigstring bspath) {

	hdlhashtable htable;
	bigstring bsname;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	if (!odbexpandtodotparams (bspath, &htable, bsname))
		return (false);
	
	return (hashtabledelete (htable, bsname));
	} /*odbDelete*/
Exemplo n.º 14
0
boolean findinparenttable (hdlhashtable htable, hdlhashtable *hparent, bigstring bs) {
	
	/*
	return enough information to identify the line in the table that the indicated
	table zoomed from.  return false if that table isn't displayed in a window, or
	if for some reason a node couldn't be found.
	
	11/14/90 DW: add flopen flag -- if true and the window isn't open, we try to 
	open it, returning false if it couldn't be opened.
	
	5.0d18 dmb: removed flopen flag, making this function public
	
	5.0.2b13 dmb: if parenthashtable is nil, search for it and set it. parentOf func
	now calls us (we stole its code).
	*/
	
	hdlhashtable h, ht = (**htable).parenthashtable;
	tyfindtableinfo info;
	
	setemptystring (bs);
	
	if (ht == nil) { // parent isn't set; search globally (& set name)
	
		if ((**htable).fllocaltable) {
			
			for (h = currenthashtable; h != nil; h = (**h).prevhashtable) {
				
				if (parentsearch (h, htable, true, &ht, bs))
					break;
				}
			}
		else
			parentsearch (roottable, htable, true, &ht, bs);
		
		(**htable).parenthashtable = ht; // retain link for future ops
		}
	else { // parent already set, just need to find name
	
		info.htablelookfor = htable; /*set global for traversal*/
		
		if (hashtablevisit (ht, &findtablevisit, &info))
			return (false);
		
		gethashkey (info.hnodelookfor, bs);
		}
	
	*hparent = ht;
	
	return (ht != nil) || (htable == roottable);
	} /*findinparenttable*/
Exemplo n.º 15
0
	boolean directorytopath ( const ptrfilespec fs, bigstring path ) {

		//
		// 2006-09-09 creedon: FSRef-ized
		//			       another way might be to use FSRefMakePath and then push insert the volume name on it
		//

		OSErr err;
		OSStatus status;
		FSRef volumesfsref;
		
		status = FSPathMakeRef ((UInt8 *)"/Volumes", &volumesfsref, NULL);
		
		if ((status == noErr) && (FSCompareFSRefs (&fs->ref, &volumesfsref) == noErr)) {	/* bail if fs is Volumes directory */
		
			setemptystring (path);
			
			return (true);
			}

		CFMutableStringRef ioPath = CFStringCreateMutable (NULL, 0);
		FSCatalogInfo catalogInfo;
		FSRef fsrefnomad = fs->ref;
		HFSUniStr255 names[100];
		int i, n;
		UniChar inSepChar = ':';
		
		err = noErr;

		clearbytes (&catalogInfo, longsizeof (catalogInfo));

		for (n = 0; err == noErr && catalogInfo.nodeID != fsRtDirID && n < 100; n++) {

			err = FSGetCatalogInfo (&fsrefnomad, kFSCatInfoNodeID, &catalogInfo, &names[n], NULL, &fsrefnomad);
			}
			
		if (err != noErr)
			return (false);
			
		for (i = n - 1; i >= 0; --i) {

			CFStringAppendCharacters (ioPath, names[i].unicode, names[i].length);
			
			CFStringAppendCharacters (ioPath, &inSepChar, 1);
			}
		
		boolean success = CFStringGetPascalString (ioPath, path, 256, kCFStringEncodingMacRoman);
		CFRelease(ioPath); //PBS 2/28/11: fixed memory leak
		return success;
	} // directorytopath
Exemplo n.º 16
0
pascal boolean odbGetValue (odbref odb, bigstring bspath, odbValueRecord *value) {

	hdlhashtable htable;
	bigstring bsname;
	tyvaluerecord val;
	hdlhashnode hnode;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	if (!odbexpandtodotparams (bspath, &htable, bsname))
		return (false);
	
	if (!langsymbolreference (htable, bsname, &val, &hnode))
		return (false);
	
	#ifndef isFrontier

	if (val.valuetype == externalvaluetype) {
		
		langerrormessage (canthandlethistypeerror);
		
		return (false);
		}
	
	#endif
	
	if (!copyvaluerecord (val, &val))
		return (false);
	
	if (!copyvaluedata (&val))
		return (false);
	
	exemptfromtmpstack (&val);
	
	(*value).valuetype = (odbValueType) langexternalgettypeid (val);
	
	/*
	if (val.valuetype == binaryvaluetype)
		pullfromhandle (val.data.binaryvalue, 0L, sizeof (typeid), &(*value).valuetype);
	*/
	
	(*value).data.binaryvalue = val.data.binaryvalue; /*largest field covers everything*/
	
	return (true);
	} /*odbGetValue*/
Exemplo n.º 17
0
pascal boolean odbSaveFile (odbref odb) {
	
	hdlcancoonrecord hc = (hdlcancoonrecord) odb;
	tyversion2cancoonrecord info;
	dbaddress adr;
	
	setemptystring (bserror);
	
	setcancoonglobals (hc);
	
	#ifdef isFrontier
	
	if ((**hc).accesssing) {
		
		return (shellsave ((**hc).shellwindow));
		}
	
	#endif
	
	dbgetview (cancoonview, &adr);
	
	if (adr == nildbaddress)
		return (false);
	
	if (!dbreference (adr, sizeof (info), &info))
		return (false); 
	
	info.versionnumber = conditionalshortswap (cancoonversionnumber);
	
	if (!tablesavesystemtable ((**hc).hrootvariable, &info.adrroottable))
		return (false);
	
	memtodisklong (info.adrroottable);

	clearbytes (&info.waste, sizeof (info.waste));
	
	if (!dbassign (&adr, sizeof (info), &info))
		return (false);
	
	dbflushreleasestack (); /*release all the db objects that were saved up*/
	
	dbsetview (cancoonview, adr);
	
	return (true);
	} /*odbSaveFile*/
Exemplo n.º 18
0
static boolean menugetcommandkeyverb (hdltreenode hparam1, tyvaluerecord *v) {
	
	/*
	menu/op globals are set.  get the command key of the current headline
	*/
	
	tymenuiteminfo item;
	bigstring bscommandkey;
	
	if (!langcheckparamcount (hparam1, 0)) /*shouldn't have any parameters*/
		return (false);
	
	setemptystring (bscommandkey);
	
	if (megetmenuiteminfo ((**outlinedata).hbarcursor, &item))
		if (item.cmdkey != chnul)
			getcommandkeystring (item.cmdkey, keycommand, bscommandkey);

	return (setstringvalue (bscommandkey, v));
	} /*menugetscriptverb*/
Exemplo n.º 19
0
pascal void odbDisposeValue (odbref odb, odbValueRecord *value) {
	
	tyvaluetype type;
	tyvaluerecord val;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	type = langexternalgetvaluetype ((OSType) (*value).valuetype);
	
	if (type == -1)	/*no match; must have been a binary value*/
		type = binaryvaluetype;
	
	initvalue (&val, type);
	
	val.data.binaryvalue = (*value).data.binaryvalue;
	
	disposevaluerecord (val, false);
	} /*odbDisposeValue*/
Exemplo n.º 20
0
pascal boolean odbAccessWindow (WindowPtr w, odbref *odb) {
	
	/*
	4.1b5 dmb: new entrypoint
	
	for the db verbs withing frontier, we need to be able to "open" a 
	database that is already open. We keep our own hashtablestack; that's
	our context. But the root table and variable and the database are just 
	borrowed from the given root window.
	*/
		
	setemptystring (bserror);
	
	if (!newcancoonrecord (&cancoonglobals))
		return (false);
	
	*odb = (odbref) cancoonglobals;
	
	odbUpdateOdbref (w, *odb);
	return (true);
	} /*odbAccess*/
Exemplo n.º 21
0
pascal boolean odbGetNthItem (odbref odb, bigstring bspath, long n, bigstring bsname) {

	hdlhashtable htable;
	tyvaluerecord val;
	hdlhashnode hnode;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	if (!odbexpandtodotparams (bspath, &htable, bsname))
		return (false);
	
	if (!langsymbolreference (htable, bsname, &val, &hnode))
		return (false);
	
	if (!odbvaltotable (val, &htable, hnode))
		return (false);
	
	if (!hashgetiteminfo (htable, (short) (n - 1), bsname, nil))
		return (false);
	
	return (true);
	} /*odbGetNthItem*/
Exemplo n.º 22
0
pascal boolean odbGetType (odbref odb, bigstring bspath, OSType *odbType) {
	
	hdlhashtable htable;
	bigstring bsname;
	tyvaluerecord val;
	hdlhashnode hnode;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	if (!odbexpandtodotparams (bspath, &htable, bsname))
		return (false);
	
	if (!langsymbolreference (htable, bsname, &val, &hnode))
		return (false);
	
	if (val.valuetype == binaryvaluetype)
		*odbType = getbinarytypeid (val.data.binaryvalue);
	else
		*odbType = langexternalgettypeid (val);
	
	return (true);
	} /*odbGetType*/
Exemplo n.º 23
0
pascal boolean odbGetModDate (odbref odb, bigstring bspath, unsigned long *date) {

	hdlhashtable htable;
	bigstring bsname;
	tyvaluerecord val;
	hdlhashnode hnode;
	
	setemptystring (bserror);
	
	setcancoonglobals ((hdlcancoonrecord) odb);
	
	if (!odbexpandtodotparams (bspath, &htable, bsname))
		return (false);
	
	if (!langsymbolreference (htable, bsname, &val, &hnode))
		return (false);
	
	if (!odbvaltotable (val, &htable, hnode))
		return (false);
	
	*date = (**htable).timelastsave;
	
	return (true);
	} /*odbGetModDate*/
Exemplo n.º 24
0
static boolean wpfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
	
	/*
	bridges wp.c with the language.  the name of the verb is bs, its first parameter
	is hparam1, and we return a value in vreturned.
	
	we use a limited number of support routines from lang.c to get parameters and
	to return values. 
	
	return false only if the error is serious enough to halt the running of the script
	that called us, otherwise error values are returned through the valuerecord, which
	is available to the script.
	
	if we return false, we try to provide a descriptive error message in the 
	returned string bserror.
	
	12/30/91 dmb: use wpinserthandle for insertfunc
	
	5/17/92 dmb: setselectfunc now uses longs, as it should always have
	
	6/1/93 dmb: when vreturned is nil, return whether or not verb token must 
	be run in the Frontier process
	
	5.0.2b17 dmb: insert, settext get readonly handles
	*/
	
	register tyvaluerecord *v = vreturned;
	register boolean fl;
	WindowPtr targetwindow;
	short idprocessor = idwordprocessor;
	
	if (v == nil)
		return (true);
	
	errornum = 0;
	
	setbooleanvalue (false, v); /*by default, wp functions return true*/
	
	switch (token) {
		
		/*
		case packtextfunc:
			if (!wppacktextverb (hparam1, v))
				goto error;
			
			return (true);
		
		case unpacktextfunc:
			if (!wpunpacktextverb (hparam1, v))
				goto error;
			
			return (true);
		*/
		
		case intextmodefunc: /*verb that don't require wp-specific target*/
		case settextmodefunc:
			idprocessor = -1;
			
			break;
		}
	
	/*all other verbs require a wp window in front -- set wpengine.c globals*/
	
	if (!langfindtargetwindow (idprocessor, &targetwindow)) {
		
		errornum = nowperror;
		
		goto error;
		}
	
	shellpushglobals (targetwindow);
	
	(*shellglobals.gettargetdataroutine) (idprocessor); /*set wp globals*/
	
	fl = false; /*default return value*/
	
	switch (token) {
		
		case intextmodefunc: {
			WindowPtr textwindow;
			
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			fl = setbooleanvalue (langfindtargetwindow (idwordprocessor, &textwindow), v);
			
			break;
			}
		
		case settextmodefunc: {
			boolean flenter;
			
			flnextparamislast = true;
			
			if (!getbooleanvalue (hparam1, 1, &flenter))
				break;
			
			fl = setbooleanvalue ((*shellglobals.settextmoderoutine) (flenter), v);
			
			break;
			}
		
		case gettextfunc: {
			Handle htext;
			
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			if (!wpgettexthandle (&htext))
				break;
			
			fl = setheapvalue (htext, stringvaluetype, v);
			
			break;
			}
		
		case settextfunc: {
			Handle htext;
			
			flnextparamislast = true;
			
			if (!getreadonlytextvalue (hparam1, 1, &htext))
				break;
			
			if (!wpsettexthandle (htext))
				break;
			
			fl = setbooleanvalue (true, v);
			
			break;
			}
		
		case getseltextfunc: {
			/*
			bigstring bs;
			*/
			Handle htext;
			
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			if (!wpgetseltexthandle (&htext))
				break;
			
			fl = setheapvalue (htext, stringvaluetype, v);
			
			/*
			wpgetseltext (bs);
			
			fl = setstringvalue (bs, v);
			*/
			
			break;
			}
		
		case getdisplayfunc:
			
			if (!langcheckparamcount (hparam1, 0)) /*too many parameters were passed*/
				break;
			
			(*v).data.flvalue = !(**wpdata).flinhibitdisplay;
			
			fl = true;
			
			break;
		
		case setdisplayfunc: {
			boolean fldisplay;
			
			flnextparamislast = true;
			
			if (!getbooleanvalue (hparam1, 1, &fldisplay))
				break;
			
			(*v).data.flvalue = wpsetdisplay (fldisplay);
			
			fl = true;
			
			break;
			}
		
		case getrulerfunc:
			
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			(*v).data.flvalue = wpgetruler ();
			
			fl = true;
			
			break;
		
		case setrulerfunc: {
			boolean flruler;
			
			flnextparamislast = true;
			
			if (!getbooleanvalue (hparam1, 1, &flruler))
				break;
			
			(*v).data.flvalue = wpsetruler (flruler);
			
			fl = true;
			
			break;
			}
		
		case getindentfunc: {
			short indent;
			
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			wpgetindent (&indent);
			
			fl = setlongvalue (indent, v);
			
			break;
			}
			
		case setindentfunc: {
			short indent;
			
			flnextparamislast = true;
			
			if (!getintvalue (hparam1, 1, &indent))
				break;
			
			(*v).data.flvalue = wpsetindent (indent);
			
			fl = true;
			
			break;
			}
			
		case getleftmarginfunc: {
			short leftmargin;
			
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			wpgetleftmargin (&leftmargin);
			
			fl = setlongvalue (leftmargin, v);
			
			break;
			}
			
		case setleftmarginfunc: {
			short leftmargin;
			
			flnextparamislast = true;
			
			if (!getintvalue (hparam1, 1, &leftmargin))
				break;
			
			(*v).data.flvalue = wpsetleftmargin (leftmargin);
			
			fl = true;
			
			break;
			}
			
		case getrightmarginfunc: {
			short rightmargin;
			
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			wpgetrightmargin (&rightmargin);
			
			fl = setlongvalue (rightmargin, v);
			
			break;
			}
			
		case setrightmarginfunc: {
			short rightmargin;
			
			flnextparamislast = true;
			
			if (!getintvalue (hparam1, 1, &rightmargin))
				break;
			
			(*v).data.flvalue = wpsetrightmargin (rightmargin);
			
			fl = true;
			
			break;
			}
		
		case setspacingfunc: {
			short spacing;
			
			flnextparamislast = true;
			
			if (!getintvalue (hparam1, 1, &spacing))
				break;
			
			(**wpwindowinfo).selectioninfo.leading = spacing;
			
			fl = setbooleanvalue (wpsetleading (), v);
			
			break;
			}
		
		case setjustificationfunc: {
			short justification;
			
			flnextparamislast = true;
			
			if (!getintvalue (hparam1, 1, &justification))
				break;
			
			(**wpwindowinfo).selectioninfo.justification = (tyjustification) (justification - 1);
			
			fl = setbooleanvalue (wpsetjustify (), v);
			
			break;
			}
		
		case settabfunc: {
			short pos;
			short type;
			char fill;
			
			if (!getintvalue (hparam1, 1, &pos))
				break;
			
			if (!getintvalue (hparam1, 2, &type)) /*1 for left tab; 2 center; etc.*/
				break;
			
			flnextparamislast = true;
			
			if (!getcharvalue (hparam1, 3, &fill))
				break;
			
			fl = setbooleanvalue (wpsettab (pos, type - 1, fill), v);
			
			break;
			}
		
		case cleartabsfunc: {
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			fl = setbooleanvalue (wpcleartabs (), v);
			
			break;
			}
		
		case getselectfunc: {
			long startsel, endsel;
			
			wpgetselection (&startsel, &endsel);
			
			if (!langsetlongvarparam (hparam1, 1, startsel))
				return (false);
			
			flnextparamislast = true;
			
			if (!langsetlongvarparam (hparam1, 2, endsel))
				return (false);
			
			(*v).data.flvalue= true;
			
			fl = true;
			
			break;
			}
		
		case setselectfunc: {
			long startsel, endsel;
			
			if (!getlongvalue (hparam1, 1, &startsel))
				break;
			
			flnextparamislast = true;
			
			if (!getlongvalue (hparam1, 2, &endsel))
				break;
			
			wpsetselection (startsel, endsel);
			
			(*v).data.flvalue= true;
			
			fl = true;
			
			break;
			}
		
		case insertfunc: {
			Handle x;

			flnextparamislast = true;
			
			if (!getreadonlytextvalue (hparam1, 1, &x))
				break;
			
			wptrimhiddentext ();
			
			if (!wpinserthandle (x))
				break;
			
			(*v).data.flvalue = true;
			
			fl = true;
			
			break;
			}
		
		/*
		case findfunc: {
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			(*v).data.flvalue = wpsearch (bs, false, false, false, false);
			
			fl = true;
			
			break;
			}
		
		case replacefunc:
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			(*v).data.flvalue = wpinsert (searchparams.bsreplace);
			
			fl = true;
			
			break;
		*/
		
		#if false
		
		case writetofilefunc: {
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			(*v).data.flvalue = wpwritetofile (bs);
			
			fl = true;
			
			break;
			}
			
		case readfromfilefunc: {
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			(*v).data.flvalue = wpreadfromfile (bs);
			
			fl = true;
			
			break;
			}
		
		case readfromtextfilefunc: {
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			(*v).data.flvalue = wpreadfromtextfile (bs);
			
			fl = true;
			
			break;
			}
		
		case writetotextfilefunc: {
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			(*v).data.flvalue = wpwritetotextfile (bs);
			
			fl = true;
			
			break;
			}
		
		#endif
		
		#ifdef flvariables
		
		case newvariablefunc: {
			bigstring bs, bsvalue;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 2, bsvalue))
				break;
			
			(*v).data.flvalue = wpnewvariable (bs, bsvalue);
			
			fl = true;
			
			break;
			}
		
		case deletevariablefunc: {
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			(*v).data.flvalue = wpdeletevariable (bs);
			
			fl = true;
			
			break;
			}
		
		case getnthvariablefunc: {
			short ix;
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getintvalue (hparam1, 1, &ix))
				break;
			
			if (!wpgetnthvariable (ix, bs))
				setemptystring (bs);
			
			fl = setstringvalue (bs, v);
			
			break;
			}
		
		case setvariablevaluefunc: {
			bigstring bs, bsvalue;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 2, bsvalue))
				break;
			
			(*v).data.flvalue = wpsetvariablevalue (bs, bsvalue);
			
			fl = true;
			
			break;
			}
		
		case getvariablevaluefunc: {
			bigstring bs, bsvalue;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			if (!wpgetvariablevalue (bs, bsvalue))
				setemptystring (bsvalue);
			
			fl = setstringvalue (bsvalue, v);
			
			break;
			}
		
		case insertvariablefunc: {
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				break;
			
			(*v).data.flvalue = wpinsertvariable (bs);
			
			fl = true;
			
			break;
			}
		
		case getevalfunc:
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			(*v).data.flvalue = wpgetevaluate ();
			
			fl = true;
			
			break;
		
		case setevalfunc: {
			boolean flexpand;
			
			flnextparamislast = true;
			
			if (!getbooleanvalue (hparam1, 1, &flexpand))
				break;
			
			(*v).data.flvalue = wpsetevaluate (flexpand);
			
			fl = true;
			
			break;
			}
		
		case hilitevariablesfunc: {
			boolean flhilite;
			
			flnextparamislast = true;
			
			if (!getbooleanvalue (hparam1, 1, &flhilite))
				break;
			
			(*v).data.flvalue = wphilitevariables (flhilite);
			
			fl = true;
			
			break;
			}
		
		#endif
		
		case rulerlengthfunc:
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			fl = setlongvalue (wpavailwidth (), v);
			
			break;
		
		case gofunc: {
			tydirection dir;
			long dist;
			
			if (!getdirectionvalue (hparam1, 1, &dir))
				break;
			
			flnextparamislast = true;
			
			if (!getlongvalue (hparam1, 2, &dist))
				break;
			
			fl = setbooleanvalue (wpgo (dir, dist), v);
			
			break;
			}
		
		case selectwordfunc:
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			fl = setbooleanvalue (wpselectword (), v);
			
			break;
		
		case selectlinefunc:
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			fl = setbooleanvalue (wpselectline (), v);
			
			break;
		
		case selectparafunc:
			if (!langcheckparamcount (hparam1, 0))
				break;
			
			fl = setbooleanvalue (wpselectpara (), v);
			
			break;
		
		} /*switch*/
	
	shellupdatescrollbars (shellwindowinfo);
	
	shellsetselectioninfo (); /*force ruler update*/
	
	shellpopglobals ();
	
	return (fl);
	
	error:
	
	if (errornum != 0) /*get error string*/
		getstringlist (wperrorlist, errornum, bserror);
	
	return (false);
	} /*wpfunctionvalue*/
Exemplo n.º 25
0
static boolean parentsearch (hdlhashtable intable, hdlhashtable fortable, boolean flonlyinmemory, hdlhashtable *hparent, bigstring bsname) {
	
	/*
	4/29/96 4.0b8 dmb: we need to convert fortable to a parenttable/name address pair
	
	root is a special case.
	
	we have no direct way of making a table-to-parent connection independent of 
	windows. someday, we should make the parenttable field always valid, but that 
	will require relatively extensive (minor but widely distributed) code change.
	
	5.0.2b13 dmb: moved this in from langvalue.c
	*/
	
	register hdlhashtable ht = intable;
	register hdlhashnode x;
	register short i;
	tyvaluerecord val;
	register hdlexternalvariable hv = nil;
	
	if (intable == fortable) {	/*special case for root*/
	
		*hparent = nil;
		
		if ((**intable).fllocaltable)
			setemptystring (bsname);
		else
			copystring (nameroottable, bsname);
		
		return (true);
		}
	
	for (i = 0; i < ctbuckets; i++) {
		
		x = (**ht).hashbucket [i];
		
		while (x != nil) { /*chain through the hash list*/
			
			register boolean fltempload = false;
			hdlhashtable htable;
			
			val = (**x).val;
			
			if (val.valuetype != externalvaluetype) 
				goto nextx;
				
			hv = (hdlexternalvariable) val.data.externalvalue;
	
			if ((**hv).id != idtableprocessor)
				goto nextx;
			
			if (!(**hv).flinmemory) {
			
				if (flonlyinmemory)	/*can't find it if it isn't in memory*/
					goto nextx;
				
				if (!tableverbinmemory (hv, x))
					return (false);
					
				fltempload = true;
				}
			
			htable = (hdlhashtable) (**hv).variabledata;
			
			if (htable == fortable) {
				
				*hparent = ht;
				
				gethashkey (x, bsname);
				
				return (true);
				}
			
			if (parentsearch (htable, fortable, flonlyinmemory, hparent, bsname)) {
				
				return (true); /*unwind recursion*/
				}
				
			nextx:
			
			if (fltempload)
				tableverbunload (hv);
			
			x = (**x).hashlink; /*advance to next node in chain*/
			} /*while*/
		} /*for*/
		
	return (false);
	} /*parentsearch*/
Exemplo n.º 26
0
boolean opdefaultdrawicon (hdlheadrecord hnode, const Rect *iconrect, boolean flselected, boolean flinverted) {
#pragma unused(flselected, flinverted)

	/*
	the default icon drawing routine, for the script editor and menu
	editor, not for clay basket.
	*/
	
	register hdloutlinerecord ho = outlinedata;
	short iconnum;
	bigstring bsheadlinetype; /*7.0b9 PBS*/
	boolean flcustomicondrawn = false;
	
	iconnum = opgetheadicon (hnode);
	
//#ifdef PIKE

	/*
	7.0b9 PBS: logic for drawing a custom icon.
	If the outline is an outline,
	and the headline has a refcon,
	and the refcon has a type attribute,
	and there's a file on disk [type.bmp],
	use that icon.
	*/

	if ((**ho).outlinetype == outlineisoutline) { /*is this an outline?*/

		if (ophasrefcon (hnode)) { /*does it have a refcon?*/
		
			setemptystring (bsheadlinetype);
			
			if (opattributesgettypestring (hnode, bsheadlinetype)) { /*is there a type att?*/

				/*Draw a custom icon. If it returns false, there was no custom icon.*/

				flcustomicondrawn = opdrawheadiconcustom (bsheadlinetype, iconrect, false);
				} /*if*/
			} /*if*/
		} /*if*/

//#endif
//	opdrawheadicon (iconnum, iconrect, flselected);

	if (!flcustomicondrawn) /*Draw a normal icon only if there was no custom icon.*/

		opdrawheadicon (iconnum, iconrect, false);
	
	/*
	if (flselected) {
		
		Rect r = *iconrect;
		
		insetrect (&r, 1, 1);
		
		invertrect (r);
		}
	*/
	
	return (true);
	} /*opdefaultdrawicon*/
Exemplo n.º 27
0
boolean opdefaultdrawicon (hdlheadrecord hnode, const Rect *iconrect, boolean flselected, boolean flinverted) {
#pragma unused(flselected, flinverted)

	/*
	the default icon drawing routine, for the script editor and menu
	editor, not for clay basket.
	*/
	
	register hdloutlinerecord ho = outlinedata;
	short iconnum;
	bigstring bsheadlinetype; /*7.0b9 PBS*/
	boolean flcustomicondrawn = false;
	
	iconnum = opgetheadicon (hnode);
	
//#ifdef PIKE

	/*
	7.0b9 PBS: logic for drawing a custom icon.
	If the outline is an outline,
	and the headline has a refcon,
	and the refcon has a type attribute,
	and there's a file on disk [type.bmp],
	use that icon.
	*/

	if ((**ho).outlinetype == outlineisoutline) { /*is this an outline?*/

		if (ophasrefcon (hnode)) { /*does it have a refcon?*/
		
			setemptystring (bsheadlinetype);
			
			if (opattributesgettypestring (hnode, bsheadlinetype)) { /*is there a type att?*/

				/* Look up a custom icon in the odb and draw it if there is one. */
				
				#if defined (MACVERSION)
				
				bigstring bsadrnodepath;

				if (stringlength(bsheadlinetype) > 0 && opgetnodetypetableadr(bsheadlinetype, bsadrnodepath)) {
					pushstring(BIGSTRING("\x09" ".icon.mac"), bsadrnodepath);
					flcustomicondrawn = opdrawheadiconcustomfromodb (bsadrnodepath, iconrect, false);
				}
				
				#endif
				
				#if (defined(MACVERSION) && defined(__ppc__)) || defined (WIN95VERSION)

				/*Draw a custom icon. If it returns false, there was no custom icon.*/
				if (!flcustomicondrawn) {
					flcustomicondrawn = opdrawheadiconcustom (bsheadlinetype, iconrect, false);
				}
				
				#endif
				} /*if*/
			} /*if*/
		} /*if*/

//#endif
//	opdrawheadicon (iconnum, iconrect, flselected);

	if (!flcustomicondrawn) /*Draw a normal icon only if there was no custom icon.*/

		opdrawheadicon (iconnum, iconrect, false);
	
	/*
	if (flselected) {
		
		Rect r = *iconrect;
		
		insetrect (&r, 1, 1);
		
		invertrect (r);
		}
	*/
	
	return (true);
	} /*opdefaultdrawicon*/
Exemplo n.º 28
0
boolean tablemakenewvalue (void) {
	
	/*
	create a new, empty value below the current cell.
	
	to get the node to be inserted below the current position, we use
	tableoverridesort to patch the comparenodes langglobals callback and 
	look for the next node in the table
	*/
	
	register hdlhashtable ht;
	bigstring bsname;
	tyvaluerecord val;
	short newrow;
	hdlhashnode hnode, hnext;
	register boolean fl;
	
	pushundoaction (undotypingstring);
	
	if (tableempty ())
		newrow = 0;
	else
		newrow = (**tableformatsdata).rowcursor + 1;
	
	ht = tablegetlinkedhashtable ();
	
	pushhashtable (ht);
	
	hashgetnthnode (ht, newrow, &hnext); /*ignore result -- will be nil if rowcursor is last*/
	
	tableoverridesort (hnext);
	
	setemptystring (bsname);
	
	clearbytes (&val, longsizeof (val));
	
	fl = hashinsert (bsname, val);
	
	assert (tablevalidate (ht, true));
	
	tablerestoresort ();
	
	// (**ht).flneedsort = true;
	
	pophashtable ();
	
	if (!fl)
		return (false);
	
	if (hashgetnthnode (ht, newrow, &hnode))
		pushundostep ((undocallback) tableredoclear, (Handle) hnode);
	
	if (!tableeditentercell (newrow, namecolumn)) {
		
		undolastaction (false);
		
		return (false);
		}
	
	return (true);
	} /*tablemakenewvalue*/
Exemplo n.º 29
0
boolean ploticonfromodb (const Rect *r, short align, short transform, bigstring bsadricon) {
#if defined (MACVERSION)
	//bigstring bsadricon = "\psystem.verbs.builtins.Frontier.tools.data.nodeTypes.link.icon.mac";
	

	IconRef iconRef;
	IconFamilyHandle iconHand;
	SInt32 theSize;
	OSStatus theErr;
	Handle hicon;
	bigstring bsadriconpart;
	
	theErr = noErr;
	theSize = sizeof(OSType) + sizeof(OSType);
	
	newhandle(theSize, (Handle*) &iconHand);

	//iconHand = (IconFamilyHandle) getnewhandle(theSize, false);
	
	if (iconHand == NULL) theErr = memFullErr;
	
	if (theErr == noErr) {
		(*iconHand)->resourceType = EndianU32_NtoB(kIconFamilyType);
		(*iconHand)->resourceSize = EndianU32_NtoB(theSize);
	}
	
	if (theErr == noErr) {
		setemptystring(bsadriconpart);
		copystring(bsadricon, bsadriconpart);
		pushstring(BIGSTRING("\x05" ".ics4"), bsadriconpart);
		theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x04" "ics4"), &hicon);
		
		if (theErr == noErr) {
			theErr = SetIconFamilyData(iconHand, kSmall4BitData, hicon);
			disposehandle(hicon);
		}
	}
	
	if (theErr == noErr) {
		setemptystring(bsadriconpart);
		copystring(bsadricon, bsadriconpart);
		pushstring(BIGSTRING("\x05" ".ics8"), bsadriconpart);
		theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x04" "ics8"), &hicon);
		
		if (theErr == noErr) {
			theErr = SetIconFamilyData(iconHand, kSmall8BitData, hicon);
			disposehandle(hicon);
		}
	}
	
	if (theErr == noErr) {
		setemptystring(bsadriconpart);
		copystring(bsadricon, bsadriconpart);
		pushstring(BIGSTRING("\x09" ".icspound"), bsadriconpart);
		theErr = loadicondatafromodb(bsadriconpart, BIGSTRING("\x08" "icspound"), &hicon);
		
		if (theErr == noErr) {
			theErr = SetIconFamilyData(iconHand, kSmall1BitMask, hicon);
			disposehandle(hicon);
		}
	}
	
	if (theErr == noErr) {
		theErr = GetIconRefFromIconFamilyPtr(*iconHand, GetHandleSize((Handle) iconHand), &iconRef);
	}
	
	if (theErr == noErr) {
		theErr = PlotIconRef(r, align, transform, kIconServicesNormalUsageFlag, iconRef);
	}
	
	setemptystring(bsadriconpart);
	ReleaseIconRef(iconRef);
	disposehandle((Handle) iconHand);
	
	return theErr == noErr;
#else if defined (WIN95VERSION)
	return FALSE;
#endif
}
Exemplo n.º 30
0
static boolean sysfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
	
	//
	// 2006-06-28 creedon: for Mac, FSRef-ized
	//
	// 5.0b16 dmb: undo that change. it affect performance adversely if many threads do it.
	//
	// 5.0b12 dmb: in systemtaskfunc, set flresting to false to make sure we don't slow down too much
	//
	// 1/18/93 dmb: in systemtaskfunc, don't call processyield directly; use langbackgroundtask
	//
	// 8/11/92 dmb: make apprunningfunc accept a string or an ostype
	//
	// 5/20/92 dmb: do processyield directly on systemtaskfunc
	//
	// 2/12/92 dmb: do partialeventloop on systemtask & bringapptofrontfunc
	//
	
	register tyvaluerecord *v = vreturned;
	
	setbooleanvalue (false, v); /*assume the worst*/
	
	switch (token) { /*these verbs don't need any special globals pushed*/
		
		case systemversionfunc: {
			bigstring bs;
			
			getsystemversionstring (bs, nil);
			
			if (!langcheckparamcount (hparam1, 0))
				return (false);
						
			return (setstringvalue (bs, v));
			}
		
		case systemtaskfunc:
			if (!langcheckparamcount (hparam1, 0)) /*shouldn't have any parameters*/
				return (false);
			
			shellsysverbwaitroutine ();
			
			/*
			if (!processyield ())
				return (false);
			*/
			
			if (!langbackgroundtask (true))
				return (false);
			
			(*v).data.flvalue = true;
			
			return (true);
		
		case browsenetworkfunc:
		
			#ifdef MACVERSION
			
				return (langipcbrowsenetwork (hparam1, v));
				
			#endif
			
			#ifdef WIN95VERSION
			
				#pragma message ("WIN95: browsenetworkfunc - not yet implemented!")
			
				break;
				
			#endif

		case apprunningfunc: {
			OSType appid;
			bigstring bsapp;
			tyvaluerecord val;
			
			flnextparamislast = true;
			
			/*
			if (!getostypevalue (hparam1, 1, &appid))
				return (false);
			
			(*v).data.flvalue = findrunningapplication (&appid, nil);
			*/
			
			if (!getparamvalue (hparam1, 1, &val))
				return (false);
			
			if (val.valuetype == ostypevaluetype) {
				
				setemptystring (bsapp);
				
				appid = val.data.ostypevalue;
				}
			else {
				if (!coercetostring (&val))
					return (false);
				
				pullstringvalue (&val, bsapp);
				
				if (!stringtoostype (bsapp, &appid))
					appid = 0;
				}
			
			(*v).data.flvalue = findrunningapplication (&appid, bsapp, nil);
			
			return (true);
			}
		
		case frontappfunc: {
			bigstring bs;
			
			if (!langcheckparamcount (hparam1, 0))
				return (false);
			
			if (!getfrontapplication (bs, false))
				return (false);
			
			return (setstringvalue (bs, v));
			}
		
		case bringapptofrontfunc: {
			bigstring bs;
			
			flnextparamislast = true;
			
			if (!getstringvalue (hparam1, 1, bs))
				return (false);
			
			(*v).data.flvalue = activateapplication (bs);
			
			return (true);
			}
		
		case countappsfunc:
			if (!langcheckparamcount (hparam1, 0))
				return (false);
			
			return (setlongvalue (countapplications (), v));
		
		case getnthappfunc: {
			short n;
			bigstring bs;
			
			if (!getintvalue (hparam1, 1, &n))
				return (false);
			
			if (!getnthapplication (n, bs))
				setemptystring (bs);
			
			return (setstringvalue (bs, v));
			}
		
		case getapppathfunc: {
			bigstring bs;
			tyfilespec fs;
			
			flnextparamislast = true;
			
			if ( ! getstringvalue ( hparam1, 1, bs ) )
				return ( false );
			
			if ( ! getapplicationfilespec ( bs, &fs ) ) // 2006-02-17 aradke: initializes fs even if it fails
				setemptystring (bs);
				
			return ( setfilespecvalue ( &fs, v ) );
			}
		
		case memavailfunc:
			{
			unsigned long memavail;

			#ifdef WIN95VERSION
				MEMORYSTATUS meminfo;

				meminfo.dwLength = sizeof (MEMORYSTATUS);

				GlobalMemoryStatus (&meminfo);

				memavail = meminfo.dwAvailVirtual;
			#endif

			#ifdef MACVERSION
				memavail = TempFreeMem();
			#endif
			
			if (!langcheckparamcount (hparam1, 0)) /*shouldn't have any parameters*/
				return (false);
			
			return (setlongvalue (memavail, v));
			}
		
		case machinefunc:
			
			#ifdef MACVERSION
				//Code change by Timothy Paustian Friday, June 16, 2000 3:13:09 PM
				//Changed to Opaque call for Carbon
				//Carbon only runs on PPC
				#if TARGET_API_MAC_CARBON
				return (setstringvalue (machinePPC, v));
				#else
				#if GENERATINGPOWERPC
				return (setstringvalue (machinePPC, v));
				#endif
				#if GENERATING68K
				return (setstringvalue (machine68K, v));
				#endif
				#endif

				
			#endif
			
			#ifdef WIN95VERSION
				return (setstringvalue (machinex86, v));
			#endif

			break;

		case osfunc:
			return (sysos (v));
			break;

		#ifdef WIN95VERSION
			case getenvironmentvariablefunc: {
				bigstring bsenvname;
				bigstring buf;
				DWORD res;
				
				flnextparamislast = true;
				
				if (!getstringvalue (hparam1, 1, bsenvname))
					return (false);

				nullterminate(bsenvname);

				res = GetEnvironmentVariable (stringbaseaddress(bsenvname), stringbaseaddress(buf), sizeof(buf)-2);

				if (res > sizeof(buf) - 2) {
					return (setbooleanvalue (false, v));		//safety valve
					}

				setstringlength (buf, res);

				return (setstringvalue (buf, v));
				}
				break;

			case setenvironmentvariablefunc: {
				bigstring bsenvname;
				bigstring bsenvval;
				bigstring bserror, bserror2;
				boolean res;
				
				if (!getstringvalue (hparam1, 1, bsenvname))
					return (false);

				flnextparamislast = true;
				
				if (!getstringvalue (hparam1, 2, bsenvval))
					return (false);

				nullterminate(bsenvname);
				nullterminate(bsenvval);

				res = SetEnvironmentVariable (stringbaseaddress(bsenvname), stringbaseaddress(bsenvval));

				if (res) {
					return (setbooleanvalue (true, v));	
					}

				getsystemerrorstring (GetLastError(), bserror);

				nullterminate(bserror);

				wsprintf (bserror2, "Can't set environment variable \"%s\" to \"%s\" because %s", stringbaseaddress (bsenvname), stringbaseaddress (bsenvval), stringbaseaddress (bserror));

				setstringlength (bserror2, strlen(stringbaseaddress(bserror2)));

				shellerrormessage (bserror2);

				return (setbooleanvalue (false, v));	
				}
				break;
		#endif
		
		#if TARGET_API_MAC_CARBON == 1
		
			case unixshellcommandfunc: { /*7.0b51 PBS: call shell on OS X*/
			
				Handle hcommand, hreturn;
				
				flnextparamislast = true;
				
				if (!getexempttextvalue (hparam1, 1, &hcommand))
					return (false);
				
				newemptyhandle (&hreturn);
										
				if (!unixshellcall (hcommand, hreturn)) {
				
					disposehandle (hreturn);
					
					disposehandle (hcommand);
					
					return (false);
					} /*if*/
				
				disposehandle (hcommand);
					
				return (setheapvalue (hreturn, stringvaluetype, v));
				}
		
		#endif 
		
		#ifdef WIN95VERSION

			case winshellcommandfunc: {
				Handle hcommand;
				Handle houttext = nil;
				Handle herrtext = nil;
				long exitcode = 0;
				tyaddress adrexitcode, adrstderr;
				short ctconsumed = 1;
				short ctpositional = 1;
				boolean flneedexitcode, flneedstderr;
				tyvaluerecord val;
				
				if (!getexempttextvalue (hparam1, 1, &hcommand))
					return (false);
				
				if (!getoptionaladdressparam (hparam1, &ctconsumed, &ctpositional, "\x0b" "adrExitCode", &adrexitcode.ht, adrexitcode.bs))
					return (false);
				
				flnextparamislast = true;
				
				if (!getoptionaladdressparam (hparam1, &ctconsumed, &ctpositional, "\x0b" "adrStdErr", &adrstderr.ht, adrstderr.bs))
					return (false);
				
				flneedexitcode = (adrexitcode.ht != nil) || !isemptystring (adrexitcode.bs);
				
				flneedstderr = (adrstderr.ht != nil) || !isemptystring (adrstderr.bs);

				newemptyhandle (&houttext);

				if (flneedstderr)
					newemptyhandle (&herrtext);
										
				if (!winshellcall (hcommand, houttext, herrtext,
										(flneedexitcode ? &exitcode : nil))) {
				
					disposehandle (houttext);
					
					disposehandle (herrtext);
					
					disposehandle (hcommand);
					
					return (false);
					} /*if*/
				
				disposehandle (hcommand);
				
				if (flneedexitcode) {

					setlongvalue (exitcode, &val);
					
					if (!langsetsymboltableval (adrexitcode.ht, adrexitcode.bs, val))
						return (false);
					}
					
				if (flneedstderr) {

					setheapvalue (herrtext, stringvaluetype, &val);
					
					if (!langsetsymboltableval (adrstderr.ht, adrstderr.bs, val))
						return (false);
					
					exemptfromtmpstack (&val);
					}
					
				return (setheapvalue (houttext, stringvaluetype, v));
				}

		#endif //WIN95VERSION
		
		default:
			break;
		}

	getstringlist (langerrorlist, unimplementedverberror, bserror);

	return (false);
	} /*sysfunctionvalue*/