1: /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */ 2: /* $Header: b.h,v 2.2 85/08/22 15:59:55 timo Exp $ */ 3: 4: /* 5: * B editor -- Basics copied from B interpreter's run-time system. 6: */ 7: 8: #include <stdio.h> 9: 10: #define Visible 11: #define Hidden static 12: #define Procedure 13: 14: typedef int bool; 15: typedef short intlet; 16: typedef char *string; 17: 18: #define No 0 19: #define Yes 1 20: 21: #define Maxintlet ((1<<15)-1) /* MACHINE DEPENDENT */ 22: 23: typedef struct { 24: char type; 25: char _unused; 26: intlet refcnt; 27: intlet len; 28: string *cts; 29: } *value; 30: 31: /* See also definitions in node.h and queu.h which must match the first 32: four fields of 'value'! */ 33: 34: #define Refcnt(v) ((v)->refcnt) 35: #define Type(v) ((v)->type) 36: #define Length(v) ((v)->len) 37: #define Str(v) ((char*)(&(v)->cts)) 38: 39: #define Vnil ((value) NULL) 40: 41: /* Types: */ 42: #define Num '0' 43: #define Tex '"' 44: #define Com ',' 45: #define Nod 'N' 46: #define Pat 'P' 47: 48: /* 49: * C library standard functions 50: */ 51: 52: string malloc(); 53: string realloc(); 54: 55: string sprintf(); 56: 57: string strcpy(); 58: string strncpy(); 59: string index(); 60: string rindex(); 61: 62: string getenv(); 63: 64: #define Strequ(s, t) !strcmp(s, t) 65: #define Strnequ(s, t, n) !strncmp(s, t, n)