HPlogo System Debug Reference Manual > Chapter 6 System Debug Command Specifications M-X

VAR

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Defines a user-defined variable.

Syntax



   VAR  var_name [:var_type] [=] var_value

The entire set of currently defined variables can be saved into a binary file for later restoration. (Refer to the STORE and RESTORE commands.)

Parameters


var_name

The name of the variable that is being defined. Names must begin with an alphabetic character and are restricted to thirty-two (32) characters, (characters must be alphanumeric, "_", "'", or "$"). Longer names are truncated with a warning. Names are case insensitive.

var_type

The type of the variable. The following types are supported:

STR

String

BOOL

Unsigned 16-bit

U16

Unsigned 16-bit

S16

Signed 16-bit

U32

Unsigned 32-bit

S32

Signed 32-bit

S64

Signed 64-bit

SPTR

Short pointer

LPTR

Long pointer

PROG

Program logical address

GRP

Group library logical address

PUB

Account library logical address

LGRP

Logon group library logical address

LPUB

Logon account library logical address

SYS

System library logical address

USER

User library logical address

TRANS

Translated CM code virtual address

EADDR

Extended address

SADDR

Secondary address

If the type specification is omitted, the type is assigned automatically, based on var_value.

The optional var_type allows the user to explicitly specify the desired internal representation for var_value (that is, signed or unsigned, 16 bit or 32 bit) for this particular assignment only. It does not establish a fixed type for the lifetime of this variable. A new value of a different type can be assigned to the same variable (name) by a subsequent VAR command.

var_value

The new value for the variable, which can be an expression. An optional equal sign "=" can be inserted before the variable value.

Examples



   %cmdebug > var save 302.120

Define variable save to be the address 302.120. By default, this variable is of type LPTR (long pointer) based on the value 302.120.

   $nmdebug > var count=1c

Define variable count to be the value 1c.

   $nmdebug > var s1:str="this is a string"

Define variable s1 to be of type STR (string) and assign the value "this is a string".

   $nmdebug > varlist
   var save:lptr    %302.120
   var count:u32    $1c
   var s1:str       this is a string

Display all currently defined user variables.

Limitations, Restrictions


Refer to ENV VARS, ENV VARS_LOC, and ENV VARS_LIMIT. These environment variables determine the maximum number of variables that can be defined.




USE


VARD[EL]