[fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux
Hi. I have simple console application: program test; var s : string; begin while s <> 'q' do readln(s); end. I compiled it in windows (FPC 2.4.0), run it in cmd.exe and I was surprised that history of commands is working out of the box (by pressing arrow UP). I thought it is done automatically by libreadline or something and that it will work on linux too. But the very same application compiled in FPC 2.4.0 in linux does not have history support. When I press arrow up, it only write ^[[A and nothing else. I tested it in xterm, urxvt and virtual console. I have Debian 5.0 with FPC from freepascal.org. Can you help me to make readln history working on linux too? Thanks. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux
On Wed, 1 Sep 2010 19:30:07 +0200, Dusan Halicky wrote about [fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux: > I compiled it in windows (FPC 2.4.0), run it in cmd.exe and I was > surprised that history of commands is working out of the box (by > pressing arrow UP). That is standard behaviour for most modern shells. > Can you help me to make readln history working on linux too? The readln() function has nothing to do with libreadline. The problem you are seeing is due to the shell you are using and the key binding options you have assigned or defaulted to in the shell and/or the terminal emulator. It has nothing to do with FPC. Try: man 1 bash and see how you can set the options you need. -- Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* david.w.n...@ntlworld.com (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* signature.asc Description: PGP signature ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux
>> I compiled it in windows (FPC 2.4.0), run it in cmd.exe and I was >> surprised that history of commands is working out of the box (by >> pressing arrow UP). > > That is standard behaviour for most modern shells. > The readln() function has nothing to do with libreadline. > > The problem you are seeing is due to the shell you are using and the > key binding options you have assigned or defaulted to in the shell > and/or the terminal emulator. It has nothing to do with FPC. So you are saying, that cmd.exe is monitoring what am I typing, and when test.exe is waiting on `readln(s)` and I press UP, then cmd.exe somehow paste to STDIN what I typed 1 EOL before? > Try: > > man 1 bash > > and see how you can set the options you need. Can you be more specific? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux
On Wed, 1 Sep 2010, Dusan Halicky wrote: I compiled it in windows (FPC 2.4.0), run it in cmd.exe and I was surprised that history of commands is working out of the box (by pressing arrow UP). That is standard behaviour for most modern shells. The readln() function has nothing to do with libreadline. The problem you are seeing is due to the shell you are using and the key binding options you have assigned or defaulted to in the shell and/or the terminal emulator. It has nothing to do with FPC. So you are saying, that cmd.exe is monitoring what am I typing, and when test.exe is waiting on `readln(s)` and I press UP, then cmd.exe somehow paste to STDIN what I typed 1 EOL before? Yes, that is correct. If you run the program twice, you'll see that you can "scroll back" even to what you typed in the first run of the program; This is clear proof that it is not the program itself which does that. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux
> If you run the program twice, you'll see that you can "scroll back" even to > what you typed in the first run of the program; This is clear proof that it > is not the program itself which does that. Ok. This somehow convinced me. Can I achieve the same thing in bash? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux
On Wed, 1 Sep 2010, Dusan Halicky wrote: If you run the program twice, you'll see that you can "scroll back" even to what you typed in the first run of the program; This is clear proof that it is not the program itself which does that. Ok. This somehow convinced me. Can I achieve the same thing in bash? Not that I know of. But I'm not a bash expert; I use tcsh. Michael ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] PC/SC
Hi! For a project with wireless chip cards (MiFare) I'm using a reader which is accessed via the PC/SC interface. Did anybody write a Pascal unit to translate the C header files? Thanks Hansi ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PC/SC
On Wed, 1 Sep 2010, Johann Glaser wrote: Hi! For a project with wireless chip cards (MiFare) I'm using a reader which is accessed via the PC/SC interface. Did anybody write a Pascal unit to translate the C header files? Is this for linux or windows ? Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PC/SC
Hi! > > For a project with wireless chip cards (MiFare) I'm using a reader which > > is accessed via the PC/SC interface. Did anybody write a Pascal unit to > > translate the C header files? > > Is this for linux or windows ? I'm working on Linux. Thanks Hansi ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PC/SC
Project Jedi has translations for Delphi. I don't know how easily they could be used for Linux and the PC/SC Lite used there, but it could be a helpful start. If you don't mind me asking, which Mifare reader supports PC/SC? I use both chipcard and Mifare readers, but hadn't seen a PC/SC Mifare reader before. Jeff. On Wed, Sep 1, 2010 at 4:12 PM, Johann Glaser wrote: > Hi! > >> > For a project with wireless chip cards (MiFare) I'm using a reader which >> > is accessed via the PC/SC interface. Did anybody write a Pascal unit to >> > translate the C header files? >> >> Is this for linux or windows ? > > I'm working on Linux. > > Thanks > Hansi > > > ___ > fpc-pascal maillist - fpc-pas...@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PC/SC
Hi! Am Mittwoch, den 01.09.2010, 16:27 -0400 schrieb DaWorm: > Project Jedi has translations for Delphi. I don't know how easily > they could be used for Linux and the PC/SC Lite used there, but it > could be a helpful start. Google pointed me to a Delphi component at http://www.nobbi.com/download/pcsccomp.zip which looks very fine. It includes (modified) versions of some JEDI header translations plus a fine OOP wrapper for PC/SC. But everything is for Windows and I'm unfamiliar with it and with components. So I thought I'd rather ask here for some help. > If you don't mind me asking, which Mifare reader supports PC/SC? I > use both chipcard and Mifare readers, but hadn't seen a PC/SC Mifare > reader before. Its an SCM SCL010 reader (really cheap, small and simple, exactly what I was looking for). They offer a proprietary pcsclite driver at their homepage, which simply installs a .so file (and a metadata file) to the driver module directory /usr/lib/pcsc/drivers/. Interestingly the Info.plist file says the driver was LGPL, but their homepage says its proprietary. No source is available. :-( I've already read the unique serial number from MiFare cards using the "gscriptor" tool in the pcsc-tools package. So, the driver works, PC/SC works, I only need an Pascal interface to PC/SC to start playing. :-) Thanks Hansi ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] TreeView and Nonrecursion
A Newbie question :-) Is it possible to fill TreeView (tree is naturally recursive) with a nonrecursive/iterative thinking paradigm? Are there some good examples regarding this matter in the Internet? I post this question in FPC mailing list because my question actually about filling a "tree" in general. Thanks in advance. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TreeView and Nonrecursion
i probably shouldn't open my mouth, as i don't quite understand the question... however FRED from the game Freespace let you design missions using a treeview. It involved following a tree like |- when 'Enemy Cargo ship' is 'attacked' | \- then 'enemy support ships' do 'jump in' |- when 'Enemy Cargo ship' is 'destroyed' | \- then 'mission successful' |- etc... or do you mean the other way around where the thinking paradigm fills in the treeview? - V On 1 September 2010 21:40, Bihar Anwar wrote: > A Newbie question :-) Is it possible to fill TreeView (tree is naturally > recursive) with a nonrecursive/iterative thinking paradigm? Are there some > good > examples regarding this matter in the Internet? > > I post this question in FPC mailing list because my question actually about > filling a "tree" in general. > > Thanks in advance. > > > > > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PC/SC
On Wed, 1 Sep 2010, Johann Glaser wrote: Hi! Am Mittwoch, den 01.09.2010, 16:27 -0400 schrieb DaWorm: Project Jedi has translations for Delphi. I don't know how easily they could be used for Linux and the PC/SC Lite used there, but it could be a helpful start. Google pointed me to a Delphi component at http://www.nobbi.com/download/pcsccomp.zip which looks very fine. It includes (modified) versions of some JEDI header translations plus a fine OOP wrapper for PC/SC. But everything is for Windows and I'm unfamiliar with it and with components. So I thought I'd rather ask here for some help. I am using this component (heavily improved) but it's geared towards the microsoft API. The Linux API (openSC) has not been translated as far as I know. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux
On Wed, 1 Sep 2010 21:17:04 +0200, Dusan Halicky wrote about Re: [fpc-pascal] ReadLine history works in windows/cmd.exe but not in bash/linux: > > If you run the program twice, you'll see that you can "scroll back" > > even to what you typed in the first run of the program; This is > > clear proof that it is not the program itself which does that. > > Ok. This somehow convinced me. Can I achieve the same thing in bash? Not bash itself, but you can call readline() explicitly and achieve the desired effect. Remember that the program and the shell are largely independent under all UNIX systems, including Linux. So, if you want the scrollback capabilities you need to use the appropriate API. -- Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* david.w.n...@ntlworld.com (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] PC/SC
Hi! Am Mittwoch, den 01.09.2010, 22:55 +0200 schrieb Michael Van Canneyt: > > On Wed, 1 Sep 2010, Johann Glaser wrote: > > > Hi! > > > > Am Mittwoch, den 01.09.2010, 16:27 -0400 schrieb DaWorm: > >> Project Jedi has translations for Delphi. I don't know how easily > >> they could be used for Linux and the PC/SC Lite used there, but it > >> could be a helpful start. > > > > Google pointed me to a Delphi component at > > http://www.nobbi.com/download/pcsccomp.zip which looks very fine. It > > includes (modified) versions of some JEDI header translations plus a > > fine OOP wrapper for PC/SC. But everything is for Windows and I'm > > unfamiliar with it and with components. So I thought I'd rather ask here > > for some help. > > I am using this component (heavily improved) but it's geared towards > the microsoft API. The Linux API (openSC) has not been translated as > far as I know. I'm using PCSC-Lite (http://pcsclite.alioth.debian.org/) which is AFAIK a Linux version of the M§ API. At least its API http://pcsclite.alioth.debian.org/api/group__API.html looks quite similar to what I've seen in this component. Bye Hansi ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TreeView and Nonrecursion
On 2 September 2010 3:53:34 AM, Vannus wrote: > i probably shouldn't open my mouth, as i don't quite understand the >question... > > however FRED from the game Freespace let you design missions using a treeview. Just to make my question clear, for example, I can fill a TreeView control with particular Registry keys by enumerating registry keys recursively and put them in the TreeView control; then for performance reason, I attempt to use a nonrecursive/iterative approach to enumerate registry keys, but how can I fill the TreeView since a "tree" is naturally recursive? Is recursion is the only way to achive it? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re[2]: [fpc-pascal] TreeView and Nonrecursion
Hello FPC-Pascal, Wednesday, September 1, 2010, 11:20:57 PM, you wrote: BA> Just to make my question clear, for example, I can fill a TreeView control with BA> particular Registry keys by enumerating registry keys recursively and put them BA> in the TreeView control; then for performance reason, I attempt to use a BA> nonrecursive/iterative approach to enumerate registry keys, but how can I fill BA> the TreeView since a "tree" is naturally recursive? Is recursion is the only way BA> to achive it? You must know at which node a new node must be inserted, but you can write something like (pseudo code): procedure FillConditional(var ParentNode: TNode); var j: integer; l: TList; n: TNode; begin l:=TList.Create; n:=nil; for j:=0 to do begin //xxx is some kind of condition n:=TNode.Create; n.position:=j; Tree.AddNode(ParentNode,n); if j=10 then begin l.add(n); //Remember the node at position 10 end; end; for j:=0 to n.Count-1 do begin n:=l.Items[j]; FillConditional(n); end; l.free; end; It is recursive, but first you add all sibliings and them you add each new brach linearly. -- Best regards, José ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal