Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
pikelang
pike
Commits
ae493b1e
Commit
ae493b1e
authored
21 years ago
by
Martin Nilsson
Browse files
Options
Downloads
Patches
Plain Diff
Added --help
Rev: bin/make_ci.pike:1.10 Rev: bin/make_interpret_functions.pike:1.9
parent
d048d8eb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/make_ci.pike
+8
-6
8 additions, 6 deletions
bin/make_ci.pike
bin/make_interpret_functions.pike
+26
-29
26 additions, 29 deletions
bin/make_interpret_functions.pike
with
34 additions
and
35 deletions
bin/make_ci.pike
+
8
−
6
View file @
ae493b1e
#! /usr/bin/env pike
/*
* $Id: make_ci.pike,v 1.
9
2003/
02
/1
0
1
2:2
7:
1
6
mast
Exp $
* $Id: make_ci.pike,v 1.
10
2003/
11
/1
9
1
6:4
7:
4
6
nilsson
Exp $
*
* Creates the file case_info.h
*
...
...
@@ -20,11 +22,11 @@ int main(int argc, array(string) argv)
array(array(int)) ci = ({({ 0, CIM_NONE, 0 })});
int prevchar = 0;
if (argc < 2) {
werror("Missing argument.\n"
if (argc < 2 || argv[1]=="--help" ) {
werror("Creates case info file by reading the unicode database from\n"
"stdin and outputs it to a file.\n"
"\n"
"Usage:\n"
"\t%s case_info.h\n", argv[0]);
"Usage: make_ci.pike output_file.h\n");
exit(1);
}
...
...
@@ -110,7 +112,7 @@ int main(int argc, array(string) argv)
outfile->
write(sprintf("/*\n"
" * Created by\n"
" * $Id: make_ci.pike,v 1.
9
2003/
02
/1
0
1
2:2
7:
1
6
mast
Exp $\n"
" * $Id: make_ci.pike,v 1.
10
2003/
11
/1
9
1
6:4
7:
4
6
nilsson
Exp $\n"
" * on %s"
" *\n"
" * Table used for looking up the case of\n"
...
...
This diff is collapsed.
Click to expand it.
bin/make_interpret_functions.pike
+
26
−
29
View file @
ae493b1e
#! /usr/bin/env pike
#ifdef OLD
import OLD;
#define PC Pike
#else /* !OLD */
#define PC Parser.Pike
#endif /* OLD */
mapping ops=([]);
array fixit2(array x)
...
...
@@ -18,7 +11,7 @@ array fixit2(array x)
if(objectp(x[e]) && ops[(string)x[e]])
{
opcodes+=x[e..e]+fixit2(x[e+1])[0];
array tmp=fixit2((x[e+1]/ ({ P
C
.Token(",") }) )[-1][0]);
array tmp=fixit2((x[e+1]/ ({ P
arser.Pike
.Token(",") }) )[-1][0]);
ret+=({ tmp[0] });
opcodes+=tmp[1];
...
...
@@ -69,7 +62,7 @@ array fixit(array x)
array filter_out_cases(array x)
{
array y=x/({ P
C
.Token("CASE") });
array y=x/({ P
arser.Pike
.Token("CASE") });
for(int e=1;e<sizeof(y);e++) y[e]=y[e][1..];
return y*({});
}
...
...
@@ -82,25 +75,25 @@ array fix_cases(array x)
while(1)
{
int casepos=search(x,P
C
.Token("CASE"), start);
//werror("%O\n",P
C
.simple_reconstitute(x[casepos..casepos+1]));
int casepos=search(x,P
arser.Pike
.Token("CASE"), start);
//werror("%O\n",P
arser.Pike
.simple_reconstitute(x[casepos..casepos+1]));
if(casepos == -1) break;
int donepos=search(x,P
C
.Token("DONE"),casepos+1);
int donepos=search(x,P
arser.Pike
.Token("DONE"),casepos+1);
ret+=x[undone..casepos-1]+
({
P
C
.Token("OPCODE0"),
P
arser.Pike
.Token("OPCODE0"),
({
P
C
.Token("("),
P
arser.Pike
.Token("("),
x[casepos+1][1],
P
C
.Token(","),
P
C
.Token(sprintf("%O",(string)x[casepos+1][1])),
P
C
.Token(","),
({ P
C
.Token("{") })+
P
arser.Pike
.Token(","),
P
arser.Pike
.Token(sprintf("%O",(string)x[casepos+1][1])),
P
arser.Pike
.Token(","),
({ P
arser.Pike
.Token("{") })+
filter_out_cases(x[casepos+2..donepos-1])+
({ P
C
.Token("}") }),
P
C
.Token(")"),
P
C
.Token(";"),
({ P
arser.Pike
.Token("}") }),
P
arser.Pike
.Token(")"),
P
arser.Pike
.Token(";"),
})
});
...
...
@@ -113,12 +106,18 @@ array fix_cases(array x)
int main(int argc, array(string) argv)
{
if(argc<2 || argv[1]=="--help") {
werror("Generates interpret_functions_fixed.h from interpret_functions.h\n"
"Usage: make_interpret_functions.pike interpret_functions.h > outfile\n");
return 1;
}
string file=argv[1];
mixed x=Stdio.read_file(file);
x=P
C
.split(x);
x=P
C
.tokenize(x,file);
x=P
C
.hide_whitespaces(x);
x=P
C
.group(x);
x=P
arser.Pike
.split(x);
x=P
arser.Pike
.tokenize(x,file);
x=P
arser.Pike
.hide_whitespaces(x);
x=P
arser.Pike
.group(x);
for(int e=0;e<=2;e++) {
foreach( ({"","TAIL"}), string tail) {
...
...
@@ -130,13 +129,11 @@ int main(int argc, array(string) argv)
}
}
// werror("%O\n",ops);
x=fix_cases(x);
x=fixit(x);
if(getenv("PIKE_DEBUG_PRECOMPILER"))
write(P
C
.simple_reconstitute(x));
write(P
arser.Pike
.simple_reconstitute(x));
else
write(P
C
.reconstitute_with_line_numbers(x));
write(P
arser.Pike
.reconstitute_with_line_numbers(x));
}
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