zsh-workers
 help / color / mirror / code / Atom feed
* Re: make zsh falls over (fwd)
@ 1997-08-04 11:37 Giles Constant
  1997-08-04 12:20 ` Geoff Wing
  0 siblings, 1 reply; 3+ messages in thread
From: Giles Constant @ 1997-08-04 11:37 UTC (permalink / raw)
  To: zsh-workers

Hiya,

I'm had this trouble installing zsh here.  This was compiled on an
ultrasparc running Solaris 5.5.

Thanks,

Giles

--------------------------------------------------------------------------
Giles Constant | 2nd Year in computer science at | giles@dcs.warwick.ac.uk
               | Warwick University              | csuab@csv.warwick.ac.uk
--------------tel-:-Home-(01203)-226160----------Uni-(01203)-522097-------


---------- Forwarded message ----------
Date: Mon, 4 Aug 1997 12:14:21 +0100 (BST)
From: Andrew Main <zefram@tao.co.uk>
To: Giles Constant <giles@dcs.warwick.ac.uk>
Subject: Re: make zsh falls over

Giles Constant wrote:
>nawk -f ./makepro.awk init.c Src >init.pro
>nawk: syntax error at source line 94
> context is
>	 >>> 	sub(/= <<< .*$/, "", dcltor)
>nawk: illegal statement at source line 94

Blech.  It looks legal to me.

>is this my version of nawk being crap?

Maybe.  Try mawk or gawk -- both of them handle the script fine.  Also,
please send a bug report to <zsh-workers@math.gatech.edu> -- there will
be some awk experts there that can fix the script.

-zefram


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: make zsh falls over (fwd)
  1997-08-04 11:37 make zsh falls over (fwd) Giles Constant
@ 1997-08-04 12:20 ` Geoff Wing
  1997-08-04 16:01   ` Andrew Main
  0 siblings, 1 reply; 3+ messages in thread
From: Geoff Wing @ 1997-08-04 12:20 UTC (permalink / raw)
  To: zsh-workers

Andrew Main <zefram@tao.co.uk> wrote:
Giles Constant <giles@dcs.warwick.ac.uk> typed:
:>I'm had this trouble installing zsh here.  This was compiled on an
:>ultrasparc running Solaris 5.5.
:>nawk -f ./makepro.awk init.c Src >init.pro
:>nawk: syntax error at source line 94
:> context is
:>	 >>> 	sub(/= <<< .*$/, "", dcltor)
:>nawk: illegal statement at source line 94
:Blech.  It looks legal to me.

Ummm, how?  None of the versions I have have makepro.awk .  What version is
this from?  Have I been asleep and this has suddenly appeared?

:>is this my version of nawk being crap?
:Maybe.  Try mawk or gawk -- both of them handle the script fine.  Also,
:please send a bug report to <zsh-workers@math.gatech.edu> -- there will
:be some awk experts there that can fix the script.

Please send us the script first :-)
-- 
Geoff Wing [mason@primenet.com.au]                   Phone    : +61-3-9818 2977 
 Technical Manager: PrimeNet Computer Consultants    Facsimile: +61-3-9819 3788 
 Web: <URL:http://www.primenet.com.au/>              Mobile   : 0412 162 441
        [ Boulderdash: <URL:http://ciips.ee.uwa.edu.au/~williams/bd/> ]


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: make zsh falls over (fwd)
  1997-08-04 12:20 ` Geoff Wing
@ 1997-08-04 16:01   ` Andrew Main
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Main @ 1997-08-04 16:01 UTC (permalink / raw)
  To: mason; +Cc: zsh-workers

Geoff Wing wrote:
>Ummm, how?  None of the versions I have have makepro.awk .  What version is
>this from?  Have I been asleep and this has suddenly appeared?

It was in one of the more recent patches I sent.  It isn't in any
official releases yet.  The script is included below.

-zefram

#
# $Id$
#
# makepro.awk - generate prototype lists
# mostly by Andrew Main
# based on makepro.sed by Mark Weaver <Mark_Weaver@brown.edu>
#

BEGIN {
    aborting = 0

    # arg 1 is the name of the file to process
    # arg 2 is the name of the subdirectory it is in
    if(ARGC != 3) {
	aborting = 1
	exit 1
    }
    name = ARGV[1]
    gsub(/^.*\//, "", name)
    gsub(/\.c$/, "", name)
    name = ARGV[2] "_" name
    gsub(/\//, "_", name)
    ARGC--

    # `locals' is a list of local declarations, built up while global
    # declarations are output.
    locals = ""

    printf "#ifndef have_%s_globals\n", name
    printf "#define have_%s_globals\n", name
    printf "\n"
}

# all relevant declarations are preceded by "/**/" on a line by itself

/^\/\*\*\/$/ {
    # The declaration is on following lines.  The interesting part might
    # be terminated by a `{' (`int foo(void) { }' or `int bar[] = {')
    # or `;' (`int x;').
    line = ""
    isfunc = 0
    while(1) {
	if(getline <= 0) {
	    aborting = 1
	    exit 1
	}
	gsub(/\t/, " ")
	line = line " " $0
	gsub(/\/\*([^*]|\*+[^*\/])*\*+\//, " ", line)
	if(line ~ /\/\*/)
	    continue
	# If it is a function definition, note so.
	if(line ~ /\) *{.*$/) #}
	    isfunc = 1
	if(sub(/ *[{;].*$/, "", line)) #}
	    break
    }
    # Put spaces around each identifier.
    while(match(line, /[^_0-9A-Za-z ][_0-9A-Za-z]/) ||
	    match(line, /[_0-9A-Za-z][^_0-9A-Za-z ]/))
	line = substr(line, 1, RSTART) " " substr(line, RSTART+1)
    # Separate declarations into a type and a list of declarators.
    # In each declarator, "@{" and "@}" are used in place of parens to
    # mark function parameter lists, and "@!" is used in place of commas
    # in parameter lists.  "@<" and "@>" are used in place of
    # non-parameter list parens.
    gsub(/ _ +/, " _ ", line)
    while(1) {
	if(isfunc && match(line, /\([^()]*\)$/))
	    line = substr(line, 1, RSTART-1) " _ (" substr(line, RSTART) ")"
	else if(match(line, / _ \(\([^,()]*,/))
	    line = substr(line, 1, RSTART+RLENGTH-2) "@!" substr(line, RSTART+RLENGTH)
	else if(match(line, / _ \(\([^,()]*\)\)/))
	    line = substr(line, 1, RSTART-1) "@{" substr(line, RSTART+5, RLENGTH-7) "@}" substr(line, RSTART+RLENGTH)
	else if(match(line, /\([^,()]*\)/))
	    line = substr(line, 1, RSTART-1) "@<" substr(line, RSTART+1, RLENGTH-2) "@>" substr(line, RSTART+RLENGTH)
	else
	    break
    }
    sub(/^ */, "", line)
    match(line, /^((const|enum|static|struct|union) +)*([_0-9A-Za-z]+ +|((char|double|float|int|long|short|unsigned|void) +)+)((const|static) +)*/)
    dtype = substr(line, 1, RLENGTH)
    sub(/ *$/, "", dtype)
    islocal = " " dtype " " ~ / static /
    line = substr(line, RLENGTH+1) ","
    # Handle each declarator.
    output = ""
    while(match(line, /^[^,]*,/)) {
	# Separate out the name from the declarator.  Use "@+" and "@-"
	# to bracket the name within the declarator.  Strip off any
	# initialiser.
	dcltor = substr(line, 1, RLENGTH-1)
	line = substr(line, RLENGTH+1)
	sub(/=.*$/, "", dcltor)
	match(dcltor, /^([^_0-9A-Za-z]| const )*/)
	dcltor = substr(dcltor, 1, RLENGTH) "@+" substr(dcltor, RLENGTH+1)
	match(dcltor, /^.*@\+[_0-9A-Za-z]+/)
	dcltor = substr(dcltor, 1, RLENGTH) "@-" substr(dcltor, RLENGTH+1)
	dnam = dcltor
	sub(/^.*@\+/, "", dnam)
	sub(/@-.*$/, "", dnam)

	# Put parens etc. back
	gsub(/@{/, " _((", dcltor)
	gsub(/@}/, "))", dcltor)
	gsub(/@</, "(", dcltor)
	gsub(/@>/, ")", dcltor)
	gsub(/@!/, ",", dcltor)

	# If this is a module boot/cleanup function, conditionally rename it.
	if(" " dtype " " ~ / int / && dcltor ~ / *@\+(boot|cleanup)_[_0-9A-Za-z]+@- *_\(\( *Module +[_0-9A-Za-z]+ *\)\) */) {
	    modtype = dnam
	    sub(/_.*$/, "", modtype)
	    output = output "# if defined(DYNAMIC_NAME_CLASH_OK) && defined(MODULE)\n"
	    output = output "#  define " dnam " " modtype "_\n"
	    output = output "# endif\n"
	}

	# Format the declaration for output
	dcl = dtype " " dcltor ";"
	if(!islocal)
	    dcl = "extern " dcl
	gsub(/@[+-]/, "", dcl)
	gsub(/ +/, " ", dcl)
	while(match(dcl, /[^_0-9A-Za-z] ./) || match(dcl, /. [^_0-9A-Za-z]/))
	    dcl = substr(dcl, 1, RSTART) substr(dcl, RSTART+2)
	output = output dcl "\n"
    }

    # Output global declarations now, but save up locals until the end.
    if(islocal)
	locals = locals output
    else
	printf "%s", output
}

END {
    if(aborting)
	exit 1
    printf "\n"
    printf "#endif /* !have_%s_globals */\n", name
    if(locals != "") {
	printf "\n"
	printf "#ifndef GLOBAL_PROTOTYPES\n"
	printf "\n"
	printf locals
	printf "\n"
	printf "#endif /* !GLOBAL_PROTOTYPES */\n"
    }
}

### end


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-08-04 16:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-04 11:37 make zsh falls over (fwd) Giles Constant
1997-08-04 12:20 ` Geoff Wing
1997-08-04 16:01   ` Andrew Main

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).