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
bd14b56f
Commit
bd14b56f
authored
26 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
bugfixes
Rev: bin/mkpeep.pike:1.9
parent
3ce484ab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/mkpeep.pike
+30
-69
30 additions, 69 deletions
bin/mkpeep.pike
with
30 additions
and
69 deletions
bin/mkpeep.pike
+
30
−
69
View file @
bd14b56f
#!/usr/local/bin/pike
/* $Id: mkpeep.pike,v 1.
8
1998/0
4/27 09:53
:4
7
hubbe Exp $ */
/* $Id: mkpeep.pike,v 1.
9
1998/0
5/13 07:35
:4
5
hubbe Exp $ */
import Simulate;
...
...
@@ -113,6 +113,30 @@ mixed split(string s)
if(a[e][0]=='F')
opcodes++;
#if 0
/* It was a good idea, but it doesn't work */
mixed qqqq=copy_value(b);
i=0;
while(sizeof(b))
{
if(b[0] != a[i])
break;
if(sizeof(b)>1 && b[1][0]!='F')
{
if(b[1] != sprintf("($%da)",i+1))
break;
b=b[2..];
}else{
b=b[1..];
}
i++;
opcodes--;
}
if(i)
werror("----------------------\n%d\n%O\n%O\n%O\n",opcodes,a,b,qqqq);
#endif
i=0;
for(e=0;e<sizeof(a);e++)
{
...
...
@@ -138,17 +162,14 @@ mixed split(string s)
{
if(a[e]=="!")
{
a[e+1]=replace(a[e+1],"==","!=");
sscanf(a[e+1],"%s==%s",string op, string arg);
a[e+1]=sprintf("%s != %s && %s !=-1",op,arg,arg);
a=a[..e-1]+a[e+1..];
e--;
}
}
#ifdef DEBUG
werror(sprintf("%O\n",({a,b})));
#endif
return ({a,b,opcodes, line});
return ({a,b,opcodes, line,a});
}
/* Replace $[0-9]+(o|a) with something a C compiler can understand */
...
...
@@ -181,7 +202,6 @@ void dump2(mixed *data,int ind)
int e,i,max,maxe;
mixed a,b,d,tmp;
string test;
int wrote_switch;
mapping foo;
mixed cons, var;
...
...
@@ -228,7 +248,6 @@ void dump2(mixed *data,int ind)
test=m_indices(foo)[maxe];
wrote_switch++;
write(sprintf("%*nswitch(%s)\n",ind,treat(test)));
write(sprintf("%*n{\n",ind));
...
...
@@ -260,9 +279,7 @@ void dump2(mixed *data,int ind)
write("\n");
}
if(sizeof(data))
write(sprintf("%*ndefault:\n",ind));
ind+=2;
write(sprintf("%*n}\n",ind));
}
/* Take care of whatever is left */
...
...
@@ -283,55 +300,6 @@ void dump2(mixed *data,int ind)
}
write(sprintf("%*n{\n",ind));
ind+=2;
#if 0
if(sizeof(d[1]))
{
write(sprintf("%*nstruct pike_string *cf;\n",ind));
write(sprintf("%*nINT32 cl=instr(0)->line;\n",ind));
}
for(i=0;i<sizeof(d[1]);i++)
{
if(i+1<sizeof(d[1]) && d[1][i+1][0]=='(')
{
string tmp=d[1][i+1];
tmp=treat(tmp[1..strlen(tmp)-2]);
write(sprintf("%*nINT32 arg%d=%s;\n",ind,i,tmp));
i++;
}
}
if(sizeof(d[1]))
{
write(sprintf("%*ncopy_shared_string(cf,instr(0)->file);\n",ind));
}
write(sprintf("%*npop_n_opcodes(%d);\n",ind,d[2]));
int q;
for(i=0;i<sizeof(d[1]);i++)
{
if(i+1<sizeof(d[1]) && d[1][i+1][0]=='(')
{
write(sprintf("%*ninsopt(%s,arg%d,cl,cf);\n",ind,d[1][i],i));
i++;
}else{
write(sprintf("%*ninsopt2(%s,cl,cf);\n",ind,d[1][i]));
}
q++;
}
if(sizeof(d[1]))
{
if(q)
write(sprintf("%*nfifo_len+=%d;\n",ind,q));
write(sprintf("%*nfree_string(cf);\n",ind));
write(sprintf("%*ndebug();\n",ind));
}
write(sprintf("%*nfifo_len+=%d;\n",ind,q+JUMPBACK));
#else
write("%*ndo_optimization(%d,\n",ind,d[2]);
for(i=0;i<sizeof(d[1]);i++)
...
...
@@ -347,18 +315,11 @@ void dump2(mixed *data,int ind)
}
write("%*n 0);\n",ind);
#endif
write(sprintf("%*ncontinue;\n",ind));
ind-=2;
write(sprintf("%*n}\n",ind,test));
}
}
while(wrote_switch--)
{
ind-=2;
write(sprintf("%*n}\n",ind));
}
}
...
...
@@ -394,7 +355,7 @@ int main(int argc, string *argv)
write(" instrbuf.s.str=0;\n");
write(" fifo_len=0;\n");
write(" init_bytecode();\n\n");
write(" for(eye=0;eye<len;)\n {\n");
write(" for(eye=0;eye<len
|| fifo_len
;)\n {\n");
write(" INT32 current_line;\n");
write(" struct pike_string *current_file;\n");
write("\n");
...
...
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