#9917: ECL has too few arguments and two many on file dpp.c
--------------------------------------------+-------------------------------
   Reporter:  drkirkby                      |       Owner:  GeorgSWeber         
                        
       Type:  defect                        |      Status:  needs_review        
                        
   Priority:  major                         |   Milestone:  sage-4.6            
                        
  Component:  build                         |    Keywords:  ecl                 
                        
     Author:  David Kirkby, Leif Leonhardy  |    Upstream:  Fixed upstream, but 
not in a stable release.
   Reviewer:                                |      Merged:                      
                        
Work_issues:                                |  
--------------------------------------------+-------------------------------

Comment(by leif):

 {{{
 #!diff
 diff -Nu ecl-10.2.1.p1/src/src/c/dpp.c ecl-10.4.1/src/src/c/dpp.c
 --- ecl-10.2.1.p1/src/src/c/dpp.c       2010-02-13 15:04:41.000000000
 +0100
 +++ ecl-10.4.1/src/src/c/dpp.c  2010-04-04 16:31:27.000000000 +0200
 @@ -251,13 +251,26 @@
  }

  char *
 -search_symbol(char *name, int *symbol_code)
 +search_symbol(char *name, int *symbol_code, int code)
  {
         int i;
         for (i = 0; cl_symbols[i].name != NULL; i++) {
                 if (!strcasecmp(name, cl_symbols[i].name)) {
                         name = poolp;
 -                       if (i == 0) {
 +                        if (code) {
 +                                pushstr("MAKE_FIXNUM(/*");
 +                                pushstr(cl_symbols[i].name);
 +                               pushstr("*/");
 +                               if (i >= 1000)
 +                                       pushc((i / 1000) % 10 + '0');
 +                               if (i >= 100)
 +                                       pushc((i / 100) % 10 + '0');
 +                               if (i >= 10)
 +                                       pushc((i / 10) % 10 + '0');
 +                               pushc(i % 10 + '0');
 +                               pushstr(")");
 +                               pushc(0);
 +                        } else if (i == 0) {
                                 pushstr("Cnil");
                                 pushc(0);
                         } else {
 @@ -283,19 +296,20 @@
  }

  char *
 -read_symbol()
 +read_symbol(int code)
  {
         char c, *name = poolp;
 +        char end = code? ']' : '\'';

         c = readc();
 -       while (c != '\'') {
 +       while (c != end) {
                 if (c == '_') c = '-';
                 pushc(c);
                 c = readc();
         }
         pushc(0);

 -       name = search_symbol(poolp = name, 0);
 +       name = search_symbol(poolp = name, 0, code);
         if (name == NULL) {
                 name = poolp;
                 printf("\nUnknown symbol: %s\n", name);
 @@ -387,7 +401,10 @@
                 } else if (c == '@') {
                         c = readc();
                         if (c == '\'') {
 -                               (void)read_symbol();
 +                               (void)read_symbol(0);
 +                               poolp--;
 +                       } else if (c == '[') {
 +                               (void)read_symbol(1);
                                 poolp--;
                         } else if (c == '@') {
                                 pushc(c);
 @@ -448,7 +465,7 @@
  get_function(void)
  {
         function = read_function();
 -       function_symbol = search_symbol(function, &function_code);
 +       function_symbol = search_symbol(function, &function_code, 0);
         if (function_symbol == NULL) {
                 function_symbol = poolp;
                 pushstr("Cnil");
 @@ -675,9 +692,9 @@
    }
    if (nopt == 0 && !rest_flag && !key_flag) {
      put_lineno();
 -    fprintf(out, "\tif (ecl_unlikely(narg!=%d))");
 +    fprintf(out, "\tif (ecl_unlikely(narg!=%d))", nreq);
      fprintf(out, "\t   FEwrong_num_arguments(MAKE_FIXNUM(%d));\n",
 -            nreq, function_code);
 +            function_code);
    } else {
      simple_varargs = !rest_flag && !key_flag && ((nreq + nopt) < 32);
      if (key_flag) {
 @@ -833,7 +850,14 @@
         } else if (c == '\'') {
                 char *p;
                 poolp = pool;
 -               p = read_symbol();
 +               p = read_symbol(0);
 +               pushc('\0');
 +               fprintf(out,"%s",p);
 +               goto LOOP;
 +       }  else if (c == '[') {
 +               char *p;
 +               poolp = pool;
 +               p = read_symbol(1);
                 pushc('\0');
                 fprintf(out,"%s",p);
                 goto LOOP;
 }}}

 If that convinces you more.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9917#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to