/************************************************************************* * * (c) Copyright 1992,1993,1994 by G & A Technical Software, Inc., * 28 Research Drive, Hampton, Virginia, 23666. * * All Rights Reserved. No part of this software or publication may be * reproduced, stored in a retrieval system, or transmitted, in any form * or by any means, electronic, mechanical, photocopying, recording, or * otherwise without the prior written permission of G & A Technical * Software, Inc. * ************************************************************************* * * Filename: callr.c * * Purpose: Performs the actual subroutine or function call. * * Author: John Burton * * Date: 06/17/94 * ************************************************************************* * * Modification History: * * $Log: s3_callr.c,v $ * Revision 2.1 1994/07/08 18:07:39 jcburt * No changes since last commit. Just bringing everything up to the same * revision number * * Revision 2.0.0.1 1994/06/28 18:48:26 jcburt * S3 Version 2.0 Initial Source * * Revision 1.5 1993/09/09 17:54:47 jcburt * Initial Production Release of s3 * * Revision 1.4 1993/09/09 17:53:39 jcburt * Initial Production version of s3 - version 1.0 * * Revision 1.3 1993/03/29 16:30:06 jcburt * Added support for multi-dimensional character arrays * * Revision 1.2 1992/12/01 15:46:28 jcburt * added rcsid character string * * ************************************************************************* * * Revision Control Information: */ static char rcsid[] = "$Id: s3_callr.c,v 2.1 1994/07/08 18:07:39 jcburt Exp $"; static char rcsrev[] = "$Revision: 2.1 $"; /************************************************************************* * * Include Files * *************************************************************************/ #include "s3_defines.h" #include "s3_typedefs.h" /****************************************************************************/ /* Written by: */ /* John Burton */ /* jcburt@gatsibm.larc.nasa.gov */ /* Date: */ /* 02/20/92 */ /****************************************************************************/ /* Routines and Revision History: */ /* */ /* void call_subroutine */ /* - 02/20/92 Original version created (John Burton) */ /* */ /* int call_function */ /* - 02/20/92 Original version created (John Burton) */ /* */ /****************************************************************************/ /* Okay, its a kludge, but I couldn't think of anything better at the time */ /************************************************************************* * * Module: s3_call_subroutine * * Description: Performs the actual subroutine call as set up by * s3_call_f_subroutine or s3_call_c_subroutine. * * Syntax: s3_call_subroutine(int (*func)(), char **a, int n) * * Inputs: *func: A pointer to the subroutine to be called * **a: An array of pointers to the datasets being * passed as parameters. * n: The number of datasets being passed. * * Outputs: * * Returns: * * Modules Called: func * *************************************************************************/ void s3_call_subroutine(int (*func)(), char **a, int n) { int maxargs = MAXARGS; #ifdef _PARAMETERS_ON_STACK /* * Assume that all structures are placed as values on the stack and * all parameters are placed on the stack. This version passes an * array of pointers as a structure so that the called routine * sees the individual pointers as individual parameters being * passed by reference. */ struct { char *args[MAXARGS]; } params; register int i; if(n > maxargs) s3_error(LOC,"Illegal number of parameters to be passed - %d, max - %d",n,maxargs); for(i=0;i maxargs) s3_error(LOC,"Illegal number of parameters to be passed - %d, max - %d",n,maxargs); for(i=0;i