Update of /cvsroot/monetdb/MonetDB5/src/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28489

Modified Files:
        mal_module.mx mal_readline.mx 
Log Message:
Extended the command completion for the console.
just try
io.pri<tab>
it will produce the list of eligible signatures.
[to do: determine the common prefix and add it to the readline as well
and handle more complex MAL instructions, e.g. 
i:= math.s<tab>]



Index: mal_module.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_module.mx,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- mal_module.mx       31 Aug 2007 08:59:41 -0000      1.59
+++ mal_module.mx       13 Sep 2007 21:45:23 -0000      1.60
@@ -878,8 +878,8 @@
 #endif
        for(i=0; i< MAXSCOPE; i++)
        for(k=0; k< MAXSCOPE; k++){
-               m= scopeJump[i][k];
-               while( m){
+         m= scopeJump[i][k];
+         while( m){
                if( strncmp(modnme,m->name,len1) && *modnme!='*' ) {
                        m= m->sibling;
                        continue;
@@ -929,7 +929,8 @@
                                        }
                                        *v++ ='\n';
                                        *v=0;
-                               } else if( strcmp(fcnnme,s->name)==0 || 
*fcnnme=='*' ) {
+                               } else if( 
strncmp(fcnnme,s->name,strlen(fcnnme))==0 ||
+                                                       *fcnnme=='*' ) {
                                        
fcnDefinition(s->def,s->def->stmt[0],buf,FALSE);
                                        buf[0]=' ';
                                        t= strstr(buf,"address");

Index: mal_readline.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/mal/mal_readline.mx,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- mal_readline.mx     11 Sep 2007 19:36:16 -0000      1.52
+++ mal_readline.mx     13 Sep 2007 21:45:23 -0000      1.53
@@ -154,7 +154,6 @@
        (void) msg; (void) a; (void) b;
        for(i=0;i<a; i++)
                stream_printf(GDKout,"%s\n",msg[i]);
-       /* stream_printf(GDKout,"%s",rl_line_buffer); */
 }
 @-
 @= tst
@@ -205,12 +204,11 @@
        if( msg == 0 && *text){
                char cmd[BUFSIZ], *c;
                c= strchr(text,'.');
-               if( c== NULL) {
-                       snprintf(cmd,BUFSIZ,"%s.*",text);
-                       c= cmd;
-               } else
-                       c= (char *) text;
-               msg= getHelp(MCgetClient()->nspace,(str)c,1);
+               if( c== NULL)
+                       snprintf(cmd,BUFSIZ,"%s.*(",text);
+               else
+                       snprintf(cmd,BUFSIZ,"%s(",text);
+               msg= getHelp(MCgetClient()->nspace,(str)cmd,1);
                for(last=0; msg[last]; last++) 
                        ;
        }
@@ -221,6 +219,29 @@
        return NULL;
 }
 
+int rl_complete(int ignore, int key){
+       char *msg[1000];
+       int i,top=0;
+
+       putchar('\n');
+       while( (msg[top]= mal_command_generator(rl_line_buffer,top)) )
+               if( ++top== 1000) break;
+       for(i=0;i<top; i++)     {
+               char *c= strchr(msg[i],' ');
+               if(c)
+                       printf("%s\n",c+1);
+               else
+                       printf("%s\n",msg[i]);
+       }
+
+       printf("%s%s",rl_prompt,rl_line_buffer);
+       for( top--;top>=0; top--)
+               free(msg[top]);
+       (void) ignore;
+       (void) key;
+       return 0;
+}
+
 static char **
 mal_completion(const char *text, int start, int end)
 {


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to