antiright-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Antiright-devel] antiright/gtkshell guidl.lex


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright/gtkshell guidl.lex
Date: Wed, 25 Jul 2007 01:58:18 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/07/25 01:58:18

Modified files:
        gtkshell       : guidl.lex 

Log message:
        Added conditional support to GUIDL.  

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/guidl.lex?cvsroot=antiright&r1=1.14&r2=1.15

Patches:
Index: guidl.lex
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/guidl.lex,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- guidl.lex   11 Jun 2007 21:32:40 -0000      1.14
+++ guidl.lex   25 Jul 2007 01:58:18 -0000      1.15
@@ -1,7 +1,30 @@
 %{
+/*
+  AntiRight
+  (c) 2002-2007 Jeffrey Bedard
+  address@hidden
+
+  This file is part of AntiRight.
+
+  AntiRight is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  AntiRight is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with AntiRight; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
+*/
+
 
 #include "gtkshell.h"
 
+
 %}
 %%
 \"[^\"]*\"      {      
@@ -19,6 +42,32 @@
 button         return BUTTON;
 echo           return TOKEN_ECHO;
 dialog         return DIALOG;
+if             {
+                       char * cond=malloc(0);
+                       char * result;
+                       char c;
+                       unsigned int length=0;
+                       
+                       /* Find beginning condition to evaluate with shell.  */
+                       while(input()!='\"');
+                       while((c=input())!='\"')
+                       {
+                               /* Resize string buffer as needed.  */
+                               cond=realloc(cond, ++length);
+                               cond[length-1]=c;
+                       cond[length]='\0'; /* NULL termination.  */
+                               puts(cond);
+                       }
+                       cond[length]='\0'; /* NULL termination.  */
+                       result=antiright_pipe_read(cond);
+                       free(cond);
+                       puts("*** Test truth.");
+                       /* Skip command on FALSE.  */
+                       if(!strcmp(result, "FALSE"))
+                               while(input()!=';');
+                       /* Else, leave command for parser.  */
+                       g_free(result); /* Cleanup.  */
+               }
 [ \t\n]                /* ignore */;
 "//".*$                /* comment */;
 %%




reply via email to

[Prev in Thread] Current Thread [Next in Thread]