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

Defined typedef's

Defined macros

Formal defined in line 188; used 5 times
Funprd defined in line 186; used 5 times
Is_filed defined in line 29; used 3 times
Is_formal defined in line 28; used 4 times
Is_howto defined in line 32; never used
Is_locloc defined in line 23; used 3 times
Is_refinement defined in line 27; used 1 times
Is_simploc defined in line 24; used 10 times
Is_tbseloc defined in line 25; used 8 times
Is_trimloc defined in line 26; used 7 times
Lastfield defined in line 140; used 1 times
Perm defined in line 190; used 1 times
Refinement defined in line 189; used 2 times
Simploc defined in line 183; used 8 times
Tbseloc defined in line 184; used 6 times
Trimloc defined in line 185; used 2 times

Usage of this include

b1obj.h used 43 times
Last modified: 1985-08-27
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1889
Valid CSS Valid XHTML 1.0 Strict