[pure-lang-svn] SF.net SVN: pure-lang:[644] pure/trunk
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-08-27 23:04:18
|
Revision: 644
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=644&view=rev
Author: agraef
Date: 2008-08-27 23:04:26 +0000 (Wed, 27 Aug 2008)
Log Message:
-----------
Add option -p to list only private/public symbols to the 'list' command.
Modified Paths:
--------------
pure/trunk/ChangeLog
pure/trunk/lexer.ll
Modified: pure/trunk/ChangeLog
===================================================================
--- pure/trunk/ChangeLog 2008-08-27 22:40:51 UTC (rev 643)
+++ pure/trunk/ChangeLog 2008-08-27 23:04:26 UTC (rev 644)
@@ -1,3 +1,8 @@
+2008-08-28 Albert Graef <Dr....@t-...>
+
+ * lexer.ll: Add option -p to list only private/public symbols to
+ the 'list' command.
+
2008-08-27 Albert Graef <Dr....@t-...>
* lib/: Clean up the public namespace.
Modified: pure/trunk/lexer.ll
===================================================================
--- pure/trunk/lexer.ll 2008-08-27 22:40:51 UTC (rev 643)
+++ pure/trunk/lexer.ll 2008-08-27 23:04:26 UTC (rev 644)
@@ -361,7 +361,7 @@
// list command is only permitted in interactive mode
if (!interp.interactive) REJECT;
uint8_t s_verbose = interpreter::g_verbose;
- uint8_t tflag = 0;
+ uint8_t tflag = 0; int pflag = -1;
bool aflag = false, dflag = false, eflag = false;
bool cflag = false, fflag = false, mflag = false, vflag = false;
bool gflag = false, lflag = false, sflag = false;
@@ -374,7 +374,7 @@
// process option arguments
for (arg = args.l.begin(); arg != args.l.end(); arg++) {
const char *s = arg->c_str();
- if (s[0] != '-' || !s[1] || !strchr("acdefghlmstv", s[1])) break;
+ if (s[0] != '-' || !s[1] || !strchr("acdefghlmpstv", s[1])) break;
while (*++s) {
switch (*s) {
case 'a': aflag = true; break;
@@ -385,6 +385,13 @@
case 'g': gflag = true; break;
case 'l': lflag = true; break;
case 'm': mflag = true; break;
+ case 'p':
+ if (isdigit(s[1])) {
+ pflag = strtoul(s+1, 0, 10)>0;
+ while (isdigit(s[1])) ++s;
+ } else
+ pflag = 1;
+ break;
case 's': sflag = true; break;
case 'v': vflag = true; break;
case 't':
@@ -410,6 +417,9 @@
-l Long format, prints definitions along with the summary symbol\n\
information. This implies -s.\n\
-m Print information about defined macros.\n\
+-p[flag] List only private symbols in the current module if flag is\n\
+ nonzero (the default), otherwise list only public symbols of all\n\
+ modules. List both private and public symbols if -p is omitted.\n\
-s Summary format, print just summary information about listed symbols.\n\
-t[level] List only symbols and definitions at the given temporary level\n\
(the current level by default) or above. Level 1 denotes all temporary\n\
@@ -439,6 +449,7 @@
const env_info& e = it->second;
const symbol& sym = interp.symtab.sym(f);
if (sym.modno >= 0 && sym.modno != interp.modno ||
+ pflag >= 0 && (pflag > 0) != (sym.modno >= 0) ||
!((e.t == env_info::fun)?fflag:
(e.t == env_info::cvar)?cflag:
(e.t == env_info::fvar)?vflag:0))
@@ -480,7 +491,9 @@
int32_t f = it->first;
if (syms.find(f) == syms.end()) {
const symbol& sym = interp.symtab.sym(f);
- if (sym.modno >= 0 && sym.modno != interp.modno) continue;
+ if (sym.modno >= 0 && sym.modno != interp.modno ||
+ pflag >= 0 && (pflag > 0) != (sym.modno >= 0))
+ continue;
bool matches = true;
if (!args.l.empty()) {
matches = false;
@@ -508,7 +521,9 @@
if (syms.find(f) == syms.end()) {
const env_info& e = it->second;
const symbol& sym = interp.symtab.sym(f);
- if (sym.modno >= 0 && sym.modno != interp.modno) continue;
+ if (sym.modno >= 0 && sym.modno != interp.modno ||
+ pflag >= 0 && (pflag > 0) != (sym.modno >= 0))
+ continue;
bool matches = e.temp >= tflag;
if (!matches && !sflag && args.l.empty()) {
// if not in summary mode, also list temporary rules for a
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|