cvsuser 04/12/15 00:45:48
Modified: ast ast.l astlexer.c
include/parrot interpreter.h
src inter_run.c
Log:
runops - astlexer
Return register frame in Parrot_runops_fromc
Courtesy of Sam Ruby <[EMAIL PROTECTED]>
--
Fix including unistd.h in astlexer
Revision Changes Path
1.9 +1 -0 parrot/ast/ast.l
Index: ast.l
===================================================================
RCS file: /cvs/public/parrot/ast/ast.l,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ast.l 5 Dec 2004 08:29:27 -0000 1.8
+++ ast.l 15 Dec 2004 08:45:46 -0000 1.9
@@ -46,6 +46,7 @@
%}
+%option never-interactive
%option nounput
LETTER [EMAIL PROTECTED]
1.9 +25 -24 parrot/ast/astlexer.c
Index: astlexer.c
===================================================================
RCS file: /cvs/public/parrot/ast/astlexer.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- astlexer.c 5 Dec 2004 08:29:27 -0000 1.8
+++ astlexer.c 15 Dec 2004 08:45:46 -0000 1.9
@@ -20,7 +20,7 @@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /cvs/public/parrot/ast/astlexer.c,v 1.8 2004/12/05 08:29:27 leo
Exp $
+ * $Header: /cvs/public/parrot/ast/astlexer.c,v 1.9 2004/12/15 08:45:46 leo
Exp $
*/
#define FLEX_SCANNER
@@ -510,8 +510,9 @@
l->last_column = col;
}
+#define YY_NEVER_INTERACTIVE 1
#define YY_NO_UNPUT 1
-#line 515 "ast/astlexer.c"
+#line 516 "ast/astlexer.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -662,10 +663,10 @@
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 75 "ast/ast.l"
+#line 76 "ast/ast.l"
-#line 669 "ast/astlexer.c"
+#line 670 "ast/astlexer.c"
if ( yy_init )
{
@@ -750,22 +751,22 @@
case 1:
YY_RULE_SETUP
-#line 77 "ast/ast.l"
+#line 78 "ast/ast.l"
/* skip comments */ {++line; col=1; }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 78 "ast/ast.l"
+#line 79 "ast/ast.l"
{ ++line; col=1; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 80 "ast/ast.l"
+#line 81 "ast/ast.l"
/* eat white space */ ;
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 81 "ast/ast.l"
+#line 82 "ast/ast.l"
{
valp->t = IMCC_find_node_nr(yytext);
return MODULE;
@@ -773,7 +774,7 @@
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 85 "ast/ast.l"
+#line 86 "ast/ast.l"
{
valp->t = IMCC_find_node_nr(yytext);
return PCCSUB;
@@ -781,7 +782,7 @@
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 89 "ast/ast.l"
+#line 90 "ast/ast.l"
{
valp->t = IMCC_find_node_nr(yytext);
return FUNCTION;
@@ -789,7 +790,7 @@
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 93 "ast/ast.l"
+#line 94 "ast/ast.l"
{
valp->t = IMCC_find_node_nr(yytext);
if (valp->t)
@@ -799,27 +800,27 @@
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 99 "ast/ast.l"
+#line 100 "ast/ast.l"
DUP_AND_RET(valp, FLOATC);
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 100 "ast/ast.l"
+#line 101 "ast/ast.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 101 "ast/ast.l"
+#line 102 "ast/ast.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 102 "ast/ast.l"
+#line 103 "ast/ast.l"
DUP_AND_RET(valp, INTC);
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 104 "ast/ast.l"
+#line 105 "ast/ast.l"
{
valp->s = str_dup(yytext);
valp->s[strlen(valp->s) - 1] = '\0'; /* trailing 'L' */
@@ -828,7 +829,7 @@
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 110 "ast/ast.l"
+#line 111 "ast/ast.l"
{
valp->s = str_dup(yytext);
return(STRINGC); /* XXX delete quotes, -> emit, pbc */
@@ -836,7 +837,7 @@
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 115 "ast/ast.l"
+#line 116 "ast/ast.l"
{
char *p = strchr(yytext, '"');
valp->s = str_dup(p); /* enc:"..." */
@@ -846,7 +847,7 @@
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 121 "ast/ast.l"
+#line 122 "ast/ast.l"
{
valp->s = str_dup(yytext); /* XXX delete quotes, -> emit, pbc */
return(STRINGC);
@@ -854,19 +855,19 @@
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 126 "ast/ast.l"
+#line 127 "ast/ast.l"
return *yytext;
YY_BREAK
case YY_STATE_EOF(INITIAL):
-#line 128 "ast/ast.l"
+#line 129 "ast/ast.l"
yyterminate();
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 130 "ast/ast.l"
+#line 131 "ast/ast.l"
ECHO;
YY_BREAK
-#line 870 "ast/astlexer.c"
+#line 871 "ast/astlexer.c"
case YY_END_OF_BUFFER:
{
@@ -1430,7 +1431,7 @@
#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
-#include<unistd.h>
+extern int isatty YY_PROTO(( int ));
#endif
#endif
@@ -1750,7 +1751,7 @@
return 0;
}
#endif
-#line 130 "ast/ast.l"
+#line 131 "ast/ast.l"
int yywrap(void) { return 1; }
1.165 +2 -2 parrot/include/parrot/interpreter.h
Index: interpreter.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/interpreter.h,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -r1.164 -r1.165
--- interpreter.h 24 Nov 2004 05:56:55 -0000 1.164
+++ interpreter.h 15 Dec 2004 08:45:47 -0000 1.165
@@ -1,7 +1,7 @@
/* interpreter.h
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: interpreter.h,v 1.164 2004/11/24 05:56:55 leo Exp $
+ * $Id: interpreter.h,v 1.165 2004/12/15 08:45:47 leo Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -400,7 +400,7 @@
void runops(Interp *, size_t offset);
void runops_int(Interp *, size_t offset);
-void Parrot_runops_fromc(Interp *, PMC *sub);
+struct parrot_regs_t* Parrot_runops_fromc(Interp *, PMC *sub);
void* Parrot_runops_fromc_args(Interp *, PMC *sub, const char *sig, ...);
INTVAL Parrot_runops_fromc_args_reti(Interp *, PMC *, const char *, ...);
FLOATVAL Parrot_runops_fromc_args_retf(Interp *, PMC *, const char *, ...);
1.25 +6 -3 parrot/src/inter_run.c
Index: inter_run.c
===================================================================
RCS file: /cvs/public/parrot/src/inter_run.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- inter_run.c 13 Dec 2004 21:51:00 -0000 1.24
+++ inter_run.c 15 Dec 2004 08:45:48 -0000 1.25
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: inter_run.c,v 1.24 2004/12/13 21:51:00 rubys Exp $
+$Id: inter_run.c,v 1.25 2004/12/15 08:45:48 leo Exp $
=head1 NAME
@@ -102,7 +102,7 @@
/*
-=item C<void
+=item C<struct parrot_regs_t *
Parrot_runops_fromc(Parrot_Interp interpreter, PMC *sub)>
Runs the Parrot ops, called from C code. The function arguments are
@@ -113,11 +113,12 @@
*/
-void
+struct parrot_regs_t *
Parrot_runops_fromc(Parrot_Interp interpreter, PMC *sub)
{
PMC *ret_c, *p1;
opcode_t offset, *dest;
+ struct parrot_regs_t *bp;
/* we need one return continuation with a NULL offset */
p1 = REG_PMC(1);
@@ -130,11 +131,13 @@
* Passing a dummy true destination copies registers
*/
dest = VTABLE_invoke(interpreter, sub, (void*) 1);
+ bp = interpreter->ctx.bp;
if (dest) {
offset = dest - interpreter->code->byte_code;
runops(interpreter, offset);
}
REG_PMC(1) = p1;
+ return bp;
}
/*