• FPC Oneliners.

    From Joseph Larsen@1:340/800 to All on Sunday, June 05, 2016 09:30:42
    Here's some code i'm having problems with. For some reason it takes two
    presses of the down arrow key to get the bot_bar procedure.

    --//--snip---------

    procedure oneliners;

    var Twriters : array[1..10] of string;
    var Toneliner : array[1..10] of string;
    var S : string;
    var Foneline : string;
    var Ch1 : char;
    var Ch2 : char;
    var Ch3 : char;
    var Count : byte;
    var Count2 : byte;


    //### begin show procedure ######################################

    Procedure show;

    var Count : byte;

    Begin
    // clrscr;
    printf('oneh.ans');
    For Count := 1 To 10 Do Begin;
    write('[1;37m+[0;37m');
    write(Twriters[Count]);
    write('[1;30m: 0;37m');
    WriteLn(Toneliner[Count]);
    End;
    End; // show

    //### end show procedure ########################################
    //### begin init procedure ######################################

    Procedure init;

    Var f1 : textfile;
    var Count : byte;

    Begin
    // GetThisUser;
    fOneLine := ('/home/imp/imp/data/oneliner.lst');
    If Not fileExists(fOneLine) Then Begin
    Assign(f1, fOneLine);
    ReWrite(f1);
    For Count := 1 To 10 Do Begin
    WriteLn(f1,'Ia! Cthulhu!');
    WriteLn(f1,'IGNATIUS');
    End;
    Close(f1);
    End;

    Assign(f1, fOneLine);
    Reset(f1);
    If IoResult = 0 Then Begin
    For Count := 1 To 10 Do Begin
    ReadLn(f1, Toneliner[Count]);
    ReadLn(f1, Twriters[Count]);
    End;
    Close(f1);
    End;
    End; // Init

    //### begin bot_bar procedure ###################################

    Procedure bot_bar;

    Begin
    printf('onen.ans');
    Ch2 := ReadKey;
    If Ch2 = #13 then Begin
    exit;
    End;
    show;
    End; // bot_bar

    //### end bot_bar procedure #####################################
    //### begin top_bar procedure ###################################

    Procedure top_bar;

    Var f1 : textfile;
    var Count : byte;
    var ch3 : char;


    Begin
    printf('oney.ans');
    Ch3 := ReadKey;
    If Ch3 = #13 then Begin
    printf('oneline.asc');
    Write('[3;3H');
    inputl(s,70);
    If s = '' then Begin
    WriteLn('[1;30maborted[0;37m');
    show;
    Exit;
    End;

    For Count := 1 To 9 Do Begin
    Count2 := Count + 1;
    Toneliner[Count] := Toneliner[Count2];
    Twriters[Count] := Twriters[Count2];
    End;

    tWriters[10]:=thisuser.name;
    tOneliner[10] := s;

    Assign(f1, fOneLine);
    ReWrite(f1);
    For Count := 1 To 10 do Begin
    WriteLn(f1,tOneliner[Count]);
    WriteLn(f1,tWriters[Count]);
    End;
    Close(f1);
    End;
    show;
    End; // top_bar

    //### end top_bar procedure #####################################
    //### begin position procedure ##################################

    Procedure position;

    Begin
    show;

    Repeat
    ch1:=ReadKey;
    case ch1 of
    #0 : begin
    ch1:=ReadKey;
    case ch1 of
    #80 : bot_bar;
    #72 : top_bar;
    end;
    end;
    end;
    until ch1=#13
    end;

    //### end position procedure ####################################

    Begin
    init;
    Position;
    End;
    --//--snip----------

    If someone could give me an idea of what's wrong, i'd appreciate it.

    Thank you,


    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)
  • From mark lewis@1:3634/12.73 to Joseph Larsen on Sunday, June 05, 2016 16:48:52

    05 Jun 16 09:30, you wrote to All:

    Here's some code i'm having problems with. For some reason it takes two presses of the down arrow key to get the bot_bar procedure.

    are you still stuck on this? i can only point back to our previous conversations about it... you should simplify it to its most basic form... if the problem still exists then it will be much easier to locate and repair...

    )\/(ark

    Always Mount a Scratch Monkey

    ... A clean desk is a sign of a cluttered desk drawer.
    ---
    * Origin: (1:3634/12.73)
  • From Joseph Larsen@1:340/800 to mark lewis on Tuesday, June 07, 2016 04:50:52
    are you still stuck on this? i can only point back to our previous conv


    I don't see how it could get any simpler.


    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)
  • From mark lewis@1:3634/12.73 to Joseph Larsen on Tuesday, June 07, 2016 10:51:44

    07 Jun 16 04:50, you wrote to me:

    are you still stuck on this? i can only point back to our previous conv

    I don't see how it could get any simpler.

    ==== Begin "readkey_test.txt" ====
    = pascal_lessons (1:3634/12.73) ===============================================
    Msg : 90 of 113 Snt Loc
    From : mark lewis 1:3634/12.73 13 Feb 16 10:45:56
    To : joseph larsen
    Subj : Some code i'm having problems with. ===============================================================================

    13 Feb 16 00:50, you wrote to All:

    Here's some code. The problem is that I have to press the down arrow
    key twice before it executes the "bot_bar" procedure. If anyone could help, or take a look at it, i'd appreciate it.

    some parts are missing for others to really be able to compile and test it... what you should do is to simplify it into a standalone program and then work it
    out using general items to replace things like the ans files and thisuser.name and such... the following seems to work fine for me after attempting to trace your logic flow...

    ==== Begin "readkey_test.pas" ====
    Program readkey_test;

    Uses crt;

    Var
    ch1 : char;
    ch2 : char;

    Procedure show;
    Begin
    writeln(' in show');
    End;

    Procedure bot_bar;
    Begin
    writeln(' in bot_bar - display show? enter=no');
    ch2:=readkey;
    if ch2=#13 then begin
    writeln(' readkey=enter - exiting bot_bar');
    exit;
    end;
    show;
    End;

    Procedure top_bar;
    Begin
    writeln(' in top_bar');
    End;


    Begin
    writeln('press uparr, dnarr or enter');
    Repeat
    writeln('in repeat block waiting on readkey');
    ch1:=ReadKey;
    case ch1 of
    #0 : begin
    writeln('readkey=nul - reading next key');
    ch1:=ReadKey;
    case ch1 of
    #72 : begin
    writeln(' readkey=uparr');
    top_bar;
    end;
    #80 : begin
    writeln(' readkey=dnarr');
    bot_bar;
    end;
    end; //case readkey
    end; //begin #0
    end; //case readkey
    until ch1=#13;
    writeln('readkey=enter - exiting program');
    end.
    ==== End "readkey_test.pas" ====

    remember to keep it simple and straightforward...

    )\/(ark

    Always Mount a Scratch Monkey

    ... If it's any good at all they will soon discontinue it.
    -!-
    ! Origin: (1:3634/12.73)

    ==== End "readkey_test.txt" ====

    )\/(ark

    Always Mount a Scratch Monkey

    ... Rock is Dead. Long live Paper and Scissors!
    ---
    * Origin: (1:3634/12.73)
  • From Joseph Larsen@1:340/800 to mark lewis on Wednesday, June 08, 2016 07:06:57
    ==== Begin "readkey_test.txt" ====
    = pascal_lessons (1:3634/12.73) =======================================
    Msg : 90 of 113 Snt Loc
    From : mark lewis 1:3634/12.73 13 Feb 16 1
    To : joseph larsen
    Subj : Some code i'm having problems with. =======================================================================

    13 Feb 16 00:50, you wrote to All:

    Here's some code. The problem is that I have to press the down arr
    key twice before it executes the "bot_bar" procedure. If anyone co help, or take a look at it, i'd appreciate it.

    some parts are missing for others to really be able to compile and test

    ==== Begin "readkey_test.pas" ====
    Program readkey_test;

    Uses crt;

    Var
    ch1 : char;
    ch2 : char;

    Procedure show;
    Begin
    writeln(' in show');
    End;

    Procedure bot_bar;
    Begin
    writeln(' in bot_bar - display show? enter=no');
    ch2:=readkey;
    if ch2=#13 then begin
    writeln(' readkey=enter - exiting bot_bar');
    exit;
    end;
    show;
    End;

    Procedure top_bar;
    Begin
    writeln(' in top_bar');
    End;


    Begin
    writeln('press uparr, dnarr or enter');
    Repeat
    writeln('in repeat block waiting on readkey');
    ch1:=ReadKey;
    case ch1 of
    #0 : begin
    writeln('readkey=nul - reading next key');
    ch1:=ReadKey;
    case ch1 of
    #72 : begin
    writeln(' readkey=uparr');
    top_bar;
    end;
    #80 : begin
    writeln(' readkey=dnarr');
    bot_bar;
    end;
    end; //case readkey
    end; //begin #0
    end; //case readkey
    until ch1=#13;
    writeln('readkey=enter - exiting program');
    end.
    ==== End "readkey_test.pas" ====

    Ok. I made the changes you suggested. Same problem. It takes 2 press of the down arrow key to get the bot_bar procedure. :/


    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)
  • From Tony Master@1:218/530 to Joseph Larsen on Wednesday, June 08, 2016 09:03:52
    On 06/08/16, Joseph Larsen said the following...
    Ok. I made the changes you suggested. Same problem. It takes 2 press of the down arrow key to get the bot_bar procedure. :/

    could the bbs software be the problem because of it being slowly developed?

    |08 .|05·|13∙|15Dr|07e|08am Ma|07st|15er|13∙|05·|08.
    |08 °∙|05·|13∙° |13°∙|05·|08∙°
    |11 DoRE|03!|11ACiDiC|03!|11Demonic |08<|15dreamland|09.|15darktech|09.|15org|08>

    --- Mystic BBS v1.12 A17 (Windows)
    * Origin: --[!dreamland BBS dreamland.darktech.org (1:218/530)
  • From Joseph Larsen@1:340/800 to Tony Master on Wednesday, June 08, 2016 21:13:53
    could the bbs software be the problem because of it being slowly develo


    Impulse? Nah. The source code is in Free Pascal. I have other procedures in
    the code that i've written, and they work fine.


    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)
  • From Joseph Larsen@1:340/800 to mark lewis on Thursday, June 09, 2016 01:56:21
    remember to keep it simple and straightforward...


    I think I know the problem.


    --snip---

    Procedure position;

    Begin
    show;
    Repeat
    printf('onen.ans');
    ch1:=ReadKey;
    case ch1 of
    #0 : begin
    begin
    ch1:=ReadKey;
    case ch1 of
    #80 : bot_bar;
    #72 : top_bar;
    end;
    end;
    end;
    until ch1=#13
    end;
    --snip----

    See the "#8 : begin" ? I don't think that's right. Any idea what I change it to?

    Thanks,


    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)
  • From mark lewis@1:3634/12.73 to Joseph Larsen on Thursday, June 09, 2016 12:20:06

    09 Jun 16 01:56, you wrote to me:

    remember to keep it simple and straightforward...

    I think I know the problem.

    [trim]

    See the "#8 : begin" ? I don't think that's right. Any idea what I
    change it to?

    that's a zero, not an eight... that zero is the null character and must be used
    to detect double-character keycodes like the F-keys and the arrow keys...

    change your routine to a completely stand alone program so you can test it easier... watch your formatting, too... below is such a standalone with an added key displaying routine so you can see which key has been pressed... you can remove that one entire routine and the two calls to it and the program should operate like what you already have that you are having troubles with...

    WARNING: some keys may not return the expected codes (eg: the END key) and others may be taken over by your terminal (eg: ALT-F?? keys)...

    ===== snip test_position.pas =====
    program test_position;

    uses crt;

    var
    ch1 : char;
    ch2 : char;

    procedure displaykey(var thechar1, thechar2 : char);

    begin
    case thechar1 of
    #00 : begin
    write(' double character key - ');
    case thechar2 of
    #16 : writeln('ALT-Q');
    #17 : writeln('ALT-W');
    #18 : writeln('ALT-E');
    #19 : writeln('ALT-R');
    #20 : writeln('ALT-T');
    #21 : writeln('ALT-Y');
    #22 : writeln('ALT-U');
    #23 : writeln('ALT-I');
    #24 : writeln('ALT-O');
    #25 : writeln('ALT-P');

    #30 : writeln('ALT-A');
    #31 : writeln('ALT-S');
    #32 : writeln('ALT-D');
    #33 : writeln('ALT-F');
    #34 : writeln('ALT-G');
    #35 : writeln('ALT-H');
    #36 : writeln('ALT-J');
    #37 : writeln('ALT-K');
    #38 : writeln('ALT-L');

    #44 : writeln('ALT-Z');
    #45 : writeln('ALT-X');
    #46 : writeln('ALT-C');
    #47 : writeln('ALT-V');
    #48 : writeln('ALT-B');
    #49 : writeln('ALT-N');
    #50 : writeln('ALT-M');

    #59 : writeln('F1');
    #60 : writeln('F2');
    #61 : writeln('F3');
    #62 : writeln('F4');
    #63 : writeln('F5');
    #64 : writeln('F6');
    #65 : writeln('F7');
    #66 : writeln('F8');
    #67 : writeln('F9');
    #68 : writeln('F10');

    #71 : writeln('HOME');
    #72 : writeln('UPARR');
    #73 : writeln('PGUP');

    #75 : writeln('LFARR');

    #77 : writeln('RTARR');

    #79 : writeln('END');
    #80 : writeln('DNARR');
    #81 : writeln('PGDN');
    #82 : writeln('INSERT');
    #83 : writeln('DELETE');

    #104 : writeln('ALT-F1');
    #105 : writeln('ALT-F2');
    #106 : writeln('ALT-F3');
    #107 : writeln('ALT-F4');
    #108 : writeln('ALT-F5');
    #109 : writeln('ALT-F6');
    #110 : writeln('ALT-F7');
    #111 : writeln('ALT-F8');
    #112 : writeln('ALT-F9');
    #113 : writeln('ALT-F10');

    #133 : writeln('F11');
    #134 : writeln('F12');

    #139 : writeln('ALT-F11');
    #140 : writeln('ALT-F12');
    else
    writeln(' unknown double character key = #',ord(thechar1),' #',ord(thechar2));
    end; {case thechar2}
    end; {begin thechar1 = #00}
    else
    begin
    write(' single character key - ');
    case thechar1 of
    #01 : writeln('CTRL-A');
    #02 : writeln('CTRL-B');
    #03 : writeln('CTRL-C');
    #04 : writeln('CTRL-D');
    #05 : writeln('CTRL-E');
    #06 : writeln('CTRL-F');
    #07 : writeln('CTRL-G');
    #08 : writeln('BCKSPC');
    #09 : writeln('TAB');
    #10 : writeln('LF');
    #11 : writeln('VT');
    #12 : writeln('FF');
    #13 : writeln('ENTER');
    #14 : writeln('CTRL-N');
    #15 : writeln('CTRL-O');
    #16 : writeln('CTRL-P');
    #17 : writeln('CTRL-Q');
    #18 : writeln('CTRL-R');
    #19 : writeln('CTRL-S');
    #20 : writeln('CTRL-T');
    #21 : writeln('CTRL-U');
    #22 : writeln('CTRL-V');
    #23 : writeln('CTRL-W');
    #24 : writeln('CTRL-X');
    #25 : writeln('CTRL-Y');
    #26 : writeln('CTRL-Z');
    #27 : writeln('ESC');
    #28 : writeln('FS');
    #29 : writeln('GS');
    #30 : writeln('RS');
    #31 : writeln('US');
    #32 : writeln('SPACE');
    else
    writeln(chr(byte(thechar1)),' = #',ord(thechar1));
    end; {case thechar1}
    end; {begin else}
    end;
    end;

    Begin
    writeln('>> do show routine <<');
    writeln('press any key to continue or ENTER to quit.');
    Repeat
    ch1 := #00;
    ch2 := #00;
    if keypressed then
    begin
    writeln('>> display onen.ans here <<');
    ch1 := readkey;
    case ch1 of
    #00 : begin
    if keypressed then
    begin
    ch2 := readkey;
    displaykey(ch1,ch2);
    case ch2 of
    #80 : writeln('>> do bot_bar routine <<');
    #72 : writeln('>> do top_bar routine <<');
    end; {case ch2}
    end; {if keypressed}
    end; {begin ch1 = #00}
    else
    displaykey(ch1,ch2);
    end; {case ch1}
    end; {if keypressed}
    until ch1=#13;
    end.
    ===== snip =====

    )\/(ark

    Always Mount a Scratch Monkey

    ... 48. Sympathy is a crutch, never fake a limp.
    ---
    * Origin: (1:3634/12.73)
  • From mark lewis@1:3634/12.73 to Joseph Larsen on Friday, June 10, 2016 03:19:34

    10 Jun 16 03:25, you wrote to me:

    It doesn't work. Same old problem with having to press the down arrow key twice.

    what is your bot_bar procedure?

    )\/(ark

    Always Mount a Scratch Monkey

    ... McDonald's: Tastes Just Like Real Food!
    ---
    * Origin: (1:3634/12.73)
  • From Joseph Larsen@1:340/800 to mark lewis on Friday, June 10, 2016 21:10:14
    what is your bot_bar procedure?


    --snip---

    Procedure bot_bar;
    Begin
    printf('onen.ans');
    Ch2 := ReadKey;
    If Ch2 = #13 then Begin
    exit;
    End;
    show;
    end; // bot_bar

    --snip---

    Thanks,

    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)
  • From mark lewis@1:3634/12.73 to Joseph Larsen on Saturday, June 11, 2016 16:53:42

    10 Jun 16 21:10, you wrote to me:

    what is your bot_bar procedure?


    --snip---

    Procedure bot_bar;

    i've gone back to your original post where i asked you if you were still stuck on this... it needs a few additional items added to make it stand alone for development and testing... a routine or two and the display files... i have no idea what they are supposed to contain so in plain ascii, what do the files onen.ans, oney.ans, oneh.ans contain? i'm guessing that oneh.ans is a header of
    some kind and maybe the others are yes and no prompts but what are they prompting? i just need simple basics to work with... here's what i've worked up
    with full debugging and my displaykey routine... i don't see any problem with the UPARR or DNARR keys and getting into either TOP_BAR or BOT_BAR... here's everything i have and the display files at the bottom...

    NOTE: this message is over 475 lines long...


    ==== Begin "oneliners.pas" ====
    program oneliners;
    {$mode objfpc}

    uses
    crt, classes, sysutils;

    type
    userrec=record
    name : string[36];
    end;

    var Twriters : array[1..10] of string;
    var Toneliner : array[1..10] of string;
    var S : string;
    var Foneline : string;
    var Ch1 : char;
    var Ch2 : char;
    var Count2 : byte;
    var thisuser : userrec;

    procedure displaykey(var thechar1, thechar2 : char);

    begin
    case thechar1 of
    #00 : begin
    write(' double character key - ');
    case thechar2 of
    #16 : writeln('ALT-Q');
    #17 : writeln('ALT-W');
    #18 : writeln('ALT-E');
    #19 : writeln('ALT-R');
    #20 : writeln('ALT-T');
    #21 : writeln('ALT-Y');
    #22 : writeln('ALT-U');
    #23 : writeln('ALT-I');
    #24 : writeln('ALT-O');
    #25 : writeln('ALT-P');

    #30 : writeln('ALT-A');
    #31 : writeln('ALT-S');
    #32 : writeln('ALT-D');
    #33 : writeln('ALT-F');
    #34 : writeln('ALT-G');
    #35 : writeln('ALT-H');
    #36 : writeln('ALT-J');
    #37 : writeln('ALT-K');
    #38 : writeln('ALT-L');

    #44 : writeln('ALT-Z');
    #45 : writeln('ALT-X');
    #46 : writeln('ALT-C');
    #47 : writeln('ALT-V');
    #48 : writeln('ALT-B');
    #49 : writeln('ALT-N');
    #50 : writeln('ALT-M');

    #59 : writeln('F1');
    #60 : writeln('F2');
    #61 : writeln('F3');
    #62 : writeln('F4');
    #63 : writeln('F5');
    #64 : writeln('F6');
    #65 : writeln('F7');
    #66 : writeln('F8');
    #67 : writeln('F9');
    #68 : writeln('F10');

    #71 : writeln('HOME');
    #72 : writeln('UPARR');
    #73 : writeln('PGUP');

    #75 : writeln('LFARR');

    #77 : writeln('RTARR');

    #79 : writeln('END');
    #80 : writeln('DNARR');
    #81 : writeln('PGDN');
    #82 : writeln('INSERT');
    #83 : writeln('DELETE');

    #104 : writeln('ALT-F1');
    #105 : writeln('ALT-F2');
    #106 : writeln('ALT-F3');
    #107 : writeln('ALT-F4');
    #108 : writeln('ALT-F5');
    #109 : writeln('ALT-F6');
    #110 : writeln('ALT-F7');
    #111 : writeln('ALT-F8');
    #112 : writeln('ALT-F9');
    #113 : writeln('ALT-F10');

    #133 : writeln('F11');
    #134 : writeln('F12');

    #139 : writeln('ALT-F11');
    #140 : writeln('ALT-F12');
    else
    writeln(' unknown double character key = #',ord(thechar1),' #',ord(thechar2));
    end; {case thechar2}
    end; {begin thechar1 = #00}
    else
    begin
    write(' single character key - ');
    case thechar1 of
    #01 : writeln('CTRL-A');
    #02 : writeln('CTRL-B');
    #03 : writeln('CTRL-C');
    #04 : writeln('CTRL-D');
    #05 : writeln('CTRL-E');
    #06 : writeln('CTRL-F');
    #07 : writeln('CTRL-G');
    #08 : writeln('BCKSPC');
    #09 : writeln('TAB');
    #10 : writeln('LF');
    #11 : writeln('VT');
    #12 : writeln('FF');
    #13 : writeln('ENTER');
    #14 : writeln('CTRL-N');
    #15 : writeln('CTRL-O');
    #16 : writeln('CTRL-P');
    #17 : writeln('CTRL-Q');
    #18 : writeln('CTRL-R');
    #19 : writeln('CTRL-S');
    #20 : writeln('CTRL-T');
    #21 : writeln('CTRL-U');
    #22 : writeln('CTRL-V');
    #23 : writeln('CTRL-W');
    #24 : writeln('CTRL-X');
    #25 : writeln('CTRL-Y');
    #26 : writeln('CTRL-Z');
    #27 : writeln('ESC');
    #28 : writeln('FS');
    #29 : writeln('GS');
    #30 : writeln('RS');
    #31 : writeln('US');
    #32 : writeln('SPACE');
    else
    writeln(chr(byte(thechar1)),' = #',ord(thechar1));
    end; {case thechar1}
    end; {begin}
    end;
    end;

    //### begin printf procedure ####################################
    //### temporary routine to provide printf without needing the
    //### entire impulse package
    procedure printf(thefile : string);

    var
    filecontents : TStringList;
    thisline : integer;

    begin
    writeln(' PRINTF: entering PRINTF routine');
    writeln(' PRINTF: creating stringlist to hold file contents');
    filecontents.sorted := false;
    filecontents := TStringList.Create;
    try
    writeln(' PRINTF: attempting to load file ',thefile);
    filecontents.LoadFromFile(thefile);
    writeln(' PRINTF: display ',IntToStr(filecontents.Count),' lines');
    for thisline := 0 to filecontents.Count-1 do
    begin
    writeln(filecontents.Strings[thisline]);
    end;
    finally
    writeln(' PRINTF: dump stringlist contents and free memory');
    if Assigned(filecontents) then
    FreeAndNil(filecontents);
    end;
    writeln(' PRINTF: leaving PRINTF routine');
    end;
    //### end printf procedure ######################################

    //### begin show procedure ######################################
    Procedure show;

    var Count : byte;

    Begin
    writeln(' SHOW: entering SHOW routine');
    writeln(' SHOW: going to PRINTF(''oneh.ans'')');
    printf('oneh.ans');
    writeln(' SHOW: back from PRINTF(''oneh.ans'')');
    writeln(' SHOW: displaying current oneliners');
    For Count := 1 To 10 Do
    Begin;
    write(Twriters[Count],' - ');
    WriteLn(Toneliner[Count]);
    End;
    writeln(' SHOW: finished displaying current oneliners');
    writeln(' SHOW: leaving SHOW routine');
    End; // show
    //### end show procedure ########################################

    //### begin init procedure ######################################
    Procedure init;

    Var f1 : textfile;
    var Count : byte;
    var myfilecode : word;

    Begin
    writeln(' INIT: entering INIT routine');
    // GetThisUser;
    // just stuff something into thisuser.name to get the prog to run
    writeln(' INIT: assign thisuser.name');
    thisuser.name := 'my goofy user';

    writeln(' INIT: look for oneliner.lst');
    fOneLine := ('./oneliner.lst');
    If Not fileExists(fOneLine) Then
    Begin
    writeln(' INIT: creating oneliner.lst with default entries');
    Assign(f1, fOneLine);
    ReWrite(f1);
    For Count := 1 To 10 Do
    Begin
    WriteLn(f1,'Ia! Cthulhu!');
    WriteLn(f1,'IGNATIUS');
    End;
    Close(f1);
    End;

    writeln(' INIT: reading oneliner.lst');
    Assign(f1, fOneLine);
    // make sure to turn off iochecking if using IoResult
    {$I-}
    Reset(f1);
    // turn iochecking back on
    {$I+}
    // grab the IoResult to our own variable
    myfilecode := IoResult;
    // reverse the logic from "= 0" to "<> 0" so we can print an error message
    If myfilecode <> 0 Then
    begin
    writeln(' INIT: ioresult ',myfilecode,' while reading oneliner.lst');
    writeln(' INIT: aborting program');
    halt;
    end
    else
    Begin
    For Count := 1 To 10 Do
    Begin
    ReadLn(f1, Toneliner[Count]);
    ReadLn(f1, Twriters[Count]);
    End;
    Close(f1);
    End;
    writeln(' INIT: leaving INIT routine');
    End; // Init
    //### end init procedure ########################################

    //### begin bot_bar procedure ###################################
    Procedure bot_bar;

    Begin
    writeln(' BOT_BAR: entering BOT_BAR routine');
    ch1 := #00;
    ch2 := #00;
    writeln(' BOT_BAR: going to PRINTF(''onen.ans'')');
    printf('onen.ans');
    writeln(' BOT_BAR: back from PRINTF(''onen.ans'')');
    writeln(' BOT_BAR: any key to show or ENTER to exit BOT_BAR');
    Ch1 := ReadKey;
    case ch1 of
    #00 : begin
    ch2 := readkey;
    displaykey(ch1,ch2);
    end; {begin ch1 = #00}
    else
    displaykey(ch1,ch2);
    end; {case ch1}
    If Ch1 = #13 then
    Begin
    writeln(' BOT_BAR: leaving BOT_BAR via ENTER key');
    exit;
    End;
    writeln(' BOT_BAR: going to SHOW routine');
    show;
    writeln(' BOT_BAR: back from SHOW routine');
    writeln(' BOT_BAR: leaving BOT_BAR via normal exit');
    End; // bot_bar
    //### end bot_bar procedure #####################################

    //### begin top_bar procedure ###################################
    Procedure top_bar;

    Var f1 : textfile;
    var Count : byte;

    Begin
    writeln(' TOP_BAR: entering TOP_BAR routine');
    ch1 := #00;
    ch2 := #00;
    writeln(' TOP_BAR: going to PRINTF(''oney.ans'')');
    printf('oney.ans');
    writeln(' TOP_BAR: back from PRINTF(''oney.ans'')');
    writeln(' TOP_BAR: any key to exit TOP_BAR or ENTER to add a oneliner');
    Ch1 := ReadKey;
    case ch1 of
    #00 : begin
    ch2 := readkey;
    displaykey(ch1,ch2);
    end; {begin ch1 = #00}
    else
    displaykey(ch1,ch2);
    end; {case ch1}
    If Ch1 = #13 then
    Begin
    writeln(' TOP_BAR: going to PRINTF(''oneline.asc'')');
    printf('oneline.asc');
    writeln(' TOP_BAR: back from PRINTF(''oneline.asc'')');
    // temp readln replacing inputl to avoid needing entire impulse code
    readln(s);
    If s = '' then
    Begin
    WriteLn('aborted');
    writeln(' TOP_BAR: going to SHOW routine');
    show;
    writeln(' TOP_BAR: back from SHOW routine');
    writeln(' TOP_BAR: leaving TOP_BAR via blank oneliner line');
    Exit;
    End;

    For Count := 1 To 9 Do
    Begin
    Count2 := Count + 1;
    Toneliner[Count] := Toneliner[Count2];
    Twriters[Count] := Twriters[Count2];
    End;

    tWriters[10]:=thisuser.name;
    tOneliner[10] := s;

    Assign(f1, fOneLine);
    ReWrite(f1);
    For Count := 1 To 10 do
    Begin
    WriteLn(f1,tOneliner[Count]);
    WriteLn(f1,tWriters[Count]);
    End;
    Close(f1);
    End;
    writeln(' TOP_BAR: going to SHOW routine');
    show;
    writeln(' TOP_BAR: back from SHOW routine');
    writeln(' TOP_BAR: leaving TOP_BAR via normal exit');
    End; // top_bar
    //### end top_bar procedure #####################################

    //### begin position procedure ##################################
    Procedure position;

    Begin
    writeln('POSITION: entering POSITION routine');
    writeln('POSITION: do show routine');
    show;
    writeln('POSITION: any key to continue or ENTER to exit');
    Repeat
    ch1 := #00;
    ch2 := #00;
    ch1 := ReadKey;
    case ch1 of
    #00 : begin
    ch2:=ReadKey;
    displaykey(ch1,ch2);
    case ch2 of
    #80 : begin
    writeln('POSITION: going to BOT_BAR routine');
    bot_bar;
    writeln('POSITION: back from BOT_BAR routine');
    end;
    #72 : begin
    writeln('POSITION: going to TOP_BAR routine');
    top_bar;
    writeln('POSITION: back from TOP_BAR routine');
    end;
    end;
    end;
    else
    displaykey(ch1,ch2);
    end; {case ch1}
    until ch1=#13;
    writeln('POSITION: leaving POSITION routine');
    end;
    //### end position procedure ####################################

    Begin
    writeln('MAIN: going to INIT routine');
    init;
    writeln('MAIN: back from INIT routine');
    writeln('MAIN: going to POSITION routine');
    Position;
    writeln('MAIN: back from POSITION routine');
    End.

    ==== End "oneliners.pas" ====



    ==== Begin "oneh.ans" ====

    ONELINERS! Whoohoo!

    Displaying 10 most recent oneliners. =============================================================================== ==== End "oneh.ans" ====



    ==== Begin "onen.ans" ====

    this is onen.ans. what is it supposed to say?

    ==== End "onen.ans" ====



    ==== Begin "oney.ans" ====

    Do you want to add to the oneliners? ENTER=Yes, any other key=no

    ==== End "oney.ans" ====



    ==== Begin "oneline.asc" ====

    this is oneline.asc. what is it supposed to say??

    ==== End "oneline.asc" ====



    ==== Begin "oneliner.lst" ====
    Ia! Cthulhu!
    IGNATIUS
    Ia! Cthulhu!
    IGNATIUS
    Ia! Cthulhu!
    IGNATIUS
    Ia! Cthulhu!
    IGNATIUS
    Ia! Cthulhu!
    IGNATIUS
    Ia! Cthulhu!
    IGNATIUS
    Ia! Cthulhu!
    IGNATIUS
    Ia! Cthulhu!
    IGNATIUS
    foobery foober foo
    my goofy user
    this is my oneliner!
    my goofy user
    ==== End "oneliner.lst" ====


    )\/(ark

    Always Mount a Scratch Monkey

    ... Men find it difficult to make eye contact cause breasts don't have eyes. ---
    * Origin: (1:3634/12.73)
  • From Joseph Larsen@1:340/800 to mark lewis on Sunday, June 12, 2016 06:38:14
    i've gone back to your original post where i asked you if you were stil


    Hmm. Not sure why the quoted portions are truncated. But, anyway, you are correct about the oneh.ans, onen.ans, and oney.ans files.

    I'll try the code out.

    Thank you!


    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)
  • From Joseph Larsen@1:340/800 to mark lewis on Sunday, June 12, 2016 07:42:16
    i've gone back to your original post where i asked you if you were stil


    Ok. I figured it out. You were right in creating that custom printf function. The problem was with the Impulse version of the printf function. I replaced
    all instances of printf('filename'); to shell('/usr/bin/cat filename');
    And it appears to be working. I can't believe I didn't think of this sooner. So, thanks, man, with your help. It's grately appreciated.

    Thanks,

    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)
  • From mark lewis@1:3634/12.73 to Joseph Larsen on Sunday, June 12, 2016 10:21:28

    12 Jun 16 06:38, you wrote to me:

    i've gone back to your original post where i asked you if you were stil


    Hmm. Not sure why the quoted portions are truncated. But, anyway, you are correct about the oneh.ans, onen.ans, and oney.ans files.

    can you provide simple ASCII versions of those files, please? i can't tell what
    they should say by the code context... i made a guess at two of them but...

    I'll try the code out.

    the main thing is all the additional debugging code so we can follow the logic flow... i think it can be completely revised and simplified... as i haven't looked at it, i'm pretty sure that a lot could be rewritten using new techniques which are simplier and easier to use... the PRINTF routine i threw in there using TStringList is one example...

    Thank you!

    luckily enough, i had a few hours to try to work with it yesterday... there are
    some problems (initial file loading if it doesn't exist) but they can be worked
    around... personally, i think i'd restructure the oneliners file to contain all
    the info on one like and then maybe break it apart for display... TStringList would works great for lines of text... using a TStringList would also allow for
    moving away from the older style of manually doing all the file reading and writing as TStringList already handles that on its own with LoadFromFile and SaveToFile... like this small rewrite...

    ==== Begin "myoneliners.pas" ====
    program myoneliners;
    {$mode objfpc}

    uses
    crt, classes, sysutils;

    type
    userrec=record
    name : string[36];
    end;

    const onehfname = './oneh.ans';
    const onenfname = './onen.ans';
    const oneyfname = './oney.ans';
    const onelinefname = './oneline.asc';
    const onelinersfname = './oneliners.lst';

    var S : string;
    var Ch1 : char;
    var Ch2 : char;
    var thisuser : userrec;
    var theoneliners : TStringList;


    procedure displaykey(var thechar1, thechar2 : char);

    begin
    case thechar1 of
    #00 : begin
    write(' double character key - ');
    case thechar2 of
    #16 : writeln('ALT-Q');
    #17 : writeln('ALT-W');
    #18 : writeln('ALT-E');
    #19 : writeln('ALT-R');
    #20 : writeln('ALT-T');
    #21 : writeln('ALT-Y');
    #22 : writeln('ALT-U');
    #23 : writeln('ALT-I');
    #24 : writeln('ALT-O');
    #25 : writeln('ALT-P');

    #30 : writeln('ALT-A');
    #31 : writeln('ALT-S');
    #32 : writeln('ALT-D');
    #33 : writeln('ALT-F');
    #34 : writeln('ALT-G');
    #35 : writeln('ALT-H');
    #36 : writeln('ALT-J');
    #37 : writeln('ALT-K');
    #38 : writeln('ALT-L');

    #44 : writeln('ALT-Z');
    #45 : writeln('ALT-X');
    #46 : writeln('ALT-C');
    #47 : writeln('ALT-V');
    #48 : writeln('ALT-B');
    #49 : writeln('ALT-N');
    #50 : writeln('ALT-M');

    #59 : writeln('F1');
    #60 : writeln('F2');
    #61 : writeln('F3');
    #62 : writeln('F4');
    #63 : writeln('F5');
    #64 : writeln('F6');
    #65 : writeln('F7');
    #66 : writeln('F8');
    #67 : writeln('F9');
    #68 : writeln('F10');

    #71 : writeln('HOME');
    #72 : writeln('UPARR');
    #73 : writeln('PGUP');

    #75 : writeln('LFARR');

    #77 : writeln('RTARR');

    #79 : writeln('END');
    #80 : writeln('DNARR');
    #81 : writeln('PGDN');
    #82 : writeln('INSERT');
    #83 : writeln('DELETE');

    #104 : writeln('ALT-F1');
    #105 : writeln('ALT-F2');
    #106 : writeln('ALT-F3');
    #107 : writeln('ALT-F4');
    #108 : writeln('ALT-F5');
    #109 : writeln('ALT-F6');
    #110 : writeln('ALT-F7');
    #111 : writeln('ALT-F8');
    #112 : writeln('ALT-F9');
    #113 : writeln('ALT-F10');

    #133 : writeln('F11');
    #134 : writeln('F12');

    #139 : writeln('ALT-F11');
    #140 : writeln('ALT-F12');
    else
    writeln(' unknown double character key = #',ord(thechar1),' #',ord(thechar2));
    end; {case thechar2}
    end; {begin thechar1 = #00}
    else
    begin
    write(' single character key - ');
    case thechar1 of
    #01 : writeln('CTRL-A');
    #02 : writeln('CTRL-B');
    #03 : writeln('CTRL-C');
    #04 : writeln('CTRL-D');
    #05 : writeln('CTRL-E');
    #06 : writeln('CTRL-F');
    #07 : writeln('CTRL-G');
    #08 : writeln('BCKSPC');
    #09 : writeln('TAB');
    #10 : writeln('LF');
    #11 : writeln('VT');
    #12 : writeln('FF');
    #13 : writeln('ENTER');
    #14 : writeln('CTRL-N');
    #15 : writeln('CTRL-O');
    #16 : writeln('CTRL-P');
    #17 : writeln('CTRL-Q');
    #18 : writeln('CTRL-R');
    #19 : writeln('CTRL-S');
    #20 : writeln('CTRL-T');
    #21 : writeln('CTRL-U');
    #22 : writeln('CTRL-V');
    #23 : writeln('CTRL-W');
    #24 : writeln('CTRL-X');
    #25 : writeln('CTRL-Y');
    #26 : writeln('CTRL-Z');
    #27 : writeln('ESC');
    #28 : writeln('FS');
    #29 : writeln('GS');
    #30 : writeln('RS');
    #31 : writeln('US');
    #32 : writeln('SPACE');
    else
    writeln(chr(byte(thechar1)),' = #',ord(thechar1));
    end; {case thechar1}
    end; {begin}
    end;
    end;

    //### begin printf procedure ####################################
    //### temporary routine to provide printf without needing the
    //### entire impulse package
    procedure printf(thefile : string);

    var
    filecontents : TStringList;
    thisline : integer;

    begin
    writeln(' PRINTF: entering PRINTF routine');
    writeln(' PRINTF: creating stringlist to hold file contents');
    filecontents := TStringList.Create;
    filecontents.sorted := false;
    try
    writeln(' PRINTF: attempting to load file ',thefile);
    filecontents.LoadFromFile(thefile);
    writeln(' PRINTF: display ',IntToStr(filecontents.Count),' lines');
    for thisline := 0 to filecontents.Count-1 do
    begin
    writeln(filecontents.Strings[thisline]);
    end;
    finally
    writeln(' PRINTF: dump stringlist contents and free memory');
    if Assigned(filecontents) then
    FreeAndNil(filecontents);
    end;
    writeln(' PRINTF: leaving PRINTF routine');
    end;
    //### end printf procedure ######################################

    //### begin show procedure ######################################
    Procedure show;

    var Count : integer;

    Begin
    writeln(' SHOW: entering SHOW routine');
    writeln(' SHOW: going to PRINTF(''',onehfname,''')');
    printf(onehfname);
    writeln(' SHOW: back from PRINTF(''',onehfname,''')');
    writeln(' SHOW: displaying current oneliners');
    for count := 0 to theoneliners.Count-1 do
    begin
    writeln(theoneliners.Strings[count]);
    end;
    writeln(' SHOW: finished displaying current oneliners');
    writeln(' SHOW: leaving SHOW routine');
    End; // show
    //### end show procedure ########################################

    //### begin init procedure ######################################
    Procedure init;

    var Count : byte;

    Begin
    writeln(' INIT: entering INIT routine');
    // GetThisUser;
    // just stuff something into thisuser.name to get the prog to run
    writeln(' INIT: assign thisuser.name');
    thisuser.name := 'my goofy user';

    writeln(' INIT: creating stringlist to hold oneliners file contents');
    theoneliners := TStringList.Create;
    theoneliners.sorted := false;
    try
    writeln(' INIT: loading default writers and oneliners');
    For Count := 1 To 10 Do
    Begin
    theoneliners.add('IGNATIUS: Ia! Cthulhu!');
    End;
    writeln(' INIT: defaults loaded');

    if FileExists(onelinersfname) then
    begin
    writeln(' INIT: attempting to load oneliners file ',onelinersfname);
    theoneliners.LoadFromFile(onelinersfname);
    end
    else
    begin
    writeln(' INIT: writing initial oneliners file ',onelinersfname);
    theoneliners.SaveToFile(onelinersfname);
    end;

    writeln(' INIT: oneliners file contains ',IntToStr(theoneliners.Count),' lines');
    finally
    end;
    writeln(' INIT: leaving INIT routine');
    End; // Init
    //### end init procedure ########################################

    //### begin bot_bar procedure ###################################
    Procedure bot_bar;

    Begin
    writeln(' BOT_BAR: entering BOT_BAR routine');
    ch1 := #00;
    ch2 := #00;
    writeln(' BOT_BAR: going to PRINTF(''',onenfname,''')');
    printf(onenfname);
    writeln(' BOT_BAR: back from PRINTF(''',onenfname,''')');
    writeln(' BOT_BAR: any key to show or ENTER to exit BOT_BAR');
    Ch1 := ReadKey;
    case ch1 of
    #00 : begin
    ch2 := readkey;
    displaykey(ch1,ch2);
    end; {begin ch1 = #00}
    else
    displaykey(ch1,ch2);
    end; {case ch1}
    If Ch1 = #13 then
    Begin
    writeln(' BOT_BAR: leaving BOT_BAR via ENTER key');
    exit;
    End;
    writeln(' BOT_BAR: going to SHOW routine');
    show;
    writeln(' BOT_BAR: back from SHOW routine');
    writeln(' BOT_BAR: leaving BOT_BAR via normal exit');
    End; // bot_bar
    //### end bot_bar procedure #####################################

    //### begin top_bar procedure ###################################
    Procedure top_bar;

    Begin
    writeln(' TOP_BAR: entering TOP_BAR routine');
    ch1 := #00;
    ch2 := #00;
    writeln(' TOP_BAR: going to PRINTF(''',oneyfname,''')');
    printf(oneyfname);
    writeln(' TOP_BAR: back from PRINTF(''',oneyfname,''')');
    writeln(' TOP_BAR: any key to exit TOP_BAR or ENTER to add a oneliner');
    Ch1 := ReadKey;
    case ch1 of
    #00 : begin
    ch2 := readkey;
    displaykey(ch1,ch2);
    end; {begin ch1 = #00}
    else
    displaykey(ch1,ch2);
    end; {case ch1}
    If Ch1 = #13 then
    Begin
    writeln(' TOP_BAR: going to PRINTF(''',onelinefname,''')');
    printf(onelinefname);
    writeln(' TOP_BAR: back from PRINTF(''',onelinefname,''')');
    // temp readln replacing inputl to avoid needing entire impulse code
    readln(s);
    If s = '' then
    Begin
    WriteLn(' TOP_BAR: aborted adding new oneliner');
    writeln(' TOP_BAR: going to SHOW routine');
    show;
    writeln(' TOP_BAR: back from SHOW routine');
    writeln(' TOP_BAR: leaving TOP_BAR via blank oneliner line');
    Exit;
    End;

    writeln(' TOP_BAR: deleting oldest oneliner from top of list');
    theoneliners.delete(0);
    writeln(' TOP_BAR: adding new oneliner to bottom of list');
    theoneliners.add(thisuser.name+': '+s);
    writeln(' TOP_BAR: saving modified oneliners file ',onelinersfname);
    theoneliners.SaveToFile(onelinersfname);

    End;
    writeln(' TOP_BAR: going to SHOW routine');
    show;
    writeln(' TOP_BAR: back from SHOW routine');
    writeln(' TOP_BAR: leaving TOP_BAR via normal exit');
    End; // top_bar
    //### end top_bar procedure #####################################

    //### begin position procedure ##################################
    Procedure position;

    Begin
    writeln(' POSITION: entering POSITION routine');
    writeln(' POSITION: do show routine');
    show;
    writeln(' POSITION: any key to continue or ENTER to exit');
    Repeat
    ch1 := #00;
    ch2 := #00;
    ch1 := ReadKey;
    case ch1 of
    #00 : begin
    ch2:=ReadKey;
    displaykey(ch1,ch2);
    case ch2 of
    #80 : begin
    writeln(' POSITION: going to BOT_BAR routine');
    bot_bar;
    writeln(' POSITION: back from BOT_BAR routine');
    end;
    #72 : begin
    writeln(' POSITION: going to TOP_BAR routine');
    top_bar;
    writeln(' POSITION: back from TOP_BAR routine');
    end;
    end;
    end;
    else
    displaykey(ch1,ch2);
    end; {case ch1}
    until ch1=#13;
    writeln(' POSITION: leaving POSITION routine');
    end;
    //### end position procedure ####################################

    Begin
    try
    writeln('MAIN: going to INIT routine');
    init;
    writeln('MAIN: back from INIT routine');
    writeln('MAIN: going to POSITION routine');
    Position;
    writeln('MAIN: back from POSITION routine');
    writeln('MAIN: dump stringlist contents and free memory');
    finally
    if Assigned(theoneliners) then
    FreeAndNil(theoneliners);
    end;
    End.

    ==== End "myoneliners.pas" ====

    )\/(ark

    Always Mount a Scratch Monkey

    ... Machine-independent Program: program which will not run on any machine.
    ---
    * Origin: (1:3634/12.73)
  • From mark lewis@1:3634/12.73 to Joseph Larsen on Sunday, June 12, 2016 12:04:26

    12 Jun 16 07:42, you wrote to me:

    i've gone back to your original post where i asked you if you were stil

    Ok. I figured it out. You were right in creating that custom printf function.

    he, i really didn't have much choice... it was either write some simple routine
    or include common2.pas and whatever else it wanted ;)

    The problem was with the Impulse version of the printf function.

    the original printf actually uses showscr which does a bunch of translation stuff of the files' contents... looks like it does some sort of MCI code stuff... but there's a number of other routines being called from showscr, too... prompt(), sprompt(), setc(), cstr(), cstrl(), lpromptc(), wkey() and a few others... any one of those may have an errant read in them... that's one of
    the reasons why i was saying to simplify everything and make it a stand alone program... generally the bugs and logic flow problems will be easily seen...

    I replaced all instances of printf('filename'); to shell('/usr/bin/cat filename'); And it appears to be working.

    it will locally but likely not remotely as well as losing the MCI decoding and such...

    I can't believe I didn't think of this sooner. So, thanks, man, with
    your help. It's grately appreciated.

    sometimes it takes a little bit for the gears to get switched and a new or different way of looking at things takes place... you're welcome and i'm glad that i was finally able to find the time to offer some assistance :)

    )\/(ark

    Always Mount a Scratch Monkey

    ... I'm so poor I can't even pay attention.
    ---
    * Origin: (1:3634/12.73)
  • From Joseph Larsen@1:340/800 to mark lewis on Monday, June 13, 2016 06:07:00
    it will locally but likely not remotely as well as losing the MCI decod


    Ok. I transferred the display routines to writeln() functions, with the raw ansi code. I tested it from my other computer, and it is working remotely.


    |09ignatius |07(|15cia|07)

    --- DayDream BBS/UNIX (Linux) 2.15a
    * Origin: catch22bbs.com >>> >> > (1:340/800)