Subject: kern/3555: genassym.sh enhancements reduce typing
To: None <gnats-bugs@gnats.netbsd.org>
From: Ty Sarna <tsarna@endicor.com>
List: netbsd-bugs
Date: 04/28/1997 10:49:55
>Number:         3555
>Category:       kern
>Synopsis:       genassym.sh enhancements reduce typing
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 28 09:05:02 1997
>Last-Modified:
>Originator:     Ty Sarna
>Organization:
	Endicor Technologies, Inc., San Antonio, Texas
>Release:        NetBSD-current 970415
>Environment:
	
System: NetBSD lotharon.endicor.com 1.2B NetBSD 1.2B (LOTHARON) #1: Thu Dec 12 12:09:19 CST 1996 tsarna@lotharon.endicor.com:/usr/src/sys/arch/sun3/compile/LOTHARON sun3

>Description:
	genassym.sh is pure genius. I even found another use for it. 
	But the input syntax can be somewhat tedious.
>How-To-Repeat:
	Get tired of typing "define REALLY_LONG_DEFINE REALLY_LONG_DEFINE",
	or equally tedius structure member offset definitions.
>Fix:
	The patch included below adds three new 'statements' to
genassym.sh's syntax:

	export X
		is a synonym for "define X X"
	struct X
		remembers X for "member" (see below) and
		does a "define X_SIZEOF sizeof(struct X)"
	member Y
		does a "define Y offsetof(last_X, Y)"

*** genassym.sh.orig	Fri Apr 25 09:54:26 1997
--- genassym.sh	Fri Apr 25 10:20:56 1997
***************
*** 75,80 ****
--- 75,96 ----
  	next;
  }
  
+ /^struct[ \t]/ {
+ 	structname = $2;
+ 	$0 = "define " structname "_SIZEOF sizeof(struct " structname ")";
+ 	/* fall through */
+ }
+ 
+ /^member[ \t]/ {
+ 	$0 = "define " $2 " offsetof(struct " structname ", " $2 ")";
+ 	/* fall through */
+ }
+ 
+ /^export[ \t]/ {
+ 	$0 = "define " $2 " " $2;
+ 	/* fall through */
+ }
+ 
  /^define[ \t]/ {
  	if (defining == 0) {
  		defining = 1;

>Audit-Trail:
>Unformatted: