9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* a few questions about alef
@ 1994-09-05  5:01 Alberto
  0 siblings, 0 replies; 2+ messages in thread
From: Alberto @ 1994-09-05  5:01 UTC (permalink / raw)



I've been working with alef in the last weeks
and I have a few questions about it.

1) I had some problems with rescue. For example the
output of this programs is "2+" and not "21". If I name
the recues then the output is ok, 21.

#include <alef.h>

void
main(int argc, byte **argv)
{
	 rescue  {
		print("1");
		return;
	 }
	 rescue  {
		print("2");
		raise ;
	 } 
	 raise ;	
}

2) Do we have something like pointer to functions of an 
adt in alef. I would like to write something like this.

enum {TEXT, AUDIO, VIDEO, MULTI};

void (*f[]) = { /* I'm not sure about f or Mesg.f */
	[TEXT]  Mime.ldtext(),
	[AUDIO] Mime.ldaudio(),
	[VIDEO] Mime.ldvideo(),
	[MULTI] Mime.ldmulti(),
};

and later do (*f[type])(); /* this avoid switch or if else */


3) Some time in an adt I declared another unamed adt
  which has functions which common names. For example:

#include <alef.h>

adt Mime{
	.....
	void write(*Mime,int);
};

adt Mesg {
	.....
	Mime;
	void write(*Mesg,int);
};

If I want to access Mime.write through a Mesg object, Is it
save to use casting? 

void
Mesg.write(Mesg *m,int)

	((Mime *)m)->write(0); /* in order to call MIME.write */
}






^ permalink raw reply	[flat|nested] 2+ messages in thread

* a few questions about alef
@ 1994-09-05  7:16 Hans-Peter
  0 siblings, 0 replies; 2+ messages in thread
From: Hans-Peter @ 1994-09-05  7:16 UTC (permalink / raw)




I have the same problems too.
Architecture: Sparc SLC

-hp






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-09-05  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-09-05  5:01 a few questions about alef Alberto
1994-09-05  7:16 Hans-Peter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).