Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
f34cb8c3
Commit
f34cb8c3
authored
29 years ago
by
Will Partain
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1996-01-09 18:43:57 by partain]
parent
fd4d3a85
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ghc/utils/ugen/tree.c
+33
-47
33 additions, 47 deletions
ghc/utils/ugen/tree.c
ghc/utils/ugen/tree.h
+236
-34
236 additions, 34 deletions
ghc/utils/ugen/tree.h
ghc/utils/ugen/tree.ugn
+1
-1
1 addition, 1 deletion
ghc/utils/ugen/tree.ugn
with
270 additions
and
82 deletions
ghc/utils/ugen/tree.c
+
33
−
47
View file @
f34cb8c3
#include
"id.h"
#include
"tree.h"
extern
char
*
malloc
();
struct
Stypdef
{
Ttree
tag
;
id
Xgtid
;
tree
Xgtdeflist
;
};
struct
Sdeflist
{
Ttree
tag
;
tree
Xgdeflist
;
tree
Xgdef
;
};
struct
Sdef
{
Ttree
tag
;
id
Xgdid
;
tree
Xgditemlist
;
};
struct
Sitemlist
{
Ttree
tag
;
tree
Xgitemlist
;
tree
Xgitem
;
};
struct
Semitemlist
{
Ttree
tag
;
};
struct
Sitem
{
Ttree
tag
;
id
Xgitemfunid
;
id
Xgitemtypid
;
};
Ttree
ttree
(
t
)
tree
t
;
{
...
...
@@ -61,16 +27,20 @@ tree mktypdef(PPgtid, PPgtdeflist)
id
*
Rgtid
(
t
)
struct
Stypdef
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
typdef
)
printf
(
"gtid: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gtid: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgtid
);
}
tree
*
Rgtdeflist
(
t
)
struct
Stypdef
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
typdef
)
printf
(
"gtdeflist: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gtdeflist: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgtdeflist
);
}
...
...
@@ -91,16 +61,20 @@ tree mkdeflist(PPgdeflist, PPgdef)
tree
*
Rgdeflist
(
t
)
struct
Sdeflist
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
deflist
)
printf
(
"gdeflist: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gdeflist: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgdeflist
);
}
tree
*
Rgdef
(
t
)
struct
Sdeflist
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
deflist
)
printf
(
"gdef: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gdef: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgdef
);
}
...
...
@@ -121,16 +95,20 @@ tree mkdef(PPgdid, PPgditemlist)
id
*
Rgdid
(
t
)
struct
Sdef
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
def
)
printf
(
"gdid: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gdid: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgdid
);
}
tree
*
Rgditemlist
(
t
)
struct
Sdef
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
def
)
printf
(
"gditemlist: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gditemlist: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgditemlist
);
}
...
...
@@ -151,22 +129,26 @@ tree mkitemlist(PPgitemlist, PPgitem)
tree
*
Rgitemlist
(
t
)
struct
Sitemlist
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
itemlist
)
printf
(
"gitemlist: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gitemlist: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgitemlist
);
}
tree
*
Rgitem
(
t
)
struct
Sitemlist
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
itemlist
)
printf
(
"gitem: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gitem: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgitem
);
}
/************** emitemlist ******************/
tree
mkemitemlist
()
tree
mkemitemlist
(
void
)
{
register
struct
Semitemlist
*
pp
=
(
struct
Semitemlist
*
)
malloc
(
sizeof
(
struct
Semitemlist
));
...
...
@@ -191,15 +173,19 @@ tree mkitem(PPgitemfunid, PPgitemtypid)
id
*
Rgitemfunid
(
t
)
struct
Sitem
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
item
)
printf
(
"gitemfunid: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gitemfunid: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgitemfunid
);
}
id
*
Rgitemtypid
(
t
)
struct
Sitem
*
t
;
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
item
)
printf
(
"gitemtypid: illegal selection; was %d
\n
"
,
t
->
tag
);
fprintf
(
stderr
,
"gitemtypid: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgitemtypid
);
}
This diff is collapsed.
Click to expand it.
ghc/utils/ugen/tree.h
+
236
−
34
View file @
f34cb8c3
#ifndef tree_defined
#define tree_defined
#include
<stdio.h>
#ifndef PROTO
#ifdef __STDC__
#define PROTO(x) x
#else
#define PROTO(x)
/**/
#endif
#endif
typedef
enum
{
typdef
,
deflist
,
...
...
@@ -11,39 +22,230 @@ typedef enum {
typedef
struct
{
Ttree
tag
;
}
*
tree
;
/* Compatibility defines */
extern
Ttree
ttree
();
#ifdef __GNUC__
Ttree
ttree
(
tree
t
);
extern
__inline__
Ttree
ttree
(
tree
t
)
{
return
(
t
->
tag
);
}
#else
/* ! __GNUC__ */
extern
Ttree
ttree
PROTO
((
tree
));
#endif
/* ! __GNUC__ */
#endif
extern
tree
mktypdef
();
extern
id
*
Rgtid
();
#define gtid(xyzxyz) (*Rgtid(xyzxyz))
extern
tree
*
Rgtdeflist
();
#define gtdeflist(xyzxyz) (*Rgtdeflist(xyzxyz))
extern
tree
mkdeflist
();
extern
tree
*
Rgdeflist
();
#define gdeflist(xyzxyz) (*Rgdeflist(xyzxyz))
extern
tree
*
Rgdef
();
#define gdef(xyzxyz) (*Rgdef(xyzxyz))
extern
tree
mkdef
();
extern
id
*
Rgdid
();
#define gdid(xyzxyz) (*Rgdid(xyzxyz))
extern
tree
*
Rgditemlist
();
#define gditemlist(xyzxyz) (*Rgditemlist(xyzxyz))
extern
tree
mkitemlist
();
extern
tree
*
Rgitemlist
();
#define gitemlist(xyzxyz) (*Rgitemlist(xyzxyz))
extern
tree
*
Rgitem
();
#define gitem(xyzxyz) (*Rgitem(xyzxyz))
extern
tree
mkemitemlist
();
extern
tree
mkitem
();
extern
id
*
Rgitemfunid
();
#define gitemfunid(xyzxyz) (*Rgitemfunid(xyzxyz))
extern
id
*
Rgitemtypid
();
#define gitemtypid(xyzxyz) (*Rgitemtypid(xyzxyz))
struct
Stypdef
{
Ttree
tag
;
id
Xgtid
;
tree
Xgtdeflist
;
};
struct
Sdeflist
{
Ttree
tag
;
tree
Xgdeflist
;
tree
Xgdef
;
};
struct
Sdef
{
Ttree
tag
;
id
Xgdid
;
tree
Xgditemlist
;
};
struct
Sitemlist
{
Ttree
tag
;
tree
Xgitemlist
;
tree
Xgitem
;
};
struct
Semitemlist
{
Ttree
tag
;
};
struct
Sitem
{
Ttree
tag
;
id
Xgitemfunid
;
id
Xgitemtypid
;
};
extern
tree
mktypdef
PROTO
((
id
,
tree
));
#ifdef __GNUC__
id
*
Rgtid
PROTO
((
struct
Stypdef
*
));
extern
__inline__
id
*
Rgtid
(
struct
Stypdef
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
typdef
)
fprintf
(
stderr
,
"gtid: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgtid
);
}
#else
/* ! __GNUC__ */
extern
id
*
Rgtid
PROTO
((
struct
Stypdef
*
));
#endif
/* ! __GNUC__ */
#define gtid(xyzxyz) (*Rgtid((struct Stypdef *) (xyzxyz)))
#ifdef __GNUC__
tree
*
Rgtdeflist
PROTO
((
struct
Stypdef
*
));
extern
__inline__
tree
*
Rgtdeflist
(
struct
Stypdef
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
typdef
)
fprintf
(
stderr
,
"gtdeflist: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgtdeflist
);
}
#else
/* ! __GNUC__ */
extern
tree
*
Rgtdeflist
PROTO
((
struct
Stypdef
*
));
#endif
/* ! __GNUC__ */
#define gtdeflist(xyzxyz) (*Rgtdeflist((struct Stypdef *) (xyzxyz)))
extern
tree
mkdeflist
PROTO
((
tree
,
tree
));
#ifdef __GNUC__
tree
*
Rgdeflist
PROTO
((
struct
Sdeflist
*
));
extern
__inline__
tree
*
Rgdeflist
(
struct
Sdeflist
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
deflist
)
fprintf
(
stderr
,
"gdeflist: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgdeflist
);
}
#else
/* ! __GNUC__ */
extern
tree
*
Rgdeflist
PROTO
((
struct
Sdeflist
*
));
#endif
/* ! __GNUC__ */
#define gdeflist(xyzxyz) (*Rgdeflist((struct Sdeflist *) (xyzxyz)))
#ifdef __GNUC__
tree
*
Rgdef
PROTO
((
struct
Sdeflist
*
));
extern
__inline__
tree
*
Rgdef
(
struct
Sdeflist
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
deflist
)
fprintf
(
stderr
,
"gdef: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgdef
);
}
#else
/* ! __GNUC__ */
extern
tree
*
Rgdef
PROTO
((
struct
Sdeflist
*
));
#endif
/* ! __GNUC__ */
#define gdef(xyzxyz) (*Rgdef((struct Sdeflist *) (xyzxyz)))
extern
tree
mkdef
PROTO
((
id
,
tree
));
#ifdef __GNUC__
id
*
Rgdid
PROTO
((
struct
Sdef
*
));
extern
__inline__
id
*
Rgdid
(
struct
Sdef
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
def
)
fprintf
(
stderr
,
"gdid: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgdid
);
}
#else
/* ! __GNUC__ */
extern
id
*
Rgdid
PROTO
((
struct
Sdef
*
));
#endif
/* ! __GNUC__ */
#define gdid(xyzxyz) (*Rgdid((struct Sdef *) (xyzxyz)))
#ifdef __GNUC__
tree
*
Rgditemlist
PROTO
((
struct
Sdef
*
));
extern
__inline__
tree
*
Rgditemlist
(
struct
Sdef
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
def
)
fprintf
(
stderr
,
"gditemlist: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgditemlist
);
}
#else
/* ! __GNUC__ */
extern
tree
*
Rgditemlist
PROTO
((
struct
Sdef
*
));
#endif
/* ! __GNUC__ */
#define gditemlist(xyzxyz) (*Rgditemlist((struct Sdef *) (xyzxyz)))
extern
tree
mkitemlist
PROTO
((
tree
,
tree
));
#ifdef __GNUC__
tree
*
Rgitemlist
PROTO
((
struct
Sitemlist
*
));
extern
__inline__
tree
*
Rgitemlist
(
struct
Sitemlist
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
itemlist
)
fprintf
(
stderr
,
"gitemlist: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgitemlist
);
}
#else
/* ! __GNUC__ */
extern
tree
*
Rgitemlist
PROTO
((
struct
Sitemlist
*
));
#endif
/* ! __GNUC__ */
#define gitemlist(xyzxyz) (*Rgitemlist((struct Sitemlist *) (xyzxyz)))
#ifdef __GNUC__
tree
*
Rgitem
PROTO
((
struct
Sitemlist
*
));
extern
__inline__
tree
*
Rgitem
(
struct
Sitemlist
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
itemlist
)
fprintf
(
stderr
,
"gitem: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgitem
);
}
#else
/* ! __GNUC__ */
extern
tree
*
Rgitem
PROTO
((
struct
Sitemlist
*
));
#endif
/* ! __GNUC__ */
#define gitem(xyzxyz) (*Rgitem((struct Sitemlist *) (xyzxyz)))
extern
tree
mkemitemlist
PROTO
((
void
));
extern
tree
mkitem
PROTO
((
id
,
id
));
#ifdef __GNUC__
id
*
Rgitemfunid
PROTO
((
struct
Sitem
*
));
extern
__inline__
id
*
Rgitemfunid
(
struct
Sitem
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
item
)
fprintf
(
stderr
,
"gitemfunid: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgitemfunid
);
}
#else
/* ! __GNUC__ */
extern
id
*
Rgitemfunid
PROTO
((
struct
Sitem
*
));
#endif
/* ! __GNUC__ */
#define gitemfunid(xyzxyz) (*Rgitemfunid((struct Sitem *) (xyzxyz)))
#ifdef __GNUC__
id
*
Rgitemtypid
PROTO
((
struct
Sitem
*
));
extern
__inline__
id
*
Rgitemtypid
(
struct
Sitem
*
t
)
{
#ifdef UGEN_DEBUG
if
(
t
->
tag
!=
item
)
fprintf
(
stderr
,
"gitemtypid: illegal selection; was %d
\n
"
,
t
->
tag
);
#endif
/* UGEN_DEBUG */
return
(
&
t
->
Xgitemtypid
);
}
#else
/* ! __GNUC__ */
extern
id
*
Rgitemtypid
PROTO
((
struct
Sitem
*
));
#endif
/* ! __GNUC__ */
#define gitemtypid(xyzxyz) (*Rgitemtypid((struct Sitem *) (xyzxyz)))
#endif
This diff is collapsed.
Click to expand it.
ghc/utils/ugen/tree.ugn
+
1
−
1
View file @
f34cb8c3
...
...
@@ -17,7 +17,7 @@ type tree;
>;
itemlist : <
gitemlist : tree;
gitem : tree;
gitem : tree;
>;
emitemlist: < >;
item : <
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment