Feynman Software -> FMSoft

This commit is contained in:
Vincent Wei
2019-10-29 09:36:01 +08:00
parent 61411c7656
commit c488f2a79c
30 changed files with 71 additions and 30 deletions

View File

@@ -0,0 +1,41 @@
BEGIN { }
# %INCLUDE{"%ATTACHURL%/helloworld.c.txt" pattern="^.*?// START_OF_INCS(.*?)// END_OF_INCS.*"}%
{
if (match ($0, /^%INCLUDE\{"%ATTACHURL%\/(\w+)\W/, fields)) {
source_file = "samples/" fields[1] ".c"
if (match ($0, /.+pattern=".+ START_OF_([A-Z]+)\W.+ END_OF_([A-Z]+)\W/, fields)) {
start_tag = "START_OF_" fields[1]
end_tag = "END_OF_" fields[2]
# print "Include source between " start_tag " and " end_tag " from " source_file " here..."
started = 0
while ((getline line < source_file) > 0) {
if (index (line, start_tag) != 0) {
started = 1
continue
}
else if (index (line, end_tag) != 0) {
started = 0
}
if (started) {
print line
}
}
close (source_file)
}
else {
# print "Include all source from " source_file " here..."
while ((getline line < source_file) > 0)
print line
close (source_file)
}
}
else
print $0
}