Check-in [51f17cd0ae]
Not logged in
Overview
SHA1:51f17cd0aea117ad5517a445a40c1570aceb546e
Date: 2014-03-17 21:55:02
User: quentin@minster.io
Comment:Style/cosmetic changes to C files
Timelines: family | ancestors | descendants | both | trunk | origin/devel
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-03-17
22:10
[743c61fc2e] Leaf: Update meta files * Add self to AUTHORS * Cosmetic changes to README * Update TODOs (user: quentin@minster.io, tags: trunk, origin/devel)
21:55
[51f17cd0ae] Style/cosmetic changes to C files (user: quentin@minster.io, tags: trunk, origin/devel)
21:54
[32a8974959] Regenerate config.h.in using autoheader (user: quentin@minster.io, tags: trunk, origin/devel)
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Modified tclreadline.c from [8e0b5f7ca4] to [ba99704a3e].

     1         - /* ==================================================================
     2         -    FILE: tclreadline.c
     3         -    $Id$
     4         -    ---
     5         -    tclreadline -- gnu readline for tcl
     6         -    http://www.zellner.org/tclreadline/
     7         -    Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
     8         -    This software is copyright under the BSD license.
     9         -    ================================================================== */
            1  + /* ================================================================== *
            2  +  * FILE: tclreadline.c
            3  +  * $Id$
            4  +  * ---
            5  +  * tclreadline -- gnu readline for tcl
            6  +  * http://www.zellner.org/tclreadline/
            7  +  * Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
            8  +  * This software is copyright under the BSD license.
            9  +  * ================================================================== */
    10     10   
    11     11   #ifdef HAVE_CONFIG_H
    12     12   #  include "config.h"
    13     13   #endif
    14     14   
    15     15   #include <tcl.h>
    16     16   #include <stdio.h>
................................................................................
    46     46   static const char* tclrl_version_str = TCLRL_VERSION_STR;
    47     47   static const char* tclrl_patchlevel_str = TCLRL_PATCHLEVEL_STR;
    48     48   
    49     49   #define MALLOC(size) malloc(size)
    50     50   #define FREE(ptr) free(ptr); ptr = NULL
    51     51   
    52     52   enum {
    53         -    _CMD_SET     = (1 << 0),
    54         -    _CMD_GET     = (1 << 1)
           53  +    _CMD_SET = (1 << 0),
           54  +    _CMD_GET = (1 << 1)
    55     55   };
    56     56   
    57     57   
    58     58   typedef struct cmds_t {
    59     59       struct cmds_t* prev;
    60     60       char**         cmd;
    61     61       struct cmds_t* next;
    62     62   } cmds_t;
    63     63   
    64     64   
    65     65   #define ISWHITE(c) ((' ' == c) || ('\t' == c) || ('\n' == c))
    66     66   
    67         -/* forward declarations. */
    68         -static char* stripleft(char* in);
    69         -static char* stripright(char* in);
    70         -static char* stripwhite(char* in);
    71         -static int TclReadlineLineComplete(void);
    72         -static void TclReadlineTerminate(int state);
    73         -static char* TclReadlineQuote(char* text, char* quotechars);
    74         -static int TclReadlineCmd(ClientData clientData, Tcl_Interp *interp, int objc,
    75         -                   Tcl_Obj *CONST objv[]);
    76         -static void TclReadlineReadHandler(ClientData clientData, int mask);
    77         -static void TclReadlineLineCompleteHandler(char* ptr);
    78         -static int TclReadlineInitialize(Tcl_Interp* interp, char* historyfile);
    79         -static int blank_line(char* str);
           67  +/**
           68  + * forward declarations
           69  + */
           70  +static char*  stripleft(char* in);
           71  +static char*  stripright(char* in);
           72  +static char*  stripwhite(char* in);
           73  +static int    TclReadlineLineComplete(void);
           74  +static void   TclReadlineTerminate(int state);
           75  +static char*  TclReadlineQuote(char* text, char* quotechars);
           76  +static int    TclReadlineCmd(ClientData clientData, Tcl_Interp *interp, int objc,
           77  +                             Tcl_Obj *CONST objv[]);
           78  +static void   TclReadlineReadHandler(ClientData clientData, int mask);
           79  +static void   TclReadlineLineCompleteHandler(char* ptr);
           80  +static int    TclReadlineInitialize(Tcl_Interp* interp, char* historyfile);
           81  +static int    blank_line(char* str);
    80     82   static char** TclReadlineCompletion(char* text, int start, int end);
    81         -static char* TclReadline0generator(char* text, int state);
    82         -static char* TclReadlineKnownCommands(char* text, int state, int mode);
    83         -static int TclReadlineParse(char** args, int maxargs, char* buf);
           83  +static char*  TclReadline0generator(char* text, int state);
           84  +static char*  TclReadlineKnownCommands(char* text, int state, int mode);
           85  +static int    TclReadlineParse(char** args, int maxargs, char* buf);
    84     86   
    85     87   
    86     88   enum {
    87         -    LINE_PENDING = -1,
    88         -    LINE_EOF = (1 << 8),
           89  +    LINE_PENDING  = -1,
           90  +    LINE_EOF      = (1 << 8),
    89     91       LINE_COMPLETE = (1 << 9)
    90     92   };
    91     93   
    92     94   /**
    93     95    * global variables
    94     96    */
    95         -static int tclrl_state = TCL_OK;
    96         -static char* tclrl_eof_string = (char*) NULL;
    97         -static char* tclrl_custom_completer = (char*) NULL;
    98         -static char* tclrl_last_line = (char*) NULL;
    99         -static int tclrl_use_builtin_completer = 1;
   100         -static int tclrl_history_length = -1;
   101         -Tcl_Interp* tclrl_interp = (Tcl_Interp*) NULL;
           97  +static int   tclrl_state                 = TCL_OK;
           98  +static char* tclrl_eof_string            = (char*) NULL;
           99  +static char* tclrl_custom_completer      = (char*) NULL;
          100  +static char* tclrl_last_line             = (char*) NULL;
          101  +static int   tclrl_use_builtin_completer = 1;
          102  +static int   tclrl_history_length        = -1;
          103  +Tcl_Interp*  tclrl_interp                = (Tcl_Interp*) NULL;
   102    104   
   103    105   static char* tclrl_license =
   104    106   "   Copyright (c) 1998 - 2000, Johannes Zellner <johannes@zellner.org>\n"
   105    107   "   All rights reserved.\n"
   106    108   "   \n"
   107    109   "   Redistribution and use in source and binary forms, with or without\n"
   108    110   "   modification, are permitted provided that the following conditions\n"

Modified tclreadline.h.in from [d85f8fea8d] to [bcab9b4af6].

     1         - /* ==================================================================
     2         -    FILE: tclreadline.h.in
     3         -    $Id$
     4         -    ---
     5         -    tclreadline -- gnu readline for tcl
     6         -    http://www.zellner.org/tclreadline/
     7         -    Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
     8         -    This software is copyright under the BSD license.
     9         -    ================================================================== */
            1  + /* ================================================================== *
            2  +  * FILE: tclreadline.h.in
            3  +  * $Id$
            4  +  * ---
            5  +  * tclreadline -- gnu readline for tcl
            6  +  * http://www.zellner.org/tclreadline/
            7  +  * Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
            8  +  * This software is copyright under the BSD license.
            9  +  * ================================================================== */
    10     10   
    11     11   #ifndef TCLREADLINE_H_
    12     12   #define TCLREADLINE_H_
    13     13   
    14     14   #include <tcl.h>
    15     15   
    16     16   #define TCLRL_LIBRARY        "@TCLRL_DIR@"

Modified tclshrl.c from [c7e5e71138] to [bbacf8add5].

     1         - /* ==================================================================
     2         -    FILE: tclshrl.c
     3         -    $Id$
     4         -    ---
     5         -    tclreadline -- gnu readline for tcl
     6         -    http://www.zellner.org/tclreadline/
     7         -    Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
     8         -    This software is copyright under the BSD license.
     9         -    ================================================================== */
            1  + /* ================================================================== *
            2  +  * FILE: tclshrl.c
            3  +  * $Id$
            4  +  * ---
            5  +  * tclreadline -- gnu readline for tcl
            6  +  * http://www.zellner.org/tclreadline/
            7  +  * Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
            8  +  * This software is copyright under the BSD license.
            9  +  * ================================================================== */
    10     10   
    11     11   #ifdef HAVE_CONFIG_H
    12         -#   include "config.h"
           12  +#  include "config.h"
    13     13   #endif
    14     14   
           15  +#include <stdlib.h>
    15     16   #include <tcl.h>
    16     17   #include <tclreadline.h>
    17     18   
    18         -#if 0
    19         -#include <assert.h>
    20         -#endif
    21         -
    22     19   extern int Tclreadline_Init(Tcl_Interp *interp);
    23     20   extern int Tclreadline_SafeInit(Tcl_Interp *interp);
    24     21   
    25     22   int
    26     23   TclreadlineAppInit(Tcl_Interp* interp)
    27     24   {
    28     25       char file[0xff];
    29     26       int status;
    30         -#if 0
    31         -    assert(Tcl_InitStubs(interp, TCL_VERSION, 0));
    32         -#endif
    33     27       if (TCL_ERROR == Tcl_Init(interp)) {
    34     28           return TCL_ERROR;
    35     29       }
    36     30       if (TCL_ERROR == Tclreadline_Init(interp)) {
    37     31           return TCL_ERROR;
    38     32       }
    39     33       Tcl_StaticPackage(interp, "tclreadline",
    40         -    Tclreadline_Init, Tclreadline_SafeInit);
           34  +                      Tclreadline_Init, Tclreadline_SafeInit);
    41     35   #if (TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION == 4)
    42     36       tcl_RcFileName = "~/.tclshrc";
    43     37   #else
    44     38       Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
    45     39   #endif
    46     40       sprintf(file, "%s/tclreadlineInit.tcl", TCLRL_LIBRARY);
    47     41       if ((status = Tcl_EvalFile(interp, file))) {
    48     42           fprintf(stderr, "(TclreadlineAppInit) unable to eval %s\n", file);
    49         -        exit (1);
           43  +        exit (EXIT_FAILURE);
    50     44       }
    51     45       return TCL_OK;
    52     46   }
    53     47   
    54     48   int
    55     49   main(int argc, char *argv[])
    56     50   {
    57     51       Tcl_Main(argc, argv, TclreadlineAppInit);
    58         -    return 0;
           52  +    return EXIT_SUCCESS;
    59     53   }

Modified wishrl.c from [d3a28cc973] to [9a235afaa7].

     1         - /* ==================================================================
     2         -    FILE: wishrl.c
     3         -    $Id$
     4         -    ---
     5         -    tclreadline -- gnu readline for tcl
     6         -    http://www.zellner.org/tclreadline/
     7         -    Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
     8         -    This software is copyright under the BSD license.
     9         -    ================================================================== */
            1  + /* ================================================================== *
            2  +  * FILE: wishrl.c
            3  +  * $Id$
            4  +  * ---
            5  +  * tclreadline -- gnu readline for tcl
            6  +  * http://www.zellner.org/tclreadline/
            7  +  * Copyright (c) 1998 - 2014, Johannes Zellner <johannes@zellner.org>
            8  +  * This software is copyright under the BSD license.
            9  +  * ================================================================== */
    10     10   
    11     11   #ifdef HAVE_CONFIG_H
    12         -#   include "config.h"
           12  +#  include "config.h"
    13     13   #endif
    14     14   
           15  +#include <stdlib.h>
    15     16   #include <tcl.h>
    16     17   #include <tk.h>
    17     18   #include <tclreadline.h>
    18     19   
    19     20   extern int Tclreadline_Init(Tcl_Interp *interp);
    20     21   extern int Tclreadline_SafeInit(Tcl_Interp *interp);
    21     22   
................................................................................
    40     41       tcl_RcFileName = "~/.wishrc";
    41     42   #else
    42     43       Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
    43     44   #endif
    44     45       sprintf(file, "%s/tclreadlineInit.tcl", TCLRL_LIBRARY);
    45     46       if ((status = Tcl_EvalFile(interp, file))) {
    46     47           fprintf(stderr, "(TclreadlineAppInit) unable to eval %s\n", file);
    47         -        exit (1);
           48  +        exit (EXIT_FAILURE);
    48     49       }
    49     50       return TCL_OK;
    50     51   }
    51     52   
    52     53   int
    53     54   main(int argc, char *argv[])
    54     55   {
    55     56       Tk_Main(argc, argv, TclreadlineAppInit);
    56         -    return 0;
           57  +    return EXIT_SUCCESS;
    57     58   }