Jump to content

VioWrtTTY: Difference between revisions

From EDM2
Anakor (talk | contribs)
m Correction CH -> PCH
Ak120 (talk | contribs)
mNo edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== VioWrtTTY ==
Writes the string to the display, with the current cursor position as the starting point. When the write is finished, the cursor is moved to one position past the end of the string.
; VioWrtTTY(string, strLength, videoHndl) : Writes the string to the display, with the current cursor position as the starting point. When the write is finished, the cursor is moved to one position past the end of the string.


=== Parameters ===
==Syntax==
; string - [[OS2 API:DataType:PCH|PCH]] - input : Character string to be written.
VioWrtTTY (CharStr, Length, VioHandle)
; strLength - [[OS2 API:DataType:ULONG|ULONG]] - input : Length of the character string in bytes.
;videoHndl - [[OS2 API:DataType:HVIO|HVIO]] - input : VIO presentation-space handle.
This value is to be zero, unless the caller is a Presentation Manager application.  If this is the case, the value need to be from [[OS2_API:VioCreatePS|VioCreatePS]].


=== Constants ===
==Parameters==
None
;CharStr ([[PCH]]) - input: Character string to be written. The address of the string to be written.
;Length ([[ULONG]]) - input: Length of the character string in bytes.
;VioHandle ([[HVIO]]) - input: VIO presentation-space handle.
:This value is to be zero, unless the caller is a Presentation Manager application. If this is the case, the value need to be from [[VioCreatePS]].


=== Returns ===
== Returns ==
[[OS2 API:DataType:APIRET|APIRET]] with values of:
[[APIRET]] with values of:
* [[OS2 API:CPI:error#NO_ERROR|NO_ERROR]]
*0 NO_ERROR
* [[OS2 API:CPI:error#ERROR_VIO_INVALID_HANDLE|ERROR_VIO_INVALID_HANDLE]]
*355 ERROR_VIO_MODE
* [[OS2 API:CPI:error#ERROR_VIO_INVALID_PARMS|ERROR_VIO_INVALID_PARMS]]
*421 ERROR_VIO_INVALID_PARMS
* [[OS2 API:CPI:error#ERROR_VIO_MODE|ERROR_VIO_MODE]]
*436 ERROR_VIO_INVALID_HANDLE
 
=== Module ===


=== Define (C/C++) ===
=== Define (C/C++) ===
INCL_VIO
INCL_VIO


=== Export name/Ordinal ===
=== Calling Convention ===
 
=== Calling conversion ===
[[Cdecl32]]
[[Cdecl32]]


=== Example Code ===
=== Example Code ===
  [[OS2 API:DataType:PCH|PCH]]     string;
  PCH    string;
  [[OS2 API:DataType:ULONG|ULONG]] strLength;
  ULONG  strLength;
  [[OS2 API:DataType:HVIO|HVIO]]   videoHndl;
  HVIO  videoHndl;
  [[OS2 API:DataType:APIRET|APIRET]] rc;
  APIRET rc;
  ...
  ...
  rc = WioVrtTTY(string, strLength, videoHndl);
  rc = VioWrtTTY(string, strLength, videoHndl);
  ...
  ...


=== Related Functions ===
==Remarks==
If a string write gets to the end of the line and is not complete, the string write continues at the beginning of the next line. If the write gets to the end of the screen, the screen is scrolled, and the write continues until completed.
 
The character's carriage return, line feed, backspace, tab, and bell are treated as commands rather than printable characters. Backspace is a nondestructive backspace. Tabs are expanded to provide standard 8-byte-wide fields. VioWrtTTY is the only video function affected by ANSI.


Characters are written using the current attribute defined by ANSI or the default value of 7.


=== Notes ===
=== Notes ===
The behavior of [[OS2 API:VioWrtTTY|VioWrtTTY]] is:
The behaviour of '''VioWrtTTY''' is:
If the string is at line's end it is continued on the next line.
If the string is at line's end it is continued on the next line.
If the string is at the screen's end; the screen is scrolled until write is completed.
If the string is at the screen's end; the screen is scrolled until write is completed.
Line 51: Line 50:
* tab
* tab
* bell
* bell
Backspaces are not destructive. Tabs are expanded into 8-byte wide fields. [[OS2_API:VioWrtTTY|VioWrtTTY]] is the only video function affected by ANSI.
Backspaces are not destructive. Tabs are expanded into 8-byte wide fields. '''VioWrtTTY''' is the only video function affected by ANSI.
 
---------------------------------------------------------------------------


Here is some documentation, based on my [http://www.myrkraverk.net/ecs/ hello world].
Here is some documentation, based on my [http://www.myrkraverk.net/ecs/ hello world].


The following is a prototype, that works with OpenWatcom 1.3.
The following is a prototype, that works with OpenWatcom 1.3.
  APIRET VioWrtTTY( char *string, unsigned short length, unsigned short VioHandle );
  APIRET VioWrtTTY( char *string, unsigned short length, unsigned short VioHandle );
To get the prototype do:
To get the prototype do:
  #define INCL_VIO
  #define INCL_VIO
  #include <os2.h>
  #include <os2.h>
 
The ''Control Program Programming Guide and Reference'' documents string as PCH, which is unsigned char * but that does not work with OpenWatcom 1.3.
The Control Program Programming Guide and Reference (that comes with the OS/2 Tool Kit 4.52)
documents string as PCH, which is unsigned char * but that does not work with OpenWatcom 1.3.
 
The VioHandle must be 0, unless the caller is a Presentation Manager application, and then it
must have been returned by VioCreatePS.


A sample, hello world:
A sample, hello world:
 
<code>
  #define INCL_VIO
  #define INCL_VIO
  #include <os2.h>
  #include <os2.h>
   
   
Line 86: Line 73:
         return rc;
         return rc;
  }
  }
</code>


 
[[Category:Vio]]
=== OS Version Introduced ===

Latest revision as of 21:28, 1 January 2020

Writes the string to the display, with the current cursor position as the starting point. When the write is finished, the cursor is moved to one position past the end of the string.

Syntax

VioWrtTTY (CharStr, Length, VioHandle)

Parameters

CharStr (PCH) - input
Character string to be written. The address of the string to be written.
Length (ULONG) - input
Length of the character string in bytes.
VioHandle (HVIO) - input
VIO presentation-space handle.
This value is to be zero, unless the caller is a Presentation Manager application. If this is the case, the value need to be from VioCreatePS.

Returns

APIRET with values of:

  • 0 NO_ERROR
  • 355 ERROR_VIO_MODE
  • 421 ERROR_VIO_INVALID_PARMS
  • 436 ERROR_VIO_INVALID_HANDLE

Define (C/C++)

INCL_VIO

Calling Convention

Cdecl32

Example Code

PCH     string;
ULONG  strLength;
HVIO   videoHndl;
APIRET rc;
...
rc = VioWrtTTY(string, strLength, videoHndl);
...

Remarks

If a string write gets to the end of the line and is not complete, the string write continues at the beginning of the next line. If the write gets to the end of the screen, the screen is scrolled, and the write continues until completed.

The character's carriage return, line feed, backspace, tab, and bell are treated as commands rather than printable characters. Backspace is a nondestructive backspace. Tabs are expanded to provide standard 8-byte-wide fields. VioWrtTTY is the only video function affected by ANSI.

Characters are written using the current attribute defined by ANSI or the default value of 7.

Notes

The behaviour of VioWrtTTY is: If the string is at line's end it is continued on the next line. If the string is at the screen's end; the screen is scrolled until write is completed.

These items are treated as commands and not printable characters:

  • carriage return
  • line feed
  • backspace
  • tab
  • bell

Backspaces are not destructive. Tabs are expanded into 8-byte wide fields. VioWrtTTY is the only video function affected by ANSI.

Here is some documentation, based on my hello world.

The following is a prototype, that works with OpenWatcom 1.3.

APIRET VioWrtTTY( char *string, unsigned short length, unsigned short VioHandle );

To get the prototype do:

#define INCL_VIO
#include <os2.h>

The Control Program Programming Guide and Reference documents string as PCH, which is unsigned char * but that does not work with OpenWatcom 1.3.

A sample, hello world:

#define INCL_VIO
#include <os2.h>

int main( int argc, char *argv[] )
{
        APIRET rc = VioWrtTTY( "Hello, VIO\n", // string to write
                               11,             // lenght of string to write
                               0 );            // VIO handle, must be 0
        return rc;
}