/* Copyright Per Bothner 1987. Read the file Q-INFO */
/* Publically-used (as68, debug, ?) definitions from the calc language.
 * Per Bothner, September 1984.
 */

#if 0
/* #define TDProc 0xA8	* tag for procedure with descriptor */
/* #define HasPType(x, type) (((long)(x) & 0xFF000000) == ((type) << 24)) */
/* cc68 bug !!! */
/* #define NotPType(x, type) (((long)(x) & 0xFF000000) != ((type) << 24)) */
#endif

typedef struct /* Parameter descriptor */
  {
    char *name;
    Object type;	/* NULL if unevaluated */
    Object filler; /* used to be defaultVal */
    Object pattern_expr;
#define ArgReleased 1
#define ArgNonObject 2
  } ArgDesc;

#define ProcPrefix 1	/* if no left argument (postfix) */
#define ProcRegParms 8	/* pass parameters in regs */

#define ProcDescFields \
    unsigned char type;	/* see below for possible values */ \
    unsigned char bits; \
    unsigned char trailParams; /* 0 unless variable # of params */ \
    unsigned char nParams;/* # of params (if variable: fixed params + 1) */ \
    struct Type *resultType; \
    Object _unused_;

struct ProcDesc /* Procedure descriptor */
  {
    ProcDescFields
  };

typedef struct
  {
    ProcDescFields
    ArgDesc parm[1];
/*if variable # of params, last ArgDesc describes Array argument of remainder*/
  } ProcDesc;

/* Possible values for ProcDesc type field */
#define ProcUnknown	0
#define ProcParsed	1	/* generated by Parse */
#define ProcDotted	2
#define ProcPartial	3	/* partial application of arguments */
#define ProcPostfixed	4	/* special case of PostPartial */

#define GetProcDesc(f) (((ProcDesc**)(f))[-2])
