Motherboard Forums


Reply
Thread Tools Display Modes

small "readline" routine?

 
 
Grant Edwards
Guest
Posts: n/a
 
      01-07-2004, 10:20 PM
I need to add a simple command-line interface to an embedded
project. Has anybody run across a small, free, readline-like
library that provides rudimentary command-line editing?

--
Grant Edwards grante Yow! BRILL CREAM is
at CREAM O' WHEAT in another
visi.com DIMENSION...
 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      01-08-2004, 04:21 AM
On 07 Jan 2004 22:20:34 GMT, Grant Edwards <(E-Mail Removed)> wrote in
comp.arch.embedded:

> I need to add a simple command-line interface to an embedded
> project. Has anybody run across a small, free, readline-like
> library that provides rudimentary command-line editing?


I think your question is a little too vague, but if you provide more
detail you can probably find something you can use.

What processor, language, compiler, communications interface? How
much RAM and code space are available? Do you just want a line
input/editor or text parser as well? What does your command line
interface look like? What sort of editing features?

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 
Reply With Quote
 
 
 
 
Grzegorz Mazur
Guest
Posts: n/a
 
      01-08-2004, 08:12 AM
"Grant Edwards" <(E-Mail Removed)> wrote in message
news:3ffc8631$0$967$(E-Mail Removed).. .
> I need to add a simple command-line interface to an embedded
> project. Has anybody run across a small, free, readline-like
> library that provides rudimentary command-line editing?


Actually I believe that writing such routine would take less time than
searching for it and adopting it to your project. The whole stuff (with
backspace and line length limit handling) takes less than 20 lines of C code
and approx. 35 lines of 51 assembly.


 
Reply With Quote
 
Scott Moore
Guest
Posts: n/a
 
      01-08-2004, 10:23 AM
I heard gdb has a general purpose routine like that. I usually write my own, it takes about
2 or 3 pages if you make it full featured (arrow editing, insert/overwrite mode, word forward,
word back, history recall, etc).

I allways thought it was facinating that you can write such a routine with just backspace as the
only control character used to manipulate the screen. Cursor forward is done by outputting the
character at the position.

"Grant Edwards" <(E-Mail Removed)> wrote in message news:3ffc8631$0$967$(E-Mail Removed).. .
> I need to add a simple command-line interface to an embedded
> project. Has anybody run across a small, free, readline-like
> library that provides rudimentary command-line editing?
>
> --
> Grant Edwards grante Yow! BRILL CREAM is
> at CREAM O' WHEAT in another
> visi.com DIMENSION...



 
Reply With Quote
 
Mark A. Odell
Guest
Posts: n/a
 
      01-08-2004, 02:22 PM
"Grzegorz Mazur" <(E-Mail Removed)> wrote in
news:btj3ds$2mjq$(E-Mail Removed):

>> I need to add a simple command-line interface to an embedded
>> project. Has anybody run across a small, free, readline-like
>> library that provides rudimentary command-line editing?

>
> Actually I believe that writing such routine would take less time than
> searching for it and adopting it to your project. The whole stuff (with
> backspace and line length limit handling) takes less than 20 lines of C
> code and approx. 35 lines of 51 assembly.


I'm thinking of the bash shell command line editing capabilities and
wondering how that could possibly be about 20 lines of C. I'd like to see
this implementation of yours.

--
- Mark ->
--
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      01-08-2004, 02:51 PM
On 2004-01-08, Jack Klein <(E-Mail Removed)> wrote:

>> I need to add a simple command-line interface to an embedded
>> project. Has anybody run across a small, free, readline-like
>> library that provides rudimentary command-line editing?

>
> I think your question is a little too vague, but if you
> provide more detail you can probably find something you can
> use.
>
> What processor,


H8

> language,


C

> compiler,


GCC 3.3

> communications interface?


Assume raw putc()/getc() type routines are available and
they're connected to an ANSI terminal.

> How much RAM and code space are available?


A total of maybe 8-16K for this function.

> Do you just want a line input/editor


Yes.

> or text parser as well?


No.

> What does your command line interface look like?


Undefined.

> What sort of editing features?


Most important:
* recall the last few lines
* move forward/reverse a character at a time
* delete and backspace
* insert typed characters at cursor

Nice to have:
* move to beginning/end of line
* move forward backward word at a time
* delete to end of line
* delete word
* transpose two characters at cursor

Hardwired (but configurable in source code) keybindings are
fine (my fingers speak emacs).

--
Grant Edwards grante Yow! I just got my PRINCE
at bumper sticker... But now I
visi.com can't remember WHO he is...
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      01-08-2004, 02:54 PM
On 2004-01-08, Mark A. Odell <(E-Mail Removed)> wrote:

>>> I need to add a simple command-line interface to an embedded
>>> project. Has anybody run across a small, free, readline-like
>>> library that provides rudimentary command-line editing?

>>
>> Actually I believe that writing such routine would take less time than
>> searching for it and adopting it to your project. The whole stuff (with
>> backspace and line length limit handling) takes less than 20 lines of C
>> code and approx. 35 lines of 51 assembly.

>
> I'm thinking of the bash shell command line editing
> capabilities


Me too. Specifically, I was thinking of a subset of Gnu
"readline" (I guess I should have been more specific).

> and wondering how that could possibly be about 20 lines of C.
> I'd like to see this implementation of yours.


I don't need full-up Gnu readline with vi and emacs modes, but
I would like command history, move by character/word delete
character word, start of line, end of line. Don't need
kill/yank or multiple modes and keybindings.

--
Grant Edwards grante Yow! Someone is DROOLING
at on my collar!!
visi.com
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      01-08-2004, 02:56 PM
On 2004-01-08, Scott Moore <(E-Mail Removed)> wrote:

> I heard gdb has a general purpose routine like that.


I had assumed it used the Gnu readline library (which is a bit
heavyweight for a small embedded system).

> I usually
> write my own, it takes about 2 or 3 pages if you make it full
> featured (arrow editing, insert/overwrite mode, word forward,
> word back, history recall, etc).


Yea, me too. I thought maybe I'd look for a pre-existing one
this time.

> I allways thought it was facinating that you can write such a
> routine with just backspace as the only control character used
> to manipulate the screen. Cursor forward is done by outputting
> the character at the position.


At low baud rates that method can be interesting to watch...

--
Grant Edwards grante Yow! Go on, EMOTE! I
at was RAISED on thought
visi.com balloons!!
 
Reply With Quote
 
Mark A. Odell
Guest
Posts: n/a
 
      01-08-2004, 03:15 PM
Grant Edwards <(E-Mail Removed)> wrote in
news:3ffd6f17$0$959$(E-Mail Removed):

>> and wondering how that could possibly be about 20 lines of C.
>> I'd like to see this implementation of yours.

>
> I don't need full-up Gnu readline with vi and emacs modes, but
> I would like command history, move by character/word delete
> character word, start of line, end of line. Don't need
> kill/yank or multiple modes and keybindings.


Me too!

--
- Mark ->
--
 
Reply With Quote
 
Grzegorz Mazur
Guest
Posts: n/a
 
      01-10-2004, 09:54 PM

"Mark A. Odell" <(E-Mail Removed)> wrote in message
news:Xns946A5F5981ED5CopyrightMarkOdell@130.133.1. 4...
> > Actually I believe that writing such routine would take less time than
> > searching for it and adopting it to your project. The whole stuff (with
> > backspace and line length limit handling) takes less than 20 lines of C
> > code and approx. 35 lines of 51 assembly.

>
> I'm thinking of the bash shell command line editing capabilities and
> wondering how that could possibly be about 20 lines of C. I'd like to see
> this implementation of yours.


Oops, didn't notice the 'redline' keyword. Single-line editing was what I
meant. Of course if you are looking for history buffer etc., it's probably
better to start with some Linux/Unix shell source then to write it from
scratch..


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Small, very small digital camera dfer Embedded 5 02-03-2004 04:23 AM
IC7-G Great Board, Small Problem Wanny Abit 14 12-18-2003 09:45 PM
Small, small, laptops...>>> Marty S. Laptops 10 12-11-2003 02:38 PM
Looking for small laptop with small LCD John Laptops 7 07-29-2003 02:30 AM
Small investment with big returns!! Serious money making opportunity!! Andrew Johnson Abit 0 07-29-2003 12:01 AM


All times are GMT. The time now is 09:42 PM.


Welcome!
Welcome to Motherboard Point
 

Advertisment