Exemple #1
0
void main(fptr *f)

{

	long oldA4;

	

	// this code is a 68K-only macro

	oldA4 = SetCurrentA4();			// get correct value of A4

	RememberA4();					// store inside code resource

	// this is not necessary (but harmless) on PowerPC

	FNS = f;	

	

	/* tell Max about your class. The cast to short is important for 68K */

	setup(&myobject_class, myobject_new,0L, (short)sizeof(MyObject), 0L, A_DEFLONG, 0);

	/* bind your methods to symbols */

	addbang((method)myobject_bang);

	addint((method)myobject_int);

	addmess((method)myobject_FullPacket, "FullPacket", A_LONG, A_LONG, 0);

	addmess((method)myobject_set, "set", A_LONG, 0);

	/* list object in the new object list */

	finder_addclass("Data","dereffer");

	// restore old value of A4 (68K only)

	RestoreA4(oldA4);

}
Exemple #2
0
		IASGlobalContext()
		{
			saveA4 = SetCurrentA4();		// Save A4 away and set A4 to point to the code resources globals.
		}
Exemple #3
0
void main(fptr *f) {
	long oldA4;
	OSStatus err;
	DateTimeRec date;
	
	oldA4 = SetCurrentA4();
	RememberA4();
	FNS = f;	

#ifdef MULTI_SEGMENT
	/* Multi-segment code resource stuff */
	{
		Str255 buf;
		short i, n, theID;
		char **ch;
		OSType theType;
		n = Count1Resources('Cccc');
	    post("This external has %ld resources", (long) n);
		for (i = 1; i <= n; i++) {
			ch = Get1IndResource('Cccc', i);
			GetResInfo(ch, &theID, &theType, buf);
			rescopy('Cccc', theID);
		}
	}
#endif

#ifdef EXTENDED_CODE_RESOURCE
	// Cause it's an extended code resource...
	// rescopy('Cccc',22222);
#endif

	ps_readbufsize = gensym("readbufsize");
	ps_writebufsize = gensym("writebufsize");
	ps_OTTCP_nbytes = gensym("OTTCP_nbytes");
	ps_OTTCP_delim = gensym("OTTCP_delim");
	ps_connected = gensym("connected");
	ps_disconnected = gensym("disconnected");

	setup(&ottcp_class, ottcp_new, (method) ottcp_free, (short)sizeof(OTTCP), 0L, A_GIMME, 0);
	
	version(0);
#ifdef DAVID_LIKES_EXPIRING_MAX_OBJECTS
	post("Expires %d/%d/%d", MONTH, DAY, YEAR);
#endif

#ifdef DAVID_LIKES_EXPIRING_MAX_OBJECTS
	GetTime(&date);
	if((date.year > YEAR)  || 
       (date.year == YEAR && ((date.month > MONTH) ||
							  (date.month == MONTH && date.day > DAY)))) {
            ouchstring(EXPIRATION_NOTICE);
            goto quit;
    }
#endif
    
    // post ("*** before  InitOpenTransport();");
	err = InitOpenTransport();
	if (err != kOTNoError) {
		ouchstring("Couldn't InitOpenTransport (err %d).  Perhaps Open Transport is not installed.",
					err);
		goto quit;
	}
	
	/* bind methods */
	addmess((method) ottcp_connect, "connect", A_SYM, A_LONG, 0);
	addmess((method) ottcp_disconnect, "disconnect", 0);
	addmess((method) ottcp_read_nbytes, "nbytes", A_LONG, 0);
	addmess((method) ottcp_read_until_delimiter_symbol, "delim", A_SYM, 0);
	addmess((method) ottcp_read_until_delimiter_bytes, "delim-bytes", A_GIMME, 0);
	addmess((method) ottcp_write, "write", A_LONG, A_LONG, 0);
	addmess((method) version, "version", 0);
	addmess((method) ottcp_ErrorReporting, "errorreporting", 0);
	addmess((method) ottcp_tellmeeverything, "tellmeeverything", 0);
	addmess((method) ottcp_assist, "assist", A_CANT, 0);

	finder_addclass("System","ottcp");

quit:
	RestoreA4(oldA4);
}
Exemple #4
0
void main(fptr *f)
{
	CInfoRec ct;
	
	long oldA4;
	oldA4 = SetCurrentA4();
	RememberA4();
	FNS = f;

	setup(&lcd_class, (void *)LCD_new, (method) LCD_free, (short)sizeof(Lcd),
		(method)LCD_menu, A_GIMME, 0);
	
	addmess((method)LCD_ascii,"ascii",A_GIMME,0);
	addmess((method)LCD_update,"clear",0);
	addmess((method)LCD_click,"click",A_CANT,0);
	addmess((method)LCD_color,"color",A_LONG,0);
	addmess((method)LCD_debug,"debug",0);
	addmess((method)LCD_font,"font",A_DEFLONG,A_DEFLONG,0);
	addmess((method)LCD_frameOval,"frameOval",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0L,0);
	addmess((method)LCD_frameRect,"frameRect",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0L,0);
	addmess((method)LCD_Line,"Line",A_LONG,A_LONG,0L,0);
	addmess((method)LCD_LineTo,"LineTo",A_LONG,A_LONG,0L,0);
	addmess((method)LCD_Move,"Move",A_LONG,A_LONG,0L,0);
	addmess((method)LCD_MoveTo,"MoveTo",A_LONG,A_LONG,0L,0);
	addmess((method)LCD_linesegment,"LineSegment",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0);
	addmess((method)LCD_paintOval,"PaintOval",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0L,0);
	addmess((method)LCD_paintRect,"PaintRect",A_LONG,A_LONG,A_LONG,A_LONG,A_DEFLONG,0L,0);
	addmess((method)LCD_penMode,"penMode",A_LONG,0L,0);
	addmess((method)LCD_pos,"pos",A_LONG,A_LONG,0);
	addmess((method)LCD_save,"psave",A_CANT,0);
	addmess((method)LCD_reson,"reson",A_GIMME,0);
	addmess((method)LCD_resonSampleRate,"resonfreqmax",A_FLOAT,0L,0);
	addmess((method)LCD_resonSpect,"resonSpect",A_FLOAT,0L,0);
	addmess((method)LCD_resonTrim,"resonTrim",A_FLOAT,0L,0);
	addmess((method)LCD_update,"update",A_CANT, 0);
	addmess((method)LCD_write,"write",A_GIMME,0);
	addmess((method)LCD_assist,"assist",A_CANT, 0);
	
	addmess((method)LCD_local,"local",A_LONG,0);
	addmess((method)LCD_readpict,"readpict",A_GIMME,0);
	addmess((method)LCD_drawpict,"drawpict",0);
	addmess((method)LCD_picthandle,"picthandle",A_LONG,0);

	GetIndPattern(&blk,sysPatListID,1);
	GetIndPattern(&wht,sysPatListID,20);
	colorinfo(&ct);
	hasColorQD = ct.c_hasColorQD;
	numPaletteColors = ct.c_depth>=8? 256 : (ct.c_depth==4? 16 : 2);
	
	if (numPaletteColors<=16)
		hasColorQD=0; // sde 4-bit mode is screwey, ignore it.
		
#ifdef debug	
	post("hasColor %d",hasColorQD);
	post("numColors %d",numPaletteColors);
#endif	
	post("LCD Object by Michael Lee, Steve Ellison, David Zicarelli");
	post("copyright © 1991-97 Regents of the University of California. All Rights Reserved.");
	
	LCD_makepalette();		/* DDZ made palette in main(), avoids rescopy */
	rescopy('STR#',myRes);	/* DDZ added assistance */

	ps_picthandle=gensym("picthandle");
	ps_pictname=gensym("pictname");

	RestoreA4(oldA4);
}