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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Sven Gestegård Robertz
LabComm
Commits
1562625c
Commit
1562625c
authored
11 years ago
by
Sven Robertz
Browse files
Options
Downloads
Patches
Plain Diff
more cleanup and some documentation
parent
07b21d7b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/dynamic/README
+29
-5
29 additions, 5 deletions
examples/dynamic/README
examples/dynamic/TestLabcommGen.java
+2
-2
2 additions, 2 deletions
examples/dynamic/TestLabcommGen.java
with
31 additions
and
7 deletions
examples/dynamic/README
+
29
−
5
View file @
1562625c
This directory contains an embryo of an example of how to
This directory contains an embryo of an example of how to
generate and compile a labcomm endpoint on the fly.
generate and compile a labcomm endpoint on the fly.
NB! There is currently no connection between the files StaticPart.java, DynamicPart.java, and
NB! There is currently no connection to the StaticPart.java
TestLabCommCompiler.java
the runme.sh script builds and runs the TestLabCommGen, which illustrates the
on-the-fly compilation to RAM, reading the labcomm declarations and handlers from file
The handlers declaration (in handlers.txt) is experimental, and has the following format:
<sample name>:handler(<data type> <variable name>) {
<handler method code>
}###
where the end marker (}###) is a kludge to avoid having to parse the method body while still allowing
it to contain blocks. Thus, having the sequence "}###" in the method body breaks this. Caveat hacker!
An example handlers declaration:
foo:handler(foo value) {
System.out.println("foo handler from handlers.txt");
System.out.println(value.x);
System.out.println(value.y);
System.out.println(value.z);
for(int i=0; i<value.x; i++){
System.out.print("."+(value.x-i));
}
System.out.println();
}###
bar:handler(int value) {
System.out.println(value);
}###
the runme.sh script builds and runs the TestLabCommCompiler, which illustrates the
on-the-fly compilation to RAM, reading the labcomm declarations from file but with the
handlers hard coded in the test program.
This diff is collapsed.
Click to expand it.
examples/dynamic/TestLabcommGen.java
+
2
−
2
View file @
1562625c
...
@@ -103,9 +103,9 @@ public class TestLabcommGen {
...
@@ -103,9 +103,9 @@ public class TestLabcommGen {
}
else
{
}
else
{
System
.
out
.
println
(
"expeced handler decl:\n"
+
srcStr
.
substring
(
pos
));
System
.
out
.
println
(
"expeced handler decl:\n"
+
srcStr
.
substring
(
pos
));
}
}
int
bodyEnd
=
srcStr
.
indexOf
(
'}'
,
pos
);
// HERE BE DRAGONS!
too
brittle
int
bodyEnd
=
srcStr
.
indexOf
(
"}###"
,
pos
);
// HERE BE DRAGONS!
a bit
brittle
String
body
=
srcStr
.
substring
(
pos
,
bodyEnd
+
1
);
String
body
=
srcStr
.
substring
(
pos
,
bodyEnd
+
1
);
pos
=
bodyEnd
+
2
;
pos
=
bodyEnd
+
5
;
// System.out.println("body:");
// System.out.println("body:");
// System.out.println(body);
// System.out.println(body);
...
...
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