[pure-lang-svn] SF.net SVN: pure-lang:[629] pure/trunk
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-08-27 09:14:41
|
Revision: 629
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=629&view=rev
Author: agraef
Date: 2008-08-27 09:14:51 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
Generate module keys.
Modified Paths:
--------------
pure/trunk/interpreter.cc
pure/trunk/interpreter.hh
Modified: pure/trunk/interpreter.cc
===================================================================
--- pure/trunk/interpreter.cc 2008-08-27 08:42:15 UTC (rev 628)
+++ pure/trunk/interpreter.cc 2008-08-27 09:14:51 UTC (rev 629)
@@ -59,8 +59,8 @@
: verbose(0), interactive(false), ttymode(false), override(false),
stats(false), temp(0),
ps("> "), libdir(""), histfile("/.pure_history"), modname("pure"),
- nerrs(0), modno(-1), source_s(0), result(0), mem(0), exps(0), tmps(0),
- module(0), JIT(0), FPM(0), fptr(0)
+ nerrs(0), modno(-1), modctr(0), source_s(0), result(0), mem(0), exps(0),
+ tmps(0), module(0), JIT(0), FPM(0), fptr(0)
{
if (!g_interp) {
g_interp = this;
@@ -618,6 +618,7 @@
uint8_t l_temp = temp;
const char *l_source_s = source_s;
string l_srcdir = srcdir;
+ int32_t l_modno = modno;
// save global data
uint8_t s_verbose = g_verbose;
bool s_interactive = g_interactive;
@@ -630,6 +631,7 @@
source = s; declare_op = false;
source_s = 0;
srcdir = dirname(fname);
+ modno = (temp == 0 && !s.empty())?modctr++:-1;
errmsg.clear();
if (check && !interactive) temp = 0;
bool ok = lex_begin(fname);
@@ -656,6 +658,7 @@
temp = l_temp;
source_s = l_source_s;
srcdir = l_srcdir;
+ modno = l_modno;
// return last computed result, if any
return result;
}
@@ -685,6 +688,7 @@
int l_nerrs = nerrs;
const char *l_source_s = source_s;
string l_srcdir = srcdir;
+ int32_t l_modno = modno;
// save global data
uint8_t s_verbose = g_verbose;
bool s_interactive = g_interactive;
@@ -697,6 +701,7 @@
source = ""; declare_op = false;
source_s = s.c_str();
srcdir = "";
+ modno = -1;
errmsg.clear();
bool ok = lex_begin();
if (ok) {
@@ -718,6 +723,7 @@
nerrs = l_nerrs;
source_s = l_source_s;
srcdir = l_srcdir;
+ modno = l_modno;
// return last computed result, if any
return result;
}
Modified: pure/trunk/interpreter.hh
===================================================================
--- pure/trunk/interpreter.hh 2008-08-27 08:42:15 UTC (rev 628)
+++ pure/trunk/interpreter.hh 2008-08-27 09:14:51 UTC (rev 629)
@@ -324,6 +324,7 @@
int nerrs; // current error count
string errmsg; // last reported error (runstr)
int32_t modno; // current module key
+ int32_t modctr; // next available module key
string source; // the source being parsed
const char *source_s; // source pointer if input comes from a string
set<string> sources; // the list of all scripts which have been loaded
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|