fixed build for clang
This commit is contained in:
@@ -65,9 +65,16 @@
|
|||||||
#define DOUBLEMARK 316
|
#define DOUBLEMARK 316
|
||||||
#define POINTSAT 317
|
#define POINTSAT 317
|
||||||
|
|
||||||
|
extern char* xmalloc(int size);
|
||||||
|
extern void Message(char *s, int l);
|
||||||
|
extern void set_up_momentum(int value,int token);
|
||||||
|
extern void automata_driver(int value);
|
||||||
|
extern char* copys(char *);
|
||||||
|
|
||||||
#line 5 "annotate.y"
|
#line 5 "annotate.y"
|
||||||
|
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "compatible.h"
|
#include "compatible.h"
|
||||||
#ifdef SYS5
|
#ifdef SYS5
|
||||||
@@ -146,8 +153,8 @@ typedef union {
|
|||||||
char AnnExTensionNumber[255]; /* to symbole right for the annotation */
|
char AnnExTensionNumber[255]; /* to symbole right for the annotation */
|
||||||
static int Recog_My_Token();
|
static int Recog_My_Token();
|
||||||
static int look_up_specialfunction();
|
static int look_up_specialfunction();
|
||||||
static unMYGETC();
|
static char unMYGETC(char c);
|
||||||
static MYGETC();
|
static char MYGETC();
|
||||||
static int map_assgn_op();
|
static int map_assgn_op();
|
||||||
|
|
||||||
#ifndef YYLTYPE
|
#ifndef YYLTYPE
|
||||||
@@ -623,6 +630,7 @@ while (0)
|
|||||||
#define YYERRCODE 256
|
#define YYERRCODE 256
|
||||||
|
|
||||||
#ifndef YYPURE
|
#ifndef YYPURE
|
||||||
|
int yylex_annotate();
|
||||||
#define YYLEX yylex_annotate()
|
#define YYLEX yylex_annotate()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -677,7 +685,7 @@ static int yydebug; /* nonzero means print parse trace */
|
|||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
int yyparse_annotate(void);
|
int yyparse_annotate(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||||
#define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
#define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||||
#else /* not GNU C or C++ */
|
#else /* not GNU C or C++ */
|
||||||
@@ -2258,7 +2266,7 @@ char *p;
|
|||||||
register char *p2, *p1;
|
register char *p2, *p1;
|
||||||
//extern char *malloc();
|
//extern char *malloc();
|
||||||
|
|
||||||
newbuf = (char*)malloc((unsigned)(newlength+1));
|
newbuf = (char*)malloc(newlength+1);
|
||||||
#ifdef __SPF
|
#ifdef __SPF
|
||||||
addToCollection(__LINE__, __FILE__,newbuf, 0);
|
addToCollection(__LINE__, __FILE__,newbuf, 0);
|
||||||
#endif
|
#endif
|
||||||
@@ -2996,8 +3004,7 @@ look_up_annotate(st)
|
|||||||
return (PTR_HASH) pt;
|
return (PTR_HASH) pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static char MYGETC()
|
||||||
MYGETC()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (LENSTRINGTOPARSE <= PTTOSTRINGTOPARSE)
|
if (LENSTRINGTOPARSE <= PTTOSTRINGTOPARSE)
|
||||||
@@ -3013,9 +3020,7 @@ MYGETC()
|
|||||||
return STRINGTOPARSE[ PTTOSTRINGTOPARSE-1];
|
return STRINGTOPARSE[ PTTOSTRINGTOPARSE-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static char unMYGETC(char c)
|
||||||
unMYGETC(c)
|
|
||||||
char c;
|
|
||||||
{
|
{
|
||||||
if (LENSTRINGTOPARSE <= PTTOSTRINGTOPARSE)
|
if (LENSTRINGTOPARSE <= PTTOSTRINGTOPARSE)
|
||||||
return EOF;
|
return EOF;
|
||||||
@@ -3086,10 +3091,10 @@ look_up_specialfunction(str)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (strcmp(specialfunction[i],"Dummy") == 0)
|
if (strcmp(specialfunction[i],"Dummy") == 0)
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,5 +71,4 @@ typedef union {
|
|||||||
#define DOUBLEMARK 316
|
#define DOUBLEMARK 316
|
||||||
#define POINTSAT 317
|
#define POINTSAT 317
|
||||||
|
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
|||||||
@@ -15,7 +15,13 @@
|
|||||||
#ifdef _NEEDALLOCAH_
|
#ifdef _NEEDALLOCAH_
|
||||||
# include <alloca.h>
|
# include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern char* xmalloc(int size);
|
||||||
|
extern void Message(char *s, int l);
|
||||||
|
extern void set_up_momentum(int value,int token);
|
||||||
|
extern void automata_driver(int value);
|
||||||
|
extern char* copys(char *);
|
||||||
|
|
||||||
#define ON 1
|
#define ON 1
|
||||||
#define OFF 0
|
#define OFF 0
|
||||||
#define OTHER 2
|
#define OTHER 2
|
||||||
@@ -182,8 +188,8 @@ extern POINTER newNode();
|
|||||||
char AnnExTensionNumber[255]; /* to symbole right for the annotation */
|
char AnnExTensionNumber[255]; /* to symbole right for the annotation */
|
||||||
static int Recog_My_Token();
|
static int Recog_My_Token();
|
||||||
static int look_up_specialfunction();
|
static int look_up_specialfunction();
|
||||||
static unMYGETC();
|
static char unMYGETC(char c);
|
||||||
static MYGETC();
|
static char MYGETC();
|
||||||
static int map_assgn_op();
|
static int map_assgn_op();
|
||||||
%}
|
%}
|
||||||
|
|
||||||
@@ -1114,7 +1120,7 @@ char *p;
|
|||||||
register char *p2, *p1;
|
register char *p2, *p1;
|
||||||
extern char *malloc();
|
extern char *malloc();
|
||||||
|
|
||||||
newbuf = malloc((unsigned)(newlength+1));
|
newbuf = malloc(newlength+1));
|
||||||
|
|
||||||
p2 = newbuf;
|
p2 = newbuf;
|
||||||
p1 = newbuf + newlength + 1;
|
p1 = newbuf + newlength + 1;
|
||||||
@@ -1844,8 +1850,7 @@ look_up(st)
|
|||||||
return (PTR_HASH) pt;
|
return (PTR_HASH) pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static char MYGETC()
|
||||||
MYGETC()
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (LENSTRINGTOPARSE <= PTTOSTRINGTOPARSE)
|
if (LENSTRINGTOPARSE <= PTTOSTRINGTOPARSE)
|
||||||
@@ -1861,9 +1866,7 @@ MYGETC()
|
|||||||
return STRINGTOPARSE[ PTTOSTRINGTOPARSE-1];
|
return STRINGTOPARSE[ PTTOSTRINGTOPARSE-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static char unMYGETC(char c)
|
||||||
unMYGETC(c)
|
|
||||||
char c;
|
|
||||||
{
|
{
|
||||||
if (LENSTRINGTOPARSE <= PTTOSTRINGTOPARSE)
|
if (LENSTRINGTOPARSE <= PTTOSTRINGTOPARSE)
|
||||||
return EOF;
|
return EOF;
|
||||||
@@ -1931,10 +1934,10 @@ look_up_specialfunction(str)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (strcmp(specialfunction[i],"Dummy") == 0)
|
if (strcmp(specialfunction[i],"Dummy") == 0)
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,15 @@
|
|||||||
#include "vextern.h"
|
#include "vextern.h"
|
||||||
#include "annotate.tab.h"
|
#include "annotate.tab.h"
|
||||||
|
|
||||||
|
extern void Message(char *s, int l);
|
||||||
|
|
||||||
void reset_semicoln_handler();
|
void reset_semicoln_handler();
|
||||||
void reset();
|
void reset();
|
||||||
|
int class_struct(int value);
|
||||||
|
int is_declare(int value);
|
||||||
|
int declare_symb(int value);
|
||||||
|
int block_like(int state);
|
||||||
|
int keep_original(int state);
|
||||||
|
|
||||||
int lastdecl_id; /* o if no main_type appeared */
|
int lastdecl_id; /* o if no main_type appeared */
|
||||||
int left_paren ;
|
int left_paren ;
|
||||||
@@ -484,8 +491,7 @@ int value ;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class_struct(value)
|
int class_struct(int value)
|
||||||
register int value ;
|
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case ENUM :
|
case ENUM :
|
||||||
@@ -496,8 +502,7 @@ register int value ;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_symb(value)
|
int declare_symb(int value)
|
||||||
register int value ;
|
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case TYPENAME :
|
case TYPENAME :
|
||||||
@@ -523,8 +528,7 @@ void reset()
|
|||||||
/* put_line_queue(line_pos_1,line_pos_fname); */
|
/* put_line_queue(line_pos_1,line_pos_fname); */
|
||||||
}
|
}
|
||||||
|
|
||||||
block_like(state)
|
int block_like(int state)
|
||||||
int state ;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch( state) {
|
switch( state) {
|
||||||
@@ -541,9 +545,7 @@ int state ;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int is_declare(int value)
|
||||||
is_declare(value)
|
|
||||||
int value ;
|
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case TYPENAME:
|
case TYPENAME:
|
||||||
@@ -594,8 +596,7 @@ void reset_semicoln_handler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
keep_original(state)
|
int keep_original(int state)
|
||||||
int state;
|
|
||||||
{
|
{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case ELSE_EXPECTED_STATE:
|
case ELSE_EXPECTED_STATE:
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ extern int PTTOSTRINGTOPARSE;
|
|||||||
extern PTR_BFND ANNOTATIONSCOPE;
|
extern PTR_BFND ANNOTATIONSCOPE;
|
||||||
extern PTR_TYPE global_int_annotation;
|
extern PTR_TYPE global_int_annotation;
|
||||||
extern char AnnExTensionNumber[];
|
extern char AnnExTensionNumber[];
|
||||||
|
extern int yyparse_annotate(void);
|
||||||
|
|
||||||
/* FORWARD DECLARATION */
|
/* FORWARD DECLARATION */
|
||||||
int Get_Scope_Of_Annotation();
|
int Get_Scope_Of_Annotation();
|
||||||
@@ -100,7 +101,7 @@ static char *Defined_Value_Str[MAX_ANNOTATION];
|
|||||||
static int Defined_Value_Value[MAX_ANNOTATION];
|
static int Defined_Value_Value[MAX_ANNOTATION];
|
||||||
|
|
||||||
/* Indicate if comment is an annotation */
|
/* Indicate if comment is an annotation */
|
||||||
Is_Annotation(str)
|
int Is_Annotation(str)
|
||||||
char *str;
|
char *str;
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ char *str;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Is_Annotation_Cont(str)
|
int Is_Annotation_Cont(str)
|
||||||
char *str;
|
char *str;
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -229,7 +230,7 @@ char *str;
|
|||||||
|
|
||||||
/* basically go thrue the program and parse annotation, and set
|
/* basically go thrue the program and parse annotation, and set
|
||||||
if they are defined */
|
if they are defined */
|
||||||
initAnnotation()
|
int initAnnotation()
|
||||||
{
|
{
|
||||||
PTR_CMNT cmnt;
|
PTR_CMNT cmnt;
|
||||||
PTR_BFND ptbif;
|
PTR_BFND ptbif;
|
||||||
|
|||||||
@@ -1,284 +1,286 @@
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* pC++/Sage++ Copyright (C) 1993 */
|
/* pC++/Sage++ Copyright (C) 1993 */
|
||||||
/* Indiana University University of Oregon University of Rennes */
|
/* Indiana University University of Oregon University of Rennes */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* hash.c -- hash table routines
|
* hash.c -- hash table routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "compatible.h"
|
#include "compatible.h"
|
||||||
#ifdef SYS5
|
#ifdef SYS5
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#else
|
#else
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "symb.h"
|
#include "symb.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "bif.h"
|
#include "bif.h"
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
extern int parstate;
|
extern int parstate;
|
||||||
extern PTR_BFND cur_bfnd, pred_bfnd, global_bfnd;
|
extern PTR_BFND cur_bfnd, pred_bfnd, global_bfnd;
|
||||||
extern PTR_TYPE vartype, global_default, impltype[];
|
extern PTR_TYPE vartype, global_default, impltype[];
|
||||||
extern void make_prog_header();
|
extern void make_prog_header();
|
||||||
PTR_TYPE install_array();
|
PTR_TYPE install_array();
|
||||||
PTR_LLND make_llnd();
|
PTR_LLND make_llnd();
|
||||||
PTR_SYMB make_symb();
|
PTR_SYMB make_symb();
|
||||||
char *chkalloc();
|
char *chkalloc();
|
||||||
void free();
|
void free();
|
||||||
void errstr();
|
void errstr();
|
||||||
|
|
||||||
PTR_HASH hash_table[hashMax];
|
PTR_HASH hash_table[hashMax];
|
||||||
|
|
||||||
|
#ifdef __SPF
|
||||||
/*
|
extern void removeFromCollection(void *pointer);
|
||||||
* init_hash -- initialize the hash table
|
#endif
|
||||||
*/
|
/*
|
||||||
void
|
* init_hash -- initialize the hash table
|
||||||
init_hash()
|
*/
|
||||||
{
|
void
|
||||||
register int i;
|
init_hash()
|
||||||
|
{
|
||||||
for (i = 0; i < hashMax; i++)
|
register int i;
|
||||||
hash_table[i] = HSNULL;
|
|
||||||
}
|
for (i = 0; i < hashMax; i++)
|
||||||
|
hash_table[i] = HSNULL;
|
||||||
|
}
|
||||||
/*
|
|
||||||
* Hash(string) -- compute hash value of string.
|
|
||||||
*/
|
/*
|
||||||
int
|
* Hash(string) -- compute hash value of string.
|
||||||
hash(string)
|
*/
|
||||||
register char *string;
|
int
|
||||||
{
|
hash(string)
|
||||||
register int i;
|
register char *string;
|
||||||
|
{
|
||||||
for (i = 0; *string;)
|
register int i;
|
||||||
i += *string++;
|
|
||||||
return (i % hashMax);
|
for (i = 0; *string;)
|
||||||
}
|
i += *string++;
|
||||||
|
return (i % hashMax);
|
||||||
|
}
|
||||||
/*
|
|
||||||
* look_up(string) -- lookup string in the hash table and
|
|
||||||
* install it if not there
|
/*
|
||||||
*/
|
* look_up(string) -- lookup string in the hash table and
|
||||||
PTR_HASH
|
* install it if not there
|
||||||
look_up(string, decl_type)
|
*/
|
||||||
register char *string;
|
PTR_HASH
|
||||||
int decl_type;
|
look_up(string, decl_type)
|
||||||
{
|
register char *string;
|
||||||
int i;
|
int decl_type;
|
||||||
register PTR_HASH entry;
|
{
|
||||||
PTR_BFND cur_scope(), p;
|
int i;
|
||||||
|
register PTR_HASH entry;
|
||||||
i = hash(string);
|
PTR_BFND cur_scope(), p;
|
||||||
p = cur_scope();
|
|
||||||
for (entry = hash_table[i]; entry; entry = entry->next_entry) {
|
i = hash(string);
|
||||||
if (!strcmp(string, entry->ident) && (entry->id_attr)) {
|
p = cur_scope();
|
||||||
if ((entry->id_attr->scope == p) ||
|
for (entry = hash_table[i]; entry; entry = entry->next_entry) {
|
||||||
((entry->id_attr->variant==FUNCTION_NAME) &&
|
if (!strcmp(string, entry->ident) && (entry->id_attr)) {
|
||||||
(p->variant==FUNC_HEDR) &&
|
if ((entry->id_attr->scope == p) ||
|
||||||
(p->entry.Template.symbol==entry->id_attr)))
|
((entry->id_attr->variant==FUNCTION_NAME) &&
|
||||||
return (entry);
|
(p->variant==FUNC_HEDR) &&
|
||||||
if (decl_type == SOFT) {
|
(p->entry.Template.symbol==entry->id_attr)))
|
||||||
for (p=cur_scope(); NEW_SCOPE(p); p = p->control_parent) {
|
return (entry);
|
||||||
if (entry->id_attr->scope == p)
|
if (decl_type == SOFT) {
|
||||||
return (entry);
|
for (p=cur_scope(); NEW_SCOPE(p); p = p->control_parent) {
|
||||||
}
|
if (entry->id_attr->scope == p)
|
||||||
if (entry->id_attr->scope == p)
|
return (entry);
|
||||||
return (entry);
|
}
|
||||||
}
|
if (entry->id_attr->scope == p)
|
||||||
}
|
return (entry);
|
||||||
}
|
}
|
||||||
entry = (struct hash_entry *) chkalloc(sizeof(struct hash_entry));
|
}
|
||||||
entry->ident = copys(string);
|
}
|
||||||
entry->next_entry = hash_table[i];
|
entry = (struct hash_entry *) chkalloc(sizeof(struct hash_entry));
|
||||||
hash_table[i] = entry;
|
entry->ident = copys(string);
|
||||||
return (entry);
|
entry->next_entry = hash_table[i];
|
||||||
}
|
hash_table[i] = entry;
|
||||||
|
return (entry);
|
||||||
|
}
|
||||||
PTR_HASH
|
|
||||||
correct_symtab(h, type)
|
|
||||||
PTR_HASH h;
|
PTR_HASH
|
||||||
int type;
|
correct_symtab(h, type)
|
||||||
{
|
PTR_HASH h;
|
||||||
int i;
|
int type;
|
||||||
PTR_HASH entry;
|
{
|
||||||
|
int i;
|
||||||
i = hash(h->ident);
|
PTR_HASH entry;
|
||||||
for (entry = hash_table[i]; entry; entry = entry->next_entry) {
|
|
||||||
if (!strcmp(h->ident, entry->ident)
|
i = hash(h->ident);
|
||||||
&& ( !(entry->id_attr)
|
for (entry = hash_table[i]; entry; entry = entry->next_entry) {
|
||||||
||(entry->id_attr->variant==type))
|
if (!strcmp(h->ident, entry->ident)
|
||||||
&& (h != entry))
|
&& ( !(entry->id_attr)
|
||||||
break;
|
||(entry->id_attr->variant==type))
|
||||||
}
|
&& (h != entry))
|
||||||
if (!entry) return h;
|
break;
|
||||||
if (hash_table[i] != h) {
|
}
|
||||||
fprintf (stderr, "Bug in correct_symtab\n");
|
if (!entry) return h;
|
||||||
return h;
|
if (hash_table[i] != h) {
|
||||||
}
|
fprintf (stderr, "Bug in correct_symtab\n");
|
||||||
hash_table[i] = hash_table[i]->next_entry;
|
return h;
|
||||||
#ifdef __SPF
|
}
|
||||||
removeFromCollection(h);
|
hash_table[i] = hash_table[i]->next_entry;
|
||||||
#endif
|
#ifdef __SPF
|
||||||
free((char *)h);
|
removeFromCollection(h);
|
||||||
return hash_table[i];
|
#endif
|
||||||
}
|
free((char *)h);
|
||||||
|
return hash_table[i];
|
||||||
|
}
|
||||||
/*
|
|
||||||
* Checks whether the "name" is installed and installs as a SOFT
|
|
||||||
* entry if not.
|
/*
|
||||||
*/
|
* Checks whether the "name" is installed and installs as a SOFT
|
||||||
PTR_LLND
|
* entry if not.
|
||||||
check_and_install(h, d, ndim)
|
*/
|
||||||
PTR_HASH h;
|
PTR_LLND
|
||||||
PTR_LLND d;
|
check_and_install(h, d, ndim)
|
||||||
int ndim;
|
PTR_HASH h;
|
||||||
{
|
PTR_LLND d;
|
||||||
PTR_BFND cur_scope();
|
int ndim;
|
||||||
PTR_SYMB install_entry();
|
{
|
||||||
PTR_TYPE p = NULL;
|
PTR_BFND cur_scope();
|
||||||
PTR_SYMB s;
|
PTR_SYMB install_entry();
|
||||||
PTR_LLND r;
|
PTR_TYPE p = NULL;
|
||||||
void set_type(), err();
|
PTR_SYMB s;
|
||||||
|
PTR_LLND r;
|
||||||
/* Check if the variable is already declared */
|
void set_type(), err();
|
||||||
if ((s = h->id_attr) && (s->scope == cur_scope()) && s->type) {
|
|
||||||
if (d && s->type->variant != T_ARRAY) {
|
/* Check if the variable is already declared */
|
||||||
p = install_array(d, s->type, ndim);
|
if ((s = h->id_attr) && (s->scope == cur_scope()) && s->type) {
|
||||||
s->type = p;
|
if (d && s->type->variant != T_ARRAY) {
|
||||||
}
|
p = install_array(d, s->type, ndim);
|
||||||
}
|
s->type = p;
|
||||||
else {
|
}
|
||||||
if (h->id_attr && h->id_attr->type)
|
}
|
||||||
p = h->id_attr->type;
|
else {
|
||||||
else if (!undeftype)
|
if (h->id_attr && h->id_attr->type)
|
||||||
p = impltype[*h->ident - 'a'];
|
p = h->id_attr->type;
|
||||||
else
|
else if (!undeftype)
|
||||||
err("Variable type unknown",327);
|
p = impltype[*h->ident - 'a'];
|
||||||
if (d)
|
else
|
||||||
p = install_array(d, p, ndim);
|
err("Variable type unknown",327);
|
||||||
s = install_entry(h, SOFT);
|
if (d)
|
||||||
set_type(s, p, LOCAL);
|
p = install_array(d, p, ndim);
|
||||||
}
|
s = install_entry(h, SOFT);
|
||||||
if (d) {
|
set_type(s, p, LOCAL);
|
||||||
r = p->entry.ar_decl.ranges
|
}
|
||||||
= make_llnd(fi,ARRAY_REF, d, LLNULL, s);
|
if (d) {
|
||||||
}
|
r = p->entry.ar_decl.ranges
|
||||||
else
|
= make_llnd(fi,ARRAY_REF, d, LLNULL, s);
|
||||||
r = make_llnd(fi,VAR_REF, LLNULL, LLNULL, s);
|
}
|
||||||
return make_llnd(fi,EXPR_LIST, r, LLNULL, SMNULL);
|
else
|
||||||
}
|
r = make_llnd(fi,VAR_REF, LLNULL, LLNULL, s);
|
||||||
|
return make_llnd(fi,EXPR_LIST, r, LLNULL, SMNULL);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* install_entry takes a pointer to a hash entry and
|
|
||||||
* makes another symbol table entry for the same id
|
/*
|
||||||
*/
|
* install_entry takes a pointer to a hash entry and
|
||||||
PTR_SYMB
|
* makes another symbol table entry for the same id
|
||||||
install_entry(entry, decl_type)
|
*/
|
||||||
PTR_HASH entry;
|
PTR_SYMB
|
||||||
int decl_type;
|
install_entry(entry, decl_type)
|
||||||
{
|
PTR_HASH entry;
|
||||||
register PTR_SYMB symb_ptr;
|
int decl_type;
|
||||||
PTR_BFND cur_scope();
|
{
|
||||||
PTR_BFND p;
|
register PTR_SYMB symb_ptr;
|
||||||
void err();
|
PTR_BFND cur_scope();
|
||||||
|
PTR_BFND p;
|
||||||
if (decl_type == HARD && entry->id_attr &&
|
void err();
|
||||||
entry->id_attr->scope != cur_scope())
|
|
||||||
entry = look_up(entry->ident, HARD);
|
if (decl_type == HARD && entry->id_attr &&
|
||||||
if ((entry->id_attr) && ((entry->id_attr->scope == cur_scope()) ||
|
entry->id_attr->scope != cur_scope())
|
||||||
((entry->id_attr->variant==FUNCTION_NAME) &&
|
entry = look_up(entry->ident, HARD);
|
||||||
(entry->id_attr->scope->variant==FUNC_HEDR))))
|
if ((entry->id_attr) && ((entry->id_attr->scope == cur_scope()) ||
|
||||||
{
|
((entry->id_attr->variant==FUNCTION_NAME) &&
|
||||||
if (entry->id_attr->decl == SOFT) {
|
(entry->id_attr->scope->variant==FUNC_HEDR))))
|
||||||
entry->id_attr->decl = decl_type;
|
{
|
||||||
return(entry->id_attr);
|
if (entry->id_attr->decl == SOFT) {
|
||||||
}
|
entry->id_attr->decl = decl_type;
|
||||||
if (decl_type == SOFT)
|
return(entry->id_attr);
|
||||||
return(entry->id_attr);
|
}
|
||||||
/* else */
|
if (decl_type == SOFT)
|
||||||
errstr("Redeclaration of identifier: %s",entry->id_attr->ident,328);
|
return(entry->id_attr);
|
||||||
/*(void)fprintf(stderr, "id: %s\n", entry->id_attr->ident);*/
|
/* else */
|
||||||
return (SMNULL);
|
errstr("Redeclaration of identifier: %s",entry->id_attr->ident,328);
|
||||||
}
|
/*(void)fprintf(stderr, "id: %s\n", entry->id_attr->ident);*/
|
||||||
symb_ptr = make_symb(fi,DEFAULT, entry->ident);
|
return (SMNULL);
|
||||||
for (p=cur_scope();
|
}
|
||||||
NEW_SCOPE(p) && (decl_type==SOFT);
|
symb_ptr = make_symb(fi,DEFAULT, entry->ident);
|
||||||
p = p->control_parent)
|
for (p=cur_scope();
|
||||||
;
|
NEW_SCOPE(p) && (decl_type==SOFT);
|
||||||
symb_ptr->scope = p;
|
p = p->control_parent)
|
||||||
symb_ptr->outer = entry->id_attr;
|
;
|
||||||
symb_ptr->parent = entry;
|
symb_ptr->scope = p;
|
||||||
symb_ptr->decl = decl_type;
|
symb_ptr->outer = entry->id_attr;
|
||||||
entry->id_attr = symb_ptr;
|
symb_ptr->parent = entry;
|
||||||
symb_ptr->id_list = SMNULL;
|
symb_ptr->decl = decl_type;
|
||||||
return (symb_ptr);
|
entry->id_attr = symb_ptr;
|
||||||
}
|
symb_ptr->id_list = SMNULL;
|
||||||
|
return (symb_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
PTR_SYMB
|
|
||||||
get_proc_symbol(entry)
|
|
||||||
PTR_HASH entry;
|
PTR_SYMB
|
||||||
{
|
get_proc_symbol(entry)
|
||||||
register PTR_SYMB symb_ptr;
|
PTR_HASH entry;
|
||||||
PTR_BFND cur_scope();
|
{
|
||||||
|
register PTR_SYMB symb_ptr;
|
||||||
symb_ptr = make_symb(fi, PROCEDURE_NAME, entry->ident);
|
PTR_BFND cur_scope();
|
||||||
symb_ptr->scope = global_bfnd;
|
|
||||||
symb_ptr->outer = entry->id_attr;
|
symb_ptr = make_symb(fi, PROCEDURE_NAME, entry->ident);
|
||||||
symb_ptr->parent = entry;
|
symb_ptr->scope = global_bfnd;
|
||||||
entry->id_attr = symb_ptr;
|
symb_ptr->outer = entry->id_attr;
|
||||||
return (symb_ptr);
|
symb_ptr->parent = entry;
|
||||||
}
|
entry->id_attr = symb_ptr;
|
||||||
|
return (symb_ptr);
|
||||||
/*
|
}
|
||||||
PTR_BFND
|
|
||||||
cur_scope()
|
/*
|
||||||
{
|
PTR_BFND
|
||||||
register PTR_BFND p;
|
cur_scope()
|
||||||
*/
|
{
|
||||||
/* Takes cares of main program unit begining without a PROGRAM
|
register PTR_BFND p;
|
||||||
statement. After rewrite of statement processing has been done,
|
*/
|
||||||
strengthen ( weaken? ) the test.
|
/* Takes cares of main program unit begining without a PROGRAM
|
||||||
*/
|
statement. After rewrite of statement processing has been done,
|
||||||
/*
|
strengthen ( weaken? ) the test.
|
||||||
if ((pred_bfnd->variant == GLOBAL) && (parstate == OUTSIDE))
|
*/
|
||||||
{
|
/*
|
||||||
make_prog_header();
|
if ((pred_bfnd->variant == GLOBAL) && (parstate == OUTSIDE))
|
||||||
return (pred_bfnd);
|
{
|
||||||
}
|
make_prog_header();
|
||||||
|
return (pred_bfnd);
|
||||||
for (p = pred_bfnd;
|
}
|
||||||
(p->variant != PROG_HEDR) &&
|
|
||||||
(p->variant != PROC_HEDR) &&
|
for (p = pred_bfnd;
|
||||||
(p->variant != PROS_HEDR) &&
|
(p->variant != PROG_HEDR) &&
|
||||||
(p->variant != FUNC_HEDR) &&
|
(p->variant != PROC_HEDR) &&
|
||||||
(p->variant != BLOCK_DATA) &&
|
(p->variant != PROS_HEDR) &&
|
||||||
(p->variant != FORALL_NODE) &&
|
(p->variant != FUNC_HEDR) &&
|
||||||
(p->variant != GLOBAL) &&
|
(p->variant != BLOCK_DATA) &&
|
||||||
(p->variant != CDOALL_NODE) &&
|
(p->variant != FORALL_NODE) &&
|
||||||
(p->variant != SDOALL_NODE) &&
|
(p->variant != GLOBAL) &&
|
||||||
(p->variant != DOACROSS_NODE) &&
|
(p->variant != CDOALL_NODE) &&
|
||||||
(p->variant != STRUCT_DECL);
|
(p->variant != SDOALL_NODE) &&
|
||||||
p = p->control_parent);
|
(p->variant != DOACROSS_NODE) &&
|
||||||
;
|
(p->variant != STRUCT_DECL);
|
||||||
|
p = p->control_parent);
|
||||||
return (p);
|
;
|
||||||
}
|
|
||||||
*/
|
return (p);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,208 +1,212 @@
|
|||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* pC++/Sage++ Copyright (C) 1993 */
|
/* pC++/Sage++ Copyright (C) 1993 */
|
||||||
/* Indiana University University of Oregon University of Rennes */
|
/* Indiana University University of Oregon University of Rennes */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* misc.c
|
* misc.c
|
||||||
*
|
*
|
||||||
* Misellanious help routines
|
* Misellanious help routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern int blklevel;
|
extern int blklevel;
|
||||||
extern void warn1();
|
extern void warn1();
|
||||||
extern PTR_BFND cur_scope();
|
extern PTR_BFND cur_scope();
|
||||||
PTR_LABEL make_label();
|
PTR_LABEL make_label();
|
||||||
extern PTR_FILE fi;
|
extern PTR_FILE fi;
|
||||||
void free();
|
void free();
|
||||||
|
|
||||||
extern PTR_CMNT comments;
|
extern PTR_CMNT comments;
|
||||||
extern PTR_FNAME cur_thread_file;
|
extern PTR_FNAME cur_thread_file;
|
||||||
extern PTR_FNAME the_file;
|
extern PTR_FNAME the_file;
|
||||||
extern int yylineno;
|
extern int yylineno;
|
||||||
extern int mod_offset;
|
extern int mod_offset;
|
||||||
extern PTR_BFND last_bfnd;
|
extern PTR_BFND last_bfnd;
|
||||||
extern PTR_BFND head_bfnd, last_bfnd;
|
extern PTR_BFND head_bfnd, last_bfnd;
|
||||||
extern PTR_LLND head_llnd;
|
extern PTR_LLND head_llnd;
|
||||||
extern PTR_SYMB head_symb;
|
extern PTR_SYMB head_symb;
|
||||||
extern PTR_TYPE head_type;
|
extern PTR_TYPE head_type;
|
||||||
extern PTR_LABEL head_label;
|
extern PTR_LABEL head_label;
|
||||||
|
|
||||||
/*
|
#ifdef __SPF
|
||||||
* eqn -- checks if first n characters of two strings are the same
|
extern void removeFromCollection(void *pointer);
|
||||||
*
|
#endif
|
||||||
* input:
|
|
||||||
* n - length to be checked
|
/*
|
||||||
* a - string1
|
* eqn -- checks if first n characters of two strings are the same
|
||||||
* b - string2
|
*
|
||||||
*
|
* input:
|
||||||
* output:
|
* n - length to be checked
|
||||||
* YES if the first n characters are same. NO, otherwise.
|
* a - string1
|
||||||
*/
|
* b - string2
|
||||||
int
|
*
|
||||||
eqn(n, a, b)
|
* output:
|
||||||
register int n;
|
* YES if the first n characters are same. NO, otherwise.
|
||||||
register unsigned char *a, *b;
|
*/
|
||||||
{
|
int
|
||||||
while (--n >= 0)
|
eqn(n, a, b)
|
||||||
if ((isupper(*a) ? tolower(*a++) : *a++) != *b++)
|
register int n;
|
||||||
return (NO);
|
register unsigned char *a, *b;
|
||||||
return (YES);
|
{
|
||||||
}
|
while (--n >= 0)
|
||||||
|
if ((isupper(*a) ? tolower(*a++) : *a++) != *b++)
|
||||||
/*
|
return (NO);
|
||||||
* StringConcatenation -- concatenate strings
|
return (YES);
|
||||||
*/
|
}
|
||||||
char *StringConcatenation(char *s1, char*s2)
|
|
||||||
{
|
/*
|
||||||
char *res = (char*)malloc(strlen(s1)+strlen(s2)+1);
|
* StringConcatenation -- concatenate strings
|
||||||
res[0] = '\0';
|
*/
|
||||||
strcat(res, s1);
|
char *StringConcatenation(char *s1, char*s2)
|
||||||
strcat(res, s2);
|
{
|
||||||
return res;
|
char *res = (char*)malloc(strlen(s1)+strlen(s2)+1);
|
||||||
}
|
res[0] = '\0';
|
||||||
|
strcat(res, s1);
|
||||||
/*
|
strcat(res, s2);
|
||||||
* convci - converts an ASCII string to binary
|
return res;
|
||||||
*
|
}
|
||||||
* input:
|
|
||||||
* n - length of the string
|
/*
|
||||||
* s - the string to be converted
|
* convci - converts an ASCII string to binary
|
||||||
*
|
*
|
||||||
* output:
|
* input:
|
||||||
* the converted long value
|
* n - length of the string
|
||||||
*/
|
* s - the string to be converted
|
||||||
long
|
*
|
||||||
convci(n, s)
|
* output:
|
||||||
register int n;
|
* the converted long value
|
||||||
register char *s;
|
*/
|
||||||
{
|
long
|
||||||
register long sum;
|
convci(n, s)
|
||||||
|
register int n;
|
||||||
sum = 0;
|
register char *s;
|
||||||
while (n-- > 0)
|
{
|
||||||
sum = 10 * sum + (*s++ - '0');
|
register long sum;
|
||||||
return (sum);
|
|
||||||
}
|
sum = 0;
|
||||||
|
while (n-- > 0)
|
||||||
|
sum = 10 * sum + (*s++ - '0');
|
||||||
/*
|
return (sum);
|
||||||
* convic -- converts a long integer to ASCII string
|
}
|
||||||
*
|
|
||||||
* input:
|
|
||||||
* n - the number to be converted
|
/*
|
||||||
*
|
* convic -- converts a long integer to ASCII string
|
||||||
* output:
|
*
|
||||||
* the converted string
|
* input:
|
||||||
*/
|
* n - the number to be converted
|
||||||
char *
|
*
|
||||||
convic(n)
|
* output:
|
||||||
long n;
|
* the converted string
|
||||||
{
|
*/
|
||||||
static char s[20];
|
char *
|
||||||
register char *t;
|
convic(n)
|
||||||
|
long n;
|
||||||
s[19] = '\0';
|
{
|
||||||
t = s + 19;
|
static char s[20];
|
||||||
|
register char *t;
|
||||||
do {
|
|
||||||
*--t = '0' + n % 10;
|
s[19] = '\0';
|
||||||
n /= 10;
|
t = s + 19;
|
||||||
} while (n > 0);
|
|
||||||
|
do {
|
||||||
return (t);
|
*--t = '0' + n % 10;
|
||||||
}
|
n /= 10;
|
||||||
|
} while (n > 0);
|
||||||
|
|
||||||
/*
|
return (t);
|
||||||
* Get a BIF node
|
}
|
||||||
*/
|
|
||||||
PTR_BFND
|
|
||||||
get_bfnd(fid,node_type, symb_ptr, ll1, ll2, ll3)
|
/*
|
||||||
PTR_FILE fid;
|
* Get a BIF node
|
||||||
int node_type;
|
*/
|
||||||
PTR_SYMB symb_ptr;
|
PTR_BFND
|
||||||
PTR_LLND ll1, ll2, ll3;
|
get_bfnd(fid,node_type, symb_ptr, ll1, ll2, ll3)
|
||||||
{
|
PTR_FILE fid;
|
||||||
PTR_BFND new_bfnd, make_bfnd();
|
int node_type;
|
||||||
|
PTR_SYMB symb_ptr;
|
||||||
new_bfnd = make_bfnd(fid, node_type, symb_ptr, ll1, ll2, ll3);
|
PTR_LLND ll1, ll2, ll3;
|
||||||
new_bfnd->filename = the_file;
|
{
|
||||||
/*new_bfnd->filename = cur_thread_file;*/ /*podd 18.04.99*/
|
PTR_BFND new_bfnd, make_bfnd();
|
||||||
new_bfnd->entry.Template.cmnt_ptr = comments;
|
|
||||||
new_bfnd->entry.Template.bl_ptr1 = BLNULL;
|
new_bfnd = make_bfnd(fid, node_type, symb_ptr, ll1, ll2, ll3);
|
||||||
new_bfnd->entry.Template.bl_ptr2 = BLNULL;
|
new_bfnd->filename = the_file;
|
||||||
new_bfnd->g_line = yylineno;
|
/*new_bfnd->filename = cur_thread_file;*/ /*podd 18.04.99*/
|
||||||
new_bfnd->l_line = yylineno - mod_offset;
|
new_bfnd->entry.Template.cmnt_ptr = comments;
|
||||||
last_bfnd = new_bfnd;
|
new_bfnd->entry.Template.bl_ptr1 = BLNULL;
|
||||||
return (new_bfnd);
|
new_bfnd->entry.Template.bl_ptr2 = BLNULL;
|
||||||
}
|
new_bfnd->g_line = yylineno;
|
||||||
|
new_bfnd->l_line = yylineno - mod_offset;
|
||||||
|
last_bfnd = new_bfnd;
|
||||||
void
|
return (new_bfnd);
|
||||||
release_nodes()
|
}
|
||||||
{
|
|
||||||
register PTR_BFND p1 = head_bfnd;
|
|
||||||
register PTR_LLND p2 = head_llnd;
|
void
|
||||||
register PTR_SYMB p3 = head_symb;
|
release_nodes()
|
||||||
register PTR_TYPE p4 = head_type;
|
{
|
||||||
register PTR_LABEL p5 =head_label;
|
register PTR_BFND p1 = head_bfnd;
|
||||||
register PTR_BFND t1;
|
register PTR_LLND p2 = head_llnd;
|
||||||
register PTR_LLND t2;
|
register PTR_SYMB p3 = head_symb;
|
||||||
register PTR_SYMB t3;
|
register PTR_TYPE p4 = head_type;
|
||||||
register PTR_TYPE t4;
|
register PTR_LABEL p5 =head_label;
|
||||||
register PTR_LABEL t5;
|
register PTR_BFND t1;
|
||||||
|
register PTR_LLND t2;
|
||||||
while (p1) {
|
register PTR_SYMB t3;
|
||||||
t1 = p1;
|
register PTR_TYPE t4;
|
||||||
p1 = p1->thread;
|
register PTR_LABEL t5;
|
||||||
#ifdef __SPF
|
|
||||||
removeFromCollection(t1);
|
while (p1) {
|
||||||
#endif
|
t1 = p1;
|
||||||
free ((char *)t1);
|
p1 = p1->thread;
|
||||||
}
|
#ifdef __SPF
|
||||||
|
removeFromCollection(t1);
|
||||||
while (p2) {
|
#endif
|
||||||
t2 = p2;
|
free ((char *)t1);
|
||||||
p2 = p2->thread;
|
}
|
||||||
#ifdef __SPF
|
|
||||||
removeFromCollection(t2);
|
while (p2) {
|
||||||
#endif
|
t2 = p2;
|
||||||
free ((char *)t2);
|
p2 = p2->thread;
|
||||||
}
|
#ifdef __SPF
|
||||||
|
removeFromCollection(t2);
|
||||||
while (p3) {
|
#endif
|
||||||
t3 = p3;
|
free ((char *)t2);
|
||||||
p3 = p3->thread;
|
}
|
||||||
#ifdef __SPF
|
|
||||||
removeFromCollection(t3);
|
while (p3) {
|
||||||
#endif
|
t3 = p3;
|
||||||
free ((char *)t3);
|
p3 = p3->thread;
|
||||||
}
|
#ifdef __SPF
|
||||||
|
removeFromCollection(t3);
|
||||||
while (p4) {
|
#endif
|
||||||
t4 = p4;
|
free ((char *)t3);
|
||||||
p4 = p4->thread;
|
}
|
||||||
#ifdef __SPF
|
|
||||||
removeFromCollection(t4);
|
while (p4) {
|
||||||
#endif
|
t4 = p4;
|
||||||
free ((char *)t4);
|
p4 = p4->thread;
|
||||||
}
|
#ifdef __SPF
|
||||||
|
removeFromCollection(t4);
|
||||||
while (p5) {
|
#endif
|
||||||
t5 = p5;
|
free ((char *)t4);
|
||||||
p5 = p5->next;
|
}
|
||||||
#ifdef __SPF
|
|
||||||
removeFromCollection(t5);
|
while (p5) {
|
||||||
#endif
|
t5 = p5;
|
||||||
free ((char *)t5);
|
p5 = p5->next;
|
||||||
}
|
#ifdef __SPF
|
||||||
}
|
removeFromCollection(t5);
|
||||||
|
#endif
|
||||||
|
free ((char *)t5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -48,6 +48,5 @@ if (MSVC_IDE)
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
|
||||||
endif()
|
endif()
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user