SMG$ routines and Esc


Topic author
fim
Active Contributor
Posts: 31
Joined: Wed Jan 04, 2023 5:14 am
Reputation: 0
Status: Offline

SMG$ routines and Esc

Post by fim » Thu Feb 09, 2023 7:14 am

I am trying to use SMG$ routines to color fields on the display.
For that I use Escape sequences.
It doesn't go well, the SMG$ routines refuse to send the Esc character (hex 1B) to the monitor.
If I use COBOL's DISPLAY it works perfectly.
A line declared in COBOL like this:

Code: Select all

01 LINE-ESC.
     10 FILLER PIC X(1)  VALUE X'1B'.
     10 FILLER PIC X(10) VALUE "[1;31;144m".
     10 FILLER PIC X(18) VALUE "Bright red on blue".
     10 FILLER PIC X(1)  VALUE X'1B'.
     10 FILLER PIC X(3)  VALUE "[0m".

Gives a completely correct result, red text on a blue background.
If I use "SMG$PUT_LINE" with the same data, the printable characters are printed at the top left of the screen and no coloring.
I have tried other SMG$ functions to send the Esc character on the screen, all fail.
Anyone know how to do it?
/Fim W.

User avatar

martin
Valued Contributor
Posts: 68
Joined: Tue Mar 22, 2022 6:47 pm
Reputation: 0
Location: England
Status: Offline

Re: SMG$ routines and Esc

Post by martin » Sat Feb 11, 2023 4:18 am

Presumably that also goes for SMG$C_COLOR_USERx as well?
Martin
  • Retired System Manager: VMS/UNIX/UNICOS/Linux.
  • Started on a VAX 11/782 in 1984 with VMS 3.6.


Topic author
fim
Active Contributor
Posts: 31
Joined: Wed Jan 04, 2023 5:14 am
Reputation: 0
Status: Offline

Re: SMG$ routines and Esc

Post by fim » Sat Feb 11, 2023 10:13 am

SMG$C_COLOR_USERx Is just for background.

User avatar

arne_v
Master
Posts: 299
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: SMG$ routines and Esc

Post by arne_v » Sun Feb 12, 2023 8:45 pm

I got an example working.

Copy termtable.txt and smgterms.txt from sys$system to current directory.
Edit termtable.txt to include putty.txt.
Clone VT500 from smgterms.txt to PUTTY in putty.txt and change USER1 strings.

And you are ready to go.

Code: Select all

$ type termtable.txt
REQUIRE 'SMGTERMS'              ! contains definitions for DEC terminals

require 'putty'
$ sear putty.txt "name = ","_user1 ="
NAME = "PUTTY"
        begin_user1 = "$[34;41m",               end_user1 = "$[0m",
$ mcr smgbldtrm
$ define/nolog term$tabloc sys$disk:[]
$ set term/dev=putty
$ type color.for
      program color
      implicit none
      include '($smgdef)'
      integer*4 stat, vdisp, pb, dummy
      integer*4 smg$create_virtual_display, smg$create_pasteboard,
     +          smg$paste_virtual_display,
     +          smg$set_cursor_abs, smg$put_line,
     +          smg$delete_virtual_display, smg$delete_pasteboard
      stat = smg$create_virtual_display(3, 78, vdisp, smg$m_border)
      stat = smg$create_pasteboard(pb)
      stat = smg$paste_virtual_display(vdisp, pb, 2, 2)
      stat = smg$set_cursor_abs(vdisp, 2, 2)
      stat = smg$put_line(vdisp, 'aa')
      stat = smg$set_cursor_abs(vdisp, 2, 4)
      stat = smg$put_line(vdisp, 'bb', 1, smg$m_bold)
      stat = smg$set_cursor_abs(vdisp, 2, 6)
      stat = smg$put_line(vdisp, 'cc', 1, smg$m_underline)
      stat = smg$set_cursor_abs(vdisp, 2, 8)
      stat = smg$put_line(vdisp, 'dd', 1, smg$m_reverse)
      stat = smg$set_cursor_abs(vdisp, 2, 10)
      stat = smg$put_line(vdisp, 'ee', 1, smg$m_user1)
      stat = smg$delete_virtual_display(vdisp)
      stat = smg$delete_pasteboard(pb)
      end
$ for color
$ link color
$ run color
And 'ee' is blue text on red background.

Sorry for using Fortran and not Cobol, but I am better at Fortran than Cobol and the code itself is not so relevant for the point.
Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
fim
Active Contributor
Posts: 31
Joined: Wed Jan 04, 2023 5:14 am
Reputation: 0
Status: Offline

Re: SMG$ routines and Esc

Post by fim » Mon Feb 13, 2023 5:08 am

Arne,
Sounds exciting, will try. Will return.
/Fim W.

Post Reply