Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!agate!shelby!portia.stanford.edu!elaine19.stanford.edu!ralphm From: ralphm@elaine19.stanford.edu (Ralph Melton) Newsgroups: comp.sys.mac.programmer Subject: Variable procedures in Pascal Message-ID: <1990Nov23.082345.12074@portia.Stanford.EDU> Date: 23 Nov 90 08:23:45 GMT Sender: news@portia.Stanford.EDU (USENET News System) Organization: Stanford University - AIR Lines: 44 I am using Think Pascal 3.01, and I really want to be able to declare procedural variables. I am writing a code resource for that calls one procedure from another procedure many, many times. However, the behavior of this procedure depends on whether Color Quickdraw is available. Currently, this looks like this: {A1 is the procedure executed with ColorQD; A2 is the one executed without ColorQD} Procedure A; begin if Color_QuickDraw_Is_Available then do A1 else do A2 end; Procedure B; begin {lots of calls to procedure A} end; I would like to avoid repeating the check for Color Quickdraw by writing something like this: Procedure B; var A : procedure; begin if Color_QuickDraw_is_available then A := A1 else A := A2; {lots of calls to procedure A, which is the correct one of the subprocedures} end I believe that it is possible to do such things in C, and I know about procedural parameters in Pascal. I also know that I can pass some Toolbox routines the address of a procedure. Is there any way to do what I want within THINK Pascal? Ralph -- Ralph Melton The White Rabbit ralphm@portia.stanford.edu "When you hear of a storybook romance, you don't think of the storybook as being _Alice in Wonderland_ . . ."