Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site tekchips.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!mtuxo!mtunh!mtung!mtunf!ariel!vax135!cornell!uw-beaver!tektronix!tekcrl!tekchips!kentb
From: kentb@tekchips.UUCP (Kent Beck)
Newsgroups: net.micro.mac
Subject: OpenPort confusion
Message-ID: <118@tekchips.UUCP>
Date: Thu, 11-Jul-85 03:44:55 EDT
Article-I.D.: tekchips.118
Posted: Thu Jul 11 03:44:55 1985
Date-Received: Sat, 13-Jul-85 10:27:04 EDT
Distribution: net
Organization: Tektronix, Beaverton OR
Lines: 33

I seem to be having problems calling OpenPort with dynamically allocated
storage from MegaMax C v2.0.  A short example is:

#include 
main()
{
	GrafPtr p,q,r;
	GrafPort s;
	
	printf("Allocating port, sizeof(GrafPort) = %d\n", sizeof(GrafPort));
	p = (GrafPtr) NewPtr(sizeof(GrafPort)); /* or malloc(...) */
	GetPort(&q);
	printf("Got the old port\n");
	r = &s;
	OpenPort(r);
	Move(10,110); /* So the next printf will show up */
	printf("Opened the first port\n");
/*	OpenPort(p);	When these statments are executed this bombs...
	printf("Opened the second port\n");*/
	SetPort(q);
	printf("Port reset\n");
}

Any ideas?  Thanks in advance.

Kent Beck
Tektronix, Inc
PO Box 500, MS 50-662
Beaverton, OR 97077
503/627-6172

usenet: {allegra|decvax}!tektronix!tekchips!kentb
CSNet:  kentb%tekchips@tektronix.csnet