Esempio n. 1
0
ast* mk_int ( const void* loc, const long x ) {
  ast* res = (ast*) malloc(sizeof(ast));
  res->tag = int_ast;
  res->info.integer = x;
  setloc(res, loc);
  return res;
};
Esempio n. 2
0
ast* mk_real ( const void* loc, const double x ) {
  ast* res = (ast*) malloc(sizeof(ast));
  res->tag = real_ast;
  res->info.real = x;
  setloc(res, loc);
  return res;
};
Esempio n. 3
0
ast* mk_str ( const void* loc, const char* x ) {
  ast* res = (ast*) malloc(sizeof(ast));
  res->tag = str_ast;
  res->info.variable = (char*) malloc(strlen(x)+1);
  strcpy(res->info.variable,x);
  setloc(res, loc);
  return res;
};
Esempio n. 4
0
/*
 * Print naming for location.
 * name[0] is location type.
 */
void
prnloc(char *name)
{
    if (*name == '0')
        setloc(DATA);
    else
        fatal("unhandled prnloc %c", *name);
    printf("%s:\n", name+1);
}