/****************************************************************************** * $Id: macros.c,v 1.3 1993/12/24 15:10:48 courtel Exp $ * * Kind: C library of functions * Abstract: Transform C macros into functions * * Copyright 1990 - 1993 Centre d'Etudes de la Navigation Aerienne (CENA) * * PARADISE is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License * as published by the Free Software Foundation; * * PARADISE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with PARADISE; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ******************************************************************************/ #include /****************************************************************************** * Command-line parameters ******************************************************************************/ #ifdef TELESOFT #include extern int ada__argc_save; extern char ** ada__argv_save; int arg_count () { return ada__argc_save; } int arg_length (pos) int pos; { return (pos < ada__argc_save) ? strlen(ada__argv_save[pos]) : 0; } char * arg_value (pos) int pos; { return (pos < ada__argc_save) ? ada__argv_save[pos] : NULL; } #endif TELESOFT /****************************************************************************** * Inet macros ******************************************************************************/ #include #include u_long Inet_ClassA (in_a) u_long in_a; { return IN_CLASSA (in_a); } u_long Inet_ClassB (in_a) u_long in_a; { return IN_CLASSB (in_a); } u_long Inet_ClassC (in_a) u_long in_a; { return IN_CLASSC (in_a); } u_long Inet_ClassD (in_a) u_long in_a; { return IN_CLASSD (in_a); } u_long Inet_Experimental (in_a) u_long in_a; { return IN_EXPERIMENTAL (in_a); } u_long Inet_BadClass (in_a) u_long in_a; { return IN_BADCLASS (in_a); } /* This is not a real macro: it is necessary as the value returned by the * function inet_makeaddr is compiler-dependant (value or pointer) */ u_long Inet_MakeAddr (net, lna) u_long net, lna; { return inet_makeaddr ((int) net, (int) lna).s_addr; } /****************************************************************************** * File descriptor macros for select ******************************************************************************/ void Fd_Set (fd, fdset) int fd; struct fd_set *fdset; { FD_SET (fd, fdset); } void Fd_Clr (fd, fdset) int fd; struct fd_set *fdset; { FD_CLR (fd, fdset); } int Fd_Isset (fd, fdset) int fd; struct fd_set *fdset; { return (FD_ISSET (fd, fdset)); } /****************************************************************************** * XDR macros ******************************************************************************/ #include void Xdr_Destroy (xdrs) XDR *xdrs; { xdr_destroy (xdrs); } u_int Xdr_GetPos (xdrs) XDR *xdrs; { return xdr_getpos (xdrs); } bool_t Xdr_SetPos (xdrs, pos) XDR *xdrs; u_int pos; { return xdr_setpos (xdrs, pos); }