Hi, Elias,

I have indeed started adding a few APL-interaction features to aplwrap,
one of the first of which uses your "variables" command, which leads me
to a request: a variation in VariablesCommand.cc of "cls = ALL"  that
tags the entries in the returned list with their name classes.  That
makes it possible for me to get all the non-system functions and
variables in one transaction and still differentiate between functions
and variables.  I've attached a proposed patch.

Thanks,
Chris

On 08/13/14 23:28, Elias Mårtenson wrote:
Hello Chris,

I've been following the discussions about the GTK wrapper, and while
I'm not using it myself (since I work on the Emacs integration) I
realise that there are plenty of (potential) overlaps between our
projects.

In particular, I want to let you know about the Emacs mode backchannel
protocol that the mode uses for directly communicating with the GNU
APL interpreter. When started, if gives you a simple text-based
protocol through which you can do things such as defining functions or
creating listeners that send you a message whenever a variable is
changed (this is used by the realtime variable watcher).

It would be neat if you were to consider implementing some of the
feature I added to the Emacs mode, and if you do it would be useful if
you used the same protocol as I am using.

Please let me know if you have any questions.

Regards,
Elias

Index: VariablesCommand.cc
===================================================================
--- VariablesCommand.cc	(revision 449)
+++ VariablesCommand.cc	(working copy)
@@ -33,6 +33,7 @@
 void VariablesCommand::run_command( NetworkConnection &conn, const std::vector<std::string> &args )
 {
     stringstream out;
+    bool tagged = false;
 
     TypeSpec cls = ALL;
     if( args.size() >= 2 ) {
@@ -43,6 +44,10 @@
         else if( typespec == "function" ) {
             cls = FUNCTION;
         }
+        else if( typespec == "tagged" ) {
+            cls = ALL;
+            tagged = true;
+        }
         else {
             CERR << "Illegal variable type: " << typespec << endl;
             throw DisconnectedError( "Illegal variable type" );
@@ -59,7 +64,8 @@
             if( (cls == ALL && (symbol_nc == NC_VARIABLE || symbol_nc == NC_FUNCTION || symbol_nc == NC_OPERATOR))
                 || (cls == VARIABLE && symbol_nc == NC_VARIABLE)
                 || (cls == FUNCTION && (symbol_nc == NC_FUNCTION || symbol_nc == NC_OPERATOR)) ) {
-                out << symbol->get_name() << "\n";
+                if (tagged) out << symbol_nc << symbol->get_name() << "\n";
+                else        out << symbol->get_name() << "\n";
             }
         }
     }

Reply via email to