zsh-workers
 help / color / mirror / code / Atom feed
* zle interface improvement
@ 1996-12-24 11:28 Zefram
  1996-12-24 15:03 ` Hasan Diwan
  0 siblings, 1 reply; 5+ messages in thread
From: Zefram @ 1996-12-24 11:28 UTC (permalink / raw)
  To: Z Shell workers mailing list

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

This patch removes another source of variation in the module interface.
Currently the ZLE entry points are only accessed via pointers if ZLE
is not linked in: this means that a module (other than ZLE itself) that
wants to call one of these functions needs to know whether ZLE is linked
in or not.  This patch makes the pointers always be used, except from
within the ZLE module itself -- the only module that can be sure these
functions will always be in the same executable as itself.

There is a small extra overhead when ZLE is linked in.  But this is less
overhead than we get from making ZLE a module, and the vast majority of
calls to these functions are from within ZLE and so are not slowed down
at all.

 -zefram

      *** Src/globals.h	1996/12/22 09:11:45	1.29
      --- Src/globals.h	1996/12/24 01:10:18
      ***************
      *** 563,583 ****
        /* flag for whether terminal has automargin (wraparound) capability */
        EXTERN int hasam;
        
      ! #ifdef UNLINKED_XMOD_zle
      ! # ifdef GLOBALS
      ! void (*trashzleptr) _((void)) = noop_function;
      ! unsigned char * (*zlereadptr) _((char *lp, char *rp)) = load_zleread;
      ! void (*spaceinlineptr) _((int)) = noop_function_int;
      ! void (*gotwordptr) _((void)) = noop_function;
      ! void (*refreshptr) _((void)) = noop_function;
      ! # else /* !GLOBALS */
      ! extern void (*trashzleptr) _((void));
      ! extern unsigned char * (*zlereadptr) _((char *lp, char *rp));
      ! extern void (*spaceinlineptr) _((int));
      ! extern void (*gotwordptr) _((void));
      ! extern void (*refreshptr) _((void));
      ! # endif /* !GLOBALS */
      ! #endif /* UNLINKED_XMOD_zle */
        
        /* pid of process undergoing 'process substitution' */
         
      --- 563,577 ----
        /* flag for whether terminal has automargin (wraparound) capability */
        EXTERN int hasam;
        
      ! /* ZLE entry point pointers */
      ! 
      ! typedef void (*ZleVoidFn) _((void));
      ! typedef void (*ZleVoidIntFn) _((int));
      ! typedef unsigned char * (*ZleReadFn) _((char *, char *));
      ! 
      ! extern ZleVoidFn trashzleptr, gotwordptr, refreshptr;
      ! extern ZleVoidIntFn spaceinlineptr;
      ! extern ZleReadFn zlereadptr;
        
        /* pid of process undergoing 'process substitution' */
         
      *** Src/init.c	1996/12/22 09:11:45	1.29
      --- Src/init.c	1996/12/24 01:22:50
      ***************
      *** 779,781 ****
      --- 779,835 ----
        #include "bltinmods.list"
        #undef DOMOD
        }
      + 
      + /* ZLE entry point pointers.  They are defined here because the initial *
      +  * values depend on whether ZLE is linked in or not -- if it is, we     *
      +  * avoid wasting space with the fallback functions.  No other source    *
      +  * file needs to know which modules are linked in.                      */
      + 
      + #ifdef LINKED_XMOD_zle
      + 
      + ZleVoidFn trashzleptr;
      + ZleVoidFn gotwordptr;
      + ZleVoidFn refreshptr;
      + ZleVoidIntFn spaceinlineptr;
      + ZleReadFn zlereadptr;
      + 
      + #else /* !LINKED_XMOD_zle */
      + 
      + ZleVoidFn trashzleptr = noop_function;
      + ZleVoidFn gotwordptr = noop_function;
      + ZleVoidFn refreshptr = noop_function;
      + ZleVoidIntFn spaceinlineptr = noop_function_int;
      + ZleReadFn zlereadptr = fallback_zleread;
      + 
      + /**/
      + void
      + noop_function(void)
      + {
      +     /* do nothing */
      + }
      + 
      + /**/
      + void
      + noop_function_int(int nothing)
      + {
      +     /* do nothing */
      + }
      + 
      + /**/
      + unsigned char *
      + fallback_zleread(char *lp, char *rp)
      + {
      +     char *pptbuf;
      +     int pptlen;
      + 
      + #ifdef UNLINKED_XMOD_zle
      +     if (load_module("zle"))
      + 	return zleread(lp, rp);
      + #endif /* UNLINKED_XMOD_zle */
      +     pptbuf = putprompt(lp, &pptlen, NULL, 1);
      +     write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
      +     free(pptbuf);
      +     return (unsigned char *)shingetline();
      + }
      + 
      + #endif /* !LINKED_XMOD_zle */
      *** Src/module.c	1996/12/24 00:15:31	1.16
      --- Src/module.c	1996/12/24 01:14:07
      ***************
      *** 464,539 ****
            return ret;
        }
        
      - #ifdef UNLINKED_XMOD_zle
      - typedef void (*Voidfn) _((void));
      - 
      - static struct symbols {
      -     char *nam;
      -     Voidfn *fn;
      - } zle_syms[] = {
      - #ifdef DLSYM_NEEDS_UNDERSCORE
      -     { "_trashzle", &trashzleptr },
      -     { "_zleread", (Voidfn *) &zlereadptr },
      -     { "_spaceinline", (Voidfn *) &spaceinlineptr },
      -     { "_gotword", &gotwordptr },
      -     { "_refresh", &refreshptr },
      -     { "_zle_init", NULL }
      - #else
      -     { "trashzle", &trashzleptr },
      -     { "zleread", (Voidfn *) &zlereadptr },
      -     { "spaceinline", (Voidfn *) &spaceinlineptr },
      -     { "gotword", &gotwordptr },
      -     { "refresh", &refreshptr },
      -     { NULL, NULL }
      - #endif
      - };
      - 
      - /**/
      - int
      - load_zle_syms(void *handle)
      - {
      -     struct symbols *sym;
      -     Voidfn fn;
      - 
      -     for (sym = zle_syms; sym->nam; sym++) {
      - 	if (!handle || !(fn = (Voidfn) dlsym(handle, sym->nam))) {
      - 	    zerr("unable to load zle: %s", dlerror(), 0);
      - 	    return -1;
      - 	}
      - 	*sym->fn = fn;
      -     }
      -     return 0;
      - }
      - 
      - /**/
      - void
      - noop_function(void)
      - {
      -     /* do nothing */
      - }
      - 
      - /**/
      - void
      - noop_function_int(int nothing)
      - {
      -     /* do nothing */
      - }
      - 
      - /**/
      - unsigned char *
      - load_zleread(char *lp, char *rp)
      - {
      -     if (load_module("zle"))
      - 	return zleread(lp, rp);
      -     else {
      - 	char *pptbuf;
      - 	int pptlen;
      - 
      - 	pptbuf = putprompt(lp, &pptlen, NULL, 1);
      - 	write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
      - 	free(pptbuf);
      - 	return (unsigned char *)shingetline();
      -     }
      - }
      - #endif /* UNLINKED_XMOD_zle */
        #endif /* DYNAMIC */
      --- 464,467 ----
      *** Src/zsh.h	1996/12/23 00:07:16	1.35
      --- Src/zsh.h	1996/12/24 00:46:11
      ***************
      *** 40,52 ****
        
        #include "zshxmods.h"
        
      ! #if defined(UNLINKED_XMOD_zle) && !defined(IN_ZLE)
        # define trashzle()      trashzleptr()
        # define zleread(X,Y)    zlereadptr(X,Y)
        # define spaceinline(X)  spaceinlineptr(X)
        # define gotword()       gotwordptr()
        # define refresh()       refreshptr()
      ! #endif
        
        /* A few typical macros */
        #define minimum(a,b)  ((a) < (b) ? (a) : (b))
      --- 40,52 ----
        
        #include "zshxmods.h"
        
      ! #ifndef IN_ZLE
        # define trashzle()      trashzleptr()
        # define zleread(X,Y)    zlereadptr(X,Y)
        # define spaceinline(X)  spaceinlineptr(X)
        # define gotword()       gotwordptr()
        # define refresh()       refreshptr()
      ! #endif /* !IN_ZLE */
        
        /* A few typical macros */
        #define minimum(a,b)  ((a) < (b) ? (a) : (b))
      ***************
      *** 1265,1273 ****
        #include "signals.h"
        #include "prototypes.h"
        #include "globals.h"
      - #if defined(LINKED_XMOD_zle) && !defined(MODULE)
      - # include "zle.h"
      - #endif
        #include "hashtable.h"
        
        #endif /*!_ZSH_H*/
      --- 1265,1270 ----
      *** Src/Zle/zle.h	1996/12/22 04:50:56	1.2
      --- Src/Zle/zle.h	1996/12/24 00:46:34
      ***************
      *** 32,38 ****
        #ifndef _ZLE_H
        #define _ZLE_H
        
      - #define IN_ZLE
        #include "zsh.h"
        
        #ifdef ZLEGLOBALS
      --- 32,37 ----
      *** Src/Zle/zle_bindings.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_bindings.c	1996/12/24 00:46:42
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        struct zlecmd zlecmds[] =
      *** Src/Zle/zle_hist.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_hist.c	1996/12/24 00:46:48
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        /**/
      *** Src/Zle/zle_main.c	1996/12/23 00:07:22	1.4
      --- Src/Zle/zle_main.c	1996/12/24 01:07:46
      ***************
      *** 45,50 ****
      --- 45,51 ----
         */
        
        #define ZLEGLOBALS
      + #define IN_ZLE
        #include "zle.h"
        
        static int embindtab[256], eofchar, eofsent;
      ***************
      *** 1557,1566 ****
        int
        boot_zle(Module m)
        {
      ! #ifdef MODULE
      !     if (load_zle_syms(m->handle))
      ! 	return -1;
      ! #endif
            createcompctltable();   /* create hash table for compctls          */
        
            /* create hash tables for multi-character key bindings */
      --- 1558,1570 ----
        int
        boot_zle(Module m)
        {
      !     /* Set up editor entry points */
      !     trashzleptr = trashzle;
      !     gotwordptr = gotword;
      !     refreshptr = refresh;
      !     spaceinlineptr = spaceinline;
      !     zlereadptr = zleread;
      ! 
            createcompctltable();   /* create hash table for compctls          */
        
            /* create hash tables for multi-character key bindings */
      *** Src/Zle/zle_misc.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_misc.c	1996/12/24 00:47:00
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        /**/
      *** Src/Zle/zle_move.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_move.c	1996/12/24 00:47:05
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        static vimarkcs[27], vimarkline[27];
      *** Src/Zle/zle_refresh.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_refresh.c	1996/12/24 00:47:16
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        #ifdef HAVE_SELECT
      *** Src/Zle/zle_tricky.c	1996/12/22 22:26:34	1.4
      --- Src/Zle/zle_tricky.c	1996/12/24 00:47:41
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        /* The main part of ZLE maintains the line being edited as binary data, *
      *** Src/Zle/zle_utils.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_utils.c	1996/12/24 00:47:47
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        /* make sure that the line buffer has at least sz chars */
      *** Src/Zle/zle_vi.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_vi.c	1996/12/24 00:47:53
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        static int lastmult, lastbuf, lastgotmult, lastgotbuf, inrepeat, vichgrepeat;
      *** Src/Zle/zle_word.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_word.c	1996/12/24 00:47:58
      ***************
      *** 29,34 ****
      --- 29,35 ----
         *
         */
        
      + #define IN_ZLE
        #include "zle.h"
        
        /**/

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

iQCVAwUBMr86UHD/+HJTpU/hAQEUdgP/b78wsD8yFozXeWx+cUzpdU6S+L6Ved3o
SNhvySTqzQ0kXT3V17Ax3eJYVgoIg7c0KgYFjIwgRDptLVtR/rhLaq5boY0F626P
7bSKfE0IsrBZ9D2CwSzrDDtcNKbJ/DlVN7pduScxfv7Ewst1TqqPqTQDYPqiv4kM
HzfgVJf/L2Q=
=YlYF
-----END PGP SIGNATURE-----


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

* Re: zle interface improvement
  1996-12-24 11:28 zle interface improvement Zefram
@ 1996-12-24 15:03 ` Hasan Diwan
  0 siblings, 0 replies; 5+ messages in thread
From: Hasan Diwan @ 1996-12-24 15:03 UTC (permalink / raw)
  To: Zefram; +Cc: Z Shell workers mailing list

[-- Attachment #1: Type: TEXT/PLAIN, Size: 13284 bytes --]

The following files fail to patch (I'm using a dual P166-based Linux
system with an unpatched version of zsh 3.1.0):
globals.h
zsh.h
The rej files are attached... 

On Tue, 24 Dec 1996, Zefram wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> 
> This patch removes another source of variation in the module interface.
> Currently the ZLE entry points are only accessed via pointers if ZLE
> is not linked in: this means that a module (other than ZLE itself) that
> wants to call one of these functions needs to know whether ZLE is linked
> in or not.  This patch makes the pointers always be used, except from
> within the ZLE module itself -- the only module that can be sure these
> functions will always be in the same executable as itself.
> 
> There is a small extra overhead when ZLE is linked in.  But this is less
> overhead than we get from making ZLE a module, and the vast majority of
> calls to these functions are from within ZLE and so are not slowed down
> at all.
> 
>  -zefram
> 
>       *** Src/globals.h	1996/12/22 09:11:45	1.29
>       --- Src/globals.h	1996/12/24 01:10:18
>       ***************
>       *** 563,583 ****
>         /* flag for whether terminal has automargin (wraparound) capability */
>         EXTERN int hasam;
>         
>       ! #ifdef UNLINKED_XMOD_zle
>       ! # ifdef GLOBALS
>       ! void (*trashzleptr) _((void)) = noop_function;
>       ! unsigned char * (*zlereadptr) _((char *lp, char *rp)) = load_zleread;
>       ! void (*spaceinlineptr) _((int)) = noop_function_int;
>       ! void (*gotwordptr) _((void)) = noop_function;
>       ! void (*refreshptr) _((void)) = noop_function;
>       ! # else /* !GLOBALS */
>       ! extern void (*trashzleptr) _((void));
>       ! extern unsigned char * (*zlereadptr) _((char *lp, char *rp));
>       ! extern void (*spaceinlineptr) _((int));
>       ! extern void (*gotwordptr) _((void));
>       ! extern void (*refreshptr) _((void));
>       ! # endif /* !GLOBALS */
>       ! #endif /* UNLINKED_XMOD_zle */
>         
>         /* pid of process undergoing 'process substitution' */
>          
>       --- 563,577 ----
>         /* flag for whether terminal has automargin (wraparound) capability */
>         EXTERN int hasam;
>         
>       ! /* ZLE entry point pointers */
>       ! 
>       ! typedef void (*ZleVoidFn) _((void));
>       ! typedef void (*ZleVoidIntFn) _((int));
>       ! typedef unsigned char * (*ZleReadFn) _((char *, char *));
>       ! 
>       ! extern ZleVoidFn trashzleptr, gotwordptr, refreshptr;
>       ! extern ZleVoidIntFn spaceinlineptr;
>       ! extern ZleReadFn zlereadptr;
>         
>         /* pid of process undergoing 'process substitution' */
>          
>       *** Src/init.c	1996/12/22 09:11:45	1.29
>       --- Src/init.c	1996/12/24 01:22:50
>       ***************
>       *** 779,781 ****
>       --- 779,835 ----
>         #include "bltinmods.list"
>         #undef DOMOD
>         }
>       + 
>       + /* ZLE entry point pointers.  They are defined here because the initial *
>       +  * values depend on whether ZLE is linked in or not -- if it is, we     *
>       +  * avoid wasting space with the fallback functions.  No other source    *
>       +  * file needs to know which modules are linked in.                      */
>       + 
>       + #ifdef LINKED_XMOD_zle
>       + 
>       + ZleVoidFn trashzleptr;
>       + ZleVoidFn gotwordptr;
>       + ZleVoidFn refreshptr;
>       + ZleVoidIntFn spaceinlineptr;
>       + ZleReadFn zlereadptr;
>       + 
>       + #else /* !LINKED_XMOD_zle */
>       + 
>       + ZleVoidFn trashzleptr = noop_function;
>       + ZleVoidFn gotwordptr = noop_function;
>       + ZleVoidFn refreshptr = noop_function;
>       + ZleVoidIntFn spaceinlineptr = noop_function_int;
>       + ZleReadFn zlereadptr = fallback_zleread;
>       + 
>       + /**/
>       + void
>       + noop_function(void)
>       + {
>       +     /* do nothing */
>       + }
>       + 
>       + /**/
>       + void
>       + noop_function_int(int nothing)
>       + {
>       +     /* do nothing */
>       + }
>       + 
>       + /**/
>       + unsigned char *
>       + fallback_zleread(char *lp, char *rp)
>       + {
>       +     char *pptbuf;
>       +     int pptlen;
>       + 
>       + #ifdef UNLINKED_XMOD_zle
>       +     if (load_module("zle"))
>       + 	return zleread(lp, rp);
>       + #endif /* UNLINKED_XMOD_zle */
>       +     pptbuf = putprompt(lp, &pptlen, NULL, 1);
>       +     write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
>       +     free(pptbuf);
>       +     return (unsigned char *)shingetline();
>       + }
>       + 
>       + #endif /* !LINKED_XMOD_zle */
>       *** Src/module.c	1996/12/24 00:15:31	1.16
>       --- Src/module.c	1996/12/24 01:14:07
>       ***************
>       *** 464,539 ****
>             return ret;
>         }
>         
>       - #ifdef UNLINKED_XMOD_zle
>       - typedef void (*Voidfn) _((void));
>       - 
>       - static struct symbols {
>       -     char *nam;
>       -     Voidfn *fn;
>       - } zle_syms[] = {
>       - #ifdef DLSYM_NEEDS_UNDERSCORE
>       -     { "_trashzle", &trashzleptr },
>       -     { "_zleread", (Voidfn *) &zlereadptr },
>       -     { "_spaceinline", (Voidfn *) &spaceinlineptr },
>       -     { "_gotword", &gotwordptr },
>       -     { "_refresh", &refreshptr },
>       -     { "_zle_init", NULL }
>       - #else
>       -     { "trashzle", &trashzleptr },
>       -     { "zleread", (Voidfn *) &zlereadptr },
>       -     { "spaceinline", (Voidfn *) &spaceinlineptr },
>       -     { "gotword", &gotwordptr },
>       -     { "refresh", &refreshptr },
>       -     { NULL, NULL }
>       - #endif
>       - };
>       - 
>       - /**/
>       - int
>       - load_zle_syms(void *handle)
>       - {
>       -     struct symbols *sym;
>       -     Voidfn fn;
>       - 
>       -     for (sym = zle_syms; sym->nam; sym++) {
>       - 	if (!handle || !(fn = (Voidfn) dlsym(handle, sym->nam))) {
>       - 	    zerr("unable to load zle: %s", dlerror(), 0);
>       - 	    return -1;
>       - 	}
>       - 	*sym->fn = fn;
>       -     }
>       -     return 0;
>       - }
>       - 
>       - /**/
>       - void
>       - noop_function(void)
>       - {
>       -     /* do nothing */
>       - }
>       - 
>       - /**/
>       - void
>       - noop_function_int(int nothing)
>       - {
>       -     /* do nothing */
>       - }
>       - 
>       - /**/
>       - unsigned char *
>       - load_zleread(char *lp, char *rp)
>       - {
>       -     if (load_module("zle"))
>       - 	return zleread(lp, rp);
>       -     else {
>       - 	char *pptbuf;
>       - 	int pptlen;
>       - 
>       - 	pptbuf = putprompt(lp, &pptlen, NULL, 1);
>       - 	write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
>       - 	free(pptbuf);
>       - 	return (unsigned char *)shingetline();
>       -     }
>       - }
>       - #endif /* UNLINKED_XMOD_zle */
>         #endif /* DYNAMIC */
>       --- 464,467 ----
>       *** Src/zsh.h	1996/12/23 00:07:16	1.35
>       --- Src/zsh.h	1996/12/24 00:46:11
>       ***************
>       *** 40,52 ****
>         
>         #include "zshxmods.h"
>         
>       ! #if defined(UNLINKED_XMOD_zle) && !defined(IN_ZLE)
>         # define trashzle()      trashzleptr()
>         # define zleread(X,Y)    zlereadptr(X,Y)
>         # define spaceinline(X)  spaceinlineptr(X)
>         # define gotword()       gotwordptr()
>         # define refresh()       refreshptr()
>       ! #endif
>         
>         /* A few typical macros */
>         #define minimum(a,b)  ((a) < (b) ? (a) : (b))
>       --- 40,52 ----
>         
>         #include "zshxmods.h"
>         
>       ! #ifndef IN_ZLE
>         # define trashzle()      trashzleptr()
>         # define zleread(X,Y)    zlereadptr(X,Y)
>         # define spaceinline(X)  spaceinlineptr(X)
>         # define gotword()       gotwordptr()
>         # define refresh()       refreshptr()
>       ! #endif /* !IN_ZLE */
>         
>         /* A few typical macros */
>         #define minimum(a,b)  ((a) < (b) ? (a) : (b))
>       ***************
>       *** 1265,1273 ****
>         #include "signals.h"
>         #include "prototypes.h"
>         #include "globals.h"
>       - #if defined(LINKED_XMOD_zle) && !defined(MODULE)
>       - # include "zle.h"
>       - #endif
>         #include "hashtable.h"
>         
>         #endif /*!_ZSH_H*/
>       --- 1265,1270 ----
>       *** Src/Zle/zle.h	1996/12/22 04:50:56	1.2
>       --- Src/Zle/zle.h	1996/12/24 00:46:34
>       ***************
>       *** 32,38 ****
>         #ifndef _ZLE_H
>         #define _ZLE_H
>         
>       - #define IN_ZLE
>         #include "zsh.h"
>         
>         #ifdef ZLEGLOBALS
>       --- 32,37 ----
>       *** Src/Zle/zle_bindings.c	1996/12/22 01:13:39	1.1.1.1
>       --- Src/Zle/zle_bindings.c	1996/12/24 00:46:42
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         struct zlecmd zlecmds[] =
>       *** Src/Zle/zle_hist.c	1996/12/22 01:13:39	1.1.1.1
>       --- Src/Zle/zle_hist.c	1996/12/24 00:46:48
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         /**/
>       *** Src/Zle/zle_main.c	1996/12/23 00:07:22	1.4
>       --- Src/Zle/zle_main.c	1996/12/24 01:07:46
>       ***************
>       *** 45,50 ****
>       --- 45,51 ----
>          */
>         
>         #define ZLEGLOBALS
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         static int embindtab[256], eofchar, eofsent;
>       ***************
>       *** 1557,1566 ****
>         int
>         boot_zle(Module m)
>         {
>       ! #ifdef MODULE
>       !     if (load_zle_syms(m->handle))
>       ! 	return -1;
>       ! #endif
>             createcompctltable();   /* create hash table for compctls          */
>         
>             /* create hash tables for multi-character key bindings */
>       --- 1558,1570 ----
>         int
>         boot_zle(Module m)
>         {
>       !     /* Set up editor entry points */
>       !     trashzleptr = trashzle;
>       !     gotwordptr = gotword;
>       !     refreshptr = refresh;
>       !     spaceinlineptr = spaceinline;
>       !     zlereadptr = zleread;
>       ! 
>             createcompctltable();   /* create hash table for compctls          */
>         
>             /* create hash tables for multi-character key bindings */
>       *** Src/Zle/zle_misc.c	1996/12/22 01:13:39	1.1.1.1
>       --- Src/Zle/zle_misc.c	1996/12/24 00:47:00
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         /**/
>       *** Src/Zle/zle_move.c	1996/12/22 01:13:39	1.1.1.1
>       --- Src/Zle/zle_move.c	1996/12/24 00:47:05
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         static vimarkcs[27], vimarkline[27];
>       *** Src/Zle/zle_refresh.c	1996/12/22 01:13:39	1.1.1.1
>       --- Src/Zle/zle_refresh.c	1996/12/24 00:47:16
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         #ifdef HAVE_SELECT
>       *** Src/Zle/zle_tricky.c	1996/12/22 22:26:34	1.4
>       --- Src/Zle/zle_tricky.c	1996/12/24 00:47:41
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         /* The main part of ZLE maintains the line being edited as binary data, *
>       *** Src/Zle/zle_utils.c	1996/12/22 01:13:39	1.1.1.1
>       --- Src/Zle/zle_utils.c	1996/12/24 00:47:47
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         /* make sure that the line buffer has at least sz chars */
>       *** Src/Zle/zle_vi.c	1996/12/22 01:13:39	1.1.1.1
>       --- Src/Zle/zle_vi.c	1996/12/24 00:47:53
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         static int lastmult, lastbuf, lastgotmult, lastgotbuf, inrepeat, vichgrepeat;
>       *** Src/Zle/zle_word.c	1996/12/22 01:13:39	1.1.1.1
>       --- Src/Zle/zle_word.c	1996/12/24 00:47:58
>       ***************
>       *** 29,34 ****
>       --- 29,35 ----
>          *
>          */
>         
>       + #define IN_ZLE
>         #include "zle.h"
>         
>         /**/
> 
> -----BEGIN PGP SIGNATURE-----
> Version: 2.6.2
> 
> iQCVAwUBMr86UHD/+HJTpU/hAQEUdgP/b78wsD8yFozXeWx+cUzpdU6S+L6Ved3o
> SNhvySTqzQ0kXT3V17Ax3eJYVgoIg7c0KgYFjIwgRDptLVtR/rhLaq5boY0F626P
> 7bSKfE0IsrBZ9D2CwSzrDDtcNKbJ/DlVN7pduScxfv7Ewst1TqqPqTQDYPqiv4kM
> HzfgVJf/L2Q=
> =YlYF
> -----END PGP SIGNATURE-----
> 
> 
> 

Hasan Diwan
hdiwan@pop.erols.com

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1209 bytes --]

***************
*** 40,52 ****
  
  #include "zshxmods.h"
  
! #if defined(UNLINKED_XMOD_zle) && !defined(IN_ZLE)
  # define trashzle()      trashzleptr()
  # define zleread(X,Y)    zlereadptr(X,Y)
  # define spaceinline(X)  spaceinlineptr(X)
  # define gotword()       gotwordptr()
  # define refresh()       refreshptr()
! #endif
  
  /* A few typical macros */
  #define minimum(a,b)  ((a) < (b) ? (a) : (b))
--- 40,52 ----
  
  #include "zshxmods.h"
  
! #ifndef IN_ZLE
  # define trashzle()      trashzleptr()
  # define zleread(X,Y)    zlereadptr(X,Y)
  # define spaceinline(X)  spaceinlineptr(X)
  # define gotword()       gotwordptr()
  # define refresh()       refreshptr()
! #endif /* !IN_ZLE */
  
  /* A few typical macros */
  #define minimum(a,b)  ((a) < (b) ? (a) : (b))
***************
*** 1265,1273 ****
  #include "signals.h"
  #include "prototypes.h"
  #include "globals.h"
- #if defined(LINKED_XMOD_zle) && !defined(MODULE)
- # include "zle.h"
- #endif
  #include "hashtable.h"
  
  #endif /*!_ZSH_H*/
--- 1265,1270 ----
  #include "signals.h"
  #include "prototypes.h"
  #include "globals.h"
  #include "hashtable.h"
  
  #endif /*!_ZSH_H*/

[-- Attachment #3: Type: TEXT/PLAIN, Size: 1336 bytes --]

***************
*** 563,583 ****
  /* flag for whether terminal has automargin (wraparound) capability */
  EXTERN int hasam;
  
! #ifdef UNLINKED_XMOD_zle
! # ifdef GLOBALS
! void (*trashzleptr) _((void)) = noop_function;
! unsigned char * (*zlereadptr) _((char *lp, char *rp)) = load_zleread;
! void (*spaceinlineptr) _((int)) = noop_function_int;
! void (*gotwordptr) _((void)) = noop_function;
! void (*refreshptr) _((void)) = noop_function;
! # else /* !GLOBALS */
! extern void (*trashzleptr) _((void));
! extern unsigned char * (*zlereadptr) _((char *lp, char *rp));
! extern void (*spaceinlineptr) _((int));
! extern void (*gotwordptr) _((void));
! extern void (*refreshptr) _((void));
! # endif /* !GLOBALS */
! #endif /* UNLINKED_XMOD_zle */
  
  /* pid of process undergoing 'process substitution' */
   
--- 563,577 ----
  /* flag for whether terminal has automargin (wraparound) capability */
  EXTERN int hasam;
  
! /* ZLE entry point pointers */
! 
! typedef void (*ZleVoidFn) _((void));
! typedef void (*ZleVoidIntFn) _((int));
! typedef unsigned char * (*ZleReadFn) _((char *, char *));
! 
! extern ZleVoidFn trashzleptr, gotwordptr, refreshptr;
! extern ZleVoidIntFn spaceinlineptr;
! extern ZleReadFn zlereadptr;
  
  /* pid of process undergoing 'process substitution' */
   

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

* Re: zle interface improvement
  1996-12-27 23:42   ` Zoltan Hidvegi
@ 1996-12-30  7:54     ` Zefram
  0 siblings, 0 replies; 5+ messages in thread
From: Zefram @ 1996-12-30  7:54 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: Z Shell workers mailing list

Zoltan Hidvegi wrote:
>> only recompiling init.c each time.  (Remember, gdb can't debug
>> modules.)
>
>Of course it can, at least on elf systems.  If you see

Well mine can't.  It professes no knowledge of dynamic linking, and
simply fails to load symbols or debug information for loaded modules.

>that's probably because you use Linux and the binary ld.so.1.8.5
>distribution.  With ld.so.1.8.2 it was possible and there were no such

However, it could be because I'm using Linux with ld.so-1.7.something.

-zefram


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

* Re: zle interface improvement
  1996-12-27 11:18 ` Zefram
@ 1996-12-27 23:42   ` Zoltan Hidvegi
  1996-12-30  7:54     ` Zefram
  0 siblings, 1 reply; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-12-27 23:42 UTC (permalink / raw)
  To: Zefram; +Cc: wayne, zsh-workers

> Wayne Davison wrote:
> >One miniscule optimization would be to allow non-module code to call
> >zle directly if zle is known to be a non-module.

That would really be comletely unnoticable and would only decrease zsh's
size by a few bytes.

> only recompiling init.c each time.  (Remember, gdb can't debug
> modules.)

Of course it can, at least on elf systems.  If you see

warning: Unable to find dynamic linker breakpoint function.
warning: GDB will be unable to debug shared library initializers
warning: and track explicitly loaded dynamic code.

that's probably because you use Linux and the binary ld.so.1.8.5
distribution.  With ld.so.1.8.2 it was possible and there were no such
warning.  I'm told that recompiling ld.so.1.8.5 with -g, or just simply not
stripping it would help here (I did not played with that).

And if you attach a runnig zsh which already loaded a module to gdb, you
can debug the loaded module.  Of course as gdb says you'll be unable to
debug the module initialisation process (i.e. the boot_... function).

Zoltan


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

* Re: zle interface improvement
       [not found] <199612241739.JAA07930@bebop.clari.net>
@ 1996-12-27 11:18 ` Zefram
  1996-12-27 23:42   ` Zoltan Hidvegi
  0 siblings, 1 reply; 5+ messages in thread
From: Zefram @ 1996-12-27 11:18 UTC (permalink / raw)
  To: Wayne Davison; +Cc: Z Shell workers mailing list

Wayne Davison wrote:
>One miniscule optimization would be to allow non-module code to call
>zle directly if zle is known to be a non-module.
...
>This would allow someone to compile a non-module version of zsh with
>no extra overhead, so it might be worth the extra complexity (or it
>might make so little difference as to be worthless).  Just a thought...

That *could* be done without having incompatible module interfaces (but
it's more complicated than the code you suggest).  But this buys very
little (try grepping for trashzle and the others), and it forces a
complete rebuild if the linked-in-ness of ZLE changes.  At the moment
I'm happily swapping modules in and out of my development executable,
only recompiling init.c each time.  (Remember, gdb can't debug
modules.)

-zefram


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

end of thread, other threads:[~1996-12-30 11:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-24 11:28 zle interface improvement Zefram
1996-12-24 15:03 ` Hasan Diwan
     [not found] <199612241739.JAA07930@bebop.clari.net>
1996-12-27 11:18 ` Zefram
1996-12-27 23:42   ` Zoltan Hidvegi
1996-12-30  7:54     ` Zefram

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