What's New in PowerBASIC 3.5 since version 3.2?
- $ELSEIF metastatement added for enhanced control of conditional
compiling.
- The ampersand character (&) can now be used to concatenate
strings:
MyString$ = MyString$ & "1"
- ASC statement added to allow placing a byte value into an existing
string:
ASC(MyString$, 5) = 65 'change the 5th char to an "A"
This is functionally equivalent to:
MID$(MyString$, 5, 1) = CHR$(65)
However, the ASC statement uses more efficient code.
- ASC/ASCII functions support an optional parameter, which allows
you to get the byte value of a character beyond the first byte
in a string.
- ASCIIZ string data type has been added. An ASCIIZ string is the
same as a fixed-length string, except that the last character in
the string is always a null [CHR$(0)].
- CONSIN function returns the status of input (keyboard)
redirection.
If standard input originates from the console (keyboard), it
returns
true (-1). If redirected from a file, it returns false (0).
- CONSOUT function returns the status of output (screen)
redirection.
If standard output displays on the console (screen), it returns
true (-1). If redirected to a file, it returns false (0).
- The CVI, CVL, etc. functions now support an optional parameter
which is the starting location within a string to extract a value.
For example, to extract an integer value from the 5th position in
a binary string:
x% = CVI(My$, 5)
- FRE(-11) function added to return the number of free bytes in EMS
memory. Before you allocate a virtual array, you should use FRE
to make sure enough memory exists to hold the array.
- Pointer variables now support 'indexes'. This allows you to
assign
a value to a pointer variable and access data as if it were an
array.
DIM x AS INTEGER PTR
x = Address???
a = @x 'get integer at Address&
b = @x[4] 'get integer at Address& + 8
In this example, the 5th integer (index pointers all start at zero
and are not effected by the OPTION BASE value) is retrieved
without
us having to modify the Address& value.
- The REDIM statement now supports the optional PRESERVE modifier.
This allows you to change the number of elements in an existing
array without destroying its contents. Note: REDIM PRESERVE does
not work with virtual arrays.
- The RND function has been enhanced to return integer class random
numbers using the RND(a, z) syntax. Where 'a' is the lowest
random
value to return and 'z' is the highest random value to return.
- SETEOF statement has been added to truncate an open file at the
current file pointer. This is equivalent to using PUT$ to store
a null (zero length) string in binary mode.
- SIZEOF function has been added to return the memory size of
variables. Unlike the LEN function, SIZEOF will return the size
of the storage buffer available in ASCIIZ strings and the size of
a string's handle (not the size of the string contents).
- STDERR statement has been added to print data to the "standard
error device". Typically, this is the screen, and output using
STDERR can not be redirected to a file.
- STDIN/STDIN LINE statements have been added to read keyboard
data from the "standard input" device. Typically this is the
keyboard. However, if a file has been redirected to your program
STDIN will read from the file instead.
- STDOUT statement has been added to print data to the "standard
output device". Typically, this is the screen, and output using
STDOUT can be redirected to a file or other device.
Note: Only text printed with the the STDOUT statement will be
redirected to a file. The PRINT statement prints data to the
screen, regardless of output redirect status.
- TRIM$ function added to trim the spaces (or other optional
characters) from both the front and back of strings.
- User-Defined Type and Union variables now support static arrays:
TYPE a
b(1 TO 50) AS INTEGER
c AS LONG
END TYPE
- Virtual Arrays in EMS memory. PowerBASIC now allows you to create
numeric, fixed-length string, ASCIIZ string, and user-defined type
arrays in EMS memory up to the LIM specification (16 megabytes).
DIM VIRTUAL x&(1 TO 10000)
If you are debugging a program with virtual arrays and an END
statement is encountered (or a program ends with an error), you
can
no longer watch elements from a virtual array. You must restart
the
program.
In order to create a virtual array, an EMS driver (such as
EMM386.EXE
or QEMM386.SYS) installed on the computer running your program.
For
DOS and Windows 95 users, the easiest way to add EMS memory is to
run
the MEMMAKER utility included. When asked if you want to add EMS
memory, answer with a "yes". Or you can manually add the
EMM386.EXE
driver to your CONFIG.SYS file with the following line:
device=C:\DOS\EMM386.EXE
Be sure to use the correct drive and directory if the EMM386.EXE
driver is not located in your C:\DOS directory.
Windows NT uses will need to create a shortcut to their DOS
program
and add EMS memory in the "memory" tab of the properties dialog
for
their program. For additional information, select "Help" from the
Start menu and search for the keyword "EMS".
Important: The ARRAY SORT, SCAN, INSERT and DELETE statements
will
not work with virtual arrays. For an example of sorting a virtual
array, see the SORT.BAS source file in the EXAMPLE directory. The
SWAP statement does not work with virtual arrays. You may not
pass
a virtual array to a Sub or Function by Reference. Only by Value.
See 'Virtual Arrays' in chapter 5 of your User's Guide for
additional
information.
- We have compiled a list of Frequently Asked Questions (FAQs) and
placed a series of text files with these questions and their
answers
in the PB35\FAQ subdirectory. You'll find information such as
linking
.OBJ's created in Borland C or Microsoft C into your programs and
saving graphics screens from EGA and VGA screen modes to a disk
file.
Important: Because of the added support for virtual memory arrays
and
other features, any unit files (.PBU) or library files (.PBL)
created
in earlier versions of PowerBASIC will need to be recompiled using
version 3.5 of the compiler.
PowerBASIC Help Kit
Starting with version 3.0c of PowerBASIC, a full copy of the PB3
Help Kit is provided so that you can create custom add-on help
files for use with the PowerBASIC IDE. The primary purpose is to
allow vendors of programming tools compatible with PowerBASIC to
make on-line help easily available to you. However, there are many
other uses as well. For example, a programming team leader might
create a help file to describe required documentation style for the
group. Or you might use it to remind yourself of structure and
goals. Regardless of the task, the tool is now available, just add
a bit of your imagination.
Complete documentation for the PowerBASIC Help Kit is provided in
the add-on help file USERHELP.PBH. Just copy that file into the
directory which contains PBHELP.PBH, and press SHIFT-F1. This
add-on help file will provide all the guidance you need to create
your own help files. Of course, add-on help files will only work
with the PowerBASIC IDE. They are not designed to be used with
user-written programs.
The syntax for MAKEHELP.EXE is:
MAKEHELP [source[.txt] [helpfile[.pbh]]]
If you type MAKEHELP without any parameters, an interactive mode is
used so that you may type in the names of the source and destination
files:
MAKEHELP
If you pass a single parameter, it is assumed to be the name of the
source file you wish to compile and you will be asked for the name
of
the destination file:
MAKEHELP userhelp.txt
If you pass two parameters, it is assumed that the first parameter
is
the name of the source file to be compiled and the second parameter
is
the name of the destination (.PBH) help file to create:
MAKEHELP userhelp.txt userhelp.pbh
If the help file is successfully compiled, an error level of zero
(0)
is returned. If it is not successfully compiled for any reason, an
error level of one (1) is returned.
The PowerBASIC online manuals
The PowerBASIC Reference and User manuals are now included on disk
for
your convenience. These manuals are in the files REF.PDF and
USER.PDF,
which use Adobe's Portable Document Format. If you do not already
have
Adobe Acrobat Reader 5 (or later) installed, you can download it from
http://www.adobe.com.
|