ivan@dbaccess.com (Ivan Covdy) (09/15/90)
In: signal( SignalValue, ActionFunction ); the function ActionFunction can be defined only as: void ActionFunction( int ); i.e., it can have only one argument. What should I do if I want to have such ActionFunction, which changes variables, and these variables should not be global/external/static? Are there any ways to pass more arguments to ActionFunction? The same question is for setjmp(Env) and longjmp(Env, 0): are there any ways to get rid of the global variable Env? Your answers will be appreciated. -- Ivan Covdy INTERNET: ivan@dbaccess.com c/o DB/Access Inc. UUCP: {uunet,mips}!troi!ivan 2900 Gordon Avenue, Suite 101 FAX: (408) 735-0328 Santa Clara, CA 95051 TEL: (408) 735-7545
gwyn@smoke.BRL.MIL (Doug Gwyn) (09/15/90)
In article <119@wookie.dbaccess.com> ivan@dbaccess.com (Ivan Covdy) writes: >Are there any ways to pass more arguments to ActionFunction? > are there any ways to get rid of the global variable Env? In general, no, you cannot (or at least really should not) attempt to change the standard library interface. Instead of phrasing the question like this, why not say what it is that you are really trying to accomplish? These attempts are probably not the only means to that end, whatever it may be.
karish@mindcrf.UUCP (Chuck Karish) (09/17/90)
In article <119@wookie.dbaccess.com> ivan@dbaccess.com (Ivan Covdy) writes: >In: > signal( SignalValue, ActionFunction ); >the function ActionFunction can be defined only as: > void ActionFunction( int ); i.e., it can have only one argument. >What should I do if I want to have such ActionFunction, which changes >variables, and these variables should not be global/external/static? >Are there any ways to pass more arguments to ActionFunction? No. The user process doesn't pass ANY arguments to the signal-catching function. The system passes the signal number. >The same question is for setjmp(Env) and longjmp(Env, 0): > are there any ways to get rid of the global variable Env? There's no requirement that `Env' be a global variable. It's a structure into which setjmp() saves the process state at the time setjmp() is called. A process is allowed to save any number of non-global jmpbuf structures, and feed the structure of its choice to longjmp() to jump to the desired state. -- Chuck Karish karish@mindcraft.com Mindcraft, Inc. (415) 323-9000