Check-in [c4dee8e781]
Not logged in
Overview
Comment:before initial relase
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c4dee8e7814b6176797fdad95fa3f2c26a71f9f5
User & Date: johannes@zellner.org on 1999-02-28 16:54:42.000
Other Links: manifest | tags
Context
1999-02-28
17:08
before initial relase check-in: ea3499a82a user: johannes@zellner.org tags: trunk
16:54
before initial relase check-in: c4dee8e781 user: johannes@zellner.org tags: trunk
16:52
ci after porting this to configure check-in: eb8595aabf user: johannes@zellner.org tags: trunk
Changes
Added GPL version [4238e547f1].
1
2
3
4
5
6
7
8
9
10
11
# -*- make -*-
#
# FILE: "/home/joze/src/tclreadline/Makefile.in"
# LAST MODIFIED: "Sun Feb 28 17:48:01 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner
# Johannes.Zellner@physik.uni-karlsruhe.de
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner



|







1
2
3
4
5
6
7
8
9
10
11
# -*- make -*-
#
# FILE: "/home/joze/src/tclreadline/Makefile.in"
# LAST MODIFIED: "Sun Feb 28 17:54:34 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner
# Johannes.Zellner@physik.uni-karlsruhe.de
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
    aux/mkinstalldirs \
    aux/vimtags

MISC = README GPL

MAN = tclreadline.n

CIFLAGS = -t-"gnu readline for tcl" -m"ci after porting this to configure"

.PHONY: clean distclean ctags tcltags vimtags tags ci co

.SUFFIXES: .c .o .so .sl .tcl

all: $(TCLREADLINE_LIB_FILE) pkgIndex.tcl








|







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
    aux/mkinstalldirs \
    aux/vimtags

MISC = README GPL

MAN = tclreadline.n

CIFLAGS = -t-"gnu readline for tcl" -m"before initial relase"

.PHONY: clean distclean ctags tcltags vimtags tags ci co

.SUFFIXES: .c .o .so .sl .tcl

all: $(TCLREADLINE_LIB_FILE) pkgIndex.tcl

250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271

vimtags: tcltags
	vimtags

tags: vimtags


ci: $(SOURCES)
	ci  -r"0.1"  -l  $(CIFLAGS) $(SOURCES)

co: $(SOURCES)
	co -l $(SOURCES)

distribution: $(SOURCES) configure $(AUXILIARY) $(MISC)
	- mkdir tclreadline-$(VERSION)
	- mkdir tclreadline-$(VERSION)/aux
	- cp $(SOURCES) $(MISC) configure tclreadline-$(VERSION)
	- cp $(AUXILIARY) tclreadline-$(VERSION)/aux
	tar zcvf $(srcdir)/tclreadline-$(VERSION).tgz tclreadline-$(VERSION)


# DO NOT DELETE THIS LINE -- make depend depends on it.







|
|

|
|










250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271

vimtags: tcltags
	vimtags

tags: vimtags


ci: $(SOURCES) $(MISC)
	ci  -l  $(CIFLAGS) $^

co: $(SOURCES) $(MISC)
	co -l $^

distribution: $(SOURCES) configure $(AUXILIARY) $(MISC)
	- mkdir tclreadline-$(VERSION)
	- mkdir tclreadline-$(VERSION)/aux
	- cp $(SOURCES) $(MISC) configure tclreadline-$(VERSION)
	- cp $(AUXILIARY) tclreadline-$(VERSION)/aux
	tar zcvf $(srcdir)/tclreadline-$(VERSION).tgz tclreadline-$(VERSION)


# DO NOT DELETE THIS LINE -- make depend depends on it.
Added README version [20d94bdcdb].
1

2
3
4
5
6

7





















8
9
10
11
12
13
14


15
16
17
18
19
20
21
/* 

 * FILE: "/home/joze/tmp/tclreadline/tclreadline.c"
 * LAST MODIFIED: "Sat Oct 03 03:06:54 1998 (joze)"
 * (c) 1998 by Johannes Zellner
 * Johannes.Zellner@physik.uni-karlsruhe.de
 * $Id$

 */






















#include <tcl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <readline.h>
#include <history.h>



#define MALLOC(size) Tcl_Alloc ((int) size)
#define FREE(ptr) if (ptr) Tcl_Free ((char *) ptr)

#define _CMD_SET	(1 << 0)
#define _CMD_GET	(1 << 1)
#define _CMD_SUB_GET	(1 << 2)
|
>
|
|
|
|
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

 /* ==================================================================
    FILE: "/home/joze/src/tclreadline/tclreadline.c"
    LAST MODIFIED: "Sun Feb 28 15:01:31 1999 (joze)"
    (C) 1998, 1999 by Johannes Zellner
    Johannes.Zellner@physik.uni-karlsruhe.de
    $Id$
    ---

    tclreadline -- gnu readline for tcl
    Copyright (C) 1999  Johannes Zellner

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

    Johannes.Zellner@physik.uni-karlsruhe.de
    http://krisal.physik.uni-karlsruhe.de/~joze
    ================================================================== */  


#include <tcl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <readline.h>
#include <history.h>

#include <tclreadline.h>

#define MALLOC(size) Tcl_Alloc ((int) size)
#define FREE(ptr) if (ptr) Tcl_Free ((char *) ptr)

#define _CMD_SET	(1 << 0)
#define _CMD_GET	(1 << 1)
#define _CMD_SUB_GET	(1 << 2)
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
do {                    \
    STRIPLEFT (ptr);    \
    STRIPRIGHT (ptr);   \
} while (0)



    /*
extern char *rl_readline_name = "tclreadline";
    */


/*
 * forward declarations.
 */
int	TclReadlineCmd	(ClientData clientData, Tcl_Interp *interp,
                         int argc, char **argv);







<
<
<







73
74
75
76
77
78
79



80
81
82
83
84
85
86
do {                    \
    STRIPLEFT (ptr);    \
    STRIPRIGHT (ptr);   \
} while (0)








/*
 * forward declarations.
 */
int	TclReadlineCmd	(ClientData clientData, Tcl_Interp *interp,
                         int argc, char **argv);
74
75
76
77
78
79
80






81
82
83
84
85
86
87
int	TclReadlineEventHook	(void);
int	TclReadlineParse	(char **args, int maxargs, char *buf);


static int line_complete = 0;
static char *line = (char *) NULL;









int TclReadlineCmd (clientData, interp, argc, argv)
    ClientData clientData;	/* Main window associated with interpreter  */
    Tcl_Interp *interp;		/* Current interpreter                      */
    int argc;			/* Number of arguments                      */
    char **argv;		/* Argument strings                         */







>
>
>
>
>
>







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
int	TclReadlineEventHook	(void);
int	TclReadlineParse	(char **args, int maxargs, char *buf);


static int line_complete = 0;
static char *line = (char *) NULL;


/*
 * Script to set the tclreadline library path in the
 * variable global "tclreadline_library"
 */



int TclReadlineCmd (clientData, interp, argc, argv)
    ClientData clientData;	/* Main window associated with interpreter  */
    Tcl_Interp *interp;		/* Current interpreter                      */
    int argc;			/* Number of arguments                      */
    char **argv;		/* Argument strings                         */
153
154
155
156
157
158
159








160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
    else if (c == 'a'  && strncmp (argv[1], "add", length) == 0) {
        if (argc != 3)
            goto BAD_COMMAND;
        else if (TclReadlineKnownCommands (argv[2], (int) 0, _CMD_SET))
            Tcl_AppendResult (interp, "unable to add command \"",
                    argv[2], "\"\n", (char *) NULL);
    }








    else
        goto BAD_COMMAND;


    return TCL_OK;

BAD_COMMAND:
    Tcl_AppendResult (interp,
            "wrong # args: should be \"readline option ?arg ...?\"",
	    (char *) NULL);
    return TCL_ERROR;

}

void TclReadlineDataAvailableHandler (ClientData clientData, int mask)
{
    if (mask & TCL_READABLE)
        rl_callback_read_char ();







>
>
>
>
>
>
>
>










|







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
    else if (c == 'a'  && strncmp (argv[1], "add", length) == 0) {
        if (argc != 3)
            goto BAD_COMMAND;
        else if (TclReadlineKnownCommands (argv[2], (int) 0, _CMD_SET))
            Tcl_AppendResult (interp, "unable to add command \"",
                    argv[2], "\"\n", (char *) NULL);
    }
    else if (c == 'c'  && strncmp (argv[1], "complete", length) == 0) {
        if (argc != 3)
            goto BAD_COMMAND;
        else if (Tcl_CommandComplete (argv[2]))
            Tcl_AppendResult (interp, "1", (char *) NULL);
        else
            Tcl_AppendResult (interp, "0", (char *) NULL);
    }
    else
        goto BAD_COMMAND;


    return TCL_OK;

BAD_COMMAND:
    Tcl_AppendResult (interp,
            "wrong # args: should be \"readline option ?arg ...?\"",
	    (char *) NULL);
    return (TCL_ERROR);

}

void TclReadlineDataAvailableHandler (ClientData clientData, int mask)
{
    if (mask & TCL_READABLE)
        rl_callback_read_char ();
190
191
192
193
194
195
196

197
198
199
200
201
202
203
204
205

206
207
208
209
210
211
212
213
214
215
216
int Tclreadline_SafeInit (Tcl_Interp *interp)
{
    return (Tclreadline_Init (interp));
}

int Tclreadline_Init (Tcl_Interp *interp)
{

    Tcl_CreateCommand (interp, "::tclreadline::readline", TclReadlineCmd,
	    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);

    return (Tcl_PkgProvide (interp, "tclreadline", TCLREADLINE_VERSION));
}

char *TclReadlineInitialize (char *historyfile)
{


    using_history ();
    /*
    rl_event_hook = TclReadlineEventHook;
    */

    /*
     * try to read historyfile in home
     * directory. If this failes, this
     * is *not* an error.
     */
    rl_attempted_completion_function = (CPPFunction *) TclReadlineCompletion;







>









>

<
<
<







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244



245
246
247
248
249
250
251
int Tclreadline_SafeInit (Tcl_Interp *interp)
{
    return (Tclreadline_Init (interp));
}

int Tclreadline_Init (Tcl_Interp *interp)
{
    
    Tcl_CreateCommand (interp, "::tclreadline::readline", TclReadlineCmd,
	    (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);

    return (Tcl_PkgProvide (interp, "tclreadline", TCLREADLINE_VERSION));
}

char *TclReadlineInitialize (char *historyfile)
{

    rl_readline_name = "tclreadline";
    using_history ();




    /*
     * try to read historyfile in home
     * directory. If this failes, this
     * is *not* an error.
     */
    rl_attempted_completion_function = (CPPFunction *) TclReadlineCompletion;

1
2
3
4
5
6
7






















8
9
10
11
12
13
14
15


# ==================================================================
# FILE: "/home/joze/tmp/tclreadline/tclreadlineConfig.sh.in"
# LAST MODIFIED: "Sat Oct 03 00:01:19 1998 (joze)"
# (c) 1998 by Johannes Zellner
# Johannes.Zellner@physik.uni-karlsruhe.de
# $Id$






















# ==================================================================
# 
# This shell script (for sh) is generated automatically by tclreadline's
# configure script.  It will create shell variables for most of
# the configuration options discovered by the configure script.
# This script is intended to be included by the configure scripts
# for tclreadline extensions so that they don't have to figure this all
# out for themselves.  This file does not duplicate information
>
|
<
|
|
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







1
2

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- sh -*-
#

# FILE: "/home/joze/src/tclreadline/tclreadlineConfig.sh.in"
# LAST MODIFIED: "Sun Feb 28 15:27:46 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner
# Johannes.Zellner@physik.uni-karlsruhe.de
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# Johannes.Zellner@physik.uni-karlsruhe.de
# http://krisal.physik.uni-karlsruhe.de/~joze
#
# ================================================================== 
# 
# This shell script (for sh) is generated automatically by tclreadline's
# configure script.  It will create shell variables for most of
# the configuration options discovered by the configure script.
# This script is intended to be included by the configure scripts
# for tclreadline extensions so that they don't have to figure this all
# out for themselves.  This file does not duplicate information
1
2

3
4
5
6
7






















8
9
10
11
12

13

14







15
16
17
18
19
20
21
22
23
#!/usr/local/bin/tclsh
# ==================================================================

# FILE: "/home/joze/tmp/tclreadline/tclreadlineInit.tcl.in"
# LAST MODIFIED: "Sat Oct 03 02:31:48 1998 (joze)"
# (c) 1998 by Johannes Zellner
# Johannes.Zellner@physik.uni-karlsruhe.de
# $Id$






















# ==================================================================

package provide tclreadline @TCLREADLINE_VERSION@

namespace eval tclreadline:: {



    proc Init {} {







        catch {load @TERMCAP_LOAD_PATH@}
        catch {load @READLINE_LOAD_PATH@}
        if {[catch {load @TCLREADLINE_LIB_FILE@} msg]} {
            puts stderr $msg
            exit 2
        }
    }

}

<
>
|
|
|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|




>
|
>
|
>
>
>
>
>
>
>
|
|
|
|
|
|
|

<
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

#!/usr/local/bin/tclsh

#
# FILE: "/home/joze/src/tclreadline/tclreadlineInit.tcl.in"
# LAST MODIFIED: "Sun Feb 28 15:28:36 1999 (joze)"
# (C) 1998, 1999 by Johannes Zellner
# Johannes.Zellner@physik.uni-karlsruhe.de
# $Id$
# ---
#
# tclreadline -- gnu readline for tcl
# Copyright (C) 1999  Johannes Zellner
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# Johannes.Zellner@physik.uni-karlsruhe.de
# http://krisal.physik.uni-karlsruhe.de/~joze
#
# ================================================================== 

package provide tclreadline @TCLREADLINE_VERSION@

namespace eval tclreadline:: {
    namespace export Init
}

proc ::tclreadline::Init {} {
    
    global tclreadline_version
    global tclreadline_library
    
    set tclreadline_version @TCLREADLINE_VERSION@
    set tclreadline_library @TCLREADLINE_LIBRARY@

    catch {load @TERMCAP_LOAD_PATH@}
    catch {load @READLINE_LOAD_PATH@}
    if [catch {load @TCLREADLINE_LIBRARY@/@TCLREADLINE_LIB_FILE@} msg] {
        puts stderr $msg
        exit 2
    }
}