 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 how_to_emulate_news.txt
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Newsgroups: comp.terminals
Path: cs.utk.edu!darwin.sura.net!europa.eng.gtefsd.com!uunet!pipex!uknet!bradford.ac.uk!M.T.Shipley
From: M.T.Shipley@bradford.ac.uk (MT SHIPLEY)
Subject: Re: VT100 Emulator: How To?
Message-ID: <1993Sep6.155625.24514@bradford.ac.uk>
Lines: 195
Organization: University of Bradford, UK
X-Newsreader: TIN [version 1.1 PL9]
References: <boutellCCtEDu.30r@netcom.com>
Date: Mon, 6 Sep 1993 15:56:25 GMT

Thomas Boutell (boutell@netcom.com) wrote:
: I need to write a simple VT100 emulator. I would appreciate any and all
: pointers to source or, preferably, documentation on the subject of the
: vt100 command set. I seem to recall having such a document years ago, but
: alas, it's long since lost to me. Any help appreciated.

Make what you will of the following, I've only a very short time to do a bit
of typing/cut/paste.  Soz.

Basically, to implement an ANSI/VT100 type escape sequence interpreter,
you need to...


          (a)  parse the escape sequence;
          (b)  decode the escape sequence;
          (c)  execute the escape sequence

                   and some housekeeping too.


First, the way *not* to do it...

    I have seen a number of implementations of ANSI-escape-sequence
    interpreters, and some of these combine steps (a) and (b) into a single
    stage, as sort of a set of comparisons which need to be done one after
    another.  The problem with this is that sequences which are not recognised
    (by your interpreter) sometimes give garbage characters on the screen.
    For example, Digital, with release 5 point-something-or-other of the VMS
    operating system started outputting the mouse enable/disable sequences
    when you went into the editor.  Now, most (all?) VT100 terminals
    don't actually implement these sequences, and the ones that combine them
    give you some rubbish on the screen too.  Either the ANSI standard or the
    DEC standard require you to IGNORE sequences that are not recognised, NOT
    output a load of rubbish on the screen and possibly mis-interpret the
    following sequence.

Now, the way to do it (in my opinion) is...

    Parse the escape sequence, according to a small finite set of valid
    syntaxes (plural?).

/*-----------------------------------------------------------------------
 * Editor's note: the notation 16#1F means the hexadecimal value 1F, etc.
 *-----------------------------------------------------------------------
 */

    There are basically the following syntax forms:

          A control character
              A character in the range 16#00 .. 16#1F
                                    or 16#80 .. 16#9F

          A escape sequence
              A escape character,
              followed by zero or more intermediate character (16#20 .. 16#2F)
              followed by a final character (16#30 .. 16#7E)

          A control sequence
              A control sequence introducer character (16#9B)
              followed by zero or more parameter characters (16#30 .. 16#3F)
              followed by zero or more intermediate character (16#20 .. 16#2F)
              followed by a final character (16#40 .. 16#7E)

          A device control string
              A device control string introducer character (16#90)
              followed by zero or more parameter characters (16#30 .. 16#3F)
              followed by zero or more intermediate character (16#20 .. 16#2F)
              followed by a final character (16#40 .. 16#7E)
              followed by the data string
              followed by a string terminator character (16#9C)

          An operating system control string
              etc
          A privacy message
              etc
          An application control string
              etc
          A printable character glyph
              etc

    There are 8 bit equivalents of some 7 bit sequences...

           7-Bit Sequence ---> 8-Bit C1 Control Character

              1.  Remove the ESC character
              2.  Add 16#40 to the final character

           8-Bit C1 Control Character ---> 7-Bit Sequence

              1.  Insert an ESC character
              2.  Subtract 16#40 from the final character

       For example...


          DCS == ESC P
          ST  == ESC \

    I strongly suggested getting hold of a DEC manual (e.g., VT420 text
    programmers manual EK-VT420-RM) and the ANSI standards, to see the full
    set of syntaxes (plural?)/sequences.

    The parsing code may be implemented as a finite state machine, with
    either state table expressed as code or data.  I.e., you may have a set of
    conditional comparison statements expressed as code, with jumps to the
    correct bit, or you may (like I do) simply use a state table, with the
    inputs being current state (soon to become the last state), and the
    character code, and the output being the new state.  Various optimizations
    may be made here, for example, you could block/group/bunch who sets
    of characters that are always treated the same way up --- you'll see
    what I mean if you implement the table!

    Label (either implicitly or explicitly) each node and terminating
    or non terminating, and when you get a terminating node, decode it and
    execute it.

    Now it has been parsed, the output from the parse should be in nice
    variables, such as parameters, intermediate characters, final characters
    etc.

      class : classes;
      parameter_introductory_byte : unsigned_byte;
      parameter_count : 0..max_params;
      parameter_values : ARRAY [1..max_params] OF param_range;
      parameter_explicitly_specified : ARRAY [1..max_params] OF BOOLEAN;
      intermediate_count : 0 .. max_intermediate;
      intermediate_bytes : ARRAY [1..max_intermediate] OF unsigned_byte;
      final_byte : unsigned_byte;

    This can be done ether as two steps (decode, then execute), or as one
    (decode and execute in same part of code).  For example, you may
    have a number of case statements...

...................
              CASE class OF
                class_ctrl      : decode_ctrl;
                class_esc       : decode_esc;
                class_csi       : decode_csi;
                class_dcs       : decode_dcs;
                class_data      : decode_data;
                class_osc       : decode_osc;
                class_pm        : decode_pm;
                class_apc       : decode_apc;
                class_printable : decode_printable
              END {CASE}
...................
          PROCEDURE decode_ctrl;

                  CASE final_byte OF
                    16#00 : mnemonic := NUL;
                    16#01 : mnemonic := SOH;
                    16#02 : mnemonic := STX;
                    16#03 : mnemonic := ETX;
                    16#04 : mnemonic := EOT;
                    16#05 : mnemonic := ENQ;
...................
          PROCEDURE decode_esc;

                  CASE intermediate_count OF
                    0 : CASE final_byte OF
                          16#60 : mnemonic := DMI;
                          16#61 : mnemonic := INT;
                          16#62 : mnemonic := EMI;
                          16#63 : mnemonic := RIS;
...................
          PROCEDURE decode_csi;
                  CASE intermediate_count OF

                    0 : CASE final_byte OF
                          16#40 : mnemonic := ICH;
                          16#41 : mnemonic := CUU;
                          16#42 : mnemonic := CUD;
                    1 : CASE intermediate_bytes[1] OF
                          16#20 : CASE final_byte OF
                                    16#40 : mnemonic := SL;
                                    16#41 : mnemonic := SR;
                                    16#42 : mnemonic := GSM;
                                    16#43 : mnemonic := GSS;
                         16#2B : CASE final_byte OF
                                    16#70 : mnemonic := DECSR; {VT420}
                                    16#71 : mnemonic := DECELF; {VT420}
                                    16#72 : mnemonic := DECSMKR; {VT420}
...................

     Now just execute it!

     The advantage with this approach is that sequences which are not
     recognised are ignored, with no garbage output the the screen.

: -T
: -- 

Martin

: "The funnels provide the deep base and rhythm       boutell@netcom.com
: And all the utensils are dancing;                  
: All rubbing together and clinking. Such pleasure  
: To be out- of- drawers and romancing!"  -- Zvi Gilbert

Well, that ones foxed me!


Newsgroups: comp.terminals
Path: cs.utk.edu!emory!europa.eng.gtefsd.com!uunet!pipex!uknet!bradford.ac.uk!M.T.Shipley
From: M.T.Shipley@bradford.ac.uk (MT SHIPLEY)
Subject: Re: VT100 Emulator: How To?
Message-ID: <1993Sep6.202256.29874@bradford.ac.uk>
Lines: 38
Organization: University of Bradford, UK
X-Newsreader: TIN [version 1.1 PL9]
References: <26fqra$6k7@vixen.cso.uiuc.edu>
Date: Mon, 6 Sep 1993 20:22:56 GMT

John Cavanaugh (cavanaug@cogsci.uiuc.edu) wrote:

: >    Parse the escape sequence, according to a small finite set of valid
: >    syntaxes (plural?).

: I was wondering if you could do all this lexing and parsing using lex
: and yacc.  That way (a) & (b) above are handled for you, all you would
: have to do then is develop the lex and yacc definition files and write
: (c).  

The first time I read this, I though that you suggested writing using the
C language, but now, on read-reading, I see you mean my option (c).

Anyway, for those wanting to travel to new ground and foreign parts, while
being able to see (ha ha), and at the same time, use Pascal (or not use
the output language of most lex/yacc systems), you may have a look at the
Turbo Pascal version of lex/yacc, called something like TPLY30A1.ZIP and
TPLY30A2.ZIP from simtel20 and friends (I saw it on oak.oakland.edu).

Anyway, even though I never see a line of Lex/Yacc, a friend uses it and
from his comments in the past, you may (likely) will be able too,
**but** since the set of possible syntax thingies (what do we call 'em?)
is quite small, you it ain't too much of a problem anyway, and the decoding
only takes one like for each mnemonic, so maybe there's not a lot in it!

: Has anybody done this before???

Bet they ain't done using the Pascal lex/yacc.  Time to break new ground!

: -John Cavanaugh

Martin

PS Can someone tell me how to change the stupid from "MT SHIPLEY" to
something nicer, such as "Martin T Shipley" etc, using "tin" newsreader,
without having to get systems admin to do it.



Article 1186 of comp.terminals:
Path: cs.utk.edu!darwin.sura.net!news-feed-2.peachnet.edu!concert!news-feed-1.peachnet.edu!umn.edu!msus1.msus.edu!news.gac.edu!news!scott
Newsgroups: comp.terminals
Subject: Re: VT100 Emulator: How To?
Message-ID: <SCOTT.93Sep12201711@flash.gac.edu>
From: scott@flash.gac.edu (Scott Hess)
Date: 12 Sep 93 20:17:11
References: <boutellCCtEDu.30r@netcom.com> <1993Sep6.155625.24514@bradford.ac.uk>
Organization: Is a sign of weakness
Lines: 30

	<26fqra$6k7@vixen.cso.uiuc.edu>
NNTP-Posting-Host: flash.gac.edu
In-reply-to: cavanaug@cogsci.uiuc.edu's message of 6 Sep 1993 17:08:58 GMT

In article <26fqra$6k7@vixen.cso.uiuc.edu> cavanaug@cogsci.uiuc.edu (John Cavanaugh) writes:
   I was wondering if you could do all this lexing and parsing using
   lex and yacc.  That way a) & b) above are handled for you, all you
   would have to do then is develop the lex and yacc definition files
   and write c).

I don't think you can do this (reasonably).  One large problem is that
any VT100 escape sequence can have embedded control characters.  For
instance, "ESC [ NL m" executes as "NL ESC [ m".  What you could do, I
suppose, it to write a multi-layered beastie to handle pulling the
control characters to the front of the escape sequences (except for
CAN and other control chars that cancel the sequence).

Another problem is that you usually need a pretty interactive system,
which will be interesting to hack into a Lex/Yacc setup.  Worse, you
don't even get some fundamental "unit" of input - if you get partial
input, you have to buffer it and save it until you _do_ get an entire
escape sequence.  Annoying.

Anyhow, it probably could be done.  I'm not certain if it's worth all
that much, though, since the parsing isn't really all that hard.  In
fact, the parsing is really pretty trivial.  The hard part is getting
the things that happen due to the parsed information correct.

Later,
--
scott hess <shess@ssesco.com>                        <To the BatCube, Robin>
12901 Upton Avenue South, #326  Burnsville, MN 55337 (612) 895-1208 Anytime!


Article 3528 of comp.terminals:
Path: cs.utk.edu!stc06.CTD.ORNL.GOV!fnnews.fnal.gov!uwm.edu!lll-winken.llnl.gov!decwrl!svc.portal.com!portal.com!cup.portal.com!Chris_F_Chiesa
From: Chris_F_Chiesa@cup.portal.com
Newsgroups: comp.terminals,comp.os.vms
Subject: Re: Pathworks VT320 vs VT100
Date: 2 Feb 1995 11:20:10 -0800
Organization: The Portal System (TM)
Lines: 25
Sender: pccop@unix.portal.com
Message-ID: <132149@cup.portal.com>
References: <3f4g3g$1mp@bert.ga.com.au> <D2Ho3L.2H4@world.std.com>
NNTP-Posting-Host: news1.unix.portal.com
Xref: cs.utk.edu comp.terminals:3528 comp.os.vms:106402


...whereas MY experience with "VT100" emulators suggests that many, maybe
even most, lack some fundamental capability: the ability to respond to an
auto-identification query, the ability to perform certain screen or cursor
operations, the ability to transmit appropriate "editing keypad" escape
sequences, etc.  The more layers (in this case Pathworks, plus whatever
transport(s) it is using to reach the VMS system) between the emulator and
the application, the more likely it is that some layer will intercept an
otherwise "vanilla" keycode and use it for its own purposes, or conversely
will insert its own background data into the stream without bothering to
inform the user.

   (My experience includes VAX and AXP VMS DECwindows/Motif "DECterm," SGI 
Irix "console" and "Unix shell," Macintosh MacTerminal and Red Ryder, numerous 
MS-DOS and MS-Windows terminal emulators including Qmodem, Procomm, MS-Kermit 
and others, and several Amiga- and (cringe) Atari-800-based emulators.  Of 
these, DECterm is definitive, MacTerminal, MS-Kermit, and "Kermit-65" on the 
Atari, are the only sufficiently complete emulations to receive my stamp of 
approval, and pretty much everything else I've seen is pure crap.)

  Beware.
 

  Chris Chiesa
   Chris_F_Chiesa@cup.portal.com


Article 3592 of comp.terminals:
Path: cs.utk.edu!stc06.CTD.ORNL.GOV!fnnews.fnal.gov!uwm.edu!news.alpha.net!news.mathworks.com!transfer.stratus.com!xylogics.com!Xylogics.COM!carlson
From: carlson@Xylogics.COM (James Carlson)
Newsgroups: comp.terminals
Subject: Re: DEC private modes fot VT series.
Date: 15 Feb 1995 12:52:20 GMT
Organization: Xylogics Incorporated
Lines: 56
Distribution: world
Message-ID: <3hste4$jpg@newhub.xylogics.com>
References: <3hpc0n$1do@senator-bedfellow.MIT.EDU>
Reply-To: carlson@xylogics.com
NNTP-Posting-Host: newhub.xylogics.com
Keywords: DEC VT100 VT200 VT240

In article <3hpc0n$1do@senator-bedfellow.MIT.EDU>, igorlord@athena.mit.edu (Igor Lyubashevskiy) writes:
|> Hi.  I am trying to write a VT200 emulator, and my manual does not make
|> it clear the exact format of what it calls Ps;Ps;... sequences with DEC
|> private modes.
|> 
|> For example, when CSI ? 2 ; 4 h     is recieved, is it equivalent to
|> CSI ? 2 h    and    CSI 4 h       or
|> CSI ? 2 h    and    CSI ? 4 h     ?
|> 
|> Please if you can help me, email to me or followup to this group.

"CSI ? 2 ; 4 h" is equivalent to "CSI ? 2 h CSI ? 4 h".  The flags (like
the '?' character) are global within a single CSI sequence.

Since the command isn't actually dispatched until the 'h' is received
(flags are saved in a bit vector and the decimal arguments are saved in
an array along with a present/omitted flag which is needed on the VT220
because the set-scroll-region command has a default of max-lines for the
second argument), the '?' flag can appear anywhere.  For example, this
is a sequence equivalent to the one above, even if it is a bit strange
looking:

	CSI 2 ; ? 4 h

A properly-functioning VT100/VT200 emulator jumps from "character" state
to "csi argument gathering" state when CSI is received, and then jumps
through a dispatch table when a code in the range 40-7E (hex) is
received.  This allows ESC, CSI, CAN and SUB to terminate the sequence
prematurely without altering any other variables, and it allows LF, VT,
FF, CR, TAB and ENQ to be dispatched in the middle of the CSI argument
list without changing state.  For example, this is a perfectly legal VT
command -- it goes down one line and right two characters:

	CSI 2 LF C

When the LF is received, the cursor is moved to the next line (and a
scroll happens if necessary), but the CSI state isn't touched.  When
the 'C' is received, the cursor is moved two characters to the right
because the CSI sequence is dispatched at that point.

The "correct" implementation is thus a big loop which dispatches all of
the incoming data based on a state machine.  It is *NOT* correct to
build a CSI-argument-parser which calls the (blocking) character-read
function directly.  This is almost guaranteed to fail, and I've seen
this done in too many poorly-implemented PC-based emulators.  The
dispatch loop must call the parser instead.

The vttest program will test for compliance with all of this.  You can
find it at an FTP site near you.  I made heavy use of this when I was
designing terminals at Data General.  (I wanted to get DG to make a
contribution to the author, but I was never able to locate him.  Sigh.)

---
James Carlson <carlson@xylogics.com>            Tel:  +1 617 272 8140
Annex Software Support / Xylogics, Inc.               +1 800 225 3317
53 Third Avenue / Burlington MA  01803-4491     Fax:  +1 617 272 2618


Article 6533 of comp.databases.pick:
Path: cs.utk.edu!stc06.ctd.ornl.gov!fnnews.fnal.gov!mp.cs.niu.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!news.sprintlink.net!matlock.mindspring.com!francisc.mindspring.com!francisc
From: francisc@mindspring.com (Francis Carden)
Newsgroups: comp.databases.pick
Subject: Re: New IPX terminal to replace Piclan wanted
Date: Mon, 8 May 1995 11:18:39 gmt
Organization: MindSpring Enterprises, Inc.
Lines: 32
Message-ID: <francisc.76.001861B6@mindspring.com>
References: <3oii76$qb7@fitzherbert.pavilion.co.uk> <3oj4uk$a54@news.primenet.com> <D88yF8.KL0@world.std.com>
NNTP-Posting-Host: francisc.mindspring.com
X-Newsreader: Trumpet for Windows [Version 1.0 Rev B]


>Is there any reason that there cannot be an int 14 compatible hook so that
>the wide world of terminal emulators that run under Novells various
>systems could be used.  Then one could load a layer between Piclan and the
>worlds emulators, rather than the rather limited Pick choices?  Novell's
>Netware connect or NASP (i think) supports terminals over the network
>and serial connection, and products that communicate with these things
>could be fooled into talking to Piclan instead.

>I don't think a user will write a terminal emulator.  We leave such chores
>up to guys like Luke Webber to do these things (listening Luke?).  The rest
>of us would like Procomm or such when there are a few extra features
>to be used, and not have to rewrite an emulator from the ground up to get
>what we want.


>Jim
>-- 
>-----------------------------------------------------------
>Jim Stephens    jws@world.std.com                Irvine, Ca
>url  ftp://www.std.com/pub/jws/jws.html
>-----------------------------------------------------------

Int 14 is an effective way of supporting lots of networks, we've had it in 
TERMiTE for many many years. However, it's very inefficient, it cripples other 
resources on the desktop, does not allow multiple sessions and locks up ports 
frequently.

Doug, what's your view ?

Francis Carden
Pixel (TERMiTE) Atlanta


Article 3050 of comp.protocols.kermit.misc:
Path: cs.utk.edu!news.msfc.nasa.gov!elroy.jpl.nasa.gov!swrinde!cs.utexas.edu!news.cs.utah.edu!cc.usu.edu!jrd
From: jrd@cc.usu.edu (Joe Doupnik)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: cursor
Message-ID: <1995Jun19.100536.54278@cc.usu.edu>
Date: 19 Jun 95 10:05:36 MDT
References: <romani-1906951034240001@aaladm26.lib.unc.edu>
Organization: Utah State University
Lines: 20

In article <romani-1906951034240001@aaladm26.lib.unc.edu>, romani@email.unc.edu (David Romani) writes:
> Folks,
> 
> Does any one know of any way to turn the terminal cursor blink off, or
> even just off (as opposed to set terminal cursor block or underline). It
> is a setup feature on VT420 terminals and I have a user who is _very_
> interested in doing it in MS-Kermit 3.14. So far the I have found DOS
> level utils that let me control the cursor in DOS and will supress the
> cursor at the MS-Kermit prompt, but not once I connect. 
----------
	The IBM PC display adapter hardware controls cursor blinking, and 
there are no blinking controls available in the hardware. The DOS utils
to which you refer are trying to play games with character sets and 
hooking the timer tick interrupt to include and then make invisible the
cursor and so on; they can't control the real cursor blinking because there 
isn't any control. Sorry to report this, but the question comes up every
few months and there isn't a satisfactory solution. 
	Joe D.

	
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
