*BSD News Article 30332


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!constellation!news.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!uw-beaver!uhog.mit.edu!MathWorks.Com!news.duke.edu!news-feed-1.peachnet.edu!gatech!howland.reston.ans.net!agate!asami
From: asami@cs.berkeley.edu (Satoshi ASAMI)
Newsgroups: comp.os.386bsd.questions
Subject: Re: ctwm 3.0
Date: 11 May 94 09:59:18
Organization: CS Div. - EECS, University of California, Berkeley, CA 94720
Lines: 56
Message-ID: <ASAMI.94May11095918@forgery.cs.berkeley.edu>
References: <2qordl$e7c@wzv.win.tue.nl> <1994May11.080109.20519@olivetti.nl>
	<NJW.94May11105325@wilma.cs.city.ac.uk> <2qqnr7$3vd@wzv.win.tue.nl>
NNTP-Posting-Host: forgery.cs.berkeley.edu
In-reply-to: guido@gvr.win.tue.nl's message of 11 May 1994 13:50:31 GMT

In article <2qqnr7$3vd@wzv.win.tue.nl>
        guido@gvr.win.tue.nl (Guido van Rooij) writes:

 * The reason is that in lex.l, input() is undefined and redefined to some 
 * internal read function.
 * However, in freebsd's lex, input() is not a define, neither as yywrap().
 * I can only conclude that ctwm's lex.l is completely broken in respect to
 * POSIX. (they also use the yylineno int).

Great!  Following your hints, I finally got piewm (like tvtwm but with
round "pie" menus) to read the startup file!  Following are the
patches to lex.l.  It may or may not apply to other *twm variants per
se, but you get the idea.

I'll package it up and put it on freefall some day.

Satoshi
---
--- lex.l.org   Sun Oct  4 00:50:35 1992
+++ lex.l       Wed May 11 09:47:49 1994
@@ -43,6 +43,18 @@
 
 extern int ParseError;
 
+
+#undef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+        { \
+          int res = (*twmInputFunc)() ; \
+          if (res == NULL) result = YY_NULL ; \
+          else { \
+            buf[0] = res ; \
+            result = 1 ; \
+          } \
+        }
+
 %}
 
 string                         \"([^"]|\\.)*\"
@@ -88,13 +100,13 @@
                                  ParseError = 1;
                                }
 %%
-yywrap() { return(1);}
+/* yywrap() { return(1);} */
 
 #undef unput
-#undef input
+/* #undef input */
 #undef output
 #undef feof
 #define unput(c)       twmUnput(c)
-#define input()                (*twmInputFunc)()
+/* #define input()             (*twmInputFunc)() */
 #define output(c)      TwmOutput(c)
 #define feof()         (1)