Difference between revisions of "VMS-Specific Python Modules"

From VSI OpenVMS Wiki
Jump to: navigation, search
(Created page with "VMS specific Python modules. == vms.decc == Provides DECC functionality. === dlopen_test(name:str)->int === Tries to open a shared image. ==== parameters ==== * <code>name:s...")
 
Line 76: Line 76:
  
 
== vms.ile3 ==
 
== vms.ile3 ==
 +
Provides functions for working with list.
 +
 +
=== new()->object ===
 +
Creates empty item list.
 +
==== parameters ====
 +
<code>None</code>
 +
==== returns ====
 +
New empty item list
 +
 +
=== delete(il:object)->None ===
 +
Deletes item list.
 +
==== parameters ====
 +
* <code>il:object</code> item list to be removed
 +
==== returns ====
 +
OpenVMS system time
 +
 +
=== size(il:object)->int ===
 +
Gets size of the item list.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
==== returns ====
 +
The size of the specified item list
 +
 +
=== addint(il:object, item:int, item_type:int, item_value:int)->None ===
 +
Adds a new integer to the item list.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>item:int</code> item to add
 +
* <code>item_type:int</code> type of the item. See '''vms.dscdef'''
 +
* <code>item_value:int</code> value of the item
 +
==== returns ====
 +
<code>None</code>
 +
 +
=== getint(il:object, index:int)->int ===
 +
Gets the integer at the specified index in the list.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>index:int</code> index of the item to get
 +
==== returns ====
 +
Integer value
 +
 +
=== gethex(il:object, index:int)->str ===
 +
Gets the integer at the specified index in the item list and returns it as a hexadecimal string.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>index:int</code> index of the item to get
 +
==== returns ====
 +
Hexadecimal string
 +
 +
=== addstr(il:object, item:int, item_value:str, item_length:int)->None ===
 +
Adds the specified string to the item list. If the <code>item_value</code> is not <code>None</code>, the <code>item_length</code> is ignored and the length of the buffer will be the same as the length of the <code>item_value</code>.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>item:int</code> item to add
 +
* <code>item_value:str</code> value to add (or <code>None</code>)
 +
* <code>item_length:int</code> length of the buffer if the <code>item_value</code> is <code>None</code>
 +
==== returns ====
 +
<code>None</code>
 +
 +
=== addstrd(il:object, item:int, item_value:str, item_length:int)->None ===
 +
Adds the specified space-expanded string to the item list. The first byte of the buffer is the length of the string. If the <code>item_value</code> is longer than the <code>item_length</code>, it will be truncated.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>item:int</code> item to add
 +
* <code>item_value:str</code> value to add
 +
* <code>item_length:int</code> length of the buffer (the resulting string length is one byte less)
 +
==== returns ====
 +
<code>None</code>
 +
 +
=== addstrn(il:object, item:int, item_value:str, item_length:int)->None ===
 +
Adds the specified space-expanded string to the item list. If the <code>item_value</code> is longer than the <code>item_length</code>, it will be truncated.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>item:int</code> item to add
 +
* <code>item_value:str</code> value to add
 +
* <code>item_length:int</code> length of the buffer
 +
==== returns ====
 +
<code>None</code>
 +
 +
=== getstr(il:object, index:int, flag:int)->str ===
 +
Gets the string at the specified index in the item list.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>index:int</code> index of the item to get
 +
* <code>flag:int</code> if set to <code>1</code>, the first byte of the resulting string is the length of the string
 +
==== returns ====
 +
String
 +
 +
=== addbin(il:object, item:int, item_value:int, item_offset:int, item_len:int)->None ===
 +
Adds a new binary item to the list. It will be interpreted as a string.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>item:int</code> item to add
 +
* <code>item_value:int</code> value to store
 +
* <code>item_offset:int</code> starting byte
 +
* <code>item_len:int</code> amount of bytes
 +
==== returns ====
 +
<code>None</code>
 +
 +
=== getbyte(il:object, index:int, item_offset:int)->int ===
 +
Gets the byte at the specified position in the item list.
 +
==== parameters ====
 +
* <code>il:object</code> item list
 +
* <code>index:int</code> index of the item
 +
* <code>item_offset:int</code> starting byte
 +
==== returns ====
 +
Integer value of the specified byte
 +
 
== vms.lib ==
 
== vms.lib ==
 
== vms.sys ==
 
== vms.sys ==
 
== rdb ==
 
== rdb ==

Revision as of 05:20, 31 August 2020

VMS specific Python modules.

Contents

vms.decc

Provides DECC functionality.

dlopen_test(name:str)->int

Tries to open a shared image.

parameters

  • name:str path to the shared image

returns

  • 1 if the shared image exists and can be opened by dlopen()
  • 0 otherwise

fix_time(vms_time:int)->int

Converts VMS time to the Unix time.

parameters

  • vms_time:int VMS system time

returns

Time in Unix format (seconds that have elapsed since 1970.01.01)

from_vms(vms_path:str, wild_flag:int)->list

Converts VMS path to a list of Unix paths.

parameters

  • vms_path:str path in VMS format (supports wildcards)
  • wild_flag:int If set to 0, wildcards found in the vms_path are not expanded

returns

List of paths in Unix format

getenv(name:str, def_value:str)->str

Gets the specified environment variable value. See getenv() description in the HP C Run-Time Library Reference Manual for OpenVMS Systems documentation.

parameters

  • name:str name of the environment variable
  • def_value:str default value

returns

Environment variable value

sleep(seconds:int)->int

Suspends execution of the current process or thread for the specified number of seconds.

parameters

  • seconds:int seconds to sleep

returns

The number of seconds left to the end of the sleep period if sleep is interrupted. 0 if the process slept for the specified number of seconds.

sysconf(name:int)->int

Provides a method for determining the current value of a configurable system limit or whether optional features are supported.

parameters

  • name:int system variable to be queried

returns

Requested value

to_vms(unix_path:str, allow_wild:int, no_directory:int)->list

Converts UNIX style file specifications to OpenVMS file specifications.

parameters

  • unix_path:str file name in UNIX style file specification format
  • allow_wild:int If set to 0, wildcards found in unix_path are not expanded
  • no_directory:int An integer that has one of the following values:
    • 0 - Directory allowed
    • 1 - Prevent expansion of the string as a directory name
    • 2 - Force expansion of the string as a directory name

returns

List of paths in OpenVMS style

unixtime(vms_time:int)->int

Converts OpenVMS system time to the Unix local time.

parameters

  • vms_time:int OpenVMS system time

returns

Unix time

vmstime(unix_time:int)->int

Converts Unix time to the OpenVMS system time.

parameters

  • unix_time:int Unix time

returns

OpenVMS system time

vms.ile3

Provides functions for working with list.

new()->object

Creates empty item list.

parameters

None

returns

New empty item list

delete(il:object)->None

Deletes item list.

parameters

  • il:object item list to be removed

returns

OpenVMS system time

size(il:object)->int

Gets size of the item list.

parameters

  • il:object item list

returns

The size of the specified item list

addint(il:object, item:int, item_type:int, item_value:int)->None

Adds a new integer to the item list.

parameters

  • il:object item list
  • item:int item to add
  • item_type:int type of the item. See vms.dscdef
  • item_value:int value of the item

returns

None

getint(il:object, index:int)->int

Gets the integer at the specified index in the list.

parameters

  • il:object item list
  • index:int index of the item to get

returns

Integer value

gethex(il:object, index:int)->str

Gets the integer at the specified index in the item list and returns it as a hexadecimal string.

parameters

  • il:object item list
  • index:int index of the item to get

returns

Hexadecimal string

addstr(il:object, item:int, item_value:str, item_length:int)->None

Adds the specified string to the item list. If the item_value is not None, the item_length is ignored and the length of the buffer will be the same as the length of the item_value.

parameters

  • il:object item list
  • item:int item to add
  • item_value:str value to add (or None)
  • item_length:int length of the buffer if the item_value is None

returns

None

addstrd(il:object, item:int, item_value:str, item_length:int)->None

Adds the specified space-expanded string to the item list. The first byte of the buffer is the length of the string. If the item_value is longer than the item_length, it will be truncated.

parameters

  • il:object item list
  • item:int item to add
  • item_value:str value to add
  • item_length:int length of the buffer (the resulting string length is one byte less)

returns

None

addstrn(il:object, item:int, item_value:str, item_length:int)->None

Adds the specified space-expanded string to the item list. If the item_value is longer than the item_length, it will be truncated.

parameters

  • il:object item list
  • item:int item to add
  • item_value:str value to add
  • item_length:int length of the buffer

returns

None

getstr(il:object, index:int, flag:int)->str

Gets the string at the specified index in the item list.

parameters

  • il:object item list
  • index:int index of the item to get
  • flag:int if set to 1, the first byte of the resulting string is the length of the string

returns

String

addbin(il:object, item:int, item_value:int, item_offset:int, item_len:int)->None

Adds a new binary item to the list. It will be interpreted as a string.

parameters

  • il:object item list
  • item:int item to add
  • item_value:int value to store
  • item_offset:int starting byte
  • item_len:int amount of bytes

returns

None

getbyte(il:object, index:int, item_offset:int)->int

Gets the byte at the specified position in the item list.

parameters

  • il:object item list
  • index:int index of the item
  • item_offset:int starting byte

returns

Integer value of the specified byte

vms.lib

vms.sys

rdb