zsh-workers
 help / color / mirror / code / Atom feed
* hashinfo improvement
@ 1996-12-01 15:47 Zefram
  1996-12-02 16:59 ` Zoltan Hidvegi
  0 siblings, 1 reply; 6+ messages in thread
From: Zefram @ 1996-12-01 15:47 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

This patch changes the means by which hashinfo lists all the hash tables.
Previously it had to know about each table individually, requiring
them all to have global scope.  This patch causes newhashtable() to
put the created hash tables into a linked list, which hashinfo can then
walk along.

This allows hash tables to be private to a single source file or function,
and yet still appear in the debugging output.  I have a couple of patches
planned that would benefit from this.  (Zoltan, are you planning a 3.1.0
release sometime soon?)

There are no changes if ZSH_HASH_DEBUG is undefined.

 -zefram

      Index: Src/builtin.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/builtin.c,v
      retrieving revision 1.38
      diff -c -r1.38 builtin.c
      *** Src/builtin.c	1996/11/30 23:34:47	1.38
      --- Src/builtin.c	1996/11/30 23:48:56
      ***************
      *** 5697,5736 ****
            return 0;
        }
        
      - /*** debugging functions ***/
      - 
      - #ifdef ZSH_HASH_DEBUG
      - /**/
      - int
      - bin_hashinfo(char *nam, char **args, char *ops, int func)
      - {
      -     printf("----------------------------------------------------\n");
      -     cmdnamtab->printinfo(cmdnamtab);
      -     printf("----------------------------------------------------\n");
      -     shfunctab->printinfo(shfunctab);
      -     printf("----------------------------------------------------\n");
      -     builtintab->printinfo(builtintab);
      -     printf("----------------------------------------------------\n");
      -     paramtab->printinfo(paramtab);
      -     printf("----------------------------------------------------\n");
      -     compctltab->printinfo(compctltab);
      -     printf("----------------------------------------------------\n");
      -     aliastab->printinfo(aliastab);
      -     printf("----------------------------------------------------\n");
      -     reswdtab->printinfo(reswdtab);
      -     printf("----------------------------------------------------\n");
      -     emkeybindtab->printinfo(emkeybindtab);
      -     printf("----------------------------------------------------\n");
      -     vikeybindtab->printinfo(vikeybindtab);
      -     printf("----------------------------------------------------\n");
      -     altkeybindtab->printinfo(altkeybindtab);
      -     printf("----------------------------------------------------\n");
      -     nameddirtab->printinfo(nameddirtab);
      -     printf("----------------------------------------------------\n");
      -     return 0;
      - }
      - #endif
      - 
        /**** utility functions -- should go in utils.c ****/
        
        /* Separate an argument into name=value parts, returning them in an     *
      --- 5697,5702 ----
      Index: Src/hashtable.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/hashtable.c,v
      retrieving revision 1.11
      diff -c -r1.11 hashtable.c
      *** Src/hashtable.c	1996/11/08 01:23:07	1.11
      --- Src/hashtable.c	1996/12/01 00:03:36
      ***************
      *** 35,40 ****
      --- 35,44 ----
        /* Generic Hash Table functions */
        /********************************/
        
      + #ifdef ZSH_HASH_DEBUG
      + static HashTable firstht, lastht;
      + #endif
      + 
        /* Generic hash function */
        
        /**/
      ***************
      *** 58,63 ****
      --- 62,76 ----
            HashTable ht;
        
            ht = (HashTable) zcalloc(sizeof *ht);
      + #ifdef ZSH_HASH_DEBUG
      +     ht->next = NULL;
      +     if(!firstht)
      + 	firstht = ht;
      +     ht->last = lastht;
      +     if(lastht)
      + 	lastht->next = ht;
      +     lastht = ht;
      + #endif /* ZSH_HASH_DEBUG */
            ht->nodes = (HashNode *) zcalloc(size * sizeof(HashNode));
            ht->hsize = size;
            ht->ct = 0;
      ***************
      *** 450,459 ****
            ht->ct = 0;
        }
        
      - /* Print info about hash table */
      - 
        #ifdef ZSH_HASH_DEBUG
        
        #define MAXDEPTH 7
        
        /**/
      --- 463,472 ----
            ht->ct = 0;
        }
        
        #ifdef ZSH_HASH_DEBUG
        
      + /* Print info about hash table */
      + 
        #define MAXDEPTH 7
        
        /**/
      ***************
      *** 488,494 ****
            printf("number of hash values with chain of length %d+ : %4d\n", MAXDEPTH, chainlen[MAXDEPTH]);
            printf("total number of nodes                         : %4d\n", total);
        }
      ! #endif
        
        /********************************/
        /* Command Hash Table Functions */
      --- 501,521 ----
            printf("number of hash values with chain of length %d+ : %4d\n", MAXDEPTH, chainlen[MAXDEPTH]);
            printf("total number of nodes                         : %4d\n", total);
        }
      ! 
      ! /**/
      ! int
      ! bin_hashinfo(char *nam, char **args, char *ops, int func)
      ! {
      !     HashTable ht;
      !     printf("----------------------------------------------------\n");
      !     for(ht = firstht; ht; ht = ht->next) {
      ! 	ht->printinfo(ht);
      ! 	printf("----------------------------------------------------\n");
      !     }
      !     return 0;
      ! }
      ! 
      ! #endif /* ZSH_HASH_DEBUG */
        
        /********************************/
        /* Command Hash Table Functions */
      Index: Src/zsh.h
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/zsh.h,v
      retrieving revision 1.28
      diff -c -r1.28 zsh.h
      *** Src/zsh.h	1996/11/22 22:59:33	1.28
      --- Src/zsh.h	1996/11/30 23:42:59
      ***************
      *** 637,650 ****
        /* hash table for standard open hashing */
        
        struct hashtable {
            /* HASHTABLE DATA */
            int hsize;			/* size of nodes[]  (number of hash values)   */
            int ct;			/* number of elements                         */
            HashNode *nodes;		/* array of size hsize                        */
      - 
      - #ifdef ZSH_HASH_DEBUG
      -     char *tablename;		/* string containing name of the hash table */
      - #endif
        
            /* HASHTABLE METHODS */
            HashFunc hash;		/* pointer to hash function for this table    */
      --- 637,651 ----
        /* hash table for standard open hashing */
        
        struct hashtable {
      + #ifdef ZSH_HASH_DEBUG
      +     HashTable next, last;	/* linked list of all hash tables */
      +     char *tablename;		/* string containing name of the hash table */
      + #endif
      + 
            /* HASHTABLE DATA */
            int hsize;			/* size of nodes[]  (number of hash values)   */
            int ct;			/* number of elements                         */
            HashNode *nodes;		/* array of size hsize                        */
        
            /* HASHTABLE METHODS */
            HashFunc hash;		/* pointer to hash function for this table    */

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMqDR4nD/+HJTpU/hAQGs5gQAuldI3pg+HbKDBXwOVYuBy1Nd0rrMlI9h
47B6s2qOTB0VKkILeSXEHc2pKi822DwQM426pVAfE8cOKG7gQucv8+87Dsj3BSfB
6Ih4Nzz/HlNIJrAncHqOYj2KNRnJ8tJJaP06HTHKwWua62VXomG8FJGGxUYNlJKS
H38wbJWemWA=
=Y8fs
-----END PGP SIGNATURE-----


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

* Re: hashinfo improvement
  1996-12-01 15:47 hashinfo improvement Zefram
@ 1996-12-02 16:59 ` Zoltan Hidvegi
  1996-12-02 17:14   ` Zefram
  1996-12-02 17:53   ` Vinnie Shelton
  0 siblings, 2 replies; 6+ messages in thread
From: Zoltan Hidvegi @ 1996-12-02 16:59 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

Zefram wrote:
> planned that would benefit from this.  (Zoltan, are you planning a 3.1.0
> release sometime soon?)

I have started to implement autoloadable zle.  It requires significant code
rearrangements and Makefile changes.  I've finished most of it but the new
Makefile is not yet ready.  I also plan to split builtins.c and create a
Builtins subdirectory.  I have also simplified the dupstruct/freestruct
routines in utils.c for a little fit smaller zsh.

The new loadable zsh is loaded completely automatically, it will not cause
any user-visible change.  It may be worth to not set the ZLE option by
default when invoking zsh as sh.  This may be desirable when zsh is /bin/sh
and the zle modules are not on the root filesystem.

And I also have a lot of work here in the university.  I hope to release
zsh-3.1.0 later this week.

Zoltan


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

* Re: hashinfo improvement
  1996-12-02 16:59 ` Zoltan Hidvegi
@ 1996-12-02 17:14   ` Zefram
  1996-12-02 17:53   ` Vinnie Shelton
  1 sibling, 0 replies; 6+ messages in thread
From: Zefram @ 1996-12-02 17:14 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zefram, zsh-workers

>I have started to implement autoloadable zle.

Excellent.  I'd been planning to do that myself.

>                          It may be worth to not set the ZLE option by
>default when invoking zsh as sh.  This may be desirable when zsh is /bin/sh
>and the zle modules are not on the root filesystem.

Probably a good idea.

What happens if the ZLE module can't be loaded?  The way I was going to
implement it, zsh would fall back on a trivial routine that outputs a
simple fixed prompt and reads from the tty in cooked mode.

-zefram


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

* Re: hashinfo improvement
  1996-12-02 16:59 ` Zoltan Hidvegi
  1996-12-02 17:14   ` Zefram
@ 1996-12-02 17:53   ` Vinnie Shelton
  1996-12-02 18:13     ` Zoltan Hidvegi
  1996-12-05 13:46     ` C. v. Stuckrad
  1 sibling, 2 replies; 6+ messages in thread
From: Vinnie Shelton @ 1996-12-02 17:53 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers

hzoli@cs.elte.hu said:
> And I also have a lot of work here in the university.  I hope to 
> release zsh-3.1.0 later this week. 

Zoltan,
    What happened to 3.0.2?  I thought you were going to release a new stable 
mainline release which didn't include modules.

--vin


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

* Re: hashinfo improvement
  1996-12-02 17:53   ` Vinnie Shelton
@ 1996-12-02 18:13     ` Zoltan Hidvegi
  1996-12-05 13:46     ` C. v. Stuckrad
  1 sibling, 0 replies; 6+ messages in thread
From: Zoltan Hidvegi @ 1996-12-02 18:13 UTC (permalink / raw)
  To: acs; +Cc: zsh-workers

Vinnie Shelton wrote:
> hzoli@cs.elte.hu said:
> > And I also have a lot of work here in the university.  I hope to 
> > release zsh-3.1.0 later this week. 
> 
> Zoltan,
>     What happened to 3.0.2?  I thought you were going to release a new stable 
> mainline release which didn't include modules.

Yes, that's comming soon.

Zoltan


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

* Re: hashinfo improvement
  1996-12-02 17:53   ` Vinnie Shelton
  1996-12-02 18:13     ` Zoltan Hidvegi
@ 1996-12-05 13:46     ` C. v. Stuckrad
  1 sibling, 0 replies; 6+ messages in thread
From: C. v. Stuckrad @ 1996-12-05 13:46 UTC (permalink / raw)
  To: acs; +Cc: Zoltan Hidvegi, zsh-workers

On Mon, 2 Dec 1996, Vinnie Shelton wrote:

> Subject: Re: hashinfo improvement 
> To: Zoltan Hidvegi <hzoli@cs.elte.hu>
> Cc: zsh-workers@math.gatech.edu
> Date: Mon, 02 Dec 1996 12:53:38 -0500
> 
> hzoli@cs.elte.hu said:
> > And I also have a lot of work here in the university.  I hope to 
> > release zsh-3.1.0 later this week. 
> 
> Zoltan,
>     What happened to 3.0.2?  I thought you were going to release a new stable 
> mainline release which didn't include modules.
> 
> --vin

May I express the hope for a stable 'last' version without modules to 
come FIRST, before we might try the modules ???

I personally can live with the bugs of 3.0.1 for a while, but the users
around here often are complaining and I would appreciate NOT to go back 
to older ZSH's (mostly because of the scripts being already adapted to
the '~1 ... ~n' instead of '=1 ... =n' dirstacks).

So is there either a list (and order) of patches to get a stable version?
Or a kind of last, patched, 'state of the art - before modules' Version?

Your's,   Stucki  (Sysadmin of math.fu-berlin.de)

Christoph von Stuckrad       * *  | talk to  | <stucki@math.fu-berlin.de> \
Freie Universitaet Berlin    |/_* | nickname | ...!unido!fub!leibniz!stucki|
Fachbereich Mathematik, EDV  |\ * | 'stucki' | Tel:+49 30 838-7545{9|8}    |
Arnimallee 2-6/14195 Berlin  * *  |  on IRC  | Fax:+49 30 838-5913        /


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

end of thread, other threads:[~1996-12-05 16:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-01 15:47 hashinfo improvement Zefram
1996-12-02 16:59 ` Zoltan Hidvegi
1996-12-02 17:14   ` Zefram
1996-12-02 17:53   ` Vinnie Shelton
1996-12-02 18:13     ` Zoltan Hidvegi
1996-12-05 13:46     ` C. v. Stuckrad

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