From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16752 invoked from network); 25 Feb 2005 14:07:41 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 25 Feb 2005 14:07:41 -0000 Received: (qmail 52760 invoked from network); 25 Feb 2005 14:07:36 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 25 Feb 2005 14:07:36 -0000 Received: (qmail 14750 invoked by alias); 25 Feb 2005 14:07:33 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20868 Received: (qmail 14737 invoked from network); 25 Feb 2005 14:07:32 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 25 Feb 2005 14:07:32 -0000 Received: (qmail 52455 invoked from network); 25 Feb 2005 14:07:32 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 25 Feb 2005 14:07:27 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id ; Fri, 25 Feb 2005 14:05:56 +0000 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 25 Feb 2005 14:08:26 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j1PE7Pb1018702; Fri, 25 Feb 2005 14:07:25 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j1PE7Oq8018699; Fri, 25 Feb 2005 14:07:25 GMT Message-Id: <200502251407.j1PE7Oq8018699@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Atousa Pahlevan , zsh-workers@sunsite.dk Subject: Re: zsh In-reply-to: References: Date: Fri, 25 Feb 2005 14:07:24 +0000 From: Peter Stephenson X-OriginalArrivalTime: 25 Feb 2005 14:08:26.0643 (UTC) FILETIME=[79940630:01C51B43] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.5 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.5 Atousa Pahlevan wrote: > Hi, > I am trying to find out the architecture of zsh.But I only find subsytems > which all of them talk to each other.I haven't find any pipe & filters or > even the other pattern for it(only a graph).Please guid me to do this. There's no detailed documentation about the overall structure. Start looking at loop() in init.c. This is the main command loop (it's also used internally). There's a lot of initialisation before that, but you don't need that for a first pass. There are basically two steps to each set of commands: parse it, then execute it. Parsing (in parse.c) reads tokens from the lexer (in lex.c) which in turn gets bytes from the history mechanism (in hist.c: in non-interactive shells this is a fairly shallow layer over input.c), which uses the input mechanism (in input.c), which either reads lines directly from its input or, in an interactive shell, reads a line from the line editor in the Zle directory via a call to zleread(). You'll see in loop() there are calls to hbegin and hend, which initialise the history mechanism, and to lexinit, which initialises the lexical analyser. The input mechanism just passes its request on and zleread will perform its own initialisation when it needs it. Then the command line is read by a call to parse_event(). You can (maybe!) trace how that works that through parse.c. This returns a pointer to a "struct eprog", which is a highly compacted version of the parsed code. This is then passed via execode() down to the code in exec.c which executes it. The code there roughly corresponds to the documented grammar in the zshmisc manual page (as, indeed, does parse.c). The core of this is execcmd, which executes each individual command with its arguments. The pipeline stuff at the level above is particularly complicated in order to get job control to work properly. exec.c makes a lot of use of the functions in jobs.c which records jobs and processes mostly for interactive job control; the file signal signals.c is also related and contains the handler function zhandler used, among other things, for recording the fact that a child process has executed. Every stage of the process is cluttered by lots of little details you don't need to know in the first instance; unfortunately it's not clearly spelled out what's essential and what isn't. -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************