jed-users mailing list

[2002 Date Index] [2002 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Looping and composite conditions


On Wed, 18 Dec 2002 23:09:03 +0100 wrote Morten Bo Johansen <mojo@xxxxxxxx>:

> ... The functions look like this:
> 
>    static define untranslated ()
>    {
>       bol_fsearch ("msgstr") and fsearch ("\"") and looking_at ("\"\"")
>         and down_1 () and skip_chars (" \t\n") and looking_at ("#");
>    }
... 
> but when executing the function it fails with:
> 
>   "S-Lang Error: Stack Underflow: Error while executing find_untranslated"

This is becouse skip_chars() does not return a value but "and" expects
something to compare.

   BTW: There is a documentation error in the description of down_1
   
    USAGE
      Void down_1 ();
      ^^^^

The following worked with the example:

   % test, whether a msgstr is translated or not
   define is_untranslated ()
   {
      push_spot();
      EXIT_BLOCK {pop_spot();}
      () = fsearch ("\"");
      !if (looking_at ("\"\""))
                return 0;
      go_down_1 ();
      skip_chars (" \t\n");
      return  looking_at ("#");
   }

   % find the next untranslated msgstr
   define find_untranslated ()
   {
      push_mark();
      while (bol_fsearch ("msgstr"))
        if (is_untranslated () and fsearch ("\""))
          {
             pop_mark(0);
             go_right_1();
             return;
          }
      message ("Not found");
      pop_mark(1);
   }


Günter

--
Milde at ife.et.tu-dresden.de


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2002 date index] [2002 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]