1: /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984. */
   2: /* $Header: b1obj.h,v 1.1 84/06/28 00:48:43 timo Exp $ */
   3: 
   4: /* B values, locations, environments: the B abstract machine */
   5: 
   6: /****************************** general ******************************/
   7: 
   8: typedef intlet relation; /* < 0, == 0, > 0 */
   9: relation compare();
  10: 
  11: #define Is_text(v) (Type(v) == Tex)
  12: #define Is_number(v) (Type(v) == Num)
  13: #define Is_compound(v) (Type(v) == Com)
  14: #define Is_list(v) (Type(v) == Lis || Type(v) == ELT)
  15: #define Is_table(v) (Type(v) == Tab || Type(v) == ELT)
  16: #define Is_tlt(v) (Type(v)==Tex || Type(v)==Lis || Type(v)==Tab || Type(v)==ELT)
  17: #define Is_ELT(v) (Type(v) == ELT)
  18: 
  19: #define Is_simploc(v) (Type(v) == Sim)
  20: #define Is_tbseloc(v) (Type(v) == Tse)
  21: #define Is_trimloc(v) (Type(v) == Tri)
  22: #define Is_refinement(v) (Type(v) == Ref)
  23: #define Is_formal(v) (Type(v) == For)
  24: #define Is_shared(v) (Type(v) == Glo)
  25: #define Is_filed(v) (Type(v) == Per)
  26: #define Is_function(v) (Type(v) == Fun)
  27: #define Is_predicate(v) (Type(v) == Prd)
  28: #define Is_howto(v) (Type(v) == How)
  29: 
  30: value grab_num();
  31: value regrab_num();
  32: value grab_rat();
  33: value grab_approx();
  34: value grab_tex();
  35: value grab_com();
  36: value grab_elt();
  37: value grab_lis();
  38: value grab_tab();
  39: value grab_sim();
  40: value grab_tri();
  41: value grab_tse();
  42: value grab_how();
  43: value grab_for();
  44: value grab_glo();
  45: value grab_per();
  46: value grab_fun();
  47: value grab_prd();
  48: value grab_ref();
  49: 
  50: value copy();
  51: /* Procedure release(); */
  52: /* Procedure uniql(); */
  53: /* Procedure uniq_assoc(); */
  54: double hash();
  55: 
  56: /****************************** Texts ******************************/
  57: string strcpy(), strncpy(), strcat(), sprintf(), index();
  58: 
  59: bool character();
  60: 
  61: value mk_text();
  62: char charval();
  63: string strval();
  64: 
  65: value concat();
  66: value behead();
  67: value curtail();
  68: value trim();
  69: value repeat();
  70: 
  71: value adjleft();
  72: value centre();
  73: value adjright();
  74: 
  75: value convert();
  76: 
  77: /****************************** Numbers ******************************/
  78: 
  79: /* Predicates */
  80: bool integral();        /* is the value an integer? */
  81: bool large();       /* can a number be represented by a C int? */
  82: 
  83: /* Constants */
  84: extern value zero, one;
  85: 
  86: /* Conversion of abstract values to concrete objects */
  87: double numval();     /* numeric value of any number */
  88: int intval();        /* numeric value of integral number */
  89: intlet propintlet(); /* converts int to intlet */
  90: string convnum();    /* character string approximation of any number */
  91: int numcomp();       /* Comparison of two numbers: yields -1, 0 or 1 */
  92: double numhash();    /* Hashes any abstract number to a 'double' */
  93: 
  94: /* Conversion of concrete objects to abstract numbers */
  95: value numconst();    /* string argument */
  96: value mk_integer();  /* int argument */
  97: 
  98: /* Functions on numbers */
  99: value sum();
 100: value diff();
 101: value negated();
 102: value prod();
 103: value quot();
 104: value modulo();
 105: value floorf();
 106: value ceilf();
 107: value round1();
 108: value round2();
 109: value mod();
 110: value power();
 111: value absval();
 112: value signum();
 113: value numerator();
 114: value denominator();
 115: value approximate();
 116: value random();
 117: value root1();
 118: value sin1();
 119: value cos1();
 120: value tan1();
 121: value atn1();
 122: value exp1();
 123: value log1();
 124: value root2();
 125: value atn2();
 126: value log2();
 127: value pi();
 128: value e();
 129: 
 130: /****************************** Compounds ******************************/
 131: #define Nfields(c) Length(c)
 132: #define Field(c, i) ((Ats(c)+(i)))
 133: #define k_Overfields for (k= 0; k < len; k++)
 134: #define Lastfield(k) ((k) == len-1)
 135: 
 136: #define mk_compound(len) grab_com(len)
 137: 
 138: value* field();
 139: /* Procedure put_in_field(); */
 140: 
 141: /****************************** Lists ******************************/
 142: value mk_numrange();
 143: value mk_charrange();
 144: 
 145: /* Procedurre insert(); */
 146: /* Procedure remove(); */
 147: 
 148: /****************************** Tables ******************************/
 149: 
 150: value keys();
 151: bool in_keys();
 152: value associate();
 153: 
 154: /* Procedure replace(); */
 155: /* Procedure delete(); */
 156: 
 157: value* adrassoc();
 158: value* key();
 159: value* assoc();
 160: 
 161: /****************************** Texts, Lists, and Tables *******************/
 162: value mk_elt();
 163: 
 164: bool in();
 165: 
 166: value size();
 167: value size2();
 168: value min1();
 169: value min2();
 170: value max1();
 171: value max2();
 172: value th_of();
 173: value thof();
 174: 
 175: int length(); /* The same as size, temporary until part2 is written in B */
 176: bool empty(); /* whether #v=0: also temporary */
 177: 
 178: /****************************** Other kinds of value ************************/
 179: 
 180: #define Simploc(l) ((simploc *)Ats(l))
 181: #define Tbseloc(l) ((tbseloc *)Ats(l))
 182: #define Trimloc(l) ((trimloc *)Ats(l))
 183: #define Funprd(f)  ((funprd *)Ats(f))
 184: #define How_to(u)  ((how *)Ats(u))
 185: #define Formal(p)  ((formal *)Ats(f))
 186: #define Refinement(r) ((ref *)Ats(r))
 187: 
 188: loc mk_simploc();
 189: loc mk_trimloc();
 190: loc mk_tbseloc();
 191: 
 192: value mk_per();
 193: fun mk_fun();
 194: prd mk_prd();
 195: value mk_how();
 196: value mk_ref();

Defined macros

Field defined in line 132; used 1 times
Formal defined in line 185; used 3 times
Is_function defined in line 26; used 2 times
Is_howto defined in line 28; used 1 times
Is_predicate defined in line 27; used 2 times
Refinement defined in line 186; used 5 times
Trimloc defined in line 182; used 2 times

Usage of this include

Last modified: 1985-08-27
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1259
Valid CSS Valid XHTML 1.0 Strict