integer.c

来自「ftam等标准协议服务器和客户端的源代码。」· C语言 代码 · 共 137 行

C
137
字号
#ifndef lintstatic char *rcsid = "$Header: /xtel/isode/isode/dsap/common/RCS/integer.c,v 9.0 1992/06/16 12:12:39 isode Rel $";#endif/* * $Header: /xtel/isode/isode/dsap/common/RCS/integer.c,v 9.0 1992/06/16 12:12:39 isode Rel $ * * * $Log: integer.c,v $ * Revision 9.0  1992/06/16  12:12:39  isode * Release 8.0 * *//* *                                NOTICE * *    Acquisition, use, and distribution of this module and related *    materials are subject to the restrictions of a license agreement. *    Consult the Preface in the User's Manual for the full terms of *    this agreement. * *//* LINTLIBRARY */#include "quipu/util.h"#include "quipu/attr.h"#include "psap.h"static PE intenc (x)int * x;{	return (int2prim(*x));}static PE enumenc (x)int *x;{	return enumint2prim ((integer)*x);}static int * intdec (pe)PE pe;{int * x;        if (! test_prim_pe (pe,PE_CLASS_UNIV,PE_PRIM_INT))		return (0);	x = (int *) smalloc (sizeof (int));	*x = prim2num(pe);	return x;}static int * enumdec (pe)PE pe;{	int *x;	if (! test_prim_pe (pe,PE_CLASS_UNIV,PE_PRIM_ENUM))		return 0;	x = (int *) smalloc (sizeof (int));        *x = prim2enum(pe);        return x;}	/* ARGSUSED */static intprint (ps,x,format)PS ps;int * x,format;{	ps_printf (ps,"%d",*x);}#define enumprint intprintstatic int * intdup (x)int *x;{int *y;	y = (int *) smalloc (sizeof (int));	*y = *x;		return (y);}#define enumdup intdupstatic intcmp (x,y)int *x,*y;{	return ( *x == *y ? 0 : (*x > *y ? 1 : -1) );}#define enumcmp intcmpstatic intfree (x)int * x;{	free ((char *) x);}#define enumfree intfreestatic int * intparse (str)char * str;{int atoi();int * x;	x = (int *) smalloc (sizeof (int));	*x = atoi (str);	return (x);}#define enumparse intparseinteger_syntax (){	(void) add_attribute_syntax ("integer",		(IFP) intenc,	(IFP) intdec,		(IFP) intparse,	intprint,		(IFP) intdup,	intcmp,		intfree,	NULLCP,		NULLIFP,	FALSE);	(void) add_attribute_syntax("enumerated",				    (IFP) enumenc, 	(IFP)enumdec,				    (IFP) enumparse,	enumprint,				    (IFP) enumdup,	enumcmp,				    enumfree,		NULLCP,				    NULLIFP,		FALSE);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?