Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Blomdell
LabComm
Commits
65b8ec23
Commit
65b8ec23
authored
10 years ago
by
Sven Gestegård Robertz
Browse files
Options
Downloads
Patches
Plain Diff
initial sketch of typedefs as samples
parent
f2be82a5
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
compiler/2014/GenerateTypedefs.jrag
+36
-0
36 additions, 0 deletions
compiler/2014/GenerateTypedefs.jrag
compiler/2014/LabComm.java
+57
-36
57 additions, 36 deletions
compiler/2014/LabComm.java
compiler/2014/TypeReferences.jrag
+8
-8
8 additions, 8 deletions
compiler/2014/TypeReferences.jrag
with
101 additions
and
44 deletions
compiler/2014/GenerateTypedefs.jrag
0 → 100644
+
36
−
0
View file @
65b8ec23
aspect TypeDefGen {
public void Specification.generateTypedefs(PrintStream out, int ver) {
for(Decl d : getDecls()) {
d.generateTypedefs(out);
}
}
public void Decl.generateTypedefs(PrintStream out) {
}
public void Decl.generateDepTypedefs(PrintStream out){
Iterator<Decl> it = type_dependencies().iterator();
while(it.hasNext()) {
Decl d = it.next();
d.generateDepTypedefs(out);
}
pp(out);
}
public void SampleDecl.generateTypedefs(PrintStream out){
if(hasDependencies()) {
out.println("sample "+getName()+"_def {");
out.println(" sample sample;");
out.println(" string typedef = <<EOL");
for(Decl d : type_dependencies()) {
d.generateDepTypedefs(out);
}
pp(out);
out.println("EOL;");
}
}
}
This diff is collapsed.
Click to expand it.
compiler/2014/LabComm.java
+
57
−
36
View file @
65b8ec23
...
...
@@ -36,6 +36,7 @@ public class LabComm {
println
(
"[ Misc options ]"
);
println
(
" --pretty=PFILE Pretty prints to PFILE"
);
println
(
" --typeinfo=TIFILE Generates typeinfo in TIFILE"
);
println
(
" --typedefs=TIFILE Generates typedefs in TIFILE"
);
}
/** To be cleaned up.
...
...
@@ -139,6 +140,7 @@ public class LabComm {
String
pythonFile
=
null
;
String
prettyFile
=
null
;
String
typeinfoFile
=
null
;
String
typedefsFile
=
null
;
String
rapidFile
=
null
;
String
fileName
=
null
;
...
...
@@ -223,6 +225,8 @@ public class LabComm {
prettyFile
=
args
[
i
].
substring
(
9
);
}
else
if
(
args
[
i
].
startsWith
(
"--typeinfo="
))
{
typeinfoFile
=
args
[
i
].
substring
(
11
);
}
else
if
(
args
[
i
].
startsWith
(
"--typedefs="
))
{
typedefsFile
=
args
[
i
].
substring
(
11
);
}
else
if
(
args
[
i
].
equals
(
"--rapid"
))
{
rapidFile
=
coreName
+
".sys"
;
}
else
if
(
i
==
args
.
length
-
1
)
{
...
...
@@ -361,6 +365,22 @@ public class LabComm {
return
wroteFile
;
}
boolean
generateTypedefs
(
Specification
ast
)
{
boolean
wroteFile
=
false
;
if
(
typedefsFile
!=
null
)
{
printStatus
(
"Typedefs: "
,
typedefsFile
);
try
{
FileOutputStream
f
=
new
FileOutputStream
(
typedefsFile
);
PrintStream
out
=
new
PrintStream
(
f
);
ast
.
generateTypedefs
(
out
,
ver
);
wroteFile
=
true
;
}
catch
(
IOException
e
)
{
System
.
err
.
println
(
"IOException: "
+
typedefsFile
+
" "
+
e
);
}
}
return
wroteFile
;
}
private
void
printStatus
(
String
kind
,
String
filename
){
if
(
verbose
)
{
System
.
err
.
println
(
"Generating "
+
kind
+
": "
+
filename
);
...
...
@@ -389,6 +409,7 @@ public class LabComm {
fileWritten
|=
opts
.
generateRAPID
(
ast
);
fileWritten
|=
opts
.
generatePrettyPrint
(
ast
);
fileWritten
|=
opts
.
generateTypeinfo
(
ast
);
fileWritten
|=
opts
.
generateTypedefs
(
ast
);
// if no output to files, prettyprint on stdout
if
(!
fileWritten
)
{
...
...
This diff is collapsed.
Click to expand it.
compiler/2014/TypeReferences.jrag
+
8
−
8
View file @
65b8ec23
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