Home > Archive > Tcl > November 2006 > history access via tcl's C API?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
history access via tcl's C API?
|
|
| MartinLemburg@UGS 2006-11-26, 7:04 pm |
| Hi,
a topic related to a further Tcl_RecordAndEval(Obj) question is the
access to the history recorded by Tcl_RecordAndEval or
Tcl_RecordAndEvalObj.
The access to the tcl command history is only possible by using tcl
commands, but not via C(++), right?
And the history command does not return normal tcl values, like lists,
but more or less visual content to read by a console user, right?
Isn't it time to change this?
What's about a tcl history C API comparable to the pure tcl history
API? Something like ...
int Tcl_HistoryAddEvent( const char *event )
int Tcl_HistoryAddEventObj( const Tcl_Obj *eventObjPtr )
int Tcl_HistoryChangeEvent( int eventNo, const char *event )
int Tcl_HistoryChangeEventObj( int eventNo, const Tcl_Obj
*eventObjPtr )
int Tcl_HistoryClear()
int Tcl_HistoryInfo( int *count, Tcl_Obj ***eventObjArrayPtr )
count would be an in and out parameter telling the count of
events to inform about
and the maximum size of the array. if "count" is 0, than all
events are returned
int Tcl_HistoryKeep( int count )
int Tcl_HistoryNextId()
int Tcl_HistoryRedo( int eventNo )
Currently the tcl interface to the history works completely in tcl, but
the proposed C API could work on C data structures and the tcl inteface
could be reimplement to use the new C API.
If there are some people wanting this, I would try to create a TIP and
a reference implementation.
Thanks in advance for any suggestion, comment, ...!
Best regards,
Martin Lemburg
UGS - Transforming the Process of Innovation
| |
| suchenwi 2006-11-27, 7:05 pm |
|
MartinLemburg@UGS schrieb:
> What's about a tcl history C API comparable to the pure tcl history
> API? Something like ...
>
> int Tcl_HistoryAddEvent( const char *event )
> int Tcl_HistoryAddEventObj( const Tcl_Obj *eventObjPtr )
> int Tcl_HistoryChangeEvent( int eventNo, const char *event )
> int Tcl_HistoryChangeEventObj( int eventNo, const Tcl_Obj
> *eventObjPtr )
> int Tcl_HistoryClear()
> int Tcl_HistoryInfo( int *count, Tcl_Obj ***eventObjArrayPtr )
> count would be an in and out parameter telling the count of
> events to inform about
> and the maximum size of the array. if "count" is 0, than all
> events are returned
> int Tcl_HistoryKeep( int count )
> int Tcl_HistoryNextId()
> int Tcl_HistoryRedo( int eventNo )
>
Is it worth blowing up the Tcl C API with nine more functions? With the
readline-like behavior of tclsh / wish console on Windows, or tkcon on
any platform, I never really bothered to use history functionality in
quite some years now...
| |
| suchenwi 2006-11-27, 7:05 pm |
| oh, and the [history] command is implemented in Tcl anyway - see
lib/tcl8.4/history.tcl :^)
| |
| MartinLemburg@UGS 2006-11-27, 7:05 pm |
| Hello RIchard,
On Nov 27, 3:57 pm, "suchenwi"
<richard.suchenwirth-bauersa...@siemens.com> wrote:
> MartinLemburg@UGS schrieb:
> ...
> readline-like behavior of tclsh / wish console on Windows, or tkcon on
> any platform, I never really bothered to use history functionality in
> quite some years now...
Ok - I never bothered at all too, until I had to write a MFC based tcl
console, wanting to use the tcl internal history mechanism, that is not
really tcl internal, but in "hinstory.tcl" and only accessable from tcl
or via Tcl_Eval & Co from C(++).
I stumbled upon this, because the history mechanism returns more or
less structured information for viewing, than for processing, so it is
unnecessary complicated to access the history.
Ok - I made the MFC console, it works using Tcl_RecordAndEval and the
history tcl command, but it could have been a bit easier.
----
But you are perhabs right - the tcl core API is big. Perhabs it isn't
that good to let it grew once more.
Best regards,
Martin Lemburg
UGS - Transforming the Process of Innovation
|
|
|
|
|