zsh-workers
 help / color / mirror / code / Atom feed
* rlimits.awk in 3.0.5-test2
@ 1997-09-25  5:55 Zoltan Hidvegi
  1997-09-25  7:53 ` Peter Stephenson
  1997-09-25 18:37 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1997-09-25  5:55 UTC (permalink / raw)
  To: Zsh hacking and development

I've just tried to compile zsh-3.0.5-test2 on an ancient SunOS 4.1.2 with
K&R compiler, and rlimits.awk failed, since it does not seem to support
|| in the pattern part.  Could you please everyone check with his own awk
(the older the better) if the fix below works?  The included patch should
be applied to zsh-3.0.5-test2, and besides the awk patch, it has a little
fix for the a='a '; print -l ${(o)=a}b problem and a trivial fix to
mem.c.  If noone complains, that will be released as zsh-3.0.5 tomorrow.

Thanks,

Zoltan


*** Src/mem.c.3.0.4	Sun Sep  1 18:57:23 1996
--- Src/mem.c	Wed Sep 24 23:38:40 1997
***************
*** 49,55 ****
  	pushheap() saves the states of all currently allocated heaps and
  	popheap() resets them to the last state saved and destroys the
  	information about that state.  If you called pushheap() and
! 	allocated some meory on the heaps and then come to a place where
  	you don't need the allocated memory anymore but you still want
  	to allocate memory on the heap, you should call freeheap().  This
  	works like popheap(), only that it doesn't free the information
--- 49,55 ----
  	pushheap() saves the states of all currently allocated heaps and
  	popheap() resets them to the last state saved and destroys the
  	information about that state.  If you called pushheap() and
! 	allocated some memory on the heaps and then come to a place where
  	you don't need the allocated memory anymore but you still want
  	to allocate memory on the heap, you should call freeheap().  This
  	works like popheap(), only that it doesn't free the information
***************
*** 72,81 ****
  	If we use zsh's own allocator we use a simple trick to avoid that
  	the (*real*) heap fills up with empty zsh-heaps: we allocate a
  	large block of memory before allocating a heap pool, this memory
! 	is freed again immediatly after the pool is allocated. If there
! 	are only small blocks on the free list this guarentees that the
  	memory for the pool is at the end of the memory which means that
! 	we can give it back to the systems when the pool is freed.
  */
  
  #ifdef ZSH_MEM_WARNING
--- 72,81 ----
  	If we use zsh's own allocator we use a simple trick to avoid that
  	the (*real*) heap fills up with empty zsh-heaps: we allocate a
  	large block of memory before allocating a heap pool, this memory
! 	is freed again immediately after the pool is allocated. If there
! 	are only small blocks on the free list this guarantees that the
  	memory for the pool is at the end of the memory which means that
! 	we can give it back to the system when the pool is freed.
  */
  
  #ifdef ZSH_MEM_WARNING
***************
*** 348,356 ****
  zrealloc(void *ptr, size_t size)
  {
      if (ptr) {
! 	if (size)
  	    /* Do normal realloc */
! 	    return realloc(ptr, size);
  	else
  	    /* If ptr is not NULL, but size is zero, *
  	     * then object pointed to is freed.      */
--- 348,361 ----
  zrealloc(void *ptr, size_t size)
  {
      if (ptr) {
! 	if (size) {
  	    /* Do normal realloc */
! 	    if (!(ptr = (void *) realloc(ptr, size))) {
! 		zerr("fatal error: out of memory", NULL, 0);
! 		exit(1);
! 	    }
! 	    return ptr;
! 	}
  	else
  	    /* If ptr is not NULL, but size is zero, *
  	     * then object pointed to is freed.      */
*** Src/subst.c~	Sat Aug  2 02:11:08 1997
--- Src/subst.c	Wed Sep 24 23:24:44 1997
***************
*** 420,425 ****
--- 420,427 ----
      return dest;
  }
  
+ typedef int (*CompareFn) _((const void *, const void *));
+ 
  /**/
  int
  strpcmp(const void *a, const void *b)
***************
*** 704,710 ****
      int vunset = 0;
      int spbreak = isset(SHWORDSPLIT) && !ssub && !qt;
      char *val = NULL, **aval = NULL;
!     int fwidth = 0;
      Value v;
      int flags = 0;
      int flnum = 0;
--- 706,712 ----
      int vunset = 0;
      int spbreak = isset(SHWORDSPLIT) && !ssub && !qt;
      char *val = NULL, **aval = NULL;
!     unsigned int fwidth = 0;
      Value v;
      int flags = 0;
      int flnum = 0;
***************
*** 1005,1011 ****
  		fwidth = v->pm->ct ? v->pm->ct : strlen(val);
  		switch (v->pm->flags & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z)) {
  		    char *t;
! 		    int t0;
  
  		case PM_LEFT:
  		case PM_LEFT | PM_RIGHT_Z:
--- 1007,1013 ----
  		fwidth = v->pm->ct ? v->pm->ct : strlen(val);
  		switch (v->pm->flags & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z)) {
  		    char *t;
! 		    unsigned int t0;
  
  		case PM_LEFT:
  		case PM_LEFT | PM_RIGHT_Z:
***************
*** 1383,1402 ****
  	    setdata(n, y);
  	    return n;
  	}
! 	if (sortit && !copied)
! 	    aval = arrdup(aval);
! 	if (sortit == 1)
! 	    qsort(aval, arrlen(aval), sizeof(char *), strpcmp);
! 
! 	else if (sortit == 2)
! 	    qsort(aval, arrlen(aval), sizeof(char *), invstrpcmp);
! 
! 	else if (sortit == 3)
! 	    qsort(aval, arrlen(aval), sizeof(char *), cstrpcmp);
  
! 	else if (sortit)
! 	    qsort(aval, arrlen(aval), sizeof(char *), invcstrpcmp);
  
  	if (plan9) {
  	    LinkList tl = newlinklist();
  	    LinkNode tn;
--- 1385,1402 ----
  	    setdata(n, y);
  	    return n;
  	}
! 	if (sortit) {
! 	    static CompareFn sortfn[] = {
! 		strpcmp, invstrpcmp, cstrpcmp, invcstrpcmp
! 	    };
  
! 	    if (!copied)
! 		aval = arrdup(aval);
  
+ 	    i = arrlen(aval);
+ 	    if (i && (*aval[i-1] || --i))
+ 		qsort(aval, i, sizeof(char *), sortfn[sortit-1]);
+ 	}
  	if (plan9) {
  	    LinkList tl = newlinklist();
  	    LinkNode tn;
*** Src/rlimits.awk.orig	Sun Sep 21 02:15:17 1997
--- Src/rlimits.awk	Thu Sep 25 01:43:09 1997
***************
*** 9,16 ****
  #
  BEGIN {limidx = 0}
  
! /^[\t ]*#[\t ]*define[\t _]*RLIMIT_[A-Z]*[\t ]*[0-9][0-9]*/ ||
! /^[\t ]*RLIMIT_[A-Z]*,[\t ]*/ {
      limindex = index($0, "RLIMIT_")
      limtail = substr($0, limindex, 80)
      split(limtail, tmp)
--- 9,15 ----
  #
  BEGIN {limidx = 0}
  
! /^[\t ]*(#[\t ]*define[\t _]*RLIMIT_[A-Z]*[\t ]*[0-9][0-9]*|RLIMIT_[A-Z]*,[\t ]*)/ {
      limindex = index($0, "RLIMIT_")
      limtail = substr($0, limindex, 80)
      split(limtail, tmp)


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

* Re: rlimits.awk in 3.0.5-test2
  1997-09-25  5:55 rlimits.awk in 3.0.5-test2 Zoltan Hidvegi
@ 1997-09-25  7:53 ` Peter Stephenson
  1997-09-25 18:37 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 1997-09-25  7:53 UTC (permalink / raw)
  To: Zsh hackers list

Zoltan Hidvegi wrote:
> I've just tried to compile zsh-3.0.5-test2 on an ancient SunOS 4.1.2 with
> K&R compiler, and rlimits.awk failed, since it does not seem to support
> || in the pattern part.  Could you please everyone check with his own awk
> (the older the better) if the fix below works?

No problems with the native awk on Irix 5.3, SunOS 4.1.3 (no surprise),
Solaris 2.5 (but I had to use a fake resource.h since the machine
isn't fully set up), AIX 4.1 and HP/UX 10.20.

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.


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

* Re: rlimits.awk in 3.0.5-test2
  1997-09-25  5:55 rlimits.awk in 3.0.5-test2 Zoltan Hidvegi
  1997-09-25  7:53 ` Peter Stephenson
@ 1997-09-25 18:37 ` Bart Schaefer
  1997-09-26  5:02   ` rlimits.awk in 3.0.5-test2 / 3.0.5 Geoff Wing
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 1997-09-25 18:37 UTC (permalink / raw)
  To: Zoltan Hidvegi, Zsh hacking and development

On Sep 25,  1:55am, Zoltan Hidvegi wrote:
} Subject: rlimits.awk in 3.0.5-test2
}
} I've just tried to compile zsh-3.0.5-test2 on an ancient SunOS 4.1.2 with
} K&R compiler, and rlimits.awk failed, since it does not seem to support
} || in the pattern part.  Could you please everyone check with his own awk
} (the older the better) if the fix below works?

The modified rlimits.awk appears to work OK on RedHat 4.2 / Linux 2.0.28 /
gawk 3.0.3 (though I must say that three consecutive `s' in "addressspace"
looks a bit strange; I'd never noticed that one before).

} If noone complains, that will be released as zsh-3.0.5 tomorrow.

Are you going to include PWS's $(r) patch from article 3526?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: rlimits.awk in 3.0.5-test2 / 3.0.5
  1997-09-25 18:37 ` Bart Schaefer
@ 1997-09-26  5:02   ` Geoff Wing
  0 siblings, 0 replies; 4+ messages in thread
From: Geoff Wing @ 1997-09-26  5:02 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer <schaefer@brasslantern.com> typed:
:On Sep 25,  1:55am, Zoltan Hidvegi wrote:
:} Subject: rlimits.awk in 3.0.5-test2
:} I've just tried to compile zsh-3.0.5-test2 on an ancient SunOS 4.1.2 with
:} K&R compiler, and rlimits.awk failed, since it does not seem to support
:} || in the pattern part.  Could you please everyone check with his own awk
:} (the older the better) if the fix below works?
:The modified rlimits.awk appears to work OK on RedHat 4.2 / Linux 2.0.28 /
:gawk 3.0.3 (though I must say that three consecutive `s' in "addressspace"
:looks a bit strange; I'd never noticed that one before).
:} If noone complains, that will be released as zsh-3.0.5 tomorrow.
:Are you going to include PWS's $(r) patch from article 3526?

None of PWS's recent stuff for nested closures is in there, though all of
``globtests'' works for me.

BTW, zsh-3.0.5.tar.gz : Src/rlimits.awk (lines 1-3)
	# 
	# $Id$
	#
-- 
Geoff Wing [mason@primenet.com.au]                   Phone    : +61-3-9818 2977
 Technical Manager: PrimeNet Computer Consultants    Facsimile: +61-3-9768 2909
 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] 4+ messages in thread

end of thread, other threads:[~1997-09-26  5:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-25  5:55 rlimits.awk in 3.0.5-test2 Zoltan Hidvegi
1997-09-25  7:53 ` Peter Stephenson
1997-09-25 18:37 ` Bart Schaefer
1997-09-26  5:02   ` rlimits.awk in 3.0.5-test2 / 3.0.5 Geoff Wing

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).