Clipper 5.3
Clipper 5.3
Clipper 5.3
For DOS
Version 5.3
June 1995
(AOMPUTER
ftSSOCIATES
Software superior by design. F
© Copyright 1995 Computer Associates International, Inc.,
One Computer Associates Plaza, Islandia, NY 11788-7000
All rights reserved.
Use of the software programs described herein and this documentation is subject to the Computer
Associates License Agreement enclosed in the software package.
All product names referenced herein are trademarks of their respective companies.
Contents
Chapter 1 : Introduction
In This Guide 1-1
Part 1: Basic Concepts 1-2
Part 2: Programming 1-2
Part 3: Utilities 1-3
iv CA-Clipper
Operators 2-48
Terminology 2-48
Error Handling 2-50
String Operators 2-50
Date Operators 2-51
Mathematical Operators 2-51
Relational Operators 2-52
Logical Operators 2-53
Assignment Operators 2-54
Simple Assignment 2-55
Inline Assignment 2-56
Compound Assignments 2-57
Increment and Decrement Operators 2-58
Special Operators 2-60
Operator Precedence 2-61
Precedence of Categories 2-62
Precedence within a Category 2-63
Preincrement and Predecrement 2-63
Mathematical 2-64
Relational 2-64
Logical 2-64
Assignment 2-65
Postincrement and Postdecrement 2-65
Parentheses 2-65
The Macro Operator 2-66
Text Substitution 2-67
Compile and Run 2-68
Relationship to Commands 2-69
Using with Command Keywords 2-69
Using with Command Arguments 2-69
Using with Lists 2-71
Macros and Arrays 2-71
Macros and Code Blocks 2-72
Using with Database Command Conditions 2-73
Invoking Procedures and Functions 2-73
External References 2-74
Nested Macro Definitions 2-74
vi CA-Clipper
Database Files 2-105
Memo Files 2-105
Database File Attributes 2-106
Database Operations 2-106
Record Scoping 2-107
The Record Processing Primitive—DBEVAL() 2-109
Index Files 2-109
Creating 2-110
Opening 2-110
Ordering 2-111
Searching 2-111
Updating 2-112
Closing 2-112
The Input/Output System 2-113
Text Mode 2-113
Graphic Mode 2-113
Console Operations 2-115
Full-Screen Operations 2-116
Controlling Screen Color 2-117
Controlling Output Destination 2-117
Directing Output to the Printer 2-117
Directing Output to a File 2-119
The Keyboard System 2-120
Changing the Keyboard Buffer Size 2-120
Putting Characters in the Keyboard Buffer 2-121
Reading Characters from the Keyboard Buffer 2-121
Controlling Predefined Keys 2-122
Reassigning Key Definitions 2-123
Clearing the Keyboard Buffer 2-123
The Low-Level File System 2-124
Opening a File 2-124
Reading from a File 2-125
Writing to a File 2-125
Manipulating the File Pointer 2-126
Closing a File 2-126
Error Detection 2-127
viii CA-Clipper
Chapter 4 : Network Programming
In This Chapter 4-1
LAN Requirements for CA-Clipper 4-3
Using Shared Mode 4-3
When to Obtain Exclusive Use 4-4
Other File Open Operations 4-4
Retrying After an Open Failure 4-6
Locking 4-7
File Locking 4-9
Record Locking 4-9
Automatic Locking 4-10
Unlocking 4-11
Resolving a Failure 4-12
Overlays on a Network 4-13
Update Visibility 4-14
The Initiator 4-14
The Operating System and Other Processes 4-14
The Physical Disk 4-15
Abnormal Termination 4-16
Network Printing 4-16
Setting Up the Network Printer 4-17
Program Design Considerations 4-17
Printing to a File 4-18
χ CA-Clipper
Chapter 6 : Introduction to TBrowse
In This Chapter 6-1
TBrowse Overview 6-2
Basic Browse Operations 6-3
Creating TBrowse Objects 6-3
Main Loop 6-4
Stabilization 6-5
Handling Keystrokes 6-6
Optimization of the Browse 6-7
Calculated Fields, Picture Clauses, and Custom Headers 6-7
Quicker Response Time 6-8
Multi-User Issues 6-9
Repositioning the Record Pointer 6-10
Using TBrowsexargo and TBColumnxargo 6-12
Browsing with Get 6-13
Determining Whether the Record Has Moved 6-16
Adding Color 6-18
TBrowse:colorSpec 6-18
TBColumn:defColor 6-19
TBColumn:colorBlock 6-20
Controlling the Highlight 6-22
TBrowse:colorRect() 6-23
Controlling the Scope 6-24
Viewing a Specific Key Value 6-26
Browsing Search Results 6-30
xii CA-Clipper
Chapter 8 : Introduction to the Menu System
In This Chapter 8 _
1
Menu Terminology 8 _
^
Overview of Class Components 8-3
Class Functions 8
~3
Instance Variables 8 - 4
Methods 8 - 4
Menultem 8
~5
PopUpMenu 8 - 6
Shortcut Keys 8 - 8
Status Messages 8 _
9
Menu Properties 8 _
9
Specifying Colors 8-12
Menu Separators 8
~13
Toggles 8
~~13
Disabling Menu Items 8
~15
Cascading Menus 8
~15
Menu Item Indicators • 8
~16
Activating the Menu 8 - 1
7
xiv CA-Clipper
Chapter 11 : CA-Clipper Protected Mode
Linker-EXOSPACE.EXE
In This Chapter 11-1
Overview of CA-Clipper /Exospace 11-2
Invoking CA-Clipper/Exospace 11-4
The CA-Clipper/Exospace Return Code 11-7
The Compile and Link Batch File 11-7
Output Files H-8
Executable Files (.EXE) . . 11-8
Map Files (.MAP) 11-9
Temporary Files 11-9
How CA-Clipper/Exospace Searches for Files 11-10
Library Files (.LIB) 11-10
Object Files (.OBJ) 11-11
Script Files (.LNK) 11-11
Linker Command Reference 11-12
Compatibility with Other Linkers 11-13
.RTLink Compatibility 11-13
Blinker Compatibility 11-14
EXOSPACE CLIPPER 501 11-15
EXOSPACE ENVIRONMENT CLIPPER 11-16
EXOSPACE ENVIRONMENT OVERRIDE 11-17
EXOSPACE EXECUTABLE CLIPPER 11-18
EXOSPACE EXECUTABLE NODELETE 11-20
EXOSPACE PACKAGE 11-21
EXOSPACE PROCEDURE DEPTH 11-23
FILE H-24
LIBRARY 11-25
MAP 11-26
MODULE...FROM 11-27
NODEFLIB 11-28
OUTPUT 11-29
STACK 11-30
xvi CA-Clipper
BLINKER LINK PAGEFRAME 12-15
BLINKER LINK XMS 12-15
BLINKER MESSAGE DUPLICATES 12-16
BLINKER MESSAGE NOBLINK 12-17
BLINKER MESSAGE NOWARNING 12-18
BLINKER MESSAGE WINK 12-18
BLINKER OVERLAY OPSIZE 12-19
BLINKER OVERLAY PAGEFRAME 12-20
BLINKER OVERLAY THRESHOLD 12-21
BLINKER OVERLAY UMB 12-22
BLINKER PROCEDURE DEPTH 12-23
DEFINE 12-24
DEFLIB 12-25
ECHO 12-25
ENDAREA 12-26
EXTDICTIONARY 12-26
FILE 12-27
LIBRARY 12-28
MAP 12-29
MIXCASE 12-29
MODULE 12-30
MURPHY 12-32
NOBELL 12-32
NODEFLIB 12-33
NOEXTDICTIONARY 12-33
NOTABLEOFCONTENTS 12-34
OUTPUT 12-34
READONLY 12-35
SEARCH 12-35
SECTION INTO 12-36
STACK 12-37
UPPERCASE 12-38
VERBOSE 12-38
WORKFILE 12-39
Blinker Function Reference 12-40
BLIVERNUM 12^0
xviii CA-Clipper
The View Workareas Window 13-43
The Set Colors Window 13-44
Dialog Boxes 13-45
Debugging a Program 13-46
Executing Program Code 13-47
Modes of Execution 13-47
Finding Program Errors 13-50
Viewing Program Output 13-52
Inspecting Data and Expressions 13-53
Using Watchpoints and Tracepoints 13-53
Creating New Variables 13-56
Inspecting Program Code 13-57
Using Breakpoints 13-57
Navigating the Call Stack 13-60
Viewing Files 13-61
Accessing DOS 13-62
Menu Command Reference 13-63
?|?? 13-64
BP 13-66
Callstack 13-68
Delete 13-69
File DOS 13-71
File Exit 13-71
File Open 13-72
File Resume 13-73
Help 13-74
List 13-76
Locate Case 13-77
Locate Find 13-78
Locate Goto 13-79
Locate Next 13-80
Locate Previous 13-81
Monitor All 13-82
Monitor Local 13-83
Monitor Private 13-84
Monitor Public 13-85
Run Animate
Ό n 13-106
Run Go
„ . KT 13-107
Run Next
D Ό . f 13-108
Run Restart
0 c A 13-109
Run Speed
xx
„CA-Clipper
Ζ 13-HO
Run Step
T
ΛA
w
w Τ
πιτ·... τTo
Window
-r,View
ViewApp
Run
Α7Γ A Trace
, ΓWorkareas
c Callstack
Sets
, l Next
Prev
Move
Iconize
. ·v
Tπ
13-111
13-118
13-115
13-116
13-119
13-117
13-112
13-120
13-119
13-114
Window Size . 13-120
Window Tile . 13-121
Window Zoom 13-122
Invoking RMAKE 14
The RMAKE Environment Variable 14
RMAKE Options 14-4
How RMAKE Works 14-6
How RMAKE Searches for Files 14-8
Make Files 14-8
Target and Dependency Files 14-8
The Make File 14-10
Using Quotation Marks 14-11
Line Continuation 14-11
Comments 14-12
Dependency Rules - 14-12
Makepath Examples 14-13
Inference Rules 14-15
Setting Environment Variables 14-17
Directives 14-19
Macros 14-22
User-Defined Macros 14-23
Predefined Macros 14-25
A Complete Make File 14-27
xxii CA-Clipper
F6 Utility 16-28
Copy 16-28
Append 16-30
Replace 16-30
Pack 16-31
Zap 16-32
Run 16-32
F7Move 16-33
Seek 16-33
Goto 16-34
Locate 16-34
Skip 16-35
F8 Set 16-35
Relation 16-36
Filter 16-39
Fields 16-40
The DBU System Architecture 16-41
xxiv CA-Clipper
Configuring the Instant Access Engine 18-15
Toggling Color 18-16
Toggling Auto Lookup 18-16
Changing the Hot Key 18-17
Saving the New Configuration 18-17
Leaving the Instant Access Engine 18-18
Exiting the Instant Access Engine 18-18
Uninstalling the Instant Access Engine 18-18
Appendix A : CLIPPER.BML
Index
In This Guide
This is the Programming and Utilities Guide for CA-Clipper. It
contains conceptual information on programming and creating
applications using the CA-Clipper development system, as well
as usage information for each utility in the package.
Part 2: Programming
This section is divided into several chapters, each of which gives
you specific details on a particular aspect of the CA-Clipper
system that may require further programming. It contains
conceptual information on programming and creating
applications using the following subsystems: TBrowse, The GET
System, and Error Handling, as well as chapters on "The
Runtime Environment," "Network Programming," and
"Programming in Graphic Mode." Further reference
information can also be found in the "Language Reference"
chapter of the Reference Guide.
1-2 CA-Clipper
Part 3: Utilities
Part 3: Utilities
This section documents each utility supplied with the
CA-Clipper package in a separate chapter. The complete
command line syntax as well as all options are completely
specified for each utility. In addition, usage information,
including navigation and selection, is provided for the
menu-driven utilities.
• CA-Clipper Compiler-CLIPPER.EXE
• CA-Clipper Linker—BLINKER.EXE
• CA-Clipper Debugger—CLD.LIB
• Program Maintenance—RMAKE.EXE
• Program Editor—PE.EXE
In This Chapter
The "Language Reference" chapter of the Reference Guide
introduced you to programming in CA-Clipper by defining all of
the components (for example, commands, functions, and
operators) that go together to make up the programming
language. This chapter builds on the "Language Reference"
material by focusing on various aspects of the programming
language and explaining how some of the language components
fit together. Although not as exhaustive as the "Language
Reference," this chapter gives you a different view of the
language, based on systems and other logical groupings, that
may help you better understand how to use CA-Clipper to
accomplish your programming tasks.
• Control Structures
• Variables
• Expressions
• Data Types
• Operators
• Arrays
• Code Blocks
• Command invocation
• Procedure call
• Preprocessor directive
• Assignment statement
• Comment
2-2 CA-Clipper
The Structure of α CA-Clipper Program
FUNCTION CreateListBox(cChoice)
CLEAR
@ 1, 31, 6, 45 GET cChoice LISTBOX {S_ADD, ;
S_EDIT, ;
S_REPORT, ;
S_QUIT}
SET MESSAGE TO 23 CENTER
READ
CLEAR
RETURN cChoice
2-4 CA-Clipper
The Structure of α CA-Clipper Program
cChoice := CreateListBox(S_QUIT)
DO CASE
CASE cChoice = S_ADD
AddRecs()
CASE cChoice = S_EDIT
EditRecs()
CASE cChoice = S_REP0RT
Reports()
OTHERWISE
EXIT
ENDCASE
ENDDO
Variable Declaration
In CA-Clipper, dynamic variables can be created and initialized
without formal declaration statements. The default scope of an
undeclared dynamic variable is private to the routine in which
the variable is first initialized. In addition, CA-Clipper is a
weak-typed language, which means that the data type of a
variable is never declared—only the scope, or visibility.
2-6 CA-Clipper
The Structure of α CA-Clipper Program
Preprocessor Directives
In addition to statements, preprocessor directives can be part of a
CA-Clipper program. These directives are instructions to the
compiler rather than statements that are compiled. Preprocessor
directives always begin with a hash symbol (#).
Comments
You can also use the asterisk (*) symbol for single-line comments,
as in dBASE programs.
2-8 CA-Clipper
The Structure of α CA-Clipper Program
Continuation
Reserved Words
In CA-Clipper there are several words that are reserved for
internal use by CA-Clipper itself. These are listed in the
"Reserved Word" appendix of the Error Messages and Appendices
Guide. Reserved words cannot be used as identifier names in
program statements. In addition to these reserved words, it is
illegal for an identifier to start with an underscore.
2-10 CA-Clipper
Functions and Procedures
. <executable statements>
RETURN <exp>
. <executable statements>
[RETURN]
2-12 CA-Clipper
Functions and Procedures
Functions All functions are called in the same way, regardless of whether
they are defined in your application or in a library that you are
linking. You can specify functions either in expressions or as
statements.
Passing Parameters
When you invoke a procedure or function, you can pass values
and references to it. This facility allows you to create black box
routines that can operate on data without any direct knowledge
of the calling routine. The following discussion defines the
various aspects of passing parameters in CA-Clipper.
The specified receiving variables are place holders for values and
references obtained from the calling routine. When a procedure
or function is called, the values and references specified as
arguments of the routine's invocation are assigned to the
corresponding receiving parameter in the invoked routine.
2-14 CA-Clipper
Functions and Procedures
Passing by Value
Passing an argument by value means the argument is evaluated
and its value is copied to the receiving parameter. Changes to a
received parameter are local to the called routine and lost when
the routine terminates. In CA-Clipper, all variables, expressions,
and array elements are passed by value as a default if the
function-calling syntax is used. This includes variables
containing references to arrays, objects, and code blocks.
2-16 CA-Clipper
Functions and Procedures
Passing by Reference
Passing an argument by reference means that a reference to the
value of the argument is passed instead of a copy of the value.
The receiving parameter then refers to the same location in
memory as the argument. If the called routine changes the value
of the receiving parameter, it also changes the argument passed
from the calling routine.
For example:
// Change the value of an array element
a := {1, 2, 3}
ChangeElement(a)
? a[l] // Result: 10
FUNCTION ChangeElement(aArray)
aArray[l] := 10
RETURN NIL
FUNCTION ChangeArray(aArray)
aArray := {4, 5, 6}
RETURN NIL
2-18 CA-Clipper
Functions and Procedures
Argument Checking
. <statements>
RETURN NIL
. <statements>
RETURN NIL
2-20 CA-Clipper
Functions and Procedures
. <statements>
RETURN .T.
Note that RETURN is limited by the fact that it can return only
one value. More than one value can be returned if arguments
are passed by reference, although this is not a preferred solution.
An aggregate data structure can be defined as an array
containing other arrays, and arrays, as mentioned above, can be
passed throughout a program as a single value.
Recursion
A procedure or function is recursive if it contains an invocation
of itself. This can be either direct or indirect when a function
calls another function that again calls the original function.
Control Structures
CA-Clipper supports several control structures that let you
change the sequential flow of program execution. These
structures allow you to execute code based on logical conditions
and to repeatedly execute code any number of times.
Looping Structures
2-22 CA-Clipper
Control Structures
FOR...NEXT
DO WHILE...ENDDO
. <processing statements>
SKIP
ENDDO
EXIT a n d LOOP
EXIT and LOOP are special statements that can only be used
inside a DO WHILE or FOR loop. EXIT transfers control out of
the loop, and LOOP transfers control to the beginning of the
loop. These statements are used as part of a conditional control
structure to control looping behavior under unusual
circumstances.
DO WHILE .T.
IF EOF()
EXIT
ELSEIF DELETED()
SKIP
LOOP
ELSE
<processing statements>
END IF
ENDDO
2-24 CA-Clipper
Control Structures
Decision-Making Structures
Decision-making structures allow you to execute one or more
program statements based on a condition. For example, you
may want to execute a different function based on a menu
choice. CA-Clipper has two such structures, IF...ENDIF and DO
CASE...ENDCASE, but they are identical in functionality.
IF...ENDIF
DO CASE...ENDCASE
2-26 CA-Clipper
Variables
Variables
Variables are place holders for values and references that have a
defined lifetime and visibility, and a given name. When a
variable name is referenced, the value it contains is returned.
2-28 CA-Clipper
Variables
Declaring Variables
Variable declarations are not executable statements. Instead,
they declare, at compile time, the names of program variables and
inform the compiler of assumptions that can be made about
them.
2-30 CA-Clipper
Variables
Referring to Variables
2-32 CA-Clipper
Variables
You can create variables and supply initial values in the same
statement. The following statements allow initializers:
• STATIC
• LOCAL
• PRIVATE
• PUBLIC
Local Variables
Local variables must be declared explicitly at compile time with
the LOCAL statement, as shown in the example below:
FUNCTION SomeFunc()
LOCAL nVar := 10, aArray[10][10]
. <statements>
NextFunc()
RETURN .T.
2-34 CA-Clipper
Variables
Static Variables
Static variables work much like local variables, but retain their
values throughout execution. Static variables must be declared
explicitly at compile time with the STATIC statement.
NextFunc()
RETURN .T.
Private Variables
Declarations are optional for private variables. If desired, they
can be declared explicitly at compile time with the MEMVAR
statement.
2-36 CA-Clipper
Variables
For example:
FUNCTION SomeFunc()
PRIVATE myVar := 10
. <statements>
NextFunc()
RETURN .T.
Public Variables
Declarations are optional for public variables. If desired, they
can be declared explicitly at compile time with the MEMVAR
statement.
NextFunc()
RETURN .T.
Field Variables
Declarations are optional for field variables. You can declare
them explicitly at compile time with the FIELD statement.
Field variables are really just synonyms for database fields of the
same name. Thus, they typically exist and possess values even
before the program begins execution, and they continue to exist
after the program terminates. A field variable's value depends
on which record of the associated database is the current record.
2-38 CA-Clipper
Expressions
Expressions
In CA-Clipper, all data items are identified by type for the
purpose of forming expressions. The most basic data items (that
is, variables, constants, and functions) are assigned data types
depending on how the item is created. For example, the data
type of a field variable is determined by its database file
structure, the data type of a constant value depends on how it is
formed,, and the data type of a function is defined by its return
value.
Data Types
The data types supported in the CA-Clipper language are:
• Array
• Character
• Code Block
• Numeric
• Date
• Logical
• Memo
• NIL
Character
2-40 CA-Clipper
Data Types
• left and right square brackets (for example, [left to open and
right to close])
Note: To express a null string, use only the delimiter pair with
no intervening characters—including spaces. For example,""
and [] both represent a null string.
This constraint should not be too limiting since you have three
pairs of delimiters from which to choose.
With SET EXACT ON, two strings must match exactly, except for
trailing blanks. For complete details on SET EXACT, see the
Reference Guide, Volume 2.
Memo
In CA-Clipper, when you change a memo field with less than 512
bytes, the existing block is used until it is filled. Once full, the
block is discarded and copied to a new location.
2-42 CA-Clipper
Data Types
Besides the fact that the length can vary in a memo field from
one record to another, memo fields are identical to character
fields. The character set is identical, the 65,535 maximum
character limitation stands, and comparisons are performed in
the same way.
Date
The date data type is used to identify data items that represent
calendar dates. In CA-Clipper, you can manipulate dates in
several ways, such as finding the number of days between two
dates and determining what the date will be ten days from now.
The date character set is defined as the digits from zero to nine
and a separator character specified by SET DATE.
• yy represents the year which must fall between 0 and 99; and
/ is the separator
2-44 CA-Clipper
Data Types
Numeric
The numeric data type is used to identify data items that you
want to manipulate mathematically (for example, perform
addition, multiplication, and other mathematical functions). The
CA-Clipper numeric character set is defined as the digits from
zero to nine, the period to represent a decimal point, and the
plus and minus to indicate the sign of the number.
• 1234
• 1234.5678
• -1234
• +1234.5678
• -.5678
Logical
The logical data type identifies data items that are Boolean in
nature. Typical logical data items are those with values of true
or false, yes or no, or on or off. In CA-Clipper, the logical
character set consists of the letters y, Y, t, Τ, η , N, f, and F.
2-46 CA-Clipper
Data Types
The literal values .y., .Y., .t., and .T. represent true. The literal
values .η., .N., i . , and .F. represent false. The preferred literal
representations are .T. and .F.
Operation Description
Operators
Along with functions, constants, and variables, operators are the
basic building blocks of expressions. An operator is like a
function in that it performs a specific operation and returns a
value. This section gives a general discussion of operators, and
categorizes and describes all of the operators available in the
CA-Clipper language.
Terminology
2-48 CA-Clipper
Operators
Unary and Binary All operators in CA-Clipper require either one or two
Operators arguments, called operands. Those requiring a single operand
are called unary operators, and those requiring two operands are
called binary operators.
Error Handling
String Operators
The following table lists each string operator and the calculation
that it performs. These operators are binary, requiring two
character and/or memo type operands, and return a character
value:
Symbol Operation
+ Concatenate
2-50 CA-Clipper
Operators
Date Operators
The + and - mathematical operators discussed in the next section
can be used to add or subtract a number of days from a date
value. The result of such an operation is a date that is a number
of days before (subtraction) or after (addition) the date value.
The order of the operands in the case of subtraction is
significant—the date value must come first. This is an exception
to the rule against operations using mixed data types.
You can also subtract one date from another using the
mathematical subtraction operator. The result of this type of
operation is a numeric value that represents the number of days
between the two dates. Subtraction of one date from another is
the only true date operator.
Mathematical Operators
The following table lists each mathematical operator and the
calculation it performs. As a general rule, these operators
require numeric type operands (see Date Operators above for
exceptions) and return a numeric value. Except where noted in
the table, the mathematical operators are binary. The unary
operations use prefix notation:
Symbol Operation
/ Division
** or Λ
Exponentiation
Relational Operators
Symbol Operation
= Equal
2-52 CA-Clipper
Operators
Logical Operators
The following table lists the logical operators:
Symbol Operation
.OR. Logical or
.AND. J. .F.
J. .T. .F.
.OR. J. .F.
J. X .T.
.NOT. J. .F.
.F. .T.
Assignment Operators
Symbol Operation
= Assign
:= Inline assign
+= Inline add (or concatenate) and assign
-= Inline subtract (or concatenate) and assign
Inline multiply and assign
/= Inline divide and assign
Λ— Inline exponentiate and assign
/o— Inline modulus and assign
2-54 CA-Clipper
Operators
Simple Assignment
For example, the following two lines of code perform exactly the
same function of replacing the current value in the Cast Age field
with the numeric value 20:
FIELD->CustAge = 20
REPLACE CustAge WITH 2 0
Inline Assignment
Compound Assignments
+= a += b a := (a + b)
-= a-=b a := (a - b)
a*=b a := (a * b)
/= a /=b a := (a / b)
0/ _
/o—
a %= b a := (a % b)
Λ— a =b
A
a := (a Λ
b)
Note that the definitions for these operators use the inline
assignment operator. This means that all of the compound
operators can be used as inline operators. The data type for
these operations is determined by the second operand using the
definitions in the table above. If the assignment operation is
formed correctly, this should be the data type of the first
operand in the original compound assignment statement.
Symbol Operation
Both are unary operators you can use with either a numeric or a
date operand. Unlike other operators which can operate on
more complicated expressions, the operand here must be a
single, nonfield variable. The resulting data type is the same as
that of the operand.
2-58 CA-Clipper
Operators
Special Operators
The following table lists all other symbols that have special
meaning in the CA-Clipper language. These are special
operators that often appear in expressions:
Symbol Operation
0 Function or grouping
[] Array element
@ Pass by reference
2-60 CA-Clipper
Operators
Curly Braces Curly braces (()) are used to create and reference a literal array.
The array elements must be within the braces and separated by
commas.
Curly braces are also used to create code blocks. The code block
arguments are further delimited within the curly braces with
vertical bars ( I I ) , and the expressions defining the code block
are separated by commas. Though the vertical bars are required
delimiters, they need not contain an argument.
Alias Identifier The alias identifier (->) is used to make an explicit reference to a
field or variable. If the name of an alias precedes the operator, it
can be followed either by a field name from that database file or
any other expression enclosed in parentheses. Additionally, the
keywords FIELD and MEMVAR can precede the operator
followed by a valid field or variable identifier.
Operator Precedence
Precedence of Categories
2. Mathematical
3. Relational
4. Logical
5. Assignment
2-62 CA-Clipper
Operators
• 5*10 + 6 / 2
• 6 / 2 + 5*10
Preincrement a n d Predecrement
Mathematical
2. Exponentiation (**, )
Λ
Relational
Logical
3. Logical or (.OR.)
2-64 CA-Clipper
Operators
Assignment
Postincrement a n d Postdecrement
Parentheses
The period (.) is the macro terminator and indicates the end of
the macro variable. The macro terminator is optional unless you
need it to distinguish the macro variable from the adjacent text in
the statement.
2-66 CA-Clipper
The Macro Operator
Text Substitution
When you use the macro operator for text substitution in this
manner, the operand must be a public or private variable whose
data type is character, and the macro operator must immediately
precede the variable. If you fail to follow these guidelines, the
macro variable will not be expanded properly.
EVAL(bBlock, DATE())
2-68 CA-Clipper
The Macro Operator
Relationship to Commands
FRENAME(xcOld, xcNew)
2-70 CA-Clipper
The Macro Operator
The macro operator (&) will not fully substitute or compile a list
as an argument of most commands, particularly those
commands in which an argument list is preprocessed into an
array or a code block. Instances of this are arguments of the
FIELDS clause and SET INDEX. An exception is the SET COLOR
command which preprocesses the list of colors into a single
character string and passes it to the SETCOLOR() function.
Macros a n d C o d e Blocks
2-72 CA-Clipper
The Macro Operator
DO &cProc
EVAL(bProc)
External References
2-74 CA-Clipper
Arrays
Arrays
An array is a collection of related data items that share the same
name. Each value in an array is referred to as an element. Array
elements can be of any data type except memo, which is limited
to fields. For example, the first element can be a character string,
the second a number, the third a date, and so on. Arrays can
also contain other arrays and code blocks as elements.
TYPE() and VALTYPE() return " A " for an array. Because array
is a distinct data type in CA-Clipper, you can create complex
array expressions.
Creating Arrays
<identifier>[<nElementsl>, <nElements2>,...]
or:
<identifier>[<nElementsl>] [<nElements2>]...
For example:
LOCAL i := 12, j := 4
LOCAL myArray[i, j]
You can also use the ARRAY() function to create an array. With
this function, you specify the dimensions as arguments, and the
return value is an array reference. In fact, each of the array
declaration statements translates into two parts: the declaration
of the array name and the subsequent creation of an array and
assignment of a reference. For example, PUBLIC my Array [12] [4]
is the same as:
PUBLIC myArray
myArray := ARRAY(12, 4)
2-76 CA-Clipper
Arrays
2-78 CA-Clipper
Arrays
Multidimensional Arrays
In CA-Clipper, you can create a multidimensional array by
declaring it with more than one dimension parameter or by
assigning an array to an existing array element.
The fact that you can assign an array to an existing array element
allows you to dynamically change the structure of an array. For
example, after an array is created, there is nothing to prevent
you from doing something like this:
myArray[1][2] := {1, 2, 3, 4, 5}
Literal Arrays
Literal arrays, sometimes called constant arrays, can be created
at runtime using the following syntax:
For example:
x := {1, 2, 3}
γ := {"Hello", SQRT(x[2]), MyFunc(x)}
Creating an array like this is the same as declaring the array (for
example, with PUBLIC or LOCAL) then assigning the values to
each element individually. You can use literal arrays anywhere
an array can be specified, including as literal array elements. For
example, to create a two-dimensional literal array, you could do
the following:
aTwoD := {{1, 2, 3}, {"a", "b", "c"}, {.t., . t. , .f.}}
1 2 3
.t. .t. i.
2-80 CA-Clipper
Arrays
? myArray[1] // Result: 1
FUNCTION MyFill(tempArray)
FOR i = 1 TO LEN(tempArray)
tempArray[i]++
NEXT
RETURN NIL
Traversing an Array
There are two ways to traverse an array in CA-Clipper.
FOR...NEXT
FOR i := 1 TO LEN(myArray)
FOR j := 1 TO LEN(myArray[1])
? myArray[i][j]
NEXT j
NEXT i
RETURN NIL
AEVALO
2-82 CA-Clippc
Arrays
Empty Arrays
An empty array is an array with zero elements and, therefore, no
dimensions. To create an empty array, declare an array with
zero elements or assign an empty literal array to a variable.
Comparing Arrays
2-84 CA-Clipper
Arrays
When you enlarge an array, the new elements are added to the
end of the array and are set to NIL. Shrinking an array (that is,
making it smaller) removes elements beyond the specified new
array size. ASIZE() updates the array and returns a reference to
it.
Both ADEL() and AINS() update the original array and return a
reference to it. Unlike AADD() and ASIZE(), these functions do
not change the size of the array.
2-86 CA-Clipper
Arrays
Sorting an Array
The ASORTQ function sorts an array and returns a reference to
the newly sorted array. With this function, you can sort an entire
array or a specified portion. This example sorts the entire array:
ASORT(myArray)
This example sorts elements ten through fifteen, leaving all other
elements in their original place:
ASORT(myArray, 10, 5)
Searching an Array
ASCAN() searches an array for a particular value specified as an
expression or a code block. This function operates on the entire
array or a specified range of elements. If used with a simple
search expression, the function searches the array until it finds a
matching value and returns the subscript, or zero if the value
was not found. For example:
LOCAL aArray := {"Tom", "Mary", "Sue", "Mary"}
? ASCAN(aArray, "Mary") // Result: 2
? ASCAN(aArray, "mary") // Result: 0
2-88 CA-Clipper
Code Blocks
Code Blocks
Code blocks provide a means of exporting small pieces of
executable program code from one place in a system to another.
You can think of them as assignable unnamed functions. They are
assignable because, except when executing them, CA-Clipper
treats them as values. That is, they can be stored in variables,
passed as arguments, and so forth.
Note: The vertical bars that delimit a code block argument list
must be present, even if there are no arguments, to distinguish a
code block from a literal array.
FUNCTION MyFunc()
LOCAL nNumber
LOCAL bBlock
nNumber := 10
bBlock := { | I nNumber++}
RETURN bBlock
2-90 CA-Clipper
Code Blocks
Using this fact, along with the fact that a code block can be
passed as a parameter to another program, you can export static
and local variables. For example:
FUNCTION One()
LOCAL myVar
myVar := 10
bBlock := { I number I number + myVar}
NextFunc(bBlock)
RETURN NIL
FUNCTION NextFunc(bBlock)
RETURN EVAL(bBlock, 200)
2-92 CA-Clipper
Code Blocks
Early Evaluation Early evaluation means that the macro is expanded at the time
the code block is created, and the expanded value remains
constant for all subsequent evaluations of the block. CA-Clipper
uses early evaluation by default, with an alternate method
available for late evaluation.
Early evaluation of the macro within the code block results in the
desired behavior: cFilter is evaluated when the block is defined
(as part of the creation of the block). The block is created via the
macro system and remains constant through all subsequent
block evaluations, regardless of any change to the value of
cFilter.
Late Evaluation Late evaluation means that the macro is evaluated each time the
block is evaluated.
2-94 CA-Clipper
Code Blocks
Classes
In CA-Clipper, there are several different types of objects. An
object's type is known as its class. The information contained in
an object, and the operations that can be applied to it, vary
depending on the class of the object.
2-96 CA-Clipper
Objects and Messages
Instances
You create a new object with a call to the create function for a
particular class. The object will have the attributes and
behaviors specified in the description of the class. The new
object is known as an instance of the class.
Instance Variables
An object contains within it all of the information necessary for it
to perform the operations specified for its class. This information
is stored inside the object in special storage locations called
instance variables.
When you create a new object, it receives its own dedicated set of
instance variables. The new instance variables are automatically
assigned initial values.
Sending Messages
For example:
oGetrleft()
2-98 CA-Clipper
Objects and Messages
For example:
nRow := oBrowse:rowPos
oBrowse:cargo := xNewCargo
Though this is useful, there is still a need to act upon the data
stored in the object, independently of setting instance variables.
This is accomplished by sending messages to the object to invoke
the desired methods.
The structure is defined and added to the database file when the
file is created. It consists of one or more field definitions
describing the name, width, and data type attributes for each
column in the table. The table rows, or records, are added to the
file using append operations which understand and enforce the
structure on a field by field basis. Records are added to a
database file in a particular physical order that is used, by
default, when accessing the file.
Several database files that have related structures and data can
be associated, along with their index files, using the SET
RELATION command. SET RELATION lets you establish
relationships between several files and operate on them as a
single entity known as a database, or view.
2-100 CA-Clipper
The Database System
Work Areas
To open a database file, you must first access the work area you
want to use. The most common way to do this is with the
SELECT command. SELECT is designed specifically to move
between work areas by changing the current work area to the
one you specify.
Aliased Expressions Aliased expressions are used to temporarily access a work area
for the purpose of expression evaluation. To form an aliased
expression, enclose the expression in parentheses and prefix it
with the desired alias name and the operator (->) (for example,
<idAlias>->(<exp>)). The work area is selected, the expression
evaluated, and finally the original work area restored.
2-102 CA-Clipper
The Database System
Command/Function Attribute
2-104 CA-Clipper
The Database System
Database Files
The database file is the main file type and has a default extension
of (.dbf). A database file, often called a table, consists of one
variable length header record that defines the structure in terms
of its field definitions, and zero or more fixed length records that
contain actual data for nonmemo fields and pointer information
for memo fields. Each record has one additional byte for the
record delete status flag. The CA-Clipper database file format is
compatible with dBASE III PLUS.
M e m o Files
The data for all memo fields is stored in the same memo file, no
matter how many memo fields are defined in the database file
structure. Each memo field in the database file contains a
pointer into the memo file, so the database system can quickly
locate the associated data.
Function Attribute
DELETED() Record delete status flag
FIELD() Field name
HEADER() Header size in bytes
LUPDATE() Date of last update
RECSIZEQ Record size in bytes
Database Operations
Category Command/Function
Add APPEND BLANK, APPEND FROM,
BROWSE()
Close CLOSE, USE
Compute AVERAGE, COUNT, SUM
Create COPY STRUCTURE, COPY STRUCTURE
EXTENDED, COPY TO, CREATE, CREATE
FROM, JOIN, SORT, TOTAL
Delete DELETE, PACK, RECALL, ZAP
Display DISPLAY, LABEL FORM, LIST, REPORT
FORM, BROWSEQ, DBEDIT()
Continued
2-106 CA-Clipper
The Database System
Continued
Category Command/Function
Filter INDEX...UNIQUE, SET DELETED, SET
FILTER
Information AFIELDS()
Iterate DBEVAL()
Lock SET EXCLUSIVE, UNLOCK, FLOCK(),
RLOCK()
Navigate CONTINUE, FIND, GO, LOCATE, SEEK,
SKIP
Open USE
Order INDEX, REINDEX, SET INDEX, SET
ORDER, SORT
Relate SET RELATION
Update ©...GET <idField>/READ, REPLACE,
UPDATE, BROWSE(), DBEDITQ
Record Scoping
2-108 CA-Clipper
The Database System
Index Files
Creating
You create index files for the database file in the current work
area with the INDEX command in which you specify an order
key expression. The maximum length of the key expression is
250 characters, and its type can be character, date, or numeric.
You determine the index key value for each record in the
database file using the index key expression. This expression is
stored in the index file in such a way that the database file can be
processed in order according to the key values which can be
searched very quickly.
Opening
You can create several index files for a single database file so the
data can be accessed in many different ways. Once the necessary
index files are created, you must open them along with the
associated database file in order to use them. You can open up
to 15 index files at the same time with the INDEX clause of the
USE command or with SET INDEX.
2-110 CA-Clipper
The Database System
Ordering
With both USE and SET INDEX you list the index files you want
to open, and the first one in the list becomes the controlling index.
The controlling index defines the order in which the database file
is processed and is the only index that can be searched.
Searching
SEEK and FIND locate a record based on its index key value in
the controlling index file. SEEK is the preferred search
command; FIND is an obsolete command that is provided for
compatibility only. Searching an index file using either of these
commands is much faster than performing a sequential search.
Updating
Closing
2-112 CA-Clipper
The Input/Output System
Text Mode
In text mode, all characters that are displayed must be one of 255
characters that make up the ASCII character set. In addition,
you can place only one character at one particular location on the
screen.
Graphic Mode
2-114 CA-Clipper
The Input/Output System
Console Operations
Commands and functions that display output on the screen
without reference to row, column, or pixel position are called
console operations. Used in conjunction with SET ALTERNATE
and SET PRINTER, these operations can simultaneously send
output to the screen, a text file, and the printer. However, the
majority of the console commands have TO PRINTER and TO
FILE clauses that supersede SET PRINTER and SET
ALTERNATE. The following table lists all the console
operations in the CA-Clipper language:
Operation Output
Full-Screen Operations
Operation Result
2-116 CA-Clipper
The Input/Output System
For console commands that do not support this clause, use the
SET PRINTER command:
SET PRINTER ON
DO WHILE .NOT. EOF()
QOUT(Name)
SKIP
ENDDO
SET PRINTER OFF
SET MARGIN sets the left printer margin. With console output,
the margin setting indents output whenever there is a new line.
@...SAY adds the margin setting to the specified column value.
2-118 CA-Clipper
The Input/Output System
SET PRINTER ON
2-120 CA-Clipper
The Keyboard System
There are three functions that access the keyboard buffer. These
are INKEY(), LASTKEY(), and NEXTKEY(). Each function
returns a numeric value between -39 and 386, identifying the
INKEY() code of keys including function, Alt+function,
Ctrl+function, Alt+letter, and Ctrl+letter key combinations.
Command/Function Purpose
2-122 CA-Clipper
The Keyboard System
All SET KEY definitions take precedence over the standard key
definitions. This includes predefined keys such as Insert and
Delete that are used in editing, as well as keys such as Esc and
Alt+C that you can control with built-in commands and
functions.
Opening α File
There are two functions available to open a binary file. The first,
FOPEN(), opens an existing file, while the second, FCREATEQ,
creates a new file, leaving it open for use. Both functions return
a number representing the DOS file handle for the open file. The
file handle must be saved in a variable to identify the file to other
functions. FCRE ATE() lets you specify a DOS file attribute, and
FOPEN() lets you specify the DOS open mode.
2-124 CA-Clipper
The Low-Level File System
Once a binary file is open, you can read its contents with one of
two functions, FREAD() or FREADSTR(). Both functions require
that you identify the file using its file handle. Specifying a
particular file is necessary since more than one binary file can be
open at a time.
In either case, the data read from a binary file is in binary form.
Thus, several functions are provided to convert binary data to
numeric so that you can manipulate the information in your
CA-Clipper application.
Writing to α File
Closing α File
FCLOSE() closes an open binary file and writes the associated
DOS buffers to disk. This function requires that you identify the
file you want to close by its file handle. Specifying a particular
file is necessary since more than one binary file can be open at a
time.
2-126 CA-Clipper
The Low-Level File System
Error Detection
When using the low-level file functions, you can test for errors
with the individual function return value or with the FERROR()
function. Which method you use depends on the level of detail
you want. The following table summarizes the return values of
the low-level file functions that indicate an error condition:
FCREATE() Returns -1
FOPEN() Returns -1
FERROR() returns a DOS error number for the last low-level file
function executed. If there is no error, FERROR() returns zero.
After determining that a function has failed by checking its
return value, you can use FERROR() to narrow down the cause
of the error. This function retains its value until the next
execution of a low-level file function.
In This Chapter
After you have designed, written, debugged, and configured a
CA-Clipper application, the next step is to install the program on
the end user's machine. This process consists of preparing the
user's workstation. Before doing this, however, there are a
number of issues to understand in order to guarantee that your
application will run correctly in the user's computing
environment.
3-2 CA-Clipper
Setting the Workstation Environment
The FILES command uses file handles to set the number of files or
devices that can be open at one time. The default value is eight,
but FILES can be set as high as 255 if the user's workstation is
running DOS 3.3 or higher. If the number of file handles is
greater than 20, you must use the CLIPPER environment
variable (discussed later on in this chapter) to tell CA-Clipper
how many handles to use.
In DOS versions 3.2 and above, you can change the default
environment size by specifying a SHELL command in
CONFIG.SYS, like this:
SHELL=COMMAND.COM /E:<nBytes> /P
The executable file (.EXE) is the program file that can be invoked
directly from the DOS command prompt and is searched for in
the current directory. If not found, the current PATH is
searched.
3-4 CA-Clipper
Setting the Workstation Environment
Temporary Files
In the process of some operations, such as sorting and indexing,
CA-Clipper creates temporary files. These files are created either
in the current directory or in the directory specified by the
environment variable TMP. To assign a TMP variable, place a
command line like the following in the user's AUTOEXEC.BAT
file:
SET TMP=C:\TEMP
If for some reason this is not the case, add an explicit assignment
of COMSPEC in the user's AUTOEXEC.BAT or application batch
file (discussed later in this chapter), as follows:
SET C0MSPEC=C:\D0S
Using MODE For example, the following application batch file shows how to
use the MODE command to configure a serial port and redirect
output to it:
REM Application batch file
MODE C0M1:=1200, 8,1,Ρ
MODE LPT1:=C0M1
MYAPP.EXE
MODE LPT1
Using SET PRINTER If SET PRINTER is used, the reference to the port can be a literal
or variable value, but a literal value designation is somewhat
restrictive and environment specific. The printer port can be
specified to the SET PRINTER command as an extended
expression. This allows you to pass the print destination to an
application via an environment variable or as a command line
argument of the application.
For example, this application batch file configures the serial port
then defines an environment variable designating the printer
port as COM1:
REM Application batch file
MODE COM1:=1200,8,1,P
SET CLIPP0RT=C0M1
MYAPP.EXE
MODE LPT1
3-6 CA-Clipper
Setting the Application Environment
Setting Meaning
Continued
Setting Meaning
3-8 CA-Clipper
Setting the Application Environment
3-10 CA-Clipper
Setting the Application Environment
• A theoretical maximum of 32 MB
If you have an application that uses more than 20 files and are
running under DOS 3.3 or greater, you must use the F parameter
to inform CA-Clipper of the maximum number of file handles to
use. This parameter is used in combination with the value you
specified with the FILES setting in CONFIG.SYS.
3-12 CA-Clipper
Setting the Application Environment
3-14 CA-Clipper
Setting the Application Environment
Valid values for <nKBytes> range from zero to 64, inclusive. The
default value is zero.
3-16 CA-Clipper
Setting the Network Environment
Assigning Rights
Most network environments govern the access of users to
various locations on the file server disk as a part of the network
security system. Network security is necessary in a shared
environment to provide suitable levels of protection to other
people's work, as well as privacy. This access control is
maintained through a system of rights to directories and files,
which are granted to users by a network supervisor.
Note: If the application creates files for any reason, the user will
also require create rights. This could include indexing, copying,
or writing output to a print file.
3-18 CA-Clipper
Setting the Network Environment
3-20 CA-Clipper
Chapter 4
Network Programming
In This Chapter
CA-Clipper provides the following features that allow you to
take advantage of Local Area Network (LAN) capabilities to
develop shared applications:
• Shared access allows two or more users to open the same file
simultaneously
• Exclusive access prevents other users from opening the same
file at the same time
• Logical file locking prevents two or more users from
updating the same file at the same time
• Locking
• Overlays on a network
• Update visibility
• Network printing
4-2 CA-Clipper
LAN Requirements for CA-Clipper
• PACK
• REINDEX
• ZAP
There are two general rules that will help you to decide how a
given operation works: if it writes to the file, the open mode is
exclusive; if it only reads the file, the open mode is shared. For
example, SAVE writes to a (.mem) file and opens it exclusively;
RESTORE reads a (.mem) file and opens it shared. Therefore,
your programs must anticipate possible conflicts when working
with .mem files and provide mechanisms for avoidance (for
example, using interworkstation communication) or recovery
(for example, using the error system).
4-4 CA-Clipper
Using Shared Mode
The following table shows the open modes for all operations that
automatically open files. In cases where there are two possible
file open operations, both files are shown; the ordering of the
files refers to the order in which they appear in the syntax.
UPDATE Shared
Opening Index Files For this reason, you should never include the INDEX clause in a
USE command when programming in a network environment.
Although USE...INDEX is a single command, it performs several
distinct open operations. Instead, open the index files with SET
INDEX after checking NETERR() to determine that the USE
succeeded. Using this method, you can prevent possible runtime
errors and be guaranteed that the index files will be opened
successfully and in the same mode as the associated database
file.
The NetUseO Function NetUse() is defined in the sample program Locks.prg. The
function demonstrates a flexible and comprehensive file opening
scheme that attempts to open a database file in either shared or
exclusive mode and continues trying to open the file for a given
amount of time or until it succeeds.
4-6 CA-Clipper
Locking
The next example is very similar to the previous one, except that
it uses NetUse() to open the database file:
#define DB_SHARED .F.
#define DB_EXCLUSIVE .T.
IF NetUse("File", DB_SHARED, 5)
SET INDEX TO Mylndexl, Mylndex2
ELSE
? "File not available in shared mode."
BREAK
END IF
Locking
If you allow file sharing in your application, you must determine
when file or record access by more than one user must be
prevented. Then, you can incorporate lock functions into your
application with accompanying logic to control execution in
accordance with the lock results. Use these basic guidelines to
determine when locking is necessary:
There are two levels of locking: record and file. The one you use
will depend on the operation required. If you are updating one
record at a time, a record lock will be sufficient; however, if you
are performing a mass update, you will need to lock either the
entire file or all of the records involved in the operation. If you
neglect to obtain a lock before attempting to write to a shared
file, the operation will result in an error message.
Operation Requirement
@...GET Record lock
DELETE (single record) Record lock
DELETE (multiple records) Exclusive use, file lock, or
multiple record locks
RECALL (sing)e record) Record lock
RECALL (multiple records) Exclusive use, file lock, or
multiple record locks
REPLACE (single record) Record lock
REPLACE (multiple records) Exclusive use, file lock, or
multiple record locks
4-8 CA-Clipper
Locking
File Locking
The FLOCK() function attempts to place a file lock on the current
database file and returns a logical value indicating the success or
failure of the lock.
The FilLockQ Function The FilLock() function, defined in the sample program
Locks.prg, allows you to retry the file lock for a specified time
limit. The syntax for FilLock() is as follows:
Record Locking
Record locking is similar to file locking and is accomplished with
RLOCK() or DBRLOCK(). RLOCK() attempts to lock the current
record, releasing all other locks currently held, whereas
DBRLOCKQ allows you to lock a range of records, called a lock
list, by specifying a particular record to lock. Both functions
make a single attempt to lock the specified record and return a
logical value indicating success or failure.
The RecLock() Function The RecLock() function, defined in the sample program
Locks.prg, allows you to retry the record lock for a specified time
limit. The syntax for RecLock() is as follows:
RecLock(<nSeconds>) —» lvalue
Automatic Locking
When you append a blank record to a shared database (using
DBAPPEND() or APPEND BLANK), CA-Clipper automatically
tries to lock the new record, setting NETERR() to indicate its
success or failure. Unless the new record can be locked, it is not
added. Thus, there is no need to attempt a record lock before
editing the new record, but it is necessary to check NETERR() so
that you will know whether the record was actually added.
The AddRec() Function AddRec(), defined in the sample program Locks.prg, is similar to
FilLock() and RecLock() in that it allows you to retry the append
operation for a specified time limit. This function illustrates how
to properly test for a successful append operation in a network
environment. The syntax is as follows:
4-10 CA-Clipper
Locking
Unlocking
Once a lock is in place, an application can write to the file. Other
users attempts to lock the same record or file will fail, but they
7
Resolving a Failure
The code for opening files and attempting locks is
straightforward and, as suggested already, you may want to try
these operations several times before giving up. If, however, a
file cannot be opened or a lock cannot be obtained, the
application has to abandon its original intentions and come up
with substitute plans.
Offer Choices As part of the communication, you may also want to provide
alternatives and make a branching choice based on the user's
selection. A typical menu might offer these choices:
• Retry
This choice simply allows the user to extend the lock or open
effort, without seeking to resolve the failure.
4-12 CA-Clipper
Overlays on a Network
Overlays on a Network
Linkers sometimes produce overlays containing compiled
program code. By default, all compiled CA-Clipper code is
placed in dynamic overlays. Additionally, static overlaying may
be requested for C or Assembler code.
Update Visibility
When programming in a network environment, it is important to
determine when database (and index) updates actually become
visible, which differs depending on the observer. This section
describes the visibility rules for each of the following possible
observers:
• The initiator
Note: The rules specified in this section are for the DBFNTX and
DBFNDX database drivers. Rules for other drivers may differ.
The Initiator
The initiator of an operation is the process which causes an
update to occur. All updates appear to the initiator immediately
after they are made.
Exclusive Mode If the file is open in exclusive mode, the update is not guaranteed
to appear until the file is closed or a commit operation (for
example, using DBCommit() or COMMIT) is performed.
File Lock If the file is open in shared mode with a file lock, the update is
not guaranteed to appear until the file is closed or one of the
following operations is performed: unlock, record lock, or
commit.
4-14 CA-Clipper
Update Visibility
Record Lock If the file is open in shared mode with a record lock or lock list,
the update is not guaranteed to appear until the file is closed or
one of the following operations is performed: unlock, commit, or
any record movement operation (such as skipping to a new
record or going directly to a specified record).
Abnormal Termination
When an application terminates normally, all files are closed and
all updates are committed to disk.
Network Printing
A network by nature is a system that provides shared access to
common resources. Printers are among several hardware
devices to which a network can provide shared access. From a
general point of view, network operating systems provide
services to make access to shared printers as transparent as
possible to the workstation. Because of this, printing to a local
printer appears no different to an application than does printing
to a network printer.
4-16 CA-Clipper
Network Printing
For example, the following code fragment starts and ends a print
job with SET PRINTER TO:
USE Customer NEW
SET PRINTER TO LPTl
SET PRINTER ON
DO WHILE !EOF()
? Customer, Amount
SKIP
ENDDO
SET PRINTER OFF
SET PRINTER TO
CLOSE Customer
Printing to α File
One of the great problems of printing is the strong likelihood
that something will happen during the printing process that
could abort a critical print job. In large scale installations with
many users and a large volume of transactions, a printer
problem can have system-wide consequences. Accounting
systems may, for example, print a report of transactions as they
are posted at the end of an accounting period. If the report is
sent directly to the printer, a print job failure could compromise
database integrity. In this instance, reprinting the report would
require a rollback of all posted transactions, and all print jobs
would then have to be resubmitted.
After printing to a file, you need to place the file in the print
queue. There are several approaches to this. Perhaps the easiest
method is to use the COPY FILE command to copy the file to the
PRN device.
4-18 CA-Clipper
Chapter 5
Programming in Graphic Mode
In This Chapter
CA-Clipper 5.3 provides you with the capability of switching
easily from text mode to graphic mode. In fact, its GUI controls,
such as push buttons and check boxes, are designed to take
advantage of graphic mode, thereby minimizing the code
changes that are needed to make the transition to graphic mode.
• Troubleshooting
Programming Similarities
5-2 CA-Clipper
Overview of Graphic Mode
Programming Differences
For example, consider the techniques needed to prevent output
from being displayed in a defined region of the screen. Imagine
a cascading window system with three windows, A, B, and C:
Using text mode, and assuming you saved each window region
prior to painting the window boxes, you would probably do the
following:
5-4 CA-Clipper
Invoking Graphic Mode
// Window C coordinates
GSETEXCL(nTop, nLeft, nBottom, nRight)
// Manipulate or paint information in window A
Now that you have had a brief introduction to graphic mode, let
us proceed to some of the basics, including: invoking and using
graphic mode, compiling and linking, and managing bitmap and
font resources with graphic mode utilities.
1. Make sure that you are using only CA-Clipper functions for
all screen displays and that other third-party products are
manipulating the screen functions (using the General
Terminal (GT) module).
5-6 CA-Clipper
Using Graphic Mode
Shadowing Restrictions
LEN(cSave) / 2))
RESTSCREEN(nTop, nLeft, nBottom, nRight, cSave)
RETURN NIL
Enhancing an Application
Now that your application is working, it is time to start
enhancing it. The simplest thing to do is to replace the usual
frame parameters in DISPBOX() by LLG_BOX_GRAY_STD so as
to get frames with a three-dimensional (3-D) look.
Next, make sure that you modify the TBrowse :footSep variable,
replacing it with a null string (""). Because the lower edge of
your frame is now made up of pixels instead of semi-graphic line
drawing characters, you do not have to write characters in this
area.
Take advantage of the fact that you now have 30 lines of text
(normal 640 χ 480 VGA mode) and not just 25. Your users will
appreciate it. For example, you may want to increase the size of
your TBrowse objects with the additional lines available. You
may also want to move your message display area from 24 to 29
and give it a thin frame with a 3-D look using GFRAME().
5-8 CA-Clipper
Using Graphic Mode
Push Buttons
Bitmaps a n d Icons
You can use icon (.ICO) files as easily as bitmap (.BMP) files. See
the GBMPLOAD() function for more information.
5-10 CA-Clipper
Managing Bitmap and Font Resources
RES2BML.EXE
<bmlFile> is the name of the resulting library file. The file name
that you choose should have the same base name as the
corresponding .EXE file, but with a .BML extension.
BML2RES.COM
<bmlFile> is the name of the library file whose contents you want
to extract. All bitmap and font files contained in this file will be
extracted and recreated on disk.
BMLDIR.COM
<bmlFile> is the name of the library file whose contents you want
to view. Use the vertical pipe and more filter if the entries
exceed the number of available rows on your screen and you
want to pause between groups of entries.
5-12 CA-Clipper
Managing Bitmap and Font Resources
Troubleshooting
This section suggests ways to resolve certain problems that can
occur when you execute your CA-Clipper application in graphic
mode. Examine this section for solutions to common problems
before you call for Computer Associates Technical Support.
Common Problems
Listed below are a number of common problems that you may
have programming in graphic mode:
This may also occur if your video card is not 100 percent
VESA 1.2 compatible. Please check your video card
manufacturer's specifications. Also, other add-ons or
custom routines which manipulate the video output may be
causing the problem, including:
- Non-VGA standard
5-14 CA-Clipper
Troubleshooting
"Can I save and restore numerous screen areas to memory for icons
and overlaid windows?"
Software Compatibility
Graphic mode does not simply switch the video mode when you
call SET VIDEOMODE. A series of environment settings, such as
SETMODE(), mouse size conversion, and so on, are updated.
These values would not be properly set if you use another library
to switch to graphic mode instead of calling SET VIDEOMODE.
Mixing two graphics libraries is thus very likely to cause
problems, and you will usually end up rebooting your PC!
5-16 CA-Clipper
Troubleshooting
Hardware Compatibility
Processors The graphic mode library was developed in C and Assembly
languages. For execution speed, it uses instructions that are only
supported by 80286 and later processors. An executable file
linked with graphic mode will, therefore, not work on computers
using 8088 or 8086 processors.
VGA Drivers Graphic mode works with video cards that either conform to or
perfectly emulate the VGA standard.
VESA Drivers Graphic mode also works with VESA video modes. It is VESA
1.2 compatible, which means the video hardware must be
compatible with the VESA 1.2 standard. However, many video
cards (both older and recent) are not fully compatible with VESA
1.2—these may be compatible with VESA 1.0 or the SVGA
standard.
Memory Shortage
5-18 CA-Clipper
Chapter 6
Introduction to TBrowse
In This Chapter
TBrowse is one of several predefined classes included in
CA-Clipper designed to give you control and flexibility in the
retrieval, display, and editing, the browsing, of tabular views of
data. It provides a robust, open-architecture browsing
mechanism that is not tied to the (.dbf), or any other, file format.
• TBrowse overview
• Adding color
Note: This chapter assumes that you are familiar with the
concepts and terminology associated with CA-Clipper's
predefined classes as discussed in the "Basic Concepts" chapter
of this guide.
TBrowse Overview
To understand TBrowse, you must understand what it does not
do as well as what it does. TBrowse is a passive object in the
sense that it never initiates an action. It never takes control from
the programmer for more than a few moments, never, without
explicit direction, handles a single keystroke, and never "ends."
You simply stop using it when you are done with it. TBrowse is
a data source access tool that can browse any data that is
expressible in a table form.
6-2 CA-Clipper
Basic Browse Operations
Create a TBrowse There are two functions for creating a TBrowse object:
Object TBrowseNew() and TBrowseDB().
NEXT
RETURN oBrowse
Main Loop
The main loop of the browse is very straightforward; stabilize
the browse (explained below), get a keystroke, act on the
keystroke, then repeat the process. If the keystroke happens to
be an exit key (in this case, Esc), exit the loop and return. When
you exit the loop, the reference to the TBrowse object, since it
was held in a local variable, falls out of scope, and the system
automatically reclaims the space used by the object.
6-4 CA-Clipper
Basic Browse Operations
ENDDO
Stabilization
Handling Keystrokes
6-6 CA-Clipper
Optimization of the Browse
PROCEDURE AddRecNo(oBrowse)
LOCAL oCol
RETURN
IF oBrowse:stable
// positioned at top or bottom of browse
// (these values only valid if stable)
IF oBrowse:hitTop .OR. oBrowse:hitBottorn
TONE(125, 0)
END IF
// Get a new keystroke
nKey := INKEY(0)
END IF
ENDDO
6-8 CA-Clipper
Optimization of the Browse
Multi-User Issues
6-10 CA-Clipper
Optimization of the Browse
If you have complete control over the objects, you can use cargo
in any way you desire. This example makes the preprocessor
code easier to understand:
// These #defines use the browse's cargo slot to
// hold the "append mode" flag for the browse.
// Having #defines for these makes it easy to
// change later.
#define TURN_ON_APPEND_MODE(b) (brcargo := .T.)
#define TURN_OFF_APPEND_MODE(b) (bicargo := .F.)
#define IS_APPEND_MODE(b) (bicargo)
Dictionaries If, on the other hand, you are not in complete control of the
objects (that is, you are writing general purpose routines for
others to use), we strongly recommend that you use cargo as a
dictionary, as implemented in the Dict.prg sample program
(located in you CA-Clipper SOURCE\SAMPLE directory). This
allows several programmers to use cargo without conflict, and
without any change in the source code.
6-12 CA-Clipper
Browsing with Get
NEXT
RETURN oBrowse
6-14 CA-Clipper
Browsing with Get
// Turn cursor on
nCursSave := SETCURSOR(SC_NORMAL)
@ ROW(), COL() GET &cField PICTURE oCol:picture ;
WHEN oColrpreBlock VALID oCol:postBlock
READ
// Restore cursor
SETCURSOR(nCursSave)
RETURN
// Turn cursor on
nCursSave := SETCURSOR(SC_NORMAL)
// And do READ
READMODAL({oGet})
// Restore cursor
SETCURSOR(nCursSave)
RETURN
6-16 CA-Clipper
Browsing with Get
// Turn cursor on
nCursSave := SETCURSOR(SC_NORMAL)
// And do READ
READMODAL({oGet})
// Restore cursor
SETCURSOR(nCursSave)
RETURN
Adding Color
Though the previous examples have been for monochrome
displays, the TBrowse class also gives control over color. The
simplest way to add color to a TBrowse object is to SET COLOR
TO the desired standard and enhanced colors. The headers,
footers, and columns will be displayed in the standard color, and
the highlight will be in the enhanced color. However, a more
complex use of color requires an understanding of the
relationships between the various exported instance variables
that control color.
TBrowse:colorSpec
6-18 CA-Clipper
Adding Color
TBColumn:defColor
DO CASE
CASE VALTYPE(xValue) == "C"
// Characters in black
oColidefColor := {1, 2, 1, 1}
CASE VALTYPE(xValue) =^ "N"
// Numbers in blue
oColrdefColor := {3, 4, 3, 3}
OTHERWISE
// Dates and others in green
oCol:defColor := {7, 8, 7, 7}
ENDCASE
NEXT
RETURN
TBColumn:colorBlock
TBrowse lets you highlight the color of individual cells based on
the value retrieved by TBColumn:block (the data retrieval block)
using TBColumnxolorBlock. This code block is passed the result
of the data retrieval block and returns a color array.
TBColumn:colorBlock overrides the TBColummdefColor for the
column. This is valuable in a number of situations, a few of
which are illustrated in the examples to follow:
// Default color
oCol:defColor := {1, 2, 1, 1}
IF VALTYPE(xValue) == "N"
// Negative numbers in red
oCol:colorBlock := {|n| IIF(n < 0, ;
{3, 4}, {1, 2}) }
END IF
NEXT
RETURN
6-20 CA-Clipper
Adding Color
// Default color
oCol:defColor := {1, 2, 1, 1}
// Ignore the value of the cell and choose
// color for column based on the time at
// which the block is executed
oCol:colorBlock := {|x| RandColor(6)}
NEXT
RETURN
// RandColor()
//
// Return color based on time
FUNCTION RandColor(nSets)
LOCAL nSelector
RETURN {(nSelector * 2) + 1 , ;
(nSelector * 2) + 2 }
ELSE
nRec := RECNO()
oBrowse:refreshAll()
6-22 CA-Clipper
Adding Color
TBrowse:colorRect()
TBrowse also includes a method, TBrowse:colorRect(), for
coloring any rectangular region. This method takes as
parameters the four corners of the box (top, left, bottom, and
right) in an array, and a color array. The coordinates of the box
are relative to the browse window, so that 1,1 is the first cell of
the first row currently visible. The box " 1 , 1, oBrowse:rowCount,
oBrowseicolCount" refers to all currently visible rows, though
the column numbers could refer to columns that are not
currently visible.
nCurRow := oBrowse:rowPos
// Color row
oBrowse:colorRect({nCurRow, 1, nCurRow, ;
oBrowse:colCount}, aColors)
// And make it happen
oBrowse:forceStable()
RETURN
6-24 CA-Clipper
Controlling the Scope
// Skipper()
//
// Handle record movement requests from the
// TBrowse object
STATIC FUNCTION Skipper(nMove)
LOCAL nMoved
nMoved := 0
nMoved++
ENDDO
RETURN nMoved
You can look at all records associated with a particular key value
by defining the movements within the data set, then forcing the
TBrowse: skip Block to remain within the key value. Define
movement to the top of the data set as seeking the particular key
and movement to the bottom of the data set as seeking the last
item matching the current key.
6-26 CA-Clipper
Controlling the Scope
// TBNextKey()
//
// Return value of next key in database
// WARNING! Does not work on logical values or
// floating point numbers
FUNCTION TBNextKey(xValue)
LOCAL cType := VALTYPE(xValue), xNext
DO CASE
CASE cType == "C"
// Find next value by incrementing the ASCII
// value of the last character in the string
// NOTE: Assume last char is not 2 55 for
// simplicity
xValue := STUFF(xValue, LEN(xValue), 1, ;
CHR(ASC(RIGHT(xValue, 1)) + 1))
ENDCASE
RETURN xNext
Finally, write a function that returns the necessary
TBrowse:skipBlock. This function is like the default
TBrowse:skipBlock described earlier, except that it checks for
moving out of range as well as for beginning and end of file.
nMoved++
END IF
RETURN nMoved
6-28 CA-Clipper
Controlling the Scope
This example ties the various code blocks and functions defined
so far in this section together, giving you a scoped browse based
on a key value that you pass as an argument:
// BrowseWhile()
// Browse database while the key field matches
// xKey
PROCEDURE BrowseWhile(nTop, nLeft, nBottom, ;
nRight, xKey)
LOCAL oBrowse // The TBrowse object
LOCAL nKey // Keystroke
LOCAL lMore // Loop control
LOCAL nCursSave // Save state
// Create another generic browse
oBrowse := StockBrowseNew(nTop + 1, nLeft + 1 , ;
nBottom - 1, nRight - 1)
// Change the movement methods
oBrowse:goTopBlock := FirstKeyBlock(xKey)
oBrowse:goBottomBlock := LastKeyBlock(xKey)
oBrowse:skipBlock : = KeySkipBlock(xKey)
// Draw a box around the browse
@ nTop, nLeft CLEAR TO nBottom, nRight
@ nTop, nLeft TO nBottom, nRight
// Turn cursor off and save shape while browsing
nCursSave := SETCURSOR(SC_NONE)
// Define exit key
oBrowse:setKey(K_ESC, {|| TBR_EXIT})
// Main loop
iMore := .Τ.
DO WHILE IMore
ENDDO
SETCURSOR(nCursSave)
RETURN
RETURN aRecs
6-30 CA-Clipper
Controlling the Scope
END IF
nCurRow + = nMove
nMoved := nMove
DBGOTO(aRecs[nCurRow])
RETURN nMoved
In This Chapter
The CA-Clipper Get system is an integral interface tool
consisting of commands, objects (and their related data and
methods), environments, and behaviors that implement data
entry and retrieval. It gives the developer direct and specific
control over the interaction between the user and data, while
making the retrieval, display, manipulation, and storage of data
easy and flexible. This chapter lays the groundwork required to
take advantage of the Get system, after which, the reader should
understand and be able to extend the system. The chapter
assumes knowledge of the @...GET and READ commands, so the
focus lies instead on more advanced uses of the system.
Note: This chapter assumes that you are familiar with the
concepts and terminology associated with CA-Clipper's
predefined classes as discussed in the "Basic Concepts" chapter
of this guide.
7-2 CA-Clipper
The Get Class
Get:block
Getrblock holds a code block that stores the value passed, or
retrieves the value associated with the Get if no parameter is
passed. If the Get refers to a simple variable (cVar in this
example), the code block is straightforward:
oGet := GetNewd, 1, ;
{|cNew| IIF(PCOUNT() = = 0, cVar, ;
cVar := cNew)}, "cVar")
The block can also refer to a function call. For example, to create
a Get object to modify the _SET_WRAP setting, one would do
the following:
cName := "_SET_WRAP"
oGet := GetNewd, 1, ;
{|lNew| IIF(PCOUNT() = = 0, SET(_SET_WRAP) , ;
SET(_SET_WRAP, lNew)}, cName)
To solve this problem, the Get class makes special provisions for
arrays. Normally, a Getblock for an array simply returns the
array reference. However, since the code block must access the
actual array element rather than the reference to the entire array,
and Get:subscript is not assignable, you must create the code
block within a function:
cName := "aVar[" + LTRIM(STR(x)) + " ] "
oGet := GetNewd, 1, AGetBlock (aVar, χ) , cName)
STATIC FUNCTION AGetBlock(aArray, x)
RETURN {IxVal| IIF(PCOUNT() = = 0, a A r r a y [ χ ] , ;
aArray[x] := xVal)}
7-4 CA-Clipper
The Get Class
Get:cargo
Sometimes it is desirable to track more information about the Get
than the Get object itself tracks. To let you do this, CA-Clipper
defines the cargo exported instance variable in all of its classes. It
is called "cargo" because it is just "along for the ride." Cargo can
hold data of any type.
If you have complete control over the objects, you can use cargo
in any way you desire. This example makes the preprocessor
code easier to understand:
// These #defines use the GET's "cargo" slot to hold
// the message displayed at the bottom of the
// screen. Having #defines for these just makes it
// easy to change later.
#define SET_MESSAGE(g, msg) (g:cargo msg)
#define GET_MESSAGE(g) (g:cargo)
Dictionaries If, on the other hand, you are not in complete control of the
objects (that is, you are writing general purpose routines for
others to use), we strongly recommend that you use cargo as a
dictionary, as implemented in the Dict.prg sample program
(located in your CA-Clipper SOURCE\SAMPLE directory). This
allows several programmers to use cargo without conflict, and
without any change in the source code.
When you perform actual data entry into the Get, you must first
prepare the Get to accept characters. Do this using
Get:setFocus(). This causes the Get object to create and initialize
its internal state information, including the exported instance
variables: Get:buffer, Get:pos, GetdecPos, Getxlear, and
Get:original. The contents of the editing buffer are then
displayed in the GET's selected color.
7-6 CA-Clipper
The Get System
Reader Layer
The Read Layer The top layer, the Read layer, is composed of the familiar
@...GET and READ commands. This is where the bulk of
CA-Clipper programming is done.
The Reader Layer The next layer, the Reader layer, controls the behavior of one Get
at a time. This layer is implemented by default through the
function GETREADER(), but can be extended through additional
custom readers.
The Get Function Layer The bottom layer, the Get function layer, separates the behavior
of a single Get down into four distinct actions: prevalidating the
Get, handling SET KEYs, applying keystrokes to the Get, and
postvalidating the Get.
7-8 CA-Clipper
Extending the Read Layer
Nested Reads
The ability to nest reads, a most desired enhancement, is easy
with CA-Clipper. Because the READ command simply passes
an array named GetList to READMODAL(), you can use a
different variable, GetList, in other functions. If you call a
function from a VALID or WHEN clause or from a SET KEY
procedure, and then define a new array, GetList, local to that
function, the @...GETS and READs there will refer to the local
GetList.
This GetList falls out of scope when the function ends, returning
control to the previous READ and its GetList:
// Creating nested reads
PROCEDURE Main()
LOCAL cName := SPACE(10)
@ 10, 10 GET cName VALID SubForm(cName)
READ
RETURN
FUNCTION SubForm(cLookup)
LOCAL GetList := {} // Create new GetList
USE Sales INDEX Salesman NEW
SEEK cLookup
IF FOUND()
// Add Get objects to new GetList
@ 15, 10 GET Salesman
@ 16, 10 GET Amount
// READ from new GetList
READ
END IF
CLOSE Sales
// Release new GetList
RETURN .T.
Using GETACTIVEO
Much of the power of the new Get system lies in its direct
manipulation of a Get object after its retrieval with the
GETACTIVE() function. This function lets you not only retrieve
and change the current value of the Get, but access all the
information stored in it.
7-10 CA-C'ipper
Extending the Read Layer
This example examines the current content of the Get. If the Get
is of character data type, it converts the contents to mixed case
using the sample function Proper() when the user types Ctrl+K.
Proper() is defined in String.prg, which is located in your
CA-Clipper SOURCE \ SAMPLE directory:
// Converting character input to mixed case
// Must be linked with String.obj to work
#include "Inkey.ch"
. .<statements>
. <statements>
@ 1, 1 GET cTest
READ
// GetCapFirst(}
// Capitalize the first letter of every word
//
STATIC PROCEDURE GetCapFirst()
LOCAL oGet, cString
RETURN
You can also improve help systems by storing the help text (or an
index to the help text) in Getxargo. Notice how dictionaries are
used to reduce potential conflicts between this and any other
modules that implement enhancements to the Get system:
// Storing Help Text in Get:cargo
// Dict.obj is necessary for the following example.
PROCEDURE ReadTest()
LOCAL cVarl
LOCAL GetList := {}
cVarl := SPACE(30)
CLS
@ 3, 0 SAY PADCC'GETs w/ Help Text in " + ;
"Get:cargo", MAXCOL())
@ 4, 0 SAY PADCC* (<F1> for help)", MAXCOL () )
// Put the help text in the cargo
// dictionary manually
© 7 , 0 SAY "Variable 1" GET cVarl
IF ATAIL(GetList):cargo = = NIL
ATAIL (GetList): cargo := DictNewO
END IF
RETURN
// HelpO
// The system automatically assigns Fl to this
// procedure, returning help from wherever you are
7-12 CA-Clipper
Extending the Read Layer
The first concern many people have when seeing this is the
difficulty of adding the help text. Fortunately, CA-Clipper also
provides a graceful way to do this. By defining a command that
adds a HELP clause to the standard @...GET command, the
interface is made much cleaner:
// Adding a help clause to the @...GET Command
// Helpget.ch
To use this command, include the header file and simply add the
HELP clause to any existing Gets, as shown below:
// Using the Help Clause
#include "HelpGet.cn"
PROCEDURE ReadTest()
LOCAL cVarl
LOCAL GetList := {}
cVarl := SPACE(30)
CLS
@ 3, 0 SAY ΡADC("GETS w/ Help Text in " + ;
"Get:cargo", MAXCOL())
@ 4, 0 SAY PADC("(<F1> for help)", MAXCOL())
// Put the help text using new command
@ 7, 0 SAY "Variable 1" GET cVarl PICTURE "@!" ;
HELP "Help for variable one."
READ
RETURN
Dynamic Pictures
PROCEDURE Main()
LOCAL GetList := {}
LOCAL cName := SPACE(20)
LOCAL cIDType := "I"
LOCAL cSSNo := SPACE(9)
SET CONFIRM ON
SET SCOREBOARD OFF
7-14 CA-Clipper
Extending the Read Layer
CLS
@ 3, 0 SAY PADC("Member Information")
@ 5, 0 SAY "Name " GET cName
@ 6, 0 SAY "Oompany or I individual" ;
GET cIDType PICTURE "!" VALID cIDType $ "CI"
RETURN
// StartPic()
// Determine what the initial value for the picture
// should be.
//
IF cIDType == "C"
RETURN "@R 99-99999-99"
ELSE
// Default value
RETURN "@R 999-99-9999"
END IF
// ChangePic()
// Change picture on-the-fly from SS# to Tax ID or
// vice versa (to be called from WHEN clause).
STATIC FUNCTION ChangePic(oGet, cIDType)
IF cIDType == "C"
oGet:picture := "@R 99-99999-99"
ELSE
// Default value
oGet:picture := "@R 999-99-9999"
END IF
RETURN .T.
RETURN aGets
7-16 CA-Clipper
Creating a New Read Layer
Basic Guidelines
• The new feature only requires modifying the Get at the time
it is created (for example, storing information in Getxargo or
one of the other instance variables).
• The new feature does not affect the order in which Gets are
traversed, or what tasks are carried out between Gets. This
type of feature is usually added by making a modification at
one of the lower layers (leaving the Read layer intact).
If you follow these rules, your Read layer has a much better
chance of working with extensions you intend to use with the
default Read layer. It also lets you revert to the default Read
layer if you have problems with your code. Most importantly,
your code will be much more maintainable by other
programmers (or by you at a later date) because it will be
obvious where you have made modifications to the system.
7-18 CA-Clipper
Creating a New Read Layer
Implementation Steps
READ VALID
The first example of a custom Read layer lets you control exit
from the Read with the VALID clause. This is accomplished by
writing a new function, ReadValid(), based on the standard
READMODAL() function as defined in Getsys.prg.
LOCAL nLastPos
WHILE IsnPos == 0
RETURN UPDATED()
7-20 CA-Clipper
Creating a New Read Layer
You need only #include Valid.ch and add the VALID clause
where desired to use the new Read layer. A simple example
follows:
// Using the New Read layer
#include "Valid.ch"
MEMVAR GetList
PROCEDURE Main()
LOCAL cVarl, cVar2, cVar3
cVarl := cVar2 := cVar3 := SPACE(20)
CLS
@ 10, 10 SAY "Variable 1" GET cVarl
@ 11, 10 SAY "Variable 2" GET cVar2
@ 12, 10 SAY "Variable 3" GET cVar3
// The following insures that none of the Gets
// are left empty, and is equivalent to:
//
// READVALID (!EMPTY(cVarl)) .AND. ;
// (!EMPTY(cVar2)) .AND. (!EMPTY(cVar3))
//
READVALID {|aGets, 1Updated| ;
NoneEmpty(aGets, lUpdated)}
RETURN
// NoneEmpty()
// Return .T. if none of the Gets is empty
STATIC FUNCTION NoneEmpty(aGets, lUpdated)
LOCAL nGet
// See if there are any empty Gets
nGet:=ASCAN(aGets,{|oGet| EMPTY(oGet:varGet())})
// nGet will equal 0 if there were no empty Gets
RETURN nGet = = 0
#include "Set.ch"
// ReadMessage()
//
FUNCTION ReadMessage(aGetList, ...)
7-22 CA-Clipper
Creating a New Read Layer
lCenter : = SET(_SET_MCENTER)
IF lCenter = NIL
lCenter : = .F.
ENDIF
WHILE !snPos == 0
// Get next Get from list and post it
RETURN UPDATED()
7-24 CA-Clipper
The Reader Layer
Basic Guidelines
7-26 CA-Clipper
Creating New Reader Layers
• Handle all possible valid picture clauses for the data type
being handled.
// DateGetReader()
//
// Replacement for GETREADER(). Logic is identical,
// except DateGetApplyKey() processes keystrokes
PROCEDURE DateGetReader(oGet, ...)
RETURN
7-28 CA-Clipper
Creating New Reader Layers
Because this reader requires special handling for only two keys,
GE1 APPLYKEY() can handle most of the keystrokes. Thus,
DateGetApplyKey() intercepts the plus and minus keys and
implements special handling for them, passing control to
GETAPPLYKEY() for all other keystrokes. This is the
recommended way to add correct support for all the default
editing keystrokes:
// DateGetApplyKey()
//
// Replacement for GETAPPLYKEY()
// Performs incr/decr on a date get for '+' and '-'
// keys, standard behavior otherwise.
PROCEDURE DateGetApplyKey(oGet, nKey, ...)
LOCAL cKey := CHR(nKey)
DO CASE
CASE cKey == '+* .AND. oGet:type == 'D'
oGet:buffer := TRANSFORM(oGet:unTransform() ;
+ 1, oGet-.picture)
oGet:changed := .T.
oGet:display()
CASE cKey == .AND. oGet:type == 'D'
oGet:buffer := TRANSFORM(oGet:unTransform() ;
- 1, oGet:picture)
oGet:changed := .T.
oGet:display()
OTHERWISE
GETAPPLYKEY(oGet, nKey, ...)
ENDCASE
RETURN
To use this new reader, you must create a new command that
includes support for it. In particular, the key to getting
READMODAL() to call the new reader instead of the default
reader is to assign the new reader, as a code block, to the Get
object's reader instance variable. This is accomplished using the
SEND clause of the @...GET command. Notice that this
command is implemented in a way that adheres to the
guidelines, calling the default implementation of @...GET in its
definition:
// Translation rule for @...GET DATECHANGE
//
// Dateget.ch
// @...GET DATECHANGE
#command @ <row>, <col> GET <var> [<clauses, ...>];
DATECHANGE [<moreClauses, ...>];
#include "Dateget.ch"
PROCEDURE Main()
LOCAL dOne, dTwo
dOne := CTOD("3/17/65")
dTwo := CTOD("5/20/91")
CLS
@ 10, 10 GET dOne DATECHANGE
@ 11, 10 GET dTwo DATECHANGE
READ
RETURN
7-30 CA-Clipper
The Get Function Layer
7-32 CA-Clipper
Chapter 8
Introduction to the Menu System
In This Chapter
The CA-Clipper Menu system is a powerful tool that allows you
to create standard menus consisting of a menu bar with
pull-down menus and built-in mouse support. The system lets
you define all types of standard items, such as menu commands,
toggles, cascading menus, and separators. It also lets you define
standard features for menu items, such as shortcut and
accelerator keys, toggle and cascading menu indicators, and the
ability to disable an item.
• Menu terminology
• Menu properties
Note: This chapter assumes that you are familiar with the
concepts and terminology associated with CA-Clipper's
predefined classes as discussed in the "Basic Concepts" chapter
of this guide.
Menu Terminology
A menu is a user-interface element that presents a list of choices.
Menus usually appear in an application's menu bar, which
generally appears across the top of the screen.
Menu bar
- Menu commands
Menu separator
Pulldown menu
Cascading menu
8-2 CA-Clipper
Overview of Class Components
This example illustrates one way to design a menu, but there are
many other ways. For example, it is not necessary to have a
menu bar.
Class Functions
You create menu bars, menus, and menu items using functions
associated with each individual class. These functions, which are
discussed in more detail later in this chapter, are TopBar(),
PopUp(), and Menultem(). Each creates an object and sets up
some basic, required properties for the object by assigning
argument values to instance variables. For example, TopBar()
assigns values to TopBarMenu:row, TopBarMenuileft, and
TopBarMenu:right to define the location and width of the menu
bar. Menultem(), among other things, assigns a menu name or
code block to the Menultenr.data instance variable to determine
the action to take when the item is selected.
Instance Variables
Methods
Methods are also used to make the object perform actions. For
example, TopBarMenu:display() activates a menu bar by
showing it on the screen.
8-4 CA-Clipper
Relationships Between Menu Classes
TopBarMenu
TopBarMenu defines the menu bar, which controls the overall
menu. To create a top bar menu, you use its class function,
TopBar(). This function creates a completely generic menu bar
by defining the location of the menu bar (that is, its row and
starting and ending column positions).
For example, the following code creates a menu bar and stores it
in the variable oTopBar. When displayed, the menu bar will be
placed on the top row and take up almost the entire width of an
80-column screen:
// Create a menu bar at the very top of the screen
oTopBar := TopBar(0, 1, 7 8)
Menultem
Once the menu bar is established, the next step is to define a
menu item for it, which you do by first creating a Menultem
object then adding it to the menu bar. In this code, a menu bar
item named Exit is added that terminates the application. The
Menultem() class function and the TopBarMenu:addltem()
methods are used, which have been mentioned already.
oTopBarraddltem(Menultem("Exit", {|| ShutDown()}))
PopUpMenu
It is not typical, however, for an item on a menu bar to be
directly associated with an action as in this example. Instead,
menu bar items are usually associated with a pull-down menu.
The menu item is still added using the construction
TopBarMenu:addItem(MenuItem()), but you specify the name of
a PopUpMenu object instead of a code block.
Ctrl+N
C t P l + O
Ctrl+S
8-6 CA-Clipper
Relationships Between Menu Classes
Accelerator Keys
One of the things you may notice is that the name, or caption, of
the both menu items contains an & character ("&File" and
"&New"). The & causes the letter immediately following it in
the caption to become the accelerator key for the menu item.
Accelerator keys are accessed differently depending on whether
the menu item is defined as part of a menu bar or menu. For
menu bar items, you must press the letter in combination with
the Alt key (for example, Alt+F opens the File menu). For menu
items, simply press the letter itself (for example, once the File
menu is open, press Ν to select the New command). Thus, in
this example, pressing Alt+F, Ν would be a quick way to execute
the File New command.
When the user chooses the New command, the code block {I I
MyCreateFile()} is evaluated, resulting in execution of the
function, MyCreateFile().
Shortcut Keys
Note: No two menu items associated with the same menu bar
can have the same shortcut key. Also, since shortcut keys
perform an immediate action, they should be used cautiously.
For example, you would probably not want to assign a shortcut
key to a menu command whose end result is a destructive
database operation, such as pack or zap.
8-8 CA-Clipper
Menu Properties
Status Messages
Menu Properties
Earlier in this chapter, it was mentioned that the properties
associated with menu components are defined using instance
variables and that the various class functions provided a
mechanism for assigning initial values to certain instance
variables when you first create an object of that class. This was
illustrated in the previous section, although not explicitly, using
the Menultem() class function.
8-10 CA-Clipper
Menu Properties
// Add a separator
οPopUp:addltern(Menultem(MENU_SΕΡARATOR))
// Add Edit Go menu item, which will result in a
// cascading menu
oPopUpl := PopUp()
oPopUpl:colorSpec := "B/W,GR+/RB, R/W, G/RB, N+/W, W+/B"
oltem := Menultem("&Go", oPopUpl)
Note: You could turn this code into a function and simply
return oTopBar to the calling routine which would, in turn,
display and activate the entire menu system. This technique is
discussed later in this chapter under Activating the Menu and
illustrated in the sample program Menu.prg, located in your
CA-Clipper SOURCE \ SAMPLE directory.
Specifying Colors
8-12 CA-Clipper
Menu Properties
Menu Separators
The Menultem:caption instance variable has already been
discussed in this chapter. In particular, you have seen how it
defines the text associated with a menu item and how it can be
used to define the accelerator key for a menu item.
Toggles
Some menu items represent a flag, or toggle, that somehow
affects the behavior of the overall system. Options AutoSave is
such a menu item, determining whether changes being made by
the user are automatically saved periodically by the system.
IF lNew = = NIL
RETURN 1SetAutoSave
ELSEIF VALTYPE(lNew) == "L"
lOld := lSetAutoSave
lSetAutoSave := lNew
RETURN lOld
END IF
8-14 CA-Clipper
Menu Properties
Cascading Menus
A cascading menu, or submenu, is any menu selection that results
in the display of another menu. Submenus simplify the top-level
menus by limiting the number of items that are initially
displayed. This allows the user to see the most important
commands while browsing through the menus without being
distracted by the details of submenus.
The example code shown earlier did not give all the details that
are shown below:
// Add Edit Go menu item, which will result in a
// cascading menu
οPopUp1 := PopUp()
oPopUpl:colorSpec := "B/W,GR+/RB,R/W,G/RB,N+/W,W+/B"
oltem := Menultern("&Go", oPopUpl)
8-16 CA-Clipper
Activating the Menu
Note: Messages are defined for each menu item using the
Menultem:message instance variable.
8-18 CA-Clipper
Chapter 9
Error Handling Strategies
In This Chapter
Earlier versions of CA-Clipper responded to runtime errors by
passing control to one of six routines you could write in
CA-Clipper. Error creation, however, was still done by code
deep in the heart of CA-Clipper so that you could only respond
to a predefined set of errors. Your encounter with errors was
purely reactive and, while you could customize the reaction, you
could only do it globally. You could not install and remove error
handling code on the fly.
The first part of this chapter is intended to give you some insight
into theoretical error handling strategies without giving you any
specifics on how you would implement those strategies in
CA-Clipper. The idea is to give you an understanding of the
basic design of the error system before the implementation
details are discussed.
• Error objects
• A baseline strategy
• Network processing
9-2 CA-Clipper
Overview of Exception Handling Concepts
Software Element
Client
Contractor
Each module has specific rights and obligations. The client must
supply the contractor with the necessary input parameters, or
raw materials, in proper form and number. In return, the
contractor owes the client the results of operations. The
contractor can expect proper input, and the client can expect
proper output.
Error Scoping
Localization is the key to effective error processing. A module
with responsibility for some well-defined part of the
application's functionality should also take responsibility for
possible malfunctions. The contractor should process departures
from normal functionality. A "departure from normal" is called
an exception, because it is exceptional to expected behavior.
9-4 CA-Clipper
Overview of Exception Handling Concepts
What this does is localize the error handling to the place closest
to its raising. It frees clients from involvement with a
contractor's difficulties. Should the contractor successfully
recover, the client proceeds unaware that an incident occurred.
The author of the error handler is likely to intelligently interpret
the error and respond appropriately.
Raising Errors
9-6 CA-Clipper
Overview of Exception Handling Concepts
IF !(nSquare >= 0)
REACT
END IF
. <statements>
// Postcondition: at this point nRoot * nRoot
// had better yield nSquare
RETURN nRoot
Handling Errors
The location of this code within the source is less important than
its availability to the application at runtime. When
error-handling code is encountered during runtime, the main
code is abandoned as illustrated below:
Main Code
Exception Code
When the error-handling code gains control, there are only two
theoretical options: retry or terminate. Generally, retrying means
finding some way to proceed. This may amount to a simple,
brute force retry, but it is usually more elaborate, including
attempts to identify and remedy the cause of the error condition.
9-8 CA-Clipper
Overview of Exception Handling Concepts
9-10 CA-Clipper
CA-Clipper Exception Mechanisms
BEGIN SEQUENCE
. <statements>
END
. <statements>
END
f
ϊ
9-12 CA-Clipper
CA-Clipper Exception Mechanisms
FUNCTION U D F I Q
BEGIN SEQUENCE
BEGIN SEQUENCE
IF .NOT. A - O K
UDF2Q
BREAK
ENDIF
IF .NOT. A - O K
FUNCTION UDF2Q
BREAK
ENDIF
UDF1Q IF .NOT. A - O K
RECOVER USING
^ BREAK
ENDIF
END
RECOVER USING
RETURN NIL
END
RETURN NIL
END
BEGIN SEQUENCE
IF lProbleml
objError := ErrorNew()
<stuff objError>
BREAK obj Error
ENDIF
IF lProblem2
objError := ErrorNew()
<stuff objError>
9-14 CA-Clipper
CA-Clipper Exception Mechanisms
ENDCASE
END SEQUENCE
There are several special cases you should consider. An
application that does not use SEQUENCE constructs has DOS as
its implicit outer context. A BREAK anywhere in the application
leads to the DOS prompt. One with a single SEQUENCE
construct surrounding the initial main menu module has that
module as outer context, with any BREAK returning there like
RETURN TO MASTER. (Dot.prg in your CA-Clipper
SOURCE \ SAMPLE directory illustrates this case.)
9-16 CA-Clipper
CA-Clipper Exception Mechanisms
This line of code creates a code block that calls a function named
DefError() (also defined in Errorsys.prg) and calls
ERRORBLOCK() to install that block at runtime. Then, when
CA-Clipper raises any error, a call is issued to DefError(). If you
look at the source for DefError() (also defined in Errorsys.prg),
you can identify the code responsible for the error message. (The
parameter that is passed to DefError is an Error object, which
will be discussed later in this chapter.)
This technique is the basis for error block chaining. The installed
block's execution of its predecessor as its "final act" is equivalent
to terminating and passing control to the predecessor.
. <statements>
. <statements>
. <error-handling statements>
ELSE
RETURN EVAL(bMyAncestor, objError)
ENDIF
9-18 CA-Clipper
CA-Clipper Exception Mechanisms
With SEQUENCE and with error block, you can create two
parallel chains of command: a group of code blocks that EVAL()
one another in a chain; and a series of nested SEQUENCES that
BREAK from innermost to outermost. It is natural to ask about
the interrelationship. (See A Baseline Strategy later in this
chapter for more information.)
. <statements>
FUNCTION SomeSubsequentFunc()
BEGIN SEQUENCE
. <statements>
VAL(99)
// Error arises here
RECOVER USING e
. <recovery code>
END SEQUENCE
RETURN NIL
There are several directions for the error block to go when called.
• It can QUIT.
9-20 CA-Clipper
Error Objects
Error Objects
Once you understand the mechanics of invoking error code, you
must decide how to use it. That decision depends on the error's
characteristics, and the vehicle for characterizing it is the Error
object.
When your error handler gains control, it has the Error object on
which to base a particular response. Typically, it uses a CASE
statement. The CASE conditions are based on information about
the error conveyed in the instance variables. This is called
specialization of error handling, and it is the means by which an
Error object is passed among error handlers.
9-22 CA-Clipper
Error Objects
A Model Example
FUNCTION VAL(p)
LOCAL objVErr
ENDIF
<the string-to-numeric conversion code>
9-24 CA-Clipper
Error Objects
. <statements>
IF objMyErr:canSubstitute
RETURN "Wacky Wacky"
ENDIF
. <statements>
. <body of operation>
ENDIF
ELSE
lRetry := .F. / / N o violation, no retry
ENDIF
. continuation code>
ENDDO
9-26 CA-Clipper
Error Objects
If ErrorxanRetry is true (.T.), the error block can seek to retry the
original code. On the other hand, the error code may go through
a few motions, perhaps altering the original error condition, then
return its request for another try.
When it tries the second time, the code encounters the error
condition once again. This time, instead of creating a new Error
object, it increments the tries instance variable of the existing one
and raises the error again. This can happen any number of
times. The error block can test for a specified limit and return
false (.F.) in order to invoke plan B.
A Baseline Strategy
A hallmark of CA-Clipper's error mechanisms is versatility. The
mechanisms are generalized, so you can adapt them to emulate
various approaches to error handling. Typically, CA-Clipper
does not provide a particular approach. Instead, it provides
tools to implement an approach of your choosing. Therefore, for
code integrity, you should adopt certain conventions. Here are
some suggestions:
Retain the initial, special case code for zero division and
network processing that appears in CA-Clipper's DefError().
During programming, the standard DefError() may be
desirable, but a user in the middle of a completed
application, is less appreciative of cryptic error messages on
a DOS screen.
9-28 CA-Clipper
A Baseline Strategy
A Comprehensive Example
The following application is a bare-bones demonstration of the
error handling principles described in this chapter. The example
is not all-inclusive but shows how control flows among the error
handlers. The error handlers are, essentially, empty (for
example, the outermost RECOVER clause does not contain
"graceful" QUIT code).
9-30 CA-Clipper
A Baseline Strategy
9-32 CA-Clipper
A Baseline Strategy
9-34 CA-Clipper
A Baseline Strategy
Now, the Divide() function is shown both ways, but in this case
the first, which uses a SEQUENCE construct to handle the error,
is preferable:
FUNCTION Divide(x, divisor)
LOCAL retval
BEGIN SEQUENCE
retval := x/divisor
RECOVER USING --
retval := 0
END
RETURN retval
// Alternative, if division by zero was not
// considered an error
FUNCTION Divide(x, divisor)
LOCAL retval
IF divisor != 0
retval := x/divisor
ELSE
retval := 0
ENDIF
RETURN retval
. <do 5th>
RECOVER USING--
IF HaveAnotherGo
// Restarts SEQUENCE block as a whole
RESTART SEQUENCE
ENDIF
END SEQUENCE
EXIT
ENDDO
9-36 CA-Clipper
Network Processing
Network Processing
The CA-Clipper function NETERR() functions differently from
earlier versions of CA-Clipper. Two events that in version
Summer '87 automatically set NETERR() to true (.T.), no longer
do so. They are failure of a USE command due to an "access
denied" from the underlying DOS file open call and failure of
APPEND BLANK due to the "phantom" record being locked by
another workstation, perhaps by simultaneous APPEND BLANK
attempts. (The phantom record is just beyond the last record.)
e:canDefault)
NETERR(.Τ.)
RETURN .F.
ENDIF
// For lock error during APPEND BLANK, set NETERR()
// and subsystem default
IF (e:genCode = = EG_APPENDL0CK .AND. e:canDefault)
NETERR(.Τ.)
RETURN .F.
ENDIF
9-38 CA-Clipper
Network Processing
Note that there is separate recovery for the startup code and for
the multiple-delete code. If an error arises in either context,
execution of the localized RECOVER code is due to the same
error block, which eventually BREAKs. Once posted, the error
block does not "belong" to the routine that posted it but to all
routines that execute it while it remains installed:
// Transact.prg
//
// Compile with /N/W/A
// Must be linked with Locks.obj to run
#include "Error.ch"
PROCEDURE Main()
LOCAL aDels, cName, aNots, objErr, cMsg
FIELD LastName
// Artificial but prototypical
ERRORBLOCK({|e| BREAK(e)})
// Open files, set relation
IF .NOT. GetReadyO
? "No, I don't feel like it."
QUIT
ENDIF
9-40 CA-Clipper
Network Processing
9-42 CA-Clipper
Chapter 10
CA-Clipper Compiler—
CLIPPER.EXE
In This Chapter
This chapter describes the basic operations of CLIPPER.EXE, the
full-featured and versatile CA-Clipper compiler. It can be used
to compile a single program file (.prg) or to compile several files
at once by taking its input from a script file. The result is an
object file (.OBJ) that can be linked with other
CA-Clipper-compiled and foreign object files to form an
executable file (.EXE).
• Using CLIPPERCMD
• Compiler options
• Header files
• Output files
10-2 CA-Clipper
Using CLIPPERCMD
Using CUPPERCMD
In addition to specifying options on the compiler command line,
you can specify them using the CLIPPERCMD environment
variable. To define CLIPPERCMD, use the DOS SET command
as follows:
SET OTiTPPERCMD= [<option list>]
<option list> is a list of one or more options that will be read and
processed each time the compiler is invoked. You specify these
options just as you would on the compiler command line.
Compiler Options
Compiler options are switches that control compilation behavior.
Besides the preprocessor directives and the standard header file,
compiler options are the main mechanism for controlling the
compiler and preprocessor.
Using the / B option causes the size of the resulting object file to
increase. The amount of the size increase depends on the
number of lines in the source code file as well as the number of
local and static symbols defined. The number of additional bytes
is approximately (4 + 3 per line + size of each static and local
symbol + size of source filename symbol). Note that each
symbol size includes a null terminator byte (for example, the
symbol Cust_Name requires 10 bytes) and that the 3 bytes per
line figured into this size increase is eliminated by the use of the
/ L option.
10-4 CA-Clipper
Compiler Options
/D /D<identifier>[=<text>]
/ES /ES[<severityLevel>]
/I /l<pathName>
The first procedure to execute when you invoke an .EXE file, also
referred to as the starting procedure, is the first procedure or
function encountered at link time. When you compile without
the / N option, the implicit procedure serves as the startup
procedure. When you compile with the / N option, the first
explicitly declared procedure or function in the first object file
listed at link time becomes the startup procedure.
Compiler Options
/Ο /0<objFile>
/R /R[</«?F//<?>]
/S If specified, the syntax of the current (.prg) file and all referenced
source code files is checked, but no object file is generated. To
check the syntax of the current program file only, use the / M
option in conjunction with / S .
/T /T<pathName>
You can test the DOS return code in a batch file using the DOS
ERRORLEVEL keyword. A good example of this can be found
in the file CL.BAT located in your CA-Clipper BIN directory
(this batch file is discussed more thoroughly in The Compile and
Link Batch File later in this chapter.)
10-10 CA-Clipper
How the CA-Clipper Preprocessor Works
Directive Meaning
10-12 CA-Clipper
The Compile and Link Batch File
Header Files
Header files, also referred to as include files, contain preprocessor
directives and command definitions. Header files have no
default extension and are specified using the #include
preprocessor directive or the / U compiler option. The
INCLUDE environment variable is used to locate header files
and is defined using the DOS SET command as follows:
SET INCLUDE=<pathSpec>
10-14 CA-Clipper
Output Files
Output Files
There are three types of output files produced by the CA-Clipper
compiler: object files, preprocessed output files, and temporary
files. Any specified output filename can include a full or partial
path name to explicitly indicate where CA-Clipper will write the
file on disk. Unless otherwise specified, files are created in the
current directory.
Object Files
Temporary Files
Normally, CA-Clipper generates one or more temporary files
during the compilation process. You can control where these
files are created by setting up an environment variable called
TMP with the DOS SET command as follows:
SET TMP=<pathName>
For example, if you are working on the C: drive, you could put
temporary files in a directory on another disk drive as follows:
SET TMP=D:\TEMP
10-16 CA-Clipper
Chapter 11
CA-Clipper Protected Mode
Lin ker—EXOSPACE. EXE
In This Chapter
Welcome to CA-Clipper/Exospace, the protected mode linker
and DOS extender for CA-Clipper. This chapter provides all the
information you need to link your applications with
CA-Clipper/Exospace and explains the benefits of doing so. The
following topics are discussed:
• Overview of CA-Clipper/Exospace
• Invoking CA-Clipper/Exospace
• Output files
Overview of CA-Clipper/Exospace
CA-Clipper/Exospace allows your CA-Clipper applications to
run in protected mode, thereby eliminating the DOS 640 KB
barrier. In protected mode, extended memory is directly
available without requiring swapping of any kind. This in itself
would be exciting enough, but it also has a number of other
important implications.
11-2 CA-Clipper
Overview of CA-Clipper/Exospace
What About 386 and Applications running on 386 and 486 machines also benefit, of
486 Machines? course. Instead of continually having to swap data from EMS
or having to load overlaid code from disk, applications can now
use all of a machine's memory directly. Swapping only occurs
when all available memory is exhausted, instead of when the
first 640 KB is full. In effect, CA-Clipper/Exospace raises the
640 KB RAM ceiling to include all available memory. This will
benefit almost any application on any supported machine.
Protected Mode = Protected mode, as its name implies, provides a greater level of
Protected Code! protection to your applications. C or Assembler code that has
not yet been fully debugged, whether it is in a third-party
library or your own, will usually generate an exception error,
detected directly by the CPU, as soon as it does something
wrong, rather than corrupting memory and leading to
mysterious and difficult-to-trace problems later on. This makes
it easier to find the source of the problem, and if a third-party
library is the source of a problem, it will usually be clear which
library is at fault.
Invoking CA-Clipper/Exospace
To execute CA-Clipper/Exospace from DOS, use the following
syntax:
EXOSPACE [@<lnkFile>] [<command list>]
Script Files <lnkFile> is the name of an ASCII text file called a script file from
which the linker takes some or all of its input. If you specify the
file without an extension, .LNK is assumed.
You can use script files to automate linker sessions that you tend
to repeat and sessions that are too long to enter from the
command line—the DOS command line limit of 128 characters
may be too restrictive for some linker sessions, necessitating the
use of a script file.
You can nest script files using the @<lnkFile> syntax within a
script file. The named script file is read and executed by
CA-Clipper/Exospace in its entirety. When it terminates, control
returns to the current script file.
11-4 CA-Clipper
Invoking CA-Clipper/Exospace
The next example links the DBU utility, assuming you are
located in the \CLIP53\SOURCE \ DBU directory. The result is
DBU.EXE:
EXOSPACE @DBU
What EXOSPACE.EXE While CA-Clipper/Exospace links your application for you, its
Does primary function is not that of a linker. The most important
tasks CA-Clipper/Exospace performs are invisible and occur
before and after linking:
11-6 CA-Clipper
The CA-Clipper/Exospace Return Code
Output Files
There are several types of files produced as output by
CA-Clipper/Exospace. This section describes each type
separately.
11-8 CA-Clipper
Output Files
Temporary Files
The linker deletes temporary files after they have served their
purpose. Therefore, you may never see them on your disk.
You can use the TMP variable to write the temporary files to
another disk drive if you are running short of space on the drive
that you normally use to link. To speed up the linking process
you can also set TMP to write temporary files on a RAM disk.
This way, the temporary files will not take up disk space that is
better used by permanent files. For example:
SET TMP=D:\TEMP
11-10 CA-Clipper
How CA-Clipper/Exospace Searches for Files
You can abbreviate any linker command to just a few letters. For
example, FILE becomes Fl and LIBRARY become LIB (or just LI).
Abbreviations are not documented for each command, but as a
general rule you must use enough letters to distinguish one
command from another and should include enough letters so
that the option is readable.
11-12 CA-Clipper
Linker Command Reference
.RTLink Compatibility
Blinker Compatibility
11-14 CA-Clipper
Linker Command Reference
Description If you are using CA-Clipper 5.01 or 5.01a, you must include this
command when linking with CA-Clipper/Exospace. Otherwise,
CA-Clipper/Exospace assumes that you are linking an
application created with a later version of the CA-Clipper
compiler.
Examples This example causes the application being linked to read its
runtime configuration information from an environment variable
named MYAPP:
# Use the environment variable MYAPP
# instead of CLIPPER
EXOSPACE ENVIRONMENT CLIPPER MYAPP
11-16 CA-Clipper
Linker Command Reference
Setting Meaning
11-18 CA-Clipper
Linker Command Reference
Examples This example sets the number of file handles to 40 and prevents
the use of E G A / V G A extended cursor capability:
EXOSPACE EXECUTABLE CLIPPER //F:40 //CGACURS
11-20 CA-Clipper
Linker Command Reference
EXOSPACE PACKAGE
Package Description
Notes Disabling VM. You can also use the EXOSPACE PACKAGE
command to prevent the default Virtual Memory (VM) package
from being included. Normally, the VM package is
automatically included in an CA-Clipper/Exospace application.
This ensures that CA-Clipper/Exospace applications can run on
a wide variety of target machines, even those that do not have
enough physical RAM—in such cases, the VM system will
automatically swap data to disk as necessary.
Examples This example includes the video BIOS package and excludes the
VM package:
# Include video BIOS package and exclude VM package
EXOSPACE PACKAGE INT10, NOVM
11-22 CA-Clipper
Linker Command Reference
Description This command has the same effect as the STACK command, but
conveniently allows you to set the stack size in terms of
procedure depth rather than number of bytes. To set the stack
size to a specified number of bytes, use the STACK command
instead.
FILE
Description If you specify more than one FILE command in the same linker
session, either on the CA-Clipper/Exospace command line or
within one or more script files, each <objFile list> is added to the
previous one, causing all files in all FILE lists to be linked.
Examples This example links three object files to create an executable file
named MAINMENU.EXE:
FILE MAINMENU, INVOICE, REPORTS
The next example links the same three object files and the
CA-Clipper debugger library, CLD.LIB, to create an executable
file named MAINMENU.EXE that has access to the debugger:
FILE MAINMENU, INVOICE, REPORTS, CLD.LIB
11-24 CA-Clipper
Linker Command Reference
LIBRARY
Examples This example specifies that the application being linked needs
access to three libraries: PWFUNCS.LIB, CLASSY.LIB, and
PWKERNEL.LIB:
LIBRARY PWFUNCS, CLASSY, PWKERNEL
MAP
Arguments <mapFile> is the name of the file to generate. If you specify the
file without an extension, .MAP is assumed.
Option Reports
On the other hand, you could specify the map filename as part of
the MAP option. In this example, the file will be called
MYMAP.MAP:
EXOSPACE FILE TESTl, TEST2 MAP=MYMAP S, Ν
11-26 CA-Clipper
Linker Command Reference
MODULE...FROM
Purpose Search for the named module in the specified library only
Examples This example forces the linker to link the OrdEntry module from
MYOLDLIB.LIB, even though it may be defined in other libraries
being linked:
MODULE OrdEntry FROM MYOLDLIB
NODEFLIB
Notes
• Renaming EXOSPACE.LIB: Do not rename the
CA-Clipper/Exospace library, EXOSPACE.LIB.
CA-Clipper/Exospace requires that the library have this
name and will not operate correctly if it is renamed.
11-28 CA-Clipper
Linker Command Reference
OUTPUT
<exeFile> The name of the executable file (.EXE) to generate. If you do not
specify an OUTPUT file, the name of the first filename (either
script or object) encountered on the CA-Clipper/Exospace
command line is used, but with an .EXE extension—you cannot
override this default extension.
STACK
Description The stack size determines how deep the procedure call stack can
be. In most cases, it is more convenient to use the EXOSPACE
PROCEDURE DEPTH command instead, but the STACK
command provides more accurate control over the size of the
stack.
Π-30 CA-Clipper
Troubleshooting
Troubleshooting
This section suggests ways to resolve certain problems that can
occur when you execute your CA-Clipper/Exospace application,
such as:
Not α DOS/16M If you get the message "not a D O S / 1 6 M executable/' your copy
Executable of the application may be corrupted. This indicates that a virus
may exist on your system. Use a virus scanning program to
determine if there is a virus on your system; if there are no
viruses, try relinking the application.
If the application does not run on any machine you have, try
loading the program under the CA-Clipper debugger and
looking at the code that executes prior to when the system hangs.
This may give you an indication of the cause or source of the
problem.
When you call us, we may also ask you to try reproducing the
problem in a small test case.
Running PMINFO If PMINFO runs on your machine, you can usually rule out most
hardware or BIOS incompatibilities and conflicts with other
software that uses extended memory. PMINFO is a small,
simple program, so your problem could be one that only occurs
when a program uses a lot of memory or attempts something
fairly complicated.
11-34 CA-Clipper
Troubleshooting
Software Compatibility
11-36 CA-Clipper
Troubleshooting
A20 Problems If the fifth digit of the address displayed in the GPF error
message, when your machine abnormally terminates, is an odd
number (for example, from 0x10000 to OxlFFFF, or from 0x30000
to 0x3FFFF), you may be running software that requires rigorous
management of the A20 line. Try setting the A20 option in the
DOS16M environment variable:
SET DOS16M= A2 0
Memory Shortage
If you encounter a "not enough memory" error when you
attempt to execute your application, run PMINFO to determine
how much memory is available for CA-Clipper/Exospace
applications.
11-38 CA-Clipper
Troubleshooting
Bad Memory
If you have a program that runs well under DOS but abnormally
terminates when it runs under a DPMI host, such as Windows
3.1 in enhanced mode or a Virtual DOS Machine under O S / 2 2.0,
check for the following problems:
11-40 CA-Clipper
Troubleshooting
• Execute the library in real mode. You can either link the
library as a separate program and communicate with
interrupts, or you can use other special functions from the
CA-Clipper/Exospace library for managing memory and
performing inter-mode calls.
• P C / A T compatibility
• Extended memory
• DOS versions
PC/AT Compatibility
Because the 80286 does not have a direct way to switch from
protected mode to real mode, CA-Clipper/Exospace forces the
switch by requesting a reset (much like power on or rebooting).
When it receives the reset, your ROM BIOS startup code must be
able to distinguish a restart from a power up, in order to return
to the CA-Clipper/Exospace kernel.
The 80386 and 80486 processors have a direct way to switch from
protected mode to real mode, If you have an 80386 or 80486, you
will not encounter this problem.
11-42 CA-Clipper
Troubleshooting
Extended Memory
11-44 CA-Clipper
Troubleshooting
EMM386 MS-DOS 5 or
MS-Windows 3.1
and later
2. A DPMI host
3. A VCPI host
If CA-Clipper/Exospace finds a VCPI host, it follows the
VCPI protocol. It also searches for an XMS driver.
4. An XMS driver
11-46 CA-Clipper
Troubleshooting
DOS Versions
DOS 3.x to 4.x CA-Clipper/Exospace runs with DOS Version 4.0, but it does not
work with XMAEM.SYS, which supports no extended memory
protocol.
DOS 5.0 and 6.0 CA-Clipper/Exospace runs under DOS Version 5.0 and 6.0.
These DOS versions allow you to put most of the DOS code in
the high memory area (HMA), the 64 KB above 1 MB, saving
about 50 KB of conventional memory. They also allow you to
put TSRs and device drivers in the upper memory area, between
640 KB and 1 MB, with the LOADHIGH and DEVICEHIGH
commands.
To use the features offered in DOS 5.0 or 6.0, however, you must
also use a memory manager. These DOS versions come with
EMM386, which is a VCPI host, and with HIMEM.SYS, an XMS
memory manager upon which EMM386 depends. You can use
QEMM or 386MAX instead of EMM386.
DOS 5.0 Task Switcher If you use EMM386 and HIMEM.SYS, you should be able to run
multiple CA-Clipper/Exospace applications under the DOS 5
task switcher, DOSSHELL, without any problems.
• With 386MAX, set the EMS or the EXT option to indicate the
amount of EMS memory that the memory manager will
control
11-48 CA-Clipper
Troubleshooting
• HW_TIMER
In order to get an accurate reading for PMINFO, turn the
timer ON.
4. When the settings box opens, select Session from the tabbed
options at the right.
In This Chapter
Welcome to Blinker, the real mode linker for CA-Clipper. This
chapter provides all the information you need to link your
applications with Blinker, and explains the benefits of doing so.
The following topics are discussed:
• Overview of Blinker
• Upgrade offer
Overview of Blinker
CA-Clipper 5.3 contains a limited version of the full Blinker
product produced by Blinkmc. This real mode CA-Clipper 5.3
version of Blinker features:
Support for the Support for the CA-Clipper paging system to optimize memory
Paging System usage and improve runtime performance.
Support for "burned Support for "burned in" CLIPPER environment variables in the
in" CLIPPER .EXE for ease of configuration and distribution. Once a
Environment CLIPPER environment variable has been "burned" into the
Variables .EXE, it cannot be inadvertently overridden by a change of the
CLIPPER environment variable on the runtime machine.
12-2 CA-Clipper
Upgrade Offer
Upgrade Offer
Blinkmc is making an exclusive offer to CA-Clipper 5.3
customers to upgrade to the full version of Blinker. Please see
the file entitled BLINKER.TXT in the directory in which
CA-Clipper is installed for details and pricing information.
# (comment)
Syntax #...
Description Any line in the script file beginning with the character # is
treated as a comment and is ignored by Blinker. If the #
character occurs within a line, the rest of the line is ignored.
12-4 CA-Clipper
Blinker Command Reference
/ / (comment)
Syntax //...
Description Any line in the script file beginning with the characters / / is
treated as a comment and is ignored by Blinker. If the / /
characters occur within a line, the rest of the line is ignored.
@ (nested script)
Syntax @<scriptname>
BEGINAREA
Syntax BEGINAREA
For most compilers other than CA-Clipper the .OBJ files listed
between a BEGINAREA and ENDAREA are managed at runtime
on a segment basis, i.e., the whole CODE segment for each .OBJ
is loaded into memory whenever any function or procedure
within that .OBJ file is called. The CA-Clipper 5.3 dynamic
paging system automatically breaks procedures down into IK
pages for improved execution speed., so this is not a concern for
CA-Clipper code.
12-6 CA-Clipper
Blinker Command Reference
Description The default for BLINKER CACHE EMS is 100 for <nuMax[%]>.
This command specifies the amount of EMS (LIM version 4.0
and higher) memory to be used for the overlay cache.
Blinker will never allocate a cache that is larger than the total
size of all the overlays contained within the program.
Examples This example defines the maximum size of the EMS cache as
being 50% of available EMS while leaving a minimum of at least
1024KB available for the program:
# use a maximum of 50% of available EMS,
# but leave at least 1024KB available
BLINKER CACHE EMS 50%, 1024
Description The default for BLINKER CACHE XMS is 100 for <nuMax[%]>.
This command specifies the amount of XMS (version 2.0 and
higher) memory to be used for the overlay cache.
Blinker will never allocate a cache that is larger than the total
size of all the overlays contained within the program.
Examples This example defines the maximum size of the XMS cache as
being 50% of available XMS while leaving a minimum of at least
1024KB available for the program:
# use a maximum of 50% of available XMS,
# but leave at least 1024KB available
# BLINKER CACHE XMS 50%, 1024
12-8 CA-Clipper
Blinker Command Reference
Description This command allows the developer to change the name of the
CLIPPER environment variable from the default setting of
"CLIPPER" to any string of up to 16 characters, and thus avoid
the remote site settings for the CLIPPER environment variable.
Even though the following statement may already have been set
from DOS:
SET CLIPPER=F21
Arguments <cName> is the name of the environment variable for Blinker run
time options.
12-10 CA-Clipper
Blinker Command Reference
Description This command is used to burn default values for the CA-Clipper
runtime environment variables into the executable file. Those
settings set using the BLINKER EXECUTABLE CLIPPER
command take precedence over those set with the SET CLIPPER
command. Parameters not specified with the BLINKER
EXECUTABLE CLIPPER command will retain values originally
assigned by the SET CLIPPER command. However, if you want
the values in the SET CLIPPER command to take precedence, use
the command BLINKER ENVIRONMENT OVERRIDE.
12-12 CA-Clipper
Blinker Command Reference
This would cause CA-Clipper to create the VMM swap file in the
root of drive D, Remember that for the application to be able to
use 41 file handles, corresponding values have to be set in the
CONFIG.SYS, and, if necessary, in the appropriate network
configuration.
Description By default, Blinker will not create an .EXE if errors occur. This
command allows you to override that behavior, although the
resulting .EXE is not guaranteed to operate correctly. This can be
useful during the development cycle, when not all routines have
been defined.
12-14 CA-Clipper
Blinker Command Reference
Examples This example disables the pageframe due to a conflict with a disk
cache:
# disable pageframe due to conflict
# with a disk cache
BLINKER LINK PAGEFRAME OFF
12-16 CA-Clipper
Blinker Command Reference
Description This command is used to enable the winking of only one eye
while Blinker is running. If no parameter is entered, the right
eye will wink (from Blinker's point of view, i.e., from inside the
screen looking out). The parameter LEFT causes the left eye to
wink.
12-18 CA-Clipper
Blinker Command Reference
Description If the size of the overlay pool is not specified, the default size is
40KB. This command is used to set the operating size of the
overlay pool at run time in KB. It can be set to any value
between 12KB and 128KB. The default operating size is 40KB.
This may be made smaller to save memory or larger to reduce
the number of disk accesses made by the overlay manager to
re-load overlaid procedures. When overlays are specified in the
link script file, Blinker will determine the size of the smallest
possible overlay pool by adding approximately 8KB to the size of
the largest overlay unit (a segment for most compilers). This
minimum value will be displayed along with the value specified
in the BLINKER OVERLAY OPSIZE command. If the minimum
value is greater than the value specified, the minimum value will
override the value specified. The overlay opsize may be
adjusted at runtime through the use of the BLINKER
environment variable. See the Environment Variable section in
this chapter.
Examples This example requests the size of the overlay pool to be increased
to 60Kb:
# increase the overlay pool size to 60Kb
BLINKER OVERLAY OPSIZE 60
Description Warning! Please read this section fully before using this
command.
If both this command and the UMB command are used, and both
the pageframe and a UMB are available, Blinker will use the
pageframe in preference. If either or both of these are specified
and are not available on the end user's system, Blinker will
automatically ignore these commands and allocate the overlay
area from conventional memory.
12-20 CA-Clipper
Blinker Command Reference
Examples This example enables the use of EMS pageframe for overlays:
# use the EMS pageframe
BLINKER OVERLAY PAGEFRAME ON
Description If the size of the smallest overlaid segment is not set, the default
size is 32 bytes. This command sets the threshold size below
which code specified to be overlaid will be moved back to the
root section of the program. Very small routines (less than 32
bytes) take up more root space when they are overlaid, due to
overlay manager table entries, than they would if they were
simply left in the root. Additionally, very small overlaid
routines execute disproportionately slower, since the time
overhead in loading/calling them may be large in comparison
with the actual execution time of the routine. If it is the case that
very small routines are very frequently called, the developer
may wish to specify a threshold large enough to cause them to be
moved back to the root, improving the performance of the
program.
12-22 CA-Clipper
Blinker Command Reference
DEFINE
Description The DEFINE command is used to ''stub out" the named symbols
and point them to a dummy routine in the overlay manager.
Instead of including the modules containing the named symbols
in the final .EXE file, Blinker maps each DEFINEd symbol to a
routine within the overlay manager which will display the
runtime error 1213 if the routine is ever called. This command
can be used (with care) to prevent routines which you know will
never be called from being linked in.
12-24 CA-Clipper
Blinker Command Reference
DEFLIB
Syntax DEFLIB
ECHO
ENDAREA
Syntax ENDAREA
Description The ENDAREA command is used to specify to the linker the end
of an overlay area, as described in the BEGINAREA section.
EXTDICTIONARY
Syntax EXTDICTIONARY
12-26 CA-Clipper
Blinker Command Reference
FILE
Description The FILE command is used to specify to the linker the names of
one or more .OBJ files to be included in the output file at that
point. The default file extension of .OBJ need not be specified.
The first file specified must be the program's main module.
Blinker looks for each file first in the current directory and then
in each directory path specified in the OBJ environment variable
in the order they appear. Alternatively, a full drive and
directory path may be specified with any or each of the file
names.
The FILE command can be used on a library file to force all the
modules within the library to be included in the .EXE. In this
case the .LIB extension and full path will probably need to be
specified, e.g. FILE path\CLD.LIB. Please use this method with
caution.
LIBRARY
The LIBRARY command may be used for both root and overlaid
libraries. If the library is to be overlaid, the LIBRARY command
should be placed within a BEGINAREA / ENDAREA sequence.
12-28 CA-Clipper
Blinker Command Reference
MAP
Arguments <filename> is the name of the MAP file of the executable that is
required.
MIXCASE
Syntax MIXCASE
MODULE
12-30 CA-Clipper
Blinker Command Reference
MURPHY
Syntax MURPHY
Note: The use of the MURPHY command may slow down the
execution of the program significantly.
NOBELL
Syntax NOBELL
12-32 CA-Clipper
Blinker Command Reference
NODEFLIB
Syntax NODEFLIB
NOEXTDICTIONARY
Syntax NOEXTDICTIONARY
Description This command specifies that Blinker should ignore the extended
dictionary which is appended to library files by some librarian
utility programs. The extended dictionary is a cross reference of
the library contents, and is used by Blinker to speed up the
processing of libraries. If use of the extended dictionary is
disabled using this command, Blinker will process the library
slightly lower. Some librarians have been known to create
invalid extended dictionaries, which can lead to erratic results at
link time—this command will ensure that such libraries will be
processed correctly. This command applies globally to all
libraries processed during the link and is disabled by default.
NOTABLEOFCONTENTS
Syntax NOTABLEOFCONTENTS
OUTPUT
Description The OUTPUT command is used to specify to the linker the drive,
path and filename of the output executable file to be created by
the linker. If no OUTPUT command is used then the linker will
use the name and path of the first object file appearing on a FILE
command in the script file (or on the command line). The
OUTPUT file name extension does not have to be .EXE, but if no
file extension is specified, a default of .EXE is used.
12-34 CA-Clipper
Blinker Command Reference
READONLY
Purpose Specify that the executable file will be set to read-only status.
Syntax READONLY
SEARCH
SECTION INTO
[, [d:][path]</'ilename>...] ]
12-36 CA-Clipper
Blinker Command Reference
STACK
UPPERCASE
Syntax UPPERCASE
VERBOSE
Syntax VERBOSE [ 0 1 1 1 2 ]
12-38 CA-Clipper
Blinker Command Reference
WORKFILE
Purpose Specify drive, path, and file name of the temporary WORKFILE
Examples This example specifies drive, path, and file name of the
temporary work file "Temp":
WORKFILE C:\TEMP\Temp
BLIVERNUM
12-40 CA-Clipper
Chapter 13
CA-Clipper Debugger—CLD.LIB
In This Chapter
Once you have finished writing a program, you must test it to
make sure there are no errors. The compiler and linker will spot
some errors that you can correct without having to actually
execute the program, but it is not at all unusual for a program to
contain errors which you can detect only while the program is
running. Examples of this type of error are runtime and
execution errors, cosmetic and other display errors, and logic
errors. It is with this type of error that a debugger comes in
handy.
As its name suggests, a debugger tool helps you track down and
remove errors from your source code. CA-Clipper's DOS-level
debugger (referred to more simply as the debugger throughout
this chapter) is a source code debugger which means that it
allows you to view your source code while your program is
running. You use the debugger to execute your application so
that you can switch back and forth between running the program
and viewing the source code to spot potential problem areas.
13-2 CA-Clipper
In This Chapter
• Debugging a program
Programming Considerations
Multistatement Lines CA-Clipper allows you to place more than one program
statement on a single line. For example:
nNewPage := (nLineNo > 55); ReportPage(nNewPage)
13-4 CA-Clipper
Starting the Debugger
This makes debugging easier and also makes the code more
readable.
Header Files Header files are files that are referenced using the #include
preprocessor directive. They typically contain manifest constant
and pseudofunction definitions. The debugger does not
automatically display header files in the Code window, but you
can view them with the File Open command.
Code Blocks A code block contains executable program code that is treated by
CA-Clipper as data and can be passed as a parameter to other
programs. Inspecting a code block in the debugger reveals only
its name, not the actual code.
If, however, you use a (.clp) file or compile each program in your
application separately, you must specify that debugging
information be included for each file every time you invoke the
compiler. During the debugging session, any subsidiary
programs which have been compiled without this option are
ignored.
In addition, you must compile without the / L option or, from the
Workbench, uncheck Suppress Line Number in Obj in the
Compiler Options dialog box. Effective debugging is not
possible without line numbers in the .OBJ file.
13-6 CA-Clipper
Starting the Debugger
From DOS
To invoke the debugger from the DOS prompt for real mode
applications, use the following syntax:
CLDR [[/43 I /50 | /S /D] [®<scriptFile>]
<exeFile> [<argument list>]]
/D specifies that the debugger screen will have focus and the
application will be suspended, ready to execute the first line of
code.
13-8 CA-Clipper
Starting the Debugger
Note that with the exception of the argument list, all other CLDR
arguments must come before the executable filename on the
command line.
Note: Real mode applications can also use the linked debugger.
Instead of using CLD.LIB, the protected mode debug library, use
CLDR.LIB for real mode debugging.
Note: The screen mode switches are mutually exclusive, the last
of one or more will predominate.
13-10 CA-Clipper
Starting the Debugger
From Windows
You can also invoke CLD from within the Workbench. To do so,
simply compile your application with debugging information by
checking the Debug Information option on the Compiler Options
dialog box. You must also include CLD.LIB in the Additional
Object Files edit control of the Linker Options dialog box. Once
your application is successfully built, simply run the application.
This creates a DOS window with CLD active. You can then
activate the debugger using Alt+D or ALTDQ, as discussed
below.
You can also use Alt+D when the debugger is invoked with the
CLD command line. When executing the application in run
mode, simply press Alt+D at any time to terminate the
application and return control to the debugger. Run mode is one
of the many execution modes that is available to you when you
debug an application using the debugger. For more information
on modes of execution, see Debugging a Program later in this
chapter.
Using ALTD()
For applications that are linked with CLD.LIB, you can use
ALTD() to prevent the user from inadvertently invoking the
debugger. By including code similar to the following at the
beginning of the main program, the ability to invoke the
debugger is controlled by the presence of a command line
parameter:
PARAMETERS dBug
IF dBug != NIL
ALTD(l) // Invoke debugger with ALTD() or Alt+D
ELSE
ALTD(0) // Debugger cannot be invoked
ENDIF
13-12 CA-Clipper
Starting the Debugger
Depending on the context of the file open request, the default file
extension supplied by the debugger varies. For example, when
the request is for a script file the debugger assumes a (.eld)
extension and for a preprocessed output file the default
extension is (.ppo). Default file extensions are supplied only
when you do not specify an explicit file extension.
For example, the following script file sets a breakpoint at the first
call to the function ViewData(), designates the variables
IMadeChanges and ISaveChanges as watchpoints, and specifies
nFieldNum and nFileArea as tracepoints:
BP ViewData
Point Watchpoint IMadeChanges
Point Watchpoint ISaveChanges
Point Tracepoint nFieldNum
Point Tracepoint nFileArea
13-14 CA-Clipper
Starting the Debugger
When the debugger is active, you can execute a script file with
the Options Restore command as in the following example:
Options Restore MyScript
You can also execute a script file from the debugger command
line as in the following example:
CLD @MyScript MainProg
Getting Help
You can activate the Help window three ways. The first is by
using the Help command. The second is by clicking Fl-Help on
the function key line at the bottom of the screen. The third is by
simply pressing F l .
When you have finished your debugging session, enter the File
Exit command or simply press Alt+X. The debugger
automatically closes all files and returns.
13-16 CA-Clipper
The Debugger Display
Menu selections appear on the menu bar at the top of the screen.
Each menu contains a group of similar, commonly used options.
For example, the Find, Next, Previous, Goto Line, and Case
Sensitive options are found on the Locate menu:
• C:^IP53\mCI\CALLSTftC.FRG -• Huh
FUMCTIOM ThirdFunc
DO SecondProc
RETURMCMIL)
PROCEDURE SecondProc
FinalFuncC)
RE TUMI
FUNCTION FinalFunc
ALTDC)
mm
RETURM(MIL)
Comand -
The File menu lets you view other files and access DOS without
leaving the current program.
The Locate menu lets you search for a string in a program and
move the cursor in the Code window to a particular line number.
The View menu lets you view certain information that is not
normally displayed as part of the debugger screen.
The Run menu lets you run the current application using one of
several debugger execution modes. Additionally, it lets you
control how much of the application to run using the Code
window cursor and restart the current application from the
beginning.
The Monitor menu lets you control the display of public, private,
static, and local variables in the Monitor window.
The Options menu lets you control the debugger display options
and create and run debugger script files.
The Help menu lets you activate the Help window. The menu
options select the help topic that is initially highlighted when the
window is opened.
The Debugger Display
Menu Operations
Accessing a Menu To access a menu, click on it, or hold down the Alt key and press
the first letter of the menu name. For example, to access the
View menu, press Alt+V.
• To access the menu to the left of the current one, press Left
arrow. If you are positioned on the first menu, the cursor
wraps around to the last menu on the menu bar.
Key Action
Selecting a Menu To select an option from an open menu, either click on it, or:
Option
1. Press Up or Down arrow to highlight the option.
Key Action
Accelerator Keys Once a menu is open, all options within the menu have an
associated accelerator key that you can press to select the option.
The accelerator key is a single letter which is usually the first
letter of the option name.
For example, to select File Exit using its shortcut, press Alt+X.
13-20 CA-Clipper
The Debugger Display
Menu Commands
The abbreviation " S p " distinguishes Run Speed from the Run
Step command.
Key Action
Fl Help
F5 Execute application
F9 Set/delete breakpoint
F10 Trace
13-22 CA-Clipper
The Debugger Display
Window N a m e Purpose
Window Operations
Navigating Between Of all the windows on the main screen, one is said to be the
Windows active window and the rest are inactive. When you select a
window, you make it the active window. The active window is
indicated by a highlighted border; inactive windows have a
single-line border.
13-24 CA-Clipper
The Debugger Display
Opening and Closing Not all debugger windows must be open on the debugger screen
at all times. The debugger automatically controls the opening
and closing of certain windows, while leaving the control of
others up to you. This section describes how to open and close
each window.
The Code and Command windows are always open and cannot
be closed by you or the debugger.
Iconizing Any window on the screen can be effectively put out of sight
without actually closing the window. For example, if the
Callstack window is open and you are not interested in its
contents for the moment, you can shrink it down so small that
only the window name is visible.
13-26 CA-Clipper
The Debugger Display
To size a window, press and hold the left mouse button on the
window's lower right-hand corner while dragging the mouse, or:
The following table lists some shortcut keys for changing the
height of a window:
Key Action
13-28 CA-Clipper
The Debugger Display
The C o d e Window
C:\CLIP53VS0UnCEN3imENTBDOl)l.PnG
LOCAL oCol
LOCAL GetList
LOCAL nKey
LOCAL nLen
LOCAL 1Append
Code LOCAL bSauIns
window" 358: LOCAL nSauRecNo := recnoO
LOCAL xnewKey
LOCAL xSauKey
// If we're at EOF we're adding the first record, so turn on append mo
if EOFQ
- Command
usam
The Code window is initially set to display a certain number of
lines but can be sized to display fewer or more lines (see
Window Operations earlier in this chapter for more information).
The minimum number of display lines is zero, and the initial and
maximum number of lines depend on the display mode.
A scroll bar appears on the right side of the Code window when
there is too much code to see at once. Using the mouse, you can
scroll:
Key Action
Up arrow /Ctrl+E Move cursor up one line
Down arrow/Ctrl+X Move cursor down one line
Left arrow/Ctrl+S Pan left one character
Right arrow/Ctrl+D Pan right one character
Home/Ctrl+A Pan left one screen
End/Ctrl+F Pan right one screen
PgUp/Ctrl+R Scroll window contents up
PgDn/Ctrl+C Scroll window contents down
Ctrl+PgUp Move cursor to first line
Ctrl+PgDn Move cursor to last line
Enter Execute pending command
Tab Activate next window
Shift+Tab Activate previous window
F2 Toggle full-screen /window display
F3 Retype last command in command history
13-30 CA-Clipper
The Debugger Display
The C o m m a n d Window
BEGIN SEQUENCE
use (dbf) index (index)
RECOUER USING oError
if C oError:genCode == EG_OPEN )
7? "Error opening file(s)"
• Comand «
Command_ > goto 56
window > bp
SSI
The Command window is like most other debugger windows in
that it can be sized, moved, and zoomed to full-screen when it is
the active window (see Window Operations earlier in this
chapter for more information).
See the Menu Command Reference at the end of this chapter for
an alphabetical list of debugger commands. See The Debugger
Menus later in this chapter for a brief description of each of the
debugger menus and information regarding its use.
Key Action
13-32 CA-Clipper
The Debugger Display
History Commands that you type are saved in a history buffer where
they can be accessed when the Command window is active.
Overwrite and Insert When the Command window is active, there are two data entry
Modes modes: overwrite and insert.
2. Press Insert.
BEGIΜ SEQUENCE
use ( d b f ) index (index)
= Comand :
> goto 56
> bp
>
When the Watch window is active, you can inspect the value of
almost any variable or expression that appears in the window.
Code blocks cannot be inspected, and inspecting arrays and
objects is slightly more complicated than other data types.
13-34 CA-Clipper
The Debugger Display
All changes that you have made are saved and control
returns to the Watch window.
The dialog box closes and control returns to the Watch window.
The following table summarizes the keys that are available when
the Watch window is active:
Key Action
13-36 CA-Clipper
The Debugger Display
When the Monitor window is active, you can change the value of
almost any variable in the window by highlighting it and
pressing Enter. Editing variables in this window is identical to
the method described above for the Watch window and with the
same exceptions—code blocks cannot be edited, and editing
array values and objects is slightly more complicated than other
data types.
The keys for this window are summarized in the table below:
Key Action
13-38 CA-Clipper
The Debugger Display
PROCEDURE SecondProc
FinalFuncO
RETURN
FUNCTION FinalFunc
ALTD Ο
17: ? "we are at the deepest part of the callstack"
RETURNCNILJ
- Corawnd
•WlWfrtrflTI
Callstack window
Key Action
You can view the call stack information easily when using the
Workbench debugger. For details, see Viewing the Call Stack
in the "Debugging Your Applications" chapter of the Workbench
User Guide.
13-40 CA-Clipper
The Debugger Display
Key Action
When the View Sets window is active, you can view and change
the status of the CA-Clipper system settings.
When you close the View Sets window, the new settings are
saved and take effect immediately in your program.
13-42 CA-Clipper
The Debugger Display
The Area pane displays the alias name for each open database
file with the active file highlighted. Information regarding the
currently highlighted file is shown in the other two window
panes.
The Status pane shows the current database driver name and the
status of most work area flag settings with information regarding
the selected database file underneath. The database information
is in the form of an outline that can be expanded and collapsed.
2. Press Enter.
When the Set Colors window is active, you can view and change
the status of the debugger color settings.
When you close the Set Colors window, the new colors take
effect immediately but will be lost as soon as you exit the
debugger. To save the new colors in a script file for future use,
execute the Options Save command.
13-44 CA-Clipper
The Debugger Display
Dialog Boxes
Several menu options and window selections require that you
enter further information into a dialog box before continuing.
Menu options that require more input are always indicated by an
ellipsis (...) to the right of the option name. Some examples of
window selections that require additional information are items
in the Monitor and Watch windows.
18: DO SecondProc
19. RETURNCNIL)
20: jpn|
Dialog 21: PfiQCEPUJT
box 22: FinalFun
23: RETURN
24:
25: FUNCTION FinalFunc
mEwammmm ,,
27: ? TJe ore at the deepest part of the callstack
28: RETURNCNIL)
29:
3Θ:
31:
32:
33: = Demand *
The following table summarizes the keys that are available when
a dialog box is open:
Key Action
Debugging α Program
In order to make full use of the information presented so far in
this chapter, this section provides a more detailed study of the
most powerful features, together with suggestions on the most
appropriate places to use them.
13-46 CA-Clipper
Debugging α Program
Modes of Execution
Animate Mode To run a program in animate mode, use the Run Animate
command (there is no function key equivalent). This execution
mode allows you to execute large portions of an application,
stopping when the value of a suspect variable or expression
changes.
Run Mode Run mode is the fastest mode of execution offered by the
debugger. In this mode, the debugger runs your application in
much the same manner as it would in animate mode. The
difference between these two execution modes is that run mode
does not return to the debugger display after each line of code is
executed.
There are three versions of run mode. The first is the one
described above which you enter by pressing F5 or selecting the
Run Go command.
13-48 CA-Clipper
Debugging α Program
The second is identical to the first except that the debugger runs
the application only until the start of the next activation. This
mode is accessed by pressing Ctrl+F5 or selecting the Run Next
command and is equivalent to setting a tracepoint of
PROCLINE() = 0.
The third is identical to the first except that the debugger runs
the application only to the current cursor position in the Code
window rather than to the application's end. This mode is
accessed by pressing F7 or selecting the Run To command.
Single Step Mode To run a program in single step mode, press F8 or select the Run
Step command. This execution mode allows you to step through
each line of code, viewing the output and examining variables as
you go. Ideally, you will use single step mode in situations
where the error you are looking for has been narrowed down to
a few lines of code.
Trace Mode To run a program in trace mode, press F10 or select the Run
Trace command. This execution mode is similar to single step
mode in that it allows you to execute one line of program code at
a time. However, trace mode does not display the code for
functions and procedures called by the current program nor does
it trace code blocks back to their definition.
Starting Out The easiest way to debug a program for the first time is to
execute the application in run mode to show the program output
in the context of the application. You will use the Run Go
command (or simply press F5) to invoke run mode.
After you have identified and noted all cosmetic errors, you will
probably want to go ahead and edit your source code to make
the necessary corrections. Then you must compile and link the
application again so that the changes will take effect the next
time you execute.
Note that all source code changes must take place outside of the
context of the debugger (that is, you must leave the debugger to
make them) since the debugger has no facility for correcting
errors on-the-fly.
13-50 CA-Clipper
Debugging α Program
Taking a Closer Look When the cause of a problem is not immediately obvious, the
next step is to examine the contents of suspected fields, variables,
and expressions. Often, you can use the ? I ?? command to reveal
an unexpected value for one of these items. If this is the case,
specify the item as a watchpoint or tracepoint. This allows you
to pinpoint exactly where in the application the erroneous value
was stored.
Final Stage When the cause of an error has been narrowed down to a few
lines of code, move the cursor in the Code window to the first of
these lines and use the F9 key or the Point Breakpoint command
to set a breakpoint there. Then press F5 to execute the
application in run mode up to that breakpoint.
When you have reached the suspect area of code, press F8 to step
through the code one line at a time (single step mode). If you are
certain that the error is in the current program and not in any
subsidiary procedures or functions, use F10 instead (trace mode).
Remember that in trace mode the debugger does not display the
code for called routines.
You can easily set breakpoints then run your application from
the debugger when using the Workbench. For details, see
Resolving Runtime Errors in the "Debugging Your
Applications" chapter of the Workbench User Guide.
13-52 CA-Clipper
Debugging α Program
Using the Workbench, you can inspect and modify the values
of expressions quickly and easily. For details, see Resolving
Runtime Errors in the "Debugging Your Applications" chapter
of the Workbench User Guide.
Setting Watchpoints To set watchpoints and tracepoints use the Point Watchpoint
and Tracepoints and Point Tracepoint menu commands. If you choose the
menu options, the debugger opens a dialog box where you are
prompted to enter an expression.
Warning! Be careful not to use Delete All on its own unless you want
to delete all watchpoints, tracepoints, and breakpoints.
13-54 CA-Clipper
Debugging α Program
Listing Watchpoints You can always see watchpoints and tracepoints in the Watch
and Tracepoints window as long as it is open. You can also display them in the
Command window using the List command:
List WP
Note that although you can inspect the value of almost any
expression that appears in the Watch window, code blocks
cannot be inspected, and inspecting arrays and objects is slightly
more complicated than other data types.
13-56 CA-Clipper
Debugging α Program
Using Breakpoints
Setting Breakpoints To set a breakpoint in the current program, move the cursor to
the appropriate line in the Code window and execute the Point
Breakpoint command (or simply press F9). The selected line is
highlighted:
Locate Uiew Run Point Monitor Options Window Help
- Watch
0) nkey <wp, Local, U>: NIL
1) lflag <wp, Local, L>: .T.
C :\air^sSOURCE\SflffTiN^^
ALTD Ο
BEGIN SEQUENCE
use (dbf) index (index)
RECOUER USING oError
if ( oError:genCode == EG_0PEN )
?? "Error opening file(s)"
I
:
Comand
> goto 56
You can also set breakpoints in programs other than the one
currently displayed in the Code window using the BP command.
This example sets a breakpoint at line 15 in the program
Opendbfs.prg:
BP 15 In OpenDbfs.prg
13-58 CA-Clipper
Debugging α Program
Deleting a Breakpoint There are several ways to delete an individual breakpoint. The
first is to move the cursor to the appropriate line in the Code
window and execute the Point Breakpoint command (or simply
press F9 or issue BP command with no parameters). When a
breakpoint is deleted, the line returns to its normal color.
Warning! Delete All without any other arguments also deletes all
watchpoints and tracepoints.
Listing Breakpoints To display all breakpoints, use the List BP command. This lists
and numbers breakpoints in the order they were entered, as
shown in the Command window below. Note that numbering
begins with zero:
File Locate Uiew Run Point Monitor Options Window Help
-Hatch
0) nkey <wp, Local, U>: NIL
1) lflag <wp, Local, L>: .T.
C:\aiF53sS0URaE\3rtf1ZSTHlMDl.™
ALTDO
BEGIN SEQUENCE
use (dbf) index (index)
I]
:
tomand :
> list bp
0) 56 TBDEN01.PRG
SEESEj
Setting and viewing breakpoints is easy using the Workbench.
See Resolving Runtime Errors in the "Debugging Your
Applications" chapter of the Workbench User Guide.
C:SCLIP53\S0LRCEsS(WLBsTBraM)l.PRG IfrBDEMO |)
otherwise
KEYBOARD chr( nKey )
DoGetC oBrowse )
endcase
RETURM
COVBIld
> goto 357
> goto 363
>
13-60 CA-Clipper
Debugging α Program
Viewing Files
The following example displays the code for the header file
Inkey.ch in the Code window. Notice that this example gives a
file extension; if none is supplied, a (.prg) extension is assumed:
File Open \CLIP53\INCLUDE\Inkey.ch
You can also use the File Open command to view other program
files in your application. This feature is convenient if you want
to set a breakpoint in another program but do not know the line
number and cannot, therefore, set it using the BP command.
For a list of navigation keys used within the Code window, see
The Debugger Display earlier in this chapter.
Accessing DOS
13-62 CA-Clipper
Menu Command Reference
?|??
Syntax ? I ?? <exp>
Arguments
13-64 CA-Clipper
Menu Command Reference
BP
Arguments
At <HneNum> The line number where you want program execution to stop.
<idFunction> I <idProcedure>
The name of a routine specified without parentheses. When you
set a breakpoint in this manner, execution stops each time the
routine is called.
13-66 CA-Clipper
Menu Command Reference
See Also Delete, List, Point Breakpoint, Run Go, Run Step
Callstack
Arguments
13-68 CA-Clipper
Menu Command Reference
Delete
Arguments
BP Specifies breakpoints.
Examples To delete a breakpoint, you must first find out where it falls in
the list of breakpoints:
List BP
See Also BP, List, Point Breakpoint, Point Delete, Point Tracepoint, Point
Watchpoint
13-70 CA-Clipper
Menu Command Reference
File DOS
Shortcut Equivalent
Abbreviation FD
Synonym DOS
File Exit
Purpose Terminate the debugger, close all files, and return to DOS
Shortcut Equivalent
Abbreviation FE
Synonym Quit
File Open
Shortcut Equivalent
Abbreviation FO
Arguments
Description File Open allows you to look at other files without leaving the
current debugging session, including header files specified with
the #include preprocessor directive. Breakpoints can be set and
are saved when you return to the original program.
Unless you have defined a source file search path with the
Options Path command, the filename that you specify is
searched for in the current directory only. If, however, you have
defined a search path, the directories in the path are searched in
order until the file is found.
When you view a file with File Open, the current program is
cleared from the Code window and the new file is displayed in
its place. To continue with the original program, use File
Resume.
13-72 CA-Clipper
Menu Command Reference
File Resume
Shortcut Equivalent
Abbreviation FR
Synonym Resume
Description File Resume clears the file being viewed with the File Open
command (or using the Callstack window) and redisplays the
file originally shown in the Code window. Any breakpoints
which have been set are saved.
Help
Shortcut Equivalent
Abbreviations Η Κ; Η W; Η Μ; Η C
Shortcut key Fl
Arguments
Keys Highlights the Keys topic when the Help window is activated.
Menus Highlights the Menus topic when the Help window is activated.
13-74 CA-Clipper
Menu Command Reference
Description The debugger Help window is divided into two panes: the left
pane contains a list of topics for which help is available, and the
right pane contains the help text for the currently highlighted
topic. When the Help window is activated with the Help
command, one of the topics in the left pane is highlighted, and a
general discussion of the topic is displayed in the right pane of
Help window.
List
Syntax List BP I TP I WP
Arguments
BP Specifies breakpoints.
See Also BP, Delete, Point Breakpoint, Point Delete, Point Tracepoint,
Point Watchpoint
13-76 CA-Clipper
Menu Command Reference
Locate Case
Shortcut Equivalent
Abbreviation LC
The Locate Case Sensitive menu option can be used to check the
status of the case-sensitivity setting. An on setting is indicated
by a checkmark to the left of the menu option. An off setting is
indicated by the absence of the checkmark in the menu.
Examples Suppose you want to locate all occurrences of the USE command
in your program, but are not always consistent in using
uppercase letters for commands. If case-sensitivity is currently
on, Locate Find USE will not find all occurrences of the
command but only those in which all uppercase letters are used.
To turn the case-2ensitivity setting off and locate the USE
command in all its possible forms:
Locate Case
Locate Find USE
Locate Find
Shortcut Equivalent
Abbreviation LF
Synonym Find
Arguments
Description Locate Find searches the file displayed in the Code window for a
specified search string.
The search always begins at the first line of code and moves
down through the file, regardless of the current cursor position
in the Code window. If the search string is found, the debugger
moves the cursor to the line containing the first occurrence of the
string in the Code window; otherwise, the cursor remains at its
current location.
13-78 CA-Clipper
Menu Command Reference
Examples If you suspect that the error you are trying to eliminate relates to
a database (.dbf) file that is not open, search for the keyword
USE:
Locate Find USE
Locate Goto
Shortcut Equivalent
Abbreviation LG
Synonym Goto
Arguments
<UneNum> The number of the line where you want to move the cursor. If
<UneNum> is not specified on the command line, Locate Goto
opens a dialog box to prompt you for a line number.
Description Locate Goto moves the cursor from its current position in the
Code window to the specified line number.
Locate Next
Shortcut Equivalent
Abbreviation LN
Synonym Next
Description Locate Next locates the next occurrence of the most recently
defined search string. A search string is defined using Locate
Find. If no search string has been defined, Locate Next opens a
dialog box to prompt you for one.
Like Locate Find, Locate Next obeys the current Locate Case
Sensitive menu setting. The Locate Case command is used to
toggle this menu setting on and off.
13-80 CA-Clipper
Menu Command Reference
Locate Previous
Shortcut Equivalent
Abbreviation LP
Synonym Prev
Description Locate Previous searches for the previous occurrence of the most
recently defined search string. A search string is defined using
the Locate Find command or the Locate Find menu option. If no
search string has been defined, Locate Previous opens a dialog
box to prompt you for one.
Like Locate Find, Locate Previous obeys the current Locate Case
Sensitive menu setting. The Locate Case command is used to
toggle this menu setting on and off.
Monitor All
Shortcut Equivalent
Abbreviation MA
See Also Monitor Local, Monitor Private, Monitor Public, Monitor Sort,
Monitor Static
13-82 CA-Clipper
Menu Command Reference
Monitor Local
Shortcut Equivalent
Abbreviation ML
See Also Monitor All, Monitor Private, Monitor Public, Monitor Sort,
Monitor Static
Monitor Private
Shortcut Equivalent
Abbreviation MPr
See Also Monitor All, Monitor Local, Monitor Public, Monitor Sort,
Monitor Static
13-84 CA-Clipper
Menu Command Reference
Monitor Public
Shortcut Equivalent
Abbreviation MP
See Also Monitor All, Monitor Local, Monitor Private, Monitor Sort,
Monitor Static
Monitor Sort
Shortcut Equivalent
Abbreviation Μ So
See Also Monitor All, Monitor Local, Monitor Private, Monitor Public,
Monitor Static
13-86 CA-Clipper
Menu Command Reference
Monitor Static
Shortcut Equivalent
Abbreviation MS
See Also Monitor All, Monitor Local, Monitor Private, Monitor Public,
Monitor Sort
Num
Arguments
13-88 CA-Clipper
Menu Command Reference
Options Codeblock
Purpose Control the tracing of code blocks during single step mode
Shortcut Equivalent
Abbreviation o c
Accelerator key Alt+O, Β
Tracing code blocks involves an extra step each time a code block
is evaluated because you also have to step over the line of code
defining the code block. If you do not want to trace code block
definitions, turn Options Codeblock off.
Options Color
Shortcut Equivalent
Abbreviation OCol
Description Options Color activates the Set Colors window where you can
inspect and change the debugger color settings. For information
on using the Set Colors window, see The Debugger Display
earlier in this chapter.
13-90 CA-Clipper
Menu Command Reference
Options Exchange
Shortcut Equivalent
Abbreviation OE
Options Line
Shortcut Equivalent
Abbreviation OL
Options Line
See Also
Locate Goto, Num
13-92 CA-Clipper
Menu Command Reference
Options Menu
Shortcut Equivalent
Abbreviation OM
Description Options Menu toggles the display of the debugger menu bar.
The default setting for Options Menu is on, meaning that the
menu bar is visible.
Options Mono
Options Mono
Shortcut Equivalent
Syntax Abbreviation Ο Mo
Description The default setting for Options Mono depends on the kind of
monitor you are using (that is, for color monitors the default is
off, whereas for monochrome monitors it is on).
13-94 CA-Clipper
Menu Command Reference
Options Path
Shortcut Equivalent
Abbreviation Ο Pa
Arguments
The search path that you specify pertains to source files only
(that is, the View and File Open commands). Other file searches
are not affected.
Options Preprocessed
Shortcut Equivalent
Abbreviation OP
13-96 CA-Clipper
Menu Command Reference
Options Restore
Shortcut Equivalent
Abbreviation OR
Synonym Input
Arguments
<idScriptFile> The name of the script file from which to read commands. If no
extension is specified, (.eld) is assumed. If <idScriptFile> is not
specified on the command line, Options Restore opens a dialog
box to prompt you for a filename.
Description Options Restore causes the debugger to read and execute all
commands in the specified script file then resume accepting
input from the keyboard.
Options Save
Shortcut Equivalent
Abbreviation OSa
Arguments
<idScriptFile> The name of the script file to which you want to save the current
debugger settings. If no extension is specified, (.eld) is assumed.
If <idScriptFile> is not specified on the command line, Options
Save opens a dialog box to prompt you for a filename.
Description Options Save writes the current debugger settings to a script file.
The settings are written to the script file using standard menu
commands.
13-98 CA-Clipper
Menu Command Reference
Options Swap
Shortcut Equivalent
Abbreviation OS
Options Tab
Shortcut Equivalent
Abbreviation OT
Arguments
<tabSize> A numeric value indicating the size to which the tabs are
expanded when displayed in the Code window. The default tab
size is 4. If <tabSize> is not specified on the command line,
Options Tab opens a dialog box to prompt you for the tab size.
Description Options Tab allows you to set the tab size for the Code window.
This command is effective only if the file you are viewing
contains tabs. Lines that are indented with spaces are not
affected.
13-100 CA-Clipper
Menu Command Reference
Point Breakpoint
Shortcut Equivalent
Abbreviation Ρ Β
Shortcut key F9
Examples To toggle the breakpoint setting for the current line of code:
Point Breakpoint
Point Delete
Shortcut Equivalent
Abbreviation PD
Arguments
13-102 CA-Clipper
Menu Command Reference
Point Tracepoint
Shortcut Equivalent
Abbreviation PT
Accelerator key Alt+P, Τ
Synonym TP
Arguments
Examples This example halts execution as soon as the value of the variable
nlnvNum changes:
Point Tracepoint nlnvNum
Point Watchpoint
Shortcut Equivalent
Abbreviation PW
Synonym WP
Arguments
13-104 CA-Clipper
Menu Command Reference
Run Animate
Shortcut Equivalent
Abbreviation RA
Synonym Animate
Description In animate mode, the debugger executes a single line, moves the
execution bar to the next line, executes it, and so on. If Options
Exchange Screens is on (indicated by a checkmark), the output of
each line is displayed after the line has been executed.
Run Go
Syntax Run Go
Shortcut Equivalent
Abbreviation RG
Shortcut key F5
Synonym Go
13-106 CA-Clipper
Menu Command Reference
Run Next
Purpose Execute the application in run mode up to the start of the next
activation
Shortcut Equivalent
Abbreviation RN
Description Run Next displays your application screen and executes the
application until it reaches line zero of the next activation (that is,
function, procedure, code block, or message send). The
application is executed in run mode until that point is reached.
This is equivalent to setting a tracepoint of "PROCLINE() = 0."
Examples Assuming the current program contains its first function call on
line 15, the following command executes the application as far as
line 15:
Run Next
Run Restart
Shortcut Equivalent
Abbreviation RR
Synonym Restart
If errors are discovered, you may want to make changes and run
the application again:
Run Restart
See Also
Run Next, Run Go
13-108 CA-Clipper
Menu Command Reference
Run Speed
Shortcut Equivalent
Abbreviation RSp
Synonym Speed
Arguments
Description Run Speed controls the speed of display while in animate mode
(for an explanation of this mode, see Debugging a Program
earlier in this chapter). Remember that this setting is expressed
in tenths of seconds so that smaller settings are faster than larger
ones.
Run Step
Shortcut Equivalent
Abbreviation RS
Shortcut key F8
Synonym Step
Description In single step mode, the debugger executes the line of code at the
execution bar, moves the execution bar to the next line, and
stops. As functions are called by the current program, their code
is displayed in the Code window.
Examples This example executes the next line of the application being
debugged. The debugger stops with the execution bar on the
next line to be executed:
Run Step
13-110 CA-Clipper
Menu Command Reference
Run To
Syntax Run To
Shortcut Equivalent
Abbreviation R To
Shortcut key F7
Description Run To executes only those lines of code up to the line indicated
by the current cursor position in the Code window. The
application is executed in run mode until that line is reached.
Run Trace
Shortcut Equivalent
Abbreviation RT
Description The Run Trace command is similar to Run Step in that it executes
one line of program code at a time. However, Run Trace does
not display the code for functions called by the current program.
View
Arguments
<idFileName> The name of the file you want to examine. Unless one is
explicitly specified as part of <idFileName>, no extension is
assumed. If <idFileName> is not specified on the command line,
View opens a dialog box to prompt you for a filename.
13-112 CA-Clipper
Menu Command Reference
Description View allows you to look at other files without leaving the current
debugging session. It can also be used to view header files
specified with the #include preprocessor directive. Breakpoints
can be set and are saved when you return to the original
program.
Unless you have defined a source file search path with the
Options Path command, View searches for <idFileName> in the
current directory only. If, however, you have defined a search
path, the directories in the path are searched in order until the
file is found.
When you view a file with View, the current program is cleared
from the Code window and the new file is displayed in its place.
To continue with the original program, use File Resume.
View PrintDbf.prg
View App
Shortcut Equivalent
Abbreviation V A
Shortcut key F4
Synonym Output
Description View App temporarily clears the debugger screen and displays
your application screen in its place. This allows you to see the
output of the application itself. To return to the debugger, press
any key.
13-114 CA-Clipper
Menu Command Reference
View Callstack
Shortcut Equivalent
Abbreviation v c
Accelerator key Alt+V, C
View Sets
Shortcut Equivalent
Abbreviation v s
Accelerator key Alt+V, S
Description View Sets activates the View Sets window. When this window is
active, you can view and change the status of the CA-Clipper
system settings.
13-116 CA-Clipper
Menu Command Reference
View Workareas
Shortcut Equivalent
Abbreviation V w
Shortcut key F6
Window Iconize
Shortcut Equivalent
Abbreviation WI
Description Window Iconize reduces the active window to an icon (its name).
This command acts as a toggle between the icon and window
display modes so that when the active window is iconized,
executing Window Iconize resumes the original window display.
A window that is iconized remains open, but you cannot see the
window contents. Certain window operations such as moving,
however, are possible.
See Also Window Move, Window Size, Window Tile, Window Zoom
13-118 CA-Clipper
Menu Command Reference
Window Move
Shortcut Equivalent
Abbreviation WM
Description Window Move allows you to move the active window around on
the screen. When you execute this command, the border of the
active window changes to a different pattern and the cursor keys
are used to move the window. Enter completes the moving
process.
See Also Window Iconize, Window Size, Window Tile, Window Zoom
Window Next
Shortcut Equivalent
Abbreviation WN
Window Prev
Shortcut Equivalent
Abbreviation WP
Window Size
Shortcut Equivalent
Abbreviation w s
Accelerator key Alt+W, S
Description Window Size allows you to change both the height and the
width of the active window. When you execute this command,
the border of the active window changes to a different pattern
and the cursor keys are used to change the size of the window.
Enter completes the sizing process.
See Also Window Iconize, Window Move, Window Tile, Window Zoom
13-120 CA-Clipper
Menu Command Reference
Window Tile
Shortcut Equivalent
Abbreviation WT
See Also Window Iconize, Window Move, Window Size, Window Zoom
Window Zoom
Shortcut Equivalent
Abbreviation w z
Accelerator key Alt+W, Ζ
Shortcut key F2
See Also Window Iconize, Window Move, Window Size, Window Tile
13-122 CA-Clipper
Chapter 14
Program Maintenance—
RMAKE.EXE
In This Chapter
CA-Clipper provides a program maintenance facility with
RMAKE.EXE. RMAKE is a powerful tool for keeping programs
involving several source, header, object, and library files up-to-
date. It does this by comparing the date and time stamps of files
related to one another and performing a series of actions if they
do not match.
• Invoking RMAKE
• RMAKE options
Invoking RMAKE
If you installed the default configuration of the CA-Clipper
development system, RMAKE.EXE is located in the
\CLIP53\BIN directory. To execute RMAKE from DOS, use the
following syntax:
RMAKE [<makeFile list>] [<macroDef list>]
[<option list>]
Like all other CA-Clipper utilities, you can execute RMAKE from
any drive or directory since the appropriate directory was placed
in the PATH list during installation.
14-2 CA-Clipper
The RMAKE Environment Variable
RMAKE Options
The options described in this section control the behavior of
RMAKE. As already discussed, you can specify options on the
RMAKE command line and in the RMAKE environment
variable. Command line options take precedence if there is a
conflict.
/D /O<macroName>[:<value>]
14-4 CA-Clipper
RMAKE Options
/XS /XS<nwnSymbols>
Sets the size of the internal symbol table. The default size is 500
symbols.
/XW /XW<numBytes>
Sets the size of the internal workspace. The default size is 2048
bytes.
Parsing Phase When invoked, RMAKE first performs the parsing phase by
processing each make file sequentially in the order encountered.
Files specified on the RMAKE command line are processed from
left to right. All file searching is performed during the parsing
phase, and all inference rules are applied. If macros or rules are
redefined, the new definitions apply to the dependencies
specified after them.
14-6 CA-Clipper
How RMAKE Works
Make Phase After the parsing phase, RMAKE performs the make phase
during which all of the rules defined in all of the files are applied
in order to produce the target files. For each rule in the make
file, the date of the target file is compared to the ciate of each
dependent file. If any dependent file has a more recent date and
time stamp than its associated target file, the accompanying
actions are executed. If none of the dependent files have been
changed since the target file was last updated, the rule is
bypassed and the process is repeated for the next rule.
RMAKE correctly handles the case where two input files define
dependencies (and possibly actions) for the same target. It
always builds all target files to ensure that multiple-specified
targets (for example, .LIB files) are not time stamped before all
make files get a chance to specify dependencies. Although no
particular order is guaranteed during the make phase, RMAKE
does guarantee that no target will be built until all of its
dependencies have been built.
Error Handling When RMAKE terminates, it sets the DOS return code to indicate
the state of the make process at termination. A return code of 0
means that the make was successful (that is, there were no
errors), and a return code of 1 means that errors were
encountered during processing.
You can test the RMAKE return code within a batch file using
the DOS ERRORLEVEL condition. For example:
RMAKE RL
IF ERRORLEVEL 1 GOTO ERROR
.<commands>
GOTO END
:ERROR
.<commands>
: END
Make Files
When RMAKE is first executed, it attempts to locate the make
files specified on the command line and in the RMAKE
environment variable. By default, these files are assumed to
have an extension of .RMK, which you can override by
specifying another extension as part of the make filename. To
indicate a file with no extension, include a period at the end of
the filename.
14-8 CA-Clipper
How RMAKE Searches for Files
Note that here you use the immediate assignment operator (:=)
rather than the assignment operator (=) that you used to
originally create the macro. This is to prevent the normal delay
that would occur in expanding the referenced makepath[.h]
macro. (See the Macros section later in this chapter for more
information.)
Note: Actions are executed during the make phase and thus
have no effect on file searches. This means, for example, that
you cannot have an action line that places a file in a subdirectory
specified with a path name with the intent of triggering a
subsequent dependency rule.
14-10 CA-Clipper
The Make File
For instance, both the colon and the backslash have special
meaning to RMAKE; therefore, when you specify a filename
with a drive and/or path specification in a dependency or
inference rule, you must enclose the filename in quotes. Another
instance is a macro name definition containing these same or
other special symbols. As a general principle, use quotes
whenever you are in doubt, since they are never interpreted
literally.
Line Continuation
Comments
You can specify comments in a make file using C-style inline
comments ( / * . . . * / ) or C-style line comments ( / / ) or, if you use
the / U option, UNIX make-style comments (#). You can place a
comment on a line by itself or embedded at the end of a
command line in a dependency rule. For example:
/* This is a comment line */
TEST.OBJ: Test.prg
CLIPPER Test.prg // This is an embedded comment
Dependency Rules
The key component of the make file is the dependency rule which
consists of a dependency statement followed by one or more
actions. The dependency statement establishes a relationship
between a target file and one or more dependent files. If any of
the dependent files has a date and time stamp newer than the
target file, the actions that follow the dependency statement are
performed to bring the target file up-to-date.
14-12 CA-Clipper
The Make File
Makepath Examples
Likewise, you can create the target .EXE file with a similar
dependency rule. This example assumes that WINDOW.OBJ
must also be linked to create the executable file. The rule to
create TEST.EXE when either TEST.OBJ or WINDOW.OBJ is
more recent is as follows:
TEST.EXE: TEST.OBJ WINDOW.OBJ
EXOSPACE FILE TEST, WINDOW
14-14 CA-Clipper
The Make File
Error Handling It is not necessary for each <action> to result in the creation of a
target file. In fact, after the actions are executed, RMAKE does
not verify that the target file was successfully created. However,
RMAKE does check the DOS ERRORLEVEL variable upon
completion of each item in the <action> list.
Note: You can disable this default error processing using the / I
option. With this option, RMAKE does not stop when DOS's
ERRORLEVEL is set. Instead, it continues processing as if
nothing had happened.
Inference Rules
Using an inference rule such as this one, you could specify each
individual object/source in your application as a separate
dependency statement:
RLFRONT.OBJ: Rlfront.prg
RLBACK.OBJ: Rlback.prg
RLDIALG.OBJ: Rldialg.prg
14-16 CA-Clipper
The Make File
Using an inference rule, you not only save on the number of lines
in the make file, but you also make it easier to maintain. For
example, if you add a source file to your application, you add
only one line (the dependency statement) to the make file instead
of two.
Each program that runs under DOS receives a local copy of the
DOS environment variables. RMAKE allows you to make
changes to its copy so that programs in action lines can inherit a
modified environment. Any changes made are discarded once
RMAKE terminates. (Like most programs, RMAKE is unable to
change its parent's environment.)
Note: In the sense that you can expand them using the syntax
$(<envVariable>), environment variables are treated like make
file macros. However, this is where the similarity ends. In no
other way are environment variables treated like macros. For
example, you cannot test for their existence with #if directives,
and you cannot undefine them with the #undef directive. See
the Macros section later in this chapter for more information on
macros.
14-18 CA-Clipper
The Make File
Directives
Several directives are provided for use in make files. You must
specify each directive on a separate line in the make file.
prgpath="C:\MYDIR"
#endif
14-20 CA-Clipper
The Make File
Note: Except for the fact that you can expand them,
environment variables are not treated like make file macros. It is
possible, therefore, to define a macro with the same name as an
environment variable and effectively hide an environment
setting within the context of the make file. As soon as you
#undef the macro, the environment variable will once again be
visible. You cannot, however, #undef an environment variable
setting.
Macros
Note: Except for the fact that you can expand them,
environment variables are not treated like make file macros. For
example, you cannot test for their existence with #if directives,
and you cannot undefine them with the #undef directive.
14-22 CA-Clipper
The Make File
User-Defined Macros
Later in the make file, you can use the macro as a substitute for
the file list in a rule:
RL.EXE: $(files)
Macro Expansion There are two cases in which macros are not immediately
expanded when they are encountered. First, macros in inference
rule actions are not expanded until those actions are attached to
a dependency rule. Second, macros within macro definitions are
not expanded until the macro which contains them is expanded.
For example:
macl = $(cfile) // cfile is not defined yet
cfile = Xfile.prg
XFILE.OBJ: $(macl) // XFILE.0BJ depends cfile
14-24 CA-Clipper
The Make File
Predefined Macros
Macro Meaning
To compile more than one source file into the same object file,
use a compiler script file to list all source files to compile into the
target object file. To use this technique, give the script file the
same name as the object file but with a (.clp) extension. Then,
when you create your make file, define the inference and
dependency rules for the compile operation as follows:
// Standard inference rule for compiling
// with a script file
.prg.obj:
CLIPPER @$*
The file, Rl.clp, simply lists the three dependent (.prg) files to
compile into RL.OBJ.
14-26 CA-Clipper
The Make File
• Rlfront.prg
• Rlback.prg
• Rldialg.prg
14-28 CA-Clipper
Chapter 15
Program Editor—PE.EXE
In This Chapter
CA-Clipper gives you the ability to create and modify source
code and header files by supplying a simple program editor,
PE.EXE. PE is a stand-alone application written in CA-Clipper
that provides basic editing features for text and source files.
<filename> is the name of the text file to edit and can include a
drive, path, and/or extension. If you specify no extension, a
(.prg) extension is assumed. If the specified filename exists, it is
loaded for editing; otherwise, a new file is created and you are
presented with an empty edit window. If you do not specify a
filename, you are queried for the name of a file to edit.
Like all other CA-Clipper utilities, you can execute PE from any
drive or directory since the appropriate directory was placed in
the PATH list during installation.
15-2 CA-Clipper
Navigation and Editing
The following table lists the editing keys for PE. Navigation keys
are the same as those used by MEMOEDIT(). See the
MEMOEDIT() entry in the "Language Reference" chapter of the
Reference Guide for a complete list of these keys.
Key Action
Continued
Key Action
Alt+S Search
15-4 CA-Clipper
Leaving the Program Editor
In either case, the edit window closes and you are returned to the
initialization screen. On the initialization screen, you can either
specify another file to edit or return to DOS. To edit another file,
enter its name at the File To Edit prompt. Otherwise, press Esc
to return to DOS.
In This Chapter
In order to provide you with an interactive database design
environment, CA-Clipper includes the DBU system. The system
is a stand-alone application written in CA-Clipper that allows
you to build database files, add data to the files, browse existing
data, create and attach index files, and construct views using a
completely menu-driven system. This chapter explains how to
use all of the features provided in DBU.
• Leaving DBU
• The DBU menus
You can specify the DBU command line arguments in any order.
Like all other CA-Clipper utilities, you can execute DBU from
any drive or directory since the appropriate directory was placed
in the PATH list during installation.
16-2 CA-Clipper
The Main DBU Screen
While on the main screen you can add, change, or delete items in
one of three ways:
The menu bar at the top of the screen consists of several menu
names with menu keys that you press to activate associated pull-
down menus. The menu bar is always available except when
there is a pending prompt.
The menu names on the menu bar are designed to give you a brief
description of what operations you can perform with the
associated pull-down menu. The menu key is a function key
whose name is displayed directly above the menu name.
Pressing it activates the pull-down menu.
The highlight marks the current item and does not appear in the
menu if all of the items are disabled. The figure below shows the
DBU menu bar and all of its components:
Copy
Append — Menu //en?
Replac
Pack
Zap
Highlight
The Left and Right arrows activate the previous and next menu,
respectively, on the menu bar. Pressing Esc terminates the menu
and returns control to the previous operation.
Note: Pressing the same menu key twice activates the specified
menu and selects the currently highlighted menu item, allowing
you to perform the same operation repetitively.
16-4 CA-Clipper
The Main DBU Screen
Dialog Boxes
Most selections that you make from the menu bar cause a dialog
box to open on the main screen, prompting you for additional
information that is needed to complete a selection.
Dialog boxes are similar to pull-down menus in that you use the
Direction keys to move the highlight from one item to another
and use Enter to make a selection. They are different in that
selecting an item does not necessarily close the dialog box, since
it is likely that you will want to make several selections. The
items in a dialog box are called controls. The figure below
illustrates the components of a typical DBU dialog box:
Ok Cancel
Buttons-
Note: When a dialog box is open on the screen, you can perform
only the actions available in the box. An attempt to activate a
menu (with the exception of F l Help, which is always available)
will reveal that all options are disabled.
Buttons
Radio Buttons SDF and DELIMITED are examples of radio buttons which do
not perform an action, but rather set some parameter. Selecting
a radio button surrounds it with a box as an indicator and
deselects any other one that might have been selected. You can
deselect a button in the same manner as you selected it, thereby
leaving all buttons in the group unselected.
16-6 CA-Clipper
The Main DBU Screen
Fill-in Fields
In many cases, the information you enter into a fill-in field will
be a logical condition or some other type of expression. In these
cases, you must enter a valid expression according to the rules
established by the CA-Clipper language. For more information
on expressions, see the "Basic Concepts" chapter in this guide.
Scrolling Lists
To close a dialog box, you can select either the OK or the Cancel
button at the bottom of the box. Selecting OK closes the dialog
box and performs the action which activated it using all of the
controls that you have set. Selecting Cancel (or pressing Esc)
closes the box without performing the action. Both selections
return you to the main screen.
Windows
Other menu selections open a window on the main screen. A
window is similar in appearance to a dialog box but has a special
purpose. Several windows are available in the DBU interface
(for example, F3 Create Database and F5 Browse Database), and
each behaves more or less independently to accomplish its
specific task. Unlike a dialog box, certain menu items other than
F l Help are available when a window is active. The figure
below shows a typical DBU window:
Character 1Θ
16-8 CA-Clipper
The Main DBU Screen
Work Areas
The figure below shows the DBU work areas with two open
database files:
Files
ORDERS |
Indexes
CUSTNUM ORDNUM
Fields
CUSTNUM ORDNUM
NAME CUSTNUM
ADDRESS ITEM
CITV QUANTITV
STATE
ZIP
Files
The Files area is for opening and closing database files (.dbf).
Pressing Enter when the Files area is highlighted allows you to
open an existing database file (.dbf) either by selecting a file
name from a scrolling list or by typing a file name in a dialog
box. You can open up to six database files at one time in DBU.
Indexes
Opening database and index files in this manner (that is, with
Enter) closes any other open files that happened to occupy that
work area. Insert, on the other hand, allows you to open a file by
pushing the other files across one column—if necessary, closing
the file occupying the last work area to make room for the new
one. Opening database and index files using Insert is equivalent
to using the F2 Open menu. Delete closes the file in the currently
highlighted work area.
16-10 CA-Clipper
The Main DBU Screen
Fields
To delete a field from the list, highlight the field name and press
Delete.
To insert a field, highlight the proper location for the field and
press Insert. The Set Fields dialog box opens allowing you to
select the field to insert from a scrolling list. This action is
equivalent to selecting F8 Set Fields from the menu bar.
You can combine the actions of inserting a new field and deleting
the current one by highlighting the field you want to delete and
pressing Enter. Similar to pressing Insert, this action opens the
Set Fields dialog box; however, pressing Enter causes the field
that you select to overwrite the current field—thereby deleting
the current field and inserting a new one. Using a combination
of these actions, you can construct a field list for the current
database file that is reflected when you select F5 Browse
Database.
The following table summarizes the keys that are available for
use when operating on the main screen in DBU. These keys
apply only when the main screen is active and you are dealing
directly with the various work area attributes. In short, they do
not apply when a menu, dialog box, or window is active.
16-12 CA-Clipper
Leaving DBU
Leaving DBU
When you are finished with DBU, you can exit the utility by
pressing Esc and responding with Y at the prompt. All files that
you created and any data that you added or changed are
automatically saved. You must, on the other hand, save a view
to disk if you plan to use it again without having to set up all of
the components in the next DBU session.
Once a view is set up on the main screen with all the necessary
files and fields represented, you can save the image to a view file
(.vew). To do this, select F4 Save View and enter the requested
information into the dialog box. Later on, you can select F2
Open View and enter the view file name as it was saved. All
files in the view are opened and all field lists established. For
more information on view files, see F4 Save in The DBU Menus
section later in this chapter.
Key Action
Enter Select current item
Esc Abandon menu without selecting
Up arrow Highlight previous item
Down arrow Highlight next item
Left arrow Activate previous menu
Right arrow Activate next menu
Home Highlight first item
End Highlight last item
16-14 CA-Clipper
The DBU Menus
Fl Help
The Fl Help menu contains only a single menu item, also named
Help. Selecting it gives you context-sensitive help, depending on
what you are trying to do when you make the menu selection.
For instance, if you are trying to open a database file and the
Open dialog box is active on the screen, requesting help gives
you information on opening a database file:
OPEN DATABASE
A database file nay be opened by using a files box,
or by just typing the nane into the space on the screen.
The files box May be opened by selecting "Database" fron
the "Open" rienu, or by pressing Insert or Enter. Enter
or just typing in the nane uill cause the current data
file to be closed before another one is opened in its
place. Pressing Insert or selecting fron the pull-doun
nenu uill cause all open files in uork areas equal to or
greater than the current area to be shifted to a higher
area before another file is opened, thus preuenting any
file froM being closed. All indexes, filters, etc. uill
be noued uith the data files. A file May be closed by
pressing Delete uhile the cursor is on the filenaMe.
F2 Open
F2 Open allows you to open files. The menu contains the
following items:
• Database
• Index
• View
All menu items activate an Open dialog box similar to the one
shown below. The scrolling list contains a different file type
depending on the item you select.
Ok Cancel
Database
You can activate the Open Database dialog box by pressing Enter
or Insert instead of using the menu. If you know the name of the
file that you want to open, you can also type it directly on the
main screen.
16-16 CA-Clipper
The DBU Menus
Index
You can activate the Open Index dialog box by pressing Enter or
Insert instead of using the menu. If you know the name of the
file that you want to open, you can also type it directly on the
main screen. The index file at the top of the column is the
controlling index.
View
Note: You can design, save, and open a view file only in D B U —
you cannot use it subsequently in a CA-Clipper application
without further programming.
F3 Create
F3 Create allows you to create and modify database and index
files. The menu contains the following items:
• Database
• Index
Database
Field N a e
M Type Width Dec
•CUSTNUM • Character 5
NAME Character 50
ADDRESS Character 3Θ
CITV Character 3Θ
STATE Character 2
ZIP Character 9
16-18 CA-Clipper
The DBU Menus
The following table summarizes the keys that are available when
the Structure window is active:
Key Action
Enter Enter input mode; go to next column
Esc Abandon input mode without saving;
close Structure window without saving
F4 Close Structure window and save
Space bar Select next value in Type column
Up arrow Go to previous field definition
Down arrow Go to next field definition
Left arrow Go to previous column
Right arrow Go to next column
Insert Insert new field definition
Delete Delete current field definition
Home Go to first column
End Go to last column
Ctrl+Home Go to first column
Ctrl+End Go to last column
PgUp Scroll field definitions back
PgDn Scroll field definitions forward
Ctrl+PgUp Go to first field definition
Ctrl+PgDn Go to last field definition
For each field in the database file, you must define a field name
and data type. Then, depending on the data type, you may also
have to define the field width and number of decimal places.
Field Name To create a new field in the Structure window, move the
highlight to an empty row in the Field Name column and type
the field name. Field names can be up to ten characters in
length, must begin with a letter, and can contain letters,
numbers, and the underscore character only.
Type The Type column defines the data type of the field. In
CA-Clipper, the valid field types are as follows:
• Character
• Date
• Logical
• Memo
• Numeric
To select a data type for a field, highlight the Type column of the
field and type the first letter of the type you want. As an
alternative, you can press the Space bar to move through the
available data types until the one that you want is displayed.
16-20 CA-Clipper
The DBU Menus
Width The Width column defines the length of the field. For date,
logical, and memo fields, DBU assigns the column width
automatically as 8 , 1 , and 10, respectively.
Decimals The Dec column is for numeric fields only. It defines the number
of decimal places allowed in the field.
The number that you enter in this column must be at least two
less than the field width. Thus, it can range between one and 17,
but the actual range depends on the current field width. Like
Field Name and Width, Dec behaves like a fill-in field in a dialog
box—just start typing for a new value or press Enter first to edit
the current value.
Inserting and Deleting To insert a new field when you have one or more field
Fields definitions already in the Structure window, highlight the field
before which you want to insert the new field and press Insert.
An empty row opens up, and all existing fields move down one
space.
Saving the File Structure When you have made all of the changes that you want to the
database file structure, you can choose to either save the changes
or abandon them altogether.
To abandon all changes and return to the main screen, press Esc.
A prompt is displayed for you to confirm your choice.
16-22 CA-Clipper
The DBU Menus
Index
Index allows you to create a new index file or modify the key
expression of an existing one for the database file in the current
work area. To create a new file, move the highlight to an unused
slot in the Indexes column; to modify an existing index key
expression, make sure the index file is open in one of the Indexes
columns and highlight its file name. Selecting this menu item
activates a dialog box where you can enter an index file name
and key expression:
KEV CUSTNUM
Mnm Cancel
You can select the file name from a scrolling list or type it
directly into a fill-in field. If an open index file is currently
highlighted on the main screen, its name (and key expression)
automatically appear in the dialog box. If you change the file
name, a new index file is created with that name; otherwise, the
current index file is recreated. If there is no current index file
when you make the menu selection, no file name appears, and
you must provide one.
You type the index key expression into a fill-in field. If there is
already a key expression present, you can edit it by pressing
Enter before you begin typing.
When you select OK in the Create Index dialog box, the file is
created and opened in the currently highlighted slot.
F4 Save
F4 Save allows you save a newly created or modified database
file structure to a (.dbf) file or to save the view defined on the
main screen to a (.vew) file. The menu contains the following
items:
• View
• Struct
View
BTl Cancel
When you select OK, a view file (.vew) is created which you can
open and modify in DBU. You cannot, however, use a view file
outside of DBU in a CA-Clipper application without further
programming.
Struct
Struct saves the database file structure that you are actively
creating or modifying in the Structure window. Selecting this
menu item opens a dialog box in which you can select a file
name from a scrolling list or type one directly into a fill-in field.
16-24 CA-Clipper
The DBU Menus
F5 Browse
F5 Browse allows you to view and edit data in a database file or
a view. The menu contains the following items:
• Database
• View
Database
Only those fields shown in the Fields area on the main screen are
available for editing. You can make changes to the existing
record simply by typing over the old information, and you can
add new records by moving the highlight below the last record
in the file. Pressing Delete marks the current record for deletion
or reinstates the record if it is already marked. (See Pack in the
F6 Utility section later in this chapter for information on how to
permanently remove records marked for deletion.)
View
View opens a Browse window for the entire view defined on the
main screen. All fields in the Fields area for all files in the Files
area are available for editing. The window behaves as if you
were editing a database file, except that you can neither edit data
from multiple files nor append new records.
Navigation and Editing The following table summarizes the keys that you can use when
a Browse window is active:
Key Action
Enter Enter input mode; go to next field
Esc Abandon input mode without saving;
close Browse window
Up arrow Go to previous record
Down arrow Go to next record
Left arrow Go to previous field
Right arrow Go to next field
Ctrl+Left arrow Pan screen to the right
Ctrl+Right arrow Pan screen to the left
Insert Toggle insert mode
Delete Toggle record delete status
Home Go to first field on the screen
End Go to last field on the screen
Ctrl+Home Go to first field
Ctrl+End Go to last field
PgUp Scroll records back
PgDn Scroll records forward
Ctrl+PgUp Go to first record
Ctrl+PgDn Go to last record
16-26 CA-Clipper
The DBU Menus
Editing Memo Fields You edit memo fields in a pop-up window. To open the
window, highlight the memo field. Then, press Enter or just start
typing.
Key Action
Enter Go to next line
Esc Close pop-up window without saving
Up arrow Go to previous line
Down arrow Go to next line
Left arrow Go to previous character
Right arrow Go to next character
Ctrl+Left arrow Go to first character of previous word
Ctrl+Right arrow Go to first character of next word
Insert Toggle insert mode
Delete Delete current character
Backspace Delete previous character
Home Go to beginning of line
End Go to end of line
Ctrl+Home Go to beginning of file
Ctrl+End Go to end of file
PgUp Scroll screen back
PgDn Scroll screen forward
Ctrl+PgUp Go to beginning of screen
Ctrl+PgDn Go to end of screen
Ctrl+B Reformat current paragraph
Ctrl+N Insert blank line
Ctrl+T Delete next word
Ctrl+W Close pop-up window and save
Ctrl+Y Delete current line
F6 Utility
F6 Utility provides you with several batch database operations.
Each of the menu items listed below directly corresponds to a
CA-Clipper command of the same name:
• Copy
• Append
• Replace
• Pack
• Zap
• Run
Copy
To copy a file, move the highlight to the database file work area
that you want to copy—you cannot select Copy if the unused
work area is highlighted.
Selecting this menu item activates a dialog box where you can
enter a file name, FOR and WHILE conditions, a record scope,
and specify a text file by selecting SDF or DELIMITED:
SDF DELIMITED
Ok Cancel
16-28 CA-Clipper
The DBU Menus
You can select the file name from a scrolling list or type it
directly into a fill-in field.
Text Files If SDF or DELIMITED is selected, the scrolling list shows text
files (.txt); otherwise, it shows database files (.dbf). SDF and
DELIMITED are radio buttons—you can select only one at a
time. If one is selected, it is surrounded by a box as an indicator.
To select (or deselect) one of these buttons, highlight it and press
Enter.
FOR and WHILE are both fill-in fields where you enter
expressions to extract a logical subset of records from the file.
You must enter a valid logical expression.
While Condition A WHILE condition causes processing to begin with the current
record and continue only while the condition evaluates to true
(.T.). If both FOR and WHILE conditions are entered, WHILE
takes precedence over FOR.
After all controls are set, selecting OK creates the new file but
does not open it on the main screen.
Append
Replace
16-30 CA-Clipper
The DBU Menus
Selecting this menu item activates the dialog box shown below.
To perform the replace, you must select a field name from the
scrolling list and enter a WITH expression in the fill-in field. You
can optionally designate FOR and WHILE conditions and a
record scope.
Ok Cancel
The Field area in this dialog box is not a fill-in field; you must
select the field from the scrolling list. This is done as a
precaution to make sure that only valid field names are used.
Pack
Zap
Run
After the command that you enter has completed execution, you
are returned to DBU with a new prompt. At this point, you can
execute another command or press Esc to go back to the main
screen.
Warning! In order to use this menu item, you must have enough
available memory to load the other program.
16-32 CA-Clipper
The DBU Menus
F7 Move
• Goto
• Locate
• Skip
None of the items in this menu are available unless you have an
open Browse window on the screen (see F5 Browse earlier in this
section). All record pointer movement is performed in the
current work area or the first work area if you are browsing a
view.
Seek
When you select Seek, a dialog box opens and allows you to
enter an expression into a fill-in field. You must enter a valid
expression that matches the data type of the controlling index
key expression. Do not use quotes when seeking a character
expression:
Ok Cancel
Goto
Recordtt
Ok Cancel
Locate
Locate searches forward from the current record position for the
first record matching a logical search condition. When you select
this menu item, a dialog box opens and allows you to enter a
logical expression into a fill-in field:
Ok Cancel
Selecting OK locates the next record in the file that meets the
search condition and highlights it for editing in the window. If
not found, an error message is displayed, and the dialog box
remains open on the screen. You can either Cancel or enter a
new search condition.
16-34 CA-Clipper
The DBU Menus
Skip
Ok Cancel
F8 Set
• Relation
• Filter
• Fields
All of these menu items require at least one open database file.
Relation requires at least two, in addition to the possible
requirement of an index file.
To save the Set menu settings, you must select F4 Save View.
Otherwise, the settings will be lost when you exit DBU.
Relation
Relations
16-36 CA-Clipper
The DBU Menus
4. Type the relation expression, and press Enter when you are
finished.
At this point, you can press Down arrow and establish another
relation by repeating the steps above. If a particular database file
is the parent of more than one relation, a multiple parent-child
relation is established. Insert inserts a relation definition and
pushes existing ones down in the window, and Delete deletes the
current relation. You can establish up to 15 relations per view in
DBU.
The following table summarizes the keys that are available for
use when a Set Relation window is active.
Key Action
Enter Enter select mode; select parent or child;
exit select mode
Esc Exit select mode without saving; close Set
Relation window
Up arrow Go to previous relation
Down arrow Go to next relation
Left arrow In input mode, go to previous file
Right arrow In input mode, go to next file
Insert Insert new relation
Delete Delete current relation
PgUp Scroll relations back
PgDn Scroll relations forward
16-38 CA-Clipper
The DBU Menus
Filter
When you select Filter, a dialog box opens and allows you to
enter a logical expression into a fill-in field:
^HHBHIHUHil
Ok Cancel
Selecting OK activates the filter for the current file so that only
those records meeting the condition are available for processing.
If there is an error in the condition, an error message is
displayed, and the dialog box remains open on the screen. You
can either Cancel or enter a new condition.
Fields
Fields allows you to establish a field list for the current database
file. This menu item operates on the currently highlighted
database file, allowing you to set a field list for each open file.
Selecting Fields activates the Set Fields dialog box where you can
select a single field name to add to the current field list:
When you select OK, the field is inserted in the Fields section for
the current work area, pushing all other fields down one slot.
You can activate the Set Fields dialog box by pressing Enter or
Insert instead of using the menu. If you know the name of the
field that you want to include, you can also type it directly on the
main screen.
The fields list that you see on the main screen and that you
establish with the F8 Set Fields dialog box is used by F5 Browse
to determine which fields to show in the Browse window and in
what order. All other operations in DBU use all fields defined in
the database file structure.
16-40 CA-Clipper
The DBU System Architecture
• Dbu.prg
• Dbu.hlp
• Dbucopy.prg
• Dbuedit.prg
• Dbuhelp.prg
• Dbuindx.prg
• Dbunet.prg
• Dbustru.prg
• Dbuutil.prg
• Dbuview.prg
In This Chapter
CA-Clipper gives you the ability to create and modify standard
dBASE III PLUS report and label definitions by supplying a
report and label utility, RL. RL is a stand-alone application
written in CA-Clipper that emulates the dBASE CREATE I
MODIFY REPORT and LABEL commands.
RL creates a binary report (.frm) or label (.lbl) file, which you can
later use with the REPORT FORM or LABEL FORM commands
to format and print data on a record by record basis from one or
more open database files.
• Leaving RL
Like all other CA-Clipper utilities, you can execute RL from any
drive or directory since the appropriate directory was placed in
the PATH list during installation.
From there, you can create and modify report form (irm) files
that are executable with the REPORT FORM command. For
more information on the REPORT FORM command refer to the
"Language Reference" chapter of the Reference Guide.
17-2 CA-Clipper
Creating a n d Modifying Reports
Fl F2 F3 F4 F5 F6 F7 FIB
Help Report Groups ... Delete Insert Go To Exit
File MYFILE.FRh
Colunn 1
— Colunn Definition = Total 3
Contents 3£Q23^^^^^^^^^^^HIHI^IHHflillHHHfli^^^HiflflfllHBI
Heading
Contents Each column has a contents expression. It is here that you enter
the name of a field or a more complicated expression—you can
specify most data types, including memo fields. Values of each
data type display in the default format and alignment settings,
unless explicitly formatted. As a general rule, you can use the
TRANSFORM^) function to apply picture formatting to each data
type. Refer to the "Language Reference" chapter of the Reference
Guide for the syntax and arguments. Specific formatting
considerations for each data type are discussed below:
17-4 CA-Clipper
Creating and Modifying Reports
A grand total prints after all other report lines print and, if there
are Groups or Subgroups defined, a subtotal prints for each level
of grouping as well.
Deleting α Column
After you have added one or more column definitions, you can
delete any column you do not want in the report definition. To
delete the current column definition, delete the Contents
expression by pressing Ctrl+Y then use F5 Delete.
Since the format of the report directly relates to the order of the
column definitions, you may need to insert columns between
existing column definitions. To do this, position the cursor at the
desired location and use F6 Insert to insert a new blank column
definition. This new column becomes the current column. You
can then enter the column definition attributes.
Note: F6 Insert will not insert a column before the first column
definition in the report.
Locating a Column
17-6 CA-Clipper
Creating and Modifying Reports
Fl F2 F3 F4 FB F6 F7 F18
Help Groups Colunns ... ... Exit
File MYFILE.FRM
= Page Header =
Fornatting
Page Uidth Eg
Left Margin Κ
Right Margin Κ
Lines Per Page
Double Space ^
Printer Directives
Page Eject Before Print jj
Page Eject After Print S
Plain Page J
Page Header Prints a four line literal string on the top and center of each page
if the Plain Page option is Ν (the default setting). You can
achieve the same effect using the REPORT FORM command with
the HEADING clause.
Page Width Determines the number of characters allowed for the combined
widths of all report columns. The default is 80.
Lines Per Page Determines the total number of lines to print on each page of the
report. This number includes the page heading, column titles,
detail lines, and total lines. The default is 58.
Double Space Determines whether detail lines are double spaced when
printed. The default is N.
Page Eject Before Print Determines whether CHR(12), the formfeed character, is sent to
the printer prior to the first report line. You can override this
setting by specifying the NOEJECT clause on the REPORT
FORM command line. The default is Y.
Page Eject After Print Determines whether a formfeed is sent to the printer after the
last report line is printed. You cannot override this setting from
the REPORT FORM command line. The default setting is N.
17-8 CA-Clipper
Creating and Modifying Reports
Defining Groups
To create groups for the current report, use F3 Groups and the
following Group Definition screen displays:
Fl F2 F4 F5 F6 F18
Help Report ColuMns Exit
File MYFILE.FRM
Group Specifications :
Sub-Group Specifications
Sub-Group On Expression
Sub-Group Heading
The options that you can define on this screen are described
below:
Group on Expression Specifies the primary key expression to group on. This can be a
single field or any valid expression involving at least one field.
As an example, the group expression might be DeptNo so you
can generate column totals for each department.
Group Heading Specifies the title of the group as a literal string. This heading
prints before the first report line for each group and just to the
left of the group expression.
Summary Report Only Determines whether detail lines are printed in a grouped report.
If you specify Y, detail lines are suppressed and only group
header and summary lines print. The default is N. Specifying Y
is equivalent to specifying the SUMMARY clause on the
REPORT FORM command line.
Page Eject After Group Determines whether there is a page eject at the end of each group
of records. The default value is N. Specifying Y causes each
group to begin on a new page.
17-10 CA-Clipper
Creating and Modifying Reports
OK Saves all changes you have made to the report form (irm) file
and returns you to the main menu.
No Discards all changes, leaving the original report form file intact,
and returns you to the main menu. In the case of a new file, the
file is simply not created.
Cancel Returns you to the current screen where you can continue
editing the report definition.
Printing α Report
To print a report form within an application, you must have a
corresponding database file as well as an open index file if
grouping was specified. Substitute the appropriate filenames in
the following CA-Clipper commands and include the commands
in a program to print the report:
USE <xcDatabase> INDEX <xcIndex list> NEW
REPORT FORM <xcReport> TO PRINTER
Using a report form, you can print field information from more
than one work area by relating work areas using the SET
RELATION command. There are, however, several
requirements to make this work.
17-12 CA-Clipper
Creating and Modifying Labels
From there, you can create and modify label (.lbl) files executable
with the LABEL FORM command. For more information on
LABEL FORM refer to the "Language Reference" chapter of the
Reference Guide.
After you create a new or select an existing (.lbl) file to edit, the
Label Editor screen displays. This screen is divided into two
sections as shown below:
Fl FZ F3 FIB
Help Toggle Fornats Exit
File MVFILE.LBL
Difiensions Fornatting
I 1
Uidth Left Margin
Height Lines Between
Across Spaces Betueen
Contents
Addressl
AddressZ
TRIM(City) + " + State + " " + Zip
17-14 CA-Clipper
Creating and Modifying Labels
Across Determines the number of labels printed across the page. For
multiple across labels, the last label contents printed on a line is
trimmed automatically. This value can range from one to 255.
The default is one label across.
Left Margin Specifies the left margin and determines the first print position of
the leftmost label. When the labels are printed, this value is
added to the SET MARGIN value. This value can range from
zero to 255. The default is zero.
Spaces Between Determines the amount of vertical space printed between labels
if the number of labels across is greater than one. You can also
use this setting to set the left margin for labels after the first label.
Its value can range from zero to 255, and the default is zero.
3 1/2 χ 15/16 by 1 35 5 1 0 1 0
3 1 / 2 x 1 5 / 1 6 by 2 35 5 2 0 1 2
3 1 / 2 x 1 5 / 1 6 by 3 35 5 3 0 1 2
4 χ 17/16 by 1 40 8 1 0 1 0
3 2 / 1 0 χ 11/12 by 3 (Cheshire) 32 5 3 0 1 2
17-16 CA-Clipper
Creating and Modifying Labels
For each label line, enter the expression whose result you want to
print on that line. For example, a familiar label content might be:
TRIM(FirstName) + " " + LastName
Addressl
Address2
TRIM(City) + '\ " + State + " " + Zip
To enter the contents for a line, move the highlight to that line
and begin typing the expression. Pressing Enter moves the
highlight to the next line.
Blank Lines
Addressl
Address2
TRIM(City) + ", " + State + " " + Zip
OK Saves all changes you have made to the label form (.lbl) file and
returns you to the main menu.
No Discards all changes, leaving the original label file intact, and
returns you to the main menu. In the case of a new file, the file is
simply not created.
Cancel Returns you to the current screen where you can continue
editing the label definition.
17-18 CA-Clipper
Leaving RL
Leaving RL
When you have finished designing report and label definitions,
you can exit RL by selecting Quit or by pressing Esc from the
main menu.
• Rlfront.prg
• Rlback.prg
• Rldialg.prg
17-20 CA-Clipper
Chapter 18
Online Documentation-NG.EXE
In This Chapter
The CA-Clipper DOS-reference documentation is provided in
the form of several databases referred to collectively as The Guide
To CA-Clipper. It contains the most timely reference information
on CA-Clipper commands, functions, and utilities.
• Pass through mode where the Instant Access Engine loads and
then runs a specified application program and remains in
memory until the application program terminates.
Like all other CA-Clipper utilities, you can execute the Instant
Access Engine from any drive or directory since the appropriate
directory was placed in the PATH list during installation.
18-2 CA-Clipper
Loading the Instant Access Engine
While operating in the editor, you can activate the Instant Access
Engine at any time to view the current documentation database.
When you save the program file you are editing and leave the
editor, the Instant Access Engine is automatically removed from
memory.
Once the Instant Access Engine is loaded, you can access the
current documentation database by pressing the activation hot
key. The default hot key is Shift+Fl. If this conflicts with a key
used by another program, you can change it to a new value
using the Options Hot key menu item described later in this
chapter.
Note: If you are using DOS 5.0 or later, you must press Esc
immediately after Shift+Fl to activate the Instant Access Engine.
If you place the statement SWITCHES=/k in your CONFIG.SYS
file, you will not have to press Esc.
Important! The Instant Access Engine will not display if your screen
is currently in graphics mode. If the screen is in either EGA 43-line or
VGA 50-line mode, the Instant Access Engine will display using 24
lines only.
18-4 CA-Clipper
Using the Access Window
ABSO mm expression
Return the absolute ualue o f a nuneric
ACHOICEO Execute a pop-up Menu.
ACLONEΟ Duplicate * nested or nullLdlfiensional array
ACOPVO Copy elenents FroM one array to another
ADELO Delete an array elenent
ADIRO* Fill a series of arrays with directory information
AEUALO Execute a code block For each elenent in an array
AFIELDSO* Fill arrays with the structure of thE current database file
AFILLO Fill an array uith a specified value
AINSO Insert a NIL elenent into an array
ALERTO Display a sinple Modal dialog box
ALIASO Return a specified uork area alias
ALL TBI PIC) Relieve leading and trailing spaces from a character string
ALT D O Invoke The CA-Clipper Debugger
ARRAVO Create an uninitialized array o f specified length
ASCO Convert a character to its ASCII ualue
ASCANO Scan an array For a ualue or until a block returns true <,T.)
ASIZEO Grou or shrink an array
ASORTO Sort an array
ΑΤΟ Return the position o f a substring uithin a character string
18-6 CA-Clipper
Using the Access Window
Getting Help
• Menus
• Menu items
• Short entries
• Long entries
18-8 CA-Clipper
Viewing α Documentation Database
ABSO
[SEEDS!
Return the absolute ualue of a nuneric expression
ACHOICEO Execute a pop-up Menu
ACLONEΟ Duplicate a nested or nultidinensional array
ACOPVO Copy elenents Fron one array to another
ADELO Delete an array elenent
ADIRO* Fill a series of arrays with directory information
AEUALO Execute a code block Tor each elenent in an array
AFIELDSO * Fill arrays with the structure nf the current database file
AFILLO Fill an array with a specified ualue
AINSO Insert a NIL elerent into an array
ALERTO Display a sinple Modal dialog box
ALIASO Return a specified uork area alias
ALL ΤΗ I H O ReMove leading and trailing spaces fron a character string
ALTDO Intake The CA-C1 ipper Debugger 5j'
:
To navigate a short entry list, you can use the typical cursor
navigation keys (refer to the Instant Access Engine Navigation
Keys section later in this chapter) or the Search menu.
Once you have entered the search string, press Enter to perform
the search operation. Searching begins with the next entry and
continues to the end of the list. If there is no match, the search
continues from the top of the list.
Once you have located a short entry of interest, you can move to
a lower-level in the database hierarchy by executing the Expand
menu. The referenced entry can be another short entry list or a
long entry.
18-10 CA-Clipper
Viewing α Documentation Database
ΑΤΟ
Return the position of a substring uithin a character string
Syntax
Arguments
Returns
Description
Moving Up α Level
From any level in the database hierarchy, you can move up to
the previous level by pressing Esc. If you are currently located
in a long entry, this moves you up to the referring short entry
list. If you are at the top level of the database hierarchy, Esc
causes you to exit the Instant Access Engine altogether.
18-12 CA-Clipper
Viewing α Documentation Database
18-14 CA-Clipper
Configuring the Instant Access Engine
Continued
• Database
• Color
• Full screen F9
• Auto lookup
• Hot key
• Uninstall
• Save options
The Database and Full screen items have already been discussed.
The remaining options are discussed in this section.
Toggling Color
The Options Color menu item toggles color and is useful only if
you have a color monitor. A checkmark indicates that color is
on.
If Auto lookup is off, the entry highlighted when you last left the
Instant Access Engine is still highlighted when you reactivate it.
This menu item is very useful if you are accessing the Instant
Access Engine from your editor while writing or editing a
program. For instance, if you do not know the correct syntax for
a function you can type the function name and press Shift+Fl.
The function will be highlighted automatically and pressing
Enter zooms into the long entry for that function, allowing you to
view the function's syntax.
18-16 CA-Clipper
Configuring the Instant Access Engine
To change the hot key, press the new hot key or key combination
that you want to use. Pressing Enter confirms your choice, and
pressing Esc cancels any changes you have made.
Note: Since the Instant Access Engine hot key takes precedence
over your application program key definition for the same key,
be sure to choose a hot key that does not conflict with other
software that you are using.
While you are using the Instant Access Engine, items that you
change in the Options menu remain in effect until you remove
the Instant Access Engine from memory. If you want to save
your changes as the new default settings, execute the Options
Save options menu item. Then, the next time you load the
Instant Access Engine, these settings will be the default settings.
When you execute the Options Save options menu item, the
Instant Access Engine saves the current options in NG.INI,
located in the same directory as NG.EXE.
Note: In some cases, you may not be able to remove the Instant
Access Engine from memory. This may occur if you load
another memory-resident program after the Instant Access
Engine, and it is still memory-resident. If this happens, uninstall
the memory-resident program loaded after the Instant Access
Engine, then uninstall the Instant Access Engine. Failing this,
you may have to reboot your computer using Ctrl+Alt+Delete.
18-18 CA-Clipper
Appendix A
CLIPPER.BML
This appendix provides information about the resource files that
are included in the CLIPPER.BML bitmap library file. This file is
installed in the \CLIP53\LIB directory. A listing of the files in
CLIPPER.BML can be obtained by using the BMLDIR.COM
utility, which is also installed in the \CLIP53\BIN directory.
ARIAL04.FNT C_NEW14.FNT
ARIAL05.FNT C_NEW16.FNT
ARIAL06.FNT C_NEW20.FNT
ARIAL08.FNT C_NEW24.FNT
ARIAL10.FNT C_NEW30.FNT
ARIAL12.FNT CJMEW36.FNT
ARIAL14.FNT CJNEW40.FNT
ARIAL16.FNT SMALL06.FNT
ARIAL20.FNT TNR04.FNT
ARIAL24.FNT TNR05.FNT
ARIAL30.FNT TNR06.FNT
ARIAL36.FNT TNR08.FNT
ARIAL42.FNT TNR10.FNT
ARIAL43.FNT TNR12.FNT
C_NEW04.FNT TNR14.FNT
C_NEW05.FNT TNR16.FNT
C_NEW06.FNT TNR20.FNT
C_NEW08.FNT TNR24.FNT
C_NEW10.FNT TNR36.FNT
C_NEW12.FNT TNR43.FNT
A-2 CA-Clipper
CLIPPER.BML
ANTIQUE.FND FRESN.FND
BIGSF.FND ITALICFND
BLOCK.FND KIDS.FND
BOLD.FND NORMS.FND
BOXROUND.FND OCR.FND
BWAY.FND ROM8PIX.FND
CNTDOWN.FND ROMAN.FND
COURRIER.FND THIN1.FND
CURFONT.FND THIN2.FND
! (
#
* (comment), 2-8
# (not equal), 2-52 * (multiplication), 2-51
#include, 2-8, See also Header files, 10-14 ** (exponentiation), 2-51
**- (exponentiation and assign), 2-57
$ V (comment), 2-8
*= (multiplication and assign), 2-57
$ (substring), 2-52
+
%
+ (addition), 2-51
% (modulus), 2-51 + (concatenation), 2-50
%= (modulus and assign), 2-57 ++ (increment), 2-58
+= (addition and assign), 2-57
+= (concatenate and assign), 2-57
&
.ndx files, 2-109, See also Index files <= (less than or equal), 2-52
lndex-2 CA-Clipper
> I
? A
( AFILL(), 2-77
AINS(), 2-86
[] (array element), 2-60 Alias
expressions, 2-60
field, 2-55
Λ operator, 2-60, 2-101
ALTD(), 2-122,13-12
Λ
(exponentiation), 2-51 APPEND BLANK, 4-10
Λ
= (exponentiation and assign), 2-57 APPEND FROM, 4-4
application
controlling execution of, 13-9
{ viewing screen, 13-10
Application failures, 11-31
{} (array delimiter), 2-60, 2-80 ARRAYQ, 2-75, 2-77
{} (code block delimiter), 2-60, 2-89
lndex-4 CA-Clipper
BLINKER ENVIRONMENT CLIPPER, STACK, 12-37
12-9 UPPERCASE, 12-38
BLINKER ENVIRONMENT NAME, VERBOSE, 12-38
12-10 WORKFILE, 12-39
BLINKER ENVIRONMENT
Blinker functions, BLIVERNUM, 12-40
OVERRIDE, 12-11
BLINKER EXECUTABLE CLIPPER, Blinker, using, 11-5
12-12
BLINKER.TXT, 12-3
BLINKER EXECUTABLE NODELETE,
12-14 BML2RESGOM, 5-12
BLINKER LINK EMS, 12-14
BLINKER LINK PAGEFRAME, 12-15 BMLDIRGOM, 5-12
BLINKER LINK XMS, 12-15 Boolean algebra, 2-46, 2-53
BLINKER MESSAGE DUPLICATES,
12-16 BP, 13-14,13-22,13-58,13-66, See also Point
BLINKER MESSAGE NOBLINK, 12-17 Breakpoint
BLINKER MESSAGE NOWARNING, Branching, conditional, 2-25, 2-26
12-18
BLINKER MESSAGE WINK, 12-18 Breakpoints, 13-4,13-47,13-57,13-61,13-72,
BLINKER OVERLAY OPSIZE, 12-19 13-73,13-106,13-112
BLINKER OVERLAY PAGEFRAME, definition, 13-57,13-66,13-101
12-20 deleting, 13-22,13-59,13-66,13-69,
BLINKER OVERLAY THRESHOLD, 13-101
12-21 listing, 13-59,13-76
BLINKER OVERLAY UMB, 12-22 setting, 13-14,13-22,13-51,13-58,13-66,
BLINKER PROCEDURE DEPTH, 12-23 13-101
DEFINE, 12-24 Buffer, management in a network
DEFLIB, 12-25 environment, 4-8
ECHO, 12-25
ENDAREA, 12-26
EXTDICTIONARY, 12-26
FILE, 12-27
LIBRARY, 12-28
c
MAP, 12-29
MIXCASE, 12-29 CA-Clipper
MODULE, 12-30 5.01 or 5.01a
MURPHY, 12-32 linking, 11-15
NOBELL, 12-32 specifying, 11-15
NODEFLIB, 12-33 bitmap library, 1-1
NOEXTDICTIONARY, 12-33 CLIPPER.BML, 5-13,1-1
NOTABLEOFCONTENTS, 12-34 debugger, 11-33,11-34
OUTPUT, 12-34 procedure stack, setting maximum
READONLY, 12-35 depth, 11-23
SEARCH, 12-35 UNIVESA.EXE, 5-17
SECTION INTO, 12-36
lndex-6 CA-Clipper
Changing name of CLIPPERCMD, 10-3,10-4
BLINKER environment variable, 12-10
Closing files
CLIPPER environment variable, 11-16,
database, 2-112
12-9
index, 2-112
Changing the DOS Environment Size, 3-4 low-level, 2-126
Character string Code blocks, 13-5,13-60
comparison, 2-42, 2-43 and the macro operator, 2-72
constants, 2-41 as return values, 2-20
delimiters, 2-41 compared to macro expressions, 2-73,
fixed length, 2-40 2-89
literals, 2-41 compiling with macro operator, 2-68,
maximum length of, 2-40 2-95
operators, 2-50, 2-57 creating, 2-60, 2-89
precedence of operators, 2-62 evaluating, 2-90
table of operators, 2-50 evaluating for arrays, 2-82
variable length, 2-42 evaluating for database records, 2-109
example using, 2-92, 2-93
CHR(), 2-121
general discussion, 2-89
CL.BAT, 10-13,11-7 passing as parameters, 2-16
syntax for defining, 2-89
Class, See also Objects used to sort arrays, 2-87
definition, 2-96
variable scoping within a, 2-30, 2-90
CLD.LIB, 13-11,13-12 Code paging
command line syntax, 13-7 disabling, 12-9
CLEAR TYPEAHEAD, 2-123 enabling, 12-9
lndex-8 CA-Clipper
D separators, 2-43
validation, 2-44
DBAPPEND(), 4-10
Data structures, 2-40
dBASE III PLUS
Data type
database driver, 2-109
array, 2-40, 2-75
character, 2-40, 2-50 dBASE III PLUS compatibility
code block, 2-40, 2-89 compiling dBASE source code, 10-12
date, 2-43,2-51 CREATE LABEL, 17-1
general discussion, 2-40 CREATE REPORT, 17-1
logical, 2-46, 2-53 database file format, 2-105
memo, 2-42, 2-50 indexing, 2-109
NIL, 2-52 LABEL FORM, 17-16
numeric, 2-45, 2-51
DBEVALQ, 2-90, 2-109
object, 2-96
DBFNTX.LIB, 10-7,11-25,11-28
Database commands
syntax for specifying scope, 2-107 DBRLOCKQ, 4-9
table, 2-106
DBRUNLOCK, 4-11
Database files
DBSTRUCT(), 2-75, 2-77
attributes of, 2-106
closing, 2-112 DBU
creating in DBU, 16-18 appending to a file in, 16-30
definition, 2-105 Browse menu, 16-2,16-8,16-11,16-25,
general discussion, 2-100 16-33, 16-36,16-40
maximum number of open in DBU, Browse window, 16-25,16-33
16-10 browsing
modifying records, 6-13 a database file, 16-25
opening, 2-101 a view, 16-26
opening in DBU, 16-16 color settings, 16-2
operations, 2-106 copying a file in, 16-28
processing with DBEVAL(), 2-109 Create menu, 16-8,16-18, 16-24
saving structure in DBU, 16-24 creating
table of attributes, 2-106 database files in, 16-18
files, 16-18
Database functions,table, 2-106
index files in, 16-23
Database utility, 2-100, See DBU data types, 16-20
decimal restrictions, 16-21
Dates
dialog
blank, 2-44
boxes, 16-5
comparison, 2-44
controls, 16-5
constants, 2-43, 2-44
editing a memo field in, 16-27
literal, 2-43, 2-44
error messages, 16-5
operators, 2-51, 2-57
executing DOS commands from, 16-32
precedence of operators, 2-62
range of, 2-44
lndex-10 CA-Clipper
Device drivers, 11-46 CONFIG.SYS, 3-2, 3-12
RAMDRIVE.SYS, 11-47 default directory, 2-124
SMARTDRIVE.SYS, 11-47 error number, 2-127
VDISK.SYS, 11-47 ERRORLEVEL, 10-5,10-9,10-13,11-7,
11-10,14-5,14-6,14-7
DEVICE^ statement, 11-32
executing commands from DBU, 16-32
Dialog boxes, 13-45,13-54,13-55 file
attributes, 2-124
Directing output to a file, 2-119, See also
pointer, 2-125
Output to text file
file pointer, 2-126
DIRECTORY(), 2-75, 2-77 FILES setting, 3-3, 3-12
flushing buffers, 2-126
Disabling MEM command, 11-44
blinking eyes, 12-17 open mode, 2-124,4-4
menu items, 8-15 PATH, 11-8,15-2,15-5,16-2,18-1,18-2
processing of table of contents, 12-34 redirection, 10-9
use of EMS pageframe, 3-15 SHELL directive, 3-4
VM package, 11-22 used with a memory manager, 11-47,
warning messages, 12-18 11-48
winking during linking, 12-18 version requirements for networking,
DISPLAY, 4-4 4-3
lndex-12 CA-Clipper
modular programming, 9-2 Execution modes, 13-47
NETERR(), 9-37 animate mode, 13-47,13-51, 13-52,
on a network environment, 9-37 13-91,13-99, 13-105, 13-109
posted error block, 9-16 run mode, 13-48, 13-50,13-51, 13-106,
raising errors, 9-4 13-107,13-111
RMAKE, 14-5,14-7 single step mode, 13-49,13-51, 13-89,
runtime, 2-50, 9-1,10-6 13-110
SEQUENCE contstruct, 9-10 trace mode, 13-49,13-51,13-112
strategies, 9-1, 9-28
EXIT, See also DO WHILE, FOR
substitution, 9-8
VAL(), 9-23, 9-25, 9-28 Exospace commands
EXOSPACE EXECUTABLE CLIPPER,
Error messages
3-8
not a DOS/16M executable, 11-33
STACK, 11-23
not enough memory, 11-38
EXOSPACE PACKAGE NOVM command,
Error object
11-22
DefError(), 9-37
Error.ch, 9-24 EXOSPACE.EXE, 11-43
ERRORNEW0, 9-21, 9-23 command line syntax, 11-4
RECOVER, 9-32
EXOSPACE.LIB, 11-41
ERRORBLOCK(), 9-28
Expanded
EVAL(), 2-90 memory manager, 3-10, 3-12,11-38
memory usage,. 3-10, 3-12
Exclusive mode, 4-1, 4-3, 4-4
commands that require, 4-4 Expressions
displaying, 13-64
Executable files, See also runtime ,10-12
evaluation of, 2-48
default
general discussion, 2-39
extension, 11-8,11-29
inspecting, 13-51, 13-55
name, 11-4,11-8,11-29
passing as parameters, 2-16
discussion of runtime environment, 3-1
precedence used to evaluate, 2-63
generating, 11-4,11-8
requesting a segment map of, 12-29 EXTEND.LIB, 10-7, 11-25,11-28
searching for, 11-8
setting to read-only status, 12-35 Extended library dictionaries
specifying stack size of, 12-37 disabling processing of, 12-33
F, 3-12 FUNCTION
compiler implications, 10-8
FIELD alias, 2-33
Function keys, 13-22
Fields Ctrl+F5 Run Next, 13-48
declaring, 2-38 Fl Help, 13-16,13-41
passing as parameters, 2-16 F10 Trace, 13-49,13-51
F4 Application Screen, 13-52
FILE command, 11-24 F5 Execute Application, 13-48,13-50,
File DOS, 13-62,13-71 13-51
F7 Run to Cursor, 13-48
File Exit, 13-16,13-71 F8 Step, 13-49,13-51
File handle F9 Set/Delete Breakpoint, 13-22,13-51,
accessing a, 2-125 13-58,13-59
obtaining a, 2-124 programming, 2-123
specifying number at runtime, 3-12
Functions, See also Library functions,
File menu, 13-18 User-defined functions
DOS Access option, 13-71 calling conventions, 2-5, 2-17, 2-18
Exit option, 13-71 defining, 2-7
Open option, 13-72 executing, 13-53,13-64
Resume option, 13-73
File Open, 13-5,13-61,13-72, See also View,
See also View, 13-73
lndex-14 CA-Clipper
G Get system commands
@ GET, 7-7
@..GET, 7-9, 7-14, 7-18, 7-27
General Protection Fault interrupt, 11-33 CLEAR GETS, 7-18
READ, 7-7
Generating
a map file, 11-26 Get system functions
an executable file, 11-29 GETACTIVE(), 7-8, 7-10
GETAPPLYKEY(), 7-7, 7-25, 7-27, 7-31,
Get Class 7-32
data dictionary, 7-5 GETDOSETKEY(), 7-7
Get class GetNew(), 7-2
assign(), 7-6 GETPOSTVALIDATE(), 7-7
block, 6-13, 7-2, 7-3, 7-4 GETPREVALIDATEQ, 7-7, 7-25
buffer, 7-6 GETREADER(), 7-8, 7-25, 7-27, 7-32
cargo, 7-5, 7-27 READVAR(), 7-10
clear, 7-6, 7-32 Graphic mode
col, 7-2 bitmaps/icons, 5-9
colorDisp(), 7-6 BML2RESGOM, 5-12
colorSpec, 7-6 BMLDIR.COM, 5-12
decPos, 7-6 CLIPPER.BML, 5-13,1-1
display(), 7-6 common problems, 5-14
exported instance variables, 7-2 compiling and linking, 5-10
extending Read layer, 7-9 hardware compatibility, 5-17
insert(), 7-6 input/output system, 2-113, 5-2
messages, 7-22 invoking, 5-5
name, 7-2 memory allocation, 5-18
original, 7-6 overview, 5-2
overStrikeO, 7-6 pixel coordinates, 5-2
pos, 7-6 programming techniques, 5-4, 5-8, 5-9
row, 7-2 push buttons, 5-9
setFocus(), 7-6 RES2BML.COM, 5-11
setting and retrieving values, 7-4 row /column coordinates, 5-9
undo(), 7-6 shadowing restrictions, 5-7
unTransform method, 7-32 software compatibility, 5-16
varGet(), 7-4 troubleshooting, 5-14
varPut method, 7-32 UNIVESA.EXE, 5-17
varPut(), 7-4 using, 5-6
Get function layer, 7-31 utilities, 5-11
creating new, 7-32 VESA drivers, 5-17
VGA drivers, 5-17
Get system x/y coordinates, 5-9
code blocks, 7-14
SET KEY, 7-14 Guide To CA-Clipper, 18-1
using code blocks for WHEN/VALID,
7-14
High memory area, putting DOS code in, Insert mode, 13-33
11-47 Inspecting
High speed linking, 12-2 code blocks, 13-5
macros, 13-5
variables and expressions, 13-51,13-55
I Installation
default
directory structure, 11-11
IF, 2-25 default directory structure, 10-13,10-14,
11-7,11-10,15-2,15-5,16-2,18-1,18-2
IF()
in LABEL FORMs, 17-16 Instance variables, 2-98
in REPORT FORMs, 17-4 accessing, 2-99
assignable, 2-99
INCLUDE directory, 10-5,10-14
exported, 2-98
Increment operators, 2-58 syntax for assigning, 2-99
INDEX, 2-110, 4-4 syntax for retrieving, 2-99
lndex-16 CA-Clipper
Instances L
creating, 2-97
definition, 2-97
LABEL FORM, 4-4
creating, 17-1
ISCOLORO, 16-2 printing, 17-19
LAN, 4-1
J requirements for using CA-Clipper
with, 4-3
IOIN, 4-4 workstation requirements, 4-3
LEN(), 2-42, 2-84
Κ LIB directory, 3-4,11-10
Libraries
KEYBOARD, 2-121, 2-123 compared with packages, 11-21
controlling the, 2-120, 2-122 disabling processing of table of
number of programmable keys contents, 12-34
available, 2-123 Disabling use of extended library
polling the, 2-121 dictionaries, 12-33
programming, 2-123 Enabling use of Library extended
dictionaries, 12-26
Keyboard buffer
ignoring default library search records,
and function keys, 2-121
12-33
changing the size of, 2-120
locating and linking, 12-25
clearing the, 2-120, 2-121, 2-123
prioritizing symbols in, 12-35
disabling the, 2-120
third-party compatibility, 11-41
extracting a key from, 2-121
general discussion, 2-120 Library files
maximum number of characters in, embedded name in object file, 10-7
2-120 search paths, 11-10
minimum size of, 2-120 searching for, 11-10
reading pending key, 2-121 Library modules
returning last key extracted, 2-121 overriding linking sequence, 11-27
stuffing the, 2-121 specifying placement of, 12-30
KEYBOARD command, 7-10 Linker
Keyboard functions resolving external references, 10-7
INKEY0,2-120, 2-121
LASTKEY(), 2-121 Linking
ΝΕΧΤΚΕΥ0,2-121 CA-Clipper 5.01 or 5.01a, with, 11-15
object
files, 11-24
modules and libraries with script
files, 11-5
required library files, 11-25
sequence, overriding, 11-27
lndex-18 CA-Clipper
Make file, 14-2,14-6,14-10 Memory manager
comments in, 14-12 providing extended memory, 11-36
default extension, 14-8 searched in the CA-Clipper/Exospace
defining environment variables in, 14-12 environment, 11-45
DOS access from, 14-19 used with DOS, 11-47,11-48
example, 14-27
MEMOTRAN()
line continuation in, 14-11
searching for, 14-8 in REPORT FORMs, 17-4
using quotation marks in, 14-8,14-11,
MEMVAR, 10-4
14-12,14-20,14-23
Makepath,RMAKE macro, 14-8,14-12,14-21 MEMVAR alias, 2-33
Menultem class
Manifest constants, 13-6 caption, 8-7, 8-9, 8-13, 8-16
defining, 2-8,10-5 checked, 8-13, 8-14, 8-17
MAP command, 11-33 data, 8-3, 8-4, 8-8, 8-9
defining
MAP file menu commands, 8-2
finding module and routine errors, properties, 8-2, 8-9, 8-10
11-33 separators, 8-13
generating, 11-26 toggles, 8-13, 8-14, 8-17
disabling items, 8-15
Map files
enabled, 8-4, 8-15
default extension, 11-9
enabling items, 8-15
generating, 11-9
id, 8-9, 8-18
Mathematical operators, 2-51 isPopUpQ, 8-4
Menultem() function, 8-3, 8-5, 8-7, 8-8,
MEM DOS command, 11-44
8-9, 8-18
Memo fields message, 8-9, 8-17
and character strings, 2-42 overview, 8-1
comparison, 2-42, 2-43 shortcut, 8-8, 8-9, 8-16
maximum length of, 2-43 style, 8-16, 8-17
operators, 2-50
Menultem(), 8-3, 8-5, 8-7, 8-8, 8-9, 8-18
relationship to memo file, 2-105
MENUMODAL(), 8-17, 8-18
Memo files, See also .dbt files
general information, 2-105 Menus
accelerator keys, 8-2, 8-7, 8-12
MEMOREAD(), 4-4 actions for, 8-8
Memory activating, 8-17, 8-18
requirements, 11-43 cascading, 8-2, 8-15, 8-17
shortage, 11-32,11-38 colors for, 8-12
creating menu objects, 8-1
disabling items, 8-15
displaying, 8-17, 8-18
enabling items, 8-15
making selections, 8-2
lndex-20 CA-Clipper
Networking, 4-1 Norton guides
assigning rights, 3-18 navigation, 18-10
hardware requirements, 3-17
Not a DOS/16M executable error message,
runtime considerations, 3-17
11-33
NEXT, See also FOR
Not enough memory error message, 11-38
NG directory, 18-1,18-2
Notes on compatibility, 11-35
NG.EXE, See also Norton Guides, 18-1
Null
command line syntax, 18-2
date, 2-44
NG.INI, 18-17 string, 2-41
terminator, 2-40
NIL
as a return value, 2-5, 2-7, 2-20 Num, 13-88, See also Options Line
as an initializer, 2-6, 2-47, 2-77
Numeric
assignment, 2-47
comparison, 2-46
assignment to omitted parameters, 2-14,
constants, 2-45
2-19
limitations, 2-45
comparison, 2-47, 2-52, 2-83
literals, 2-45
operations, 2-52
operators, 2-51, 2-57
NOIDLE, 3-13 overflow in REPORT FORMs, 17-5
precedence of operators, 2-62, 2-64
Norton Guides, See also Guide To
precision, 2-45
CA-Clipper
range of values, 2-45
Access window, 18-5,18-6
storage format, 2-45
accessing, 18-3
table of operators, 2-51
configuration, 18-15
Expand menu, 18-5,18-6
getting help, 18-7
hot key, 18-3,18-17,18-18 Ο
Instant Access Engine, 18-1
leaving, 18-18
loading, 18-2 OBJ directory, 11-11
memory used by, 18-2 Object files
memory-resident mode, 18-2 default name, 10-2,10-7,10-9,10-15
menu bar, 18-5 embedding library name in, 10-7
menu bar navigation keys, 18-6 generating, 10-2,10-12
menu navigation, 18-6 reducing size of, 10-6
navigation, 18-14 search paths, 11-11
NG.INI, 18-17 searching for, 11-11
operation, 18-4 specifying a directory for, 10-7
Options menu, 18-5,18-6 specifying a name for, 10-7,10-15
pass through mode, 18-2,18-3 specifying name of, 12-27
Search menu, 18-5,18-9
syntax, 18-2
unins tailing, 18-18
lndex-22 CA-Clipper
Options Line, 13-92, See also Num Overlay pool,size of, 3-15
Options Menu, 13-93 Overlaying code,automatically, 11-2
Options menu, 13-18 Overriding default linking sequence, 11-27
Codeblock Trace option, 13-89
Color option, 13-90 Overview of Blinker, 12-2
Colors option, 13-44 Overview of CA-Clipper/Exospace, 11-2
Exchange Screens option, 13-91,13-105
Line Numbers option, 13-92 Overwrite mode, 13-33
Menu Bar option, 13-93
Mono Display option, 13-94
Path for Files option, 13-95 Ρ
Preprocessed Code option, 13-96
Restore Settings option, 13-97
Save Settings option, 13-98 PACK, 4-4
Swap on Input option, 13-99
Tab Width option, 13-100 Packages
compared with libraries, 11-21
Options Mono, 13-94 including in .EXE, 11-21
Options Path, 13-95 protected-mode support, 11-21
third-party libraries, 11-22
Options Preprocessed, 13-6,13-96
Pageframe
Options Restore, 13-14,13-97
for overlays, 12-20
Options Save, 13-14,13-98 use of, 12-20
Options Swap, 13-99 Paging system, support for, 12-2
Options Tab, 13-100 Parameter
Organization,manual, 1-1 declared, 2-14
definition of actual, 2-14
OS/2 Virtual DOS Machines, compatibility
definition of formal, 2-14
with CA-Clipper/Exospace, 11-49
methods of specifying, 2-14
OTHERWISE, See also DO CASE number passed, 2-14, 2-19
omitting, 2-14, 2-19
Output executable file
optional, 2-14, 2-19
specifying name of, 12-34
passing, 2-14, 2-19
Output to text file passing arrays as, 2-16, 2-18, 2-81
@...SAY, 2-119 passing by reference, 2-17, 2-18
console commands, 2-119 passing by value, 2-16, 2-18
Overlay passing code blocks as, 2-16
area,specifying end of, 12-26 passing fields as, 2-16
manager,forcing display of errors, 12-32 passing from DOS command line, 2-20
pool passing objects as, 2-16, 2-18, 2-97
adjusting opsize of, 12-19 passing with DO...WITH, 2-17
default size of, 12-19 PARAMETERS, 10-4
request size for, 12-19
Parentheses, and precedence, 2-49, 2-65
lndex-24 CA-Clipper
PROCLINE(), 2-123 R
PROCNAME(), 2-123
Program RAM, 11-2,11-22
comments, 2-8
multistatement line, 2-9 RAMDRIVE.SYS device driver, 11-47
termination, 2-122 Read layer, 7-17, 7-25, 7-27
Program editor, 15-1 ©...GET, 7-8
architecture, 15-5 creating, 7-19, 7-27
make file, 15-5 implementation rules, 7-18, 7-27
navigation, 15-3 implementation steps, 7-19
operation, 15-3 READMODAL, 7-8
source code, 15-5 SET MESSAGE TO, 7-22
syntax, 15-2 STD.CH, 7-8
lndex-26 CA-Clipper
#!, 14-19 Run Restart, 13-108
#else, 14-19,14-20,14-21
#endif, 14-19,14-20,14-21 Run Speed, 13-47, 13-51, 13-105, 13-109
#ifdef, 14-19 Run Step, 13-110,13-112
#ifeq, 14-20
#iffile, 14-20 Run To, 13-48,13-111
#ifndef, 14-21 Run Trace, 13-112
#include, 14-21
#stderr, 14-21 RUN, runtime implications, 3-5
#stdout, 14-21 Running
#undef, 14-22 an application using
RMAKE options, See RMAKE switches CA-Clipper/Exospace, 11-41
in protected mode, 11-2
RMAKE switches
/B, 14-4 Runtime
/D, 14-3,14-4,14-8,14-23 configuration, 3-7, 3-8, 11-16,11-17,
/F, 14-4,14-7,14-12 11-19
/1,14-5,14-15 configuring number of files at, 3-12
/N, 14-5 controlling extended cursor, 3-10
/U, 14-5,14-12,14-19 displaying memory configuration at,
/W, 14-5 3-12
/XS, 14-5 environment settings, 3-7, 3-8, 11-16,
/XW, 14-5 11-17, 11-19
excluding available memory at, 3-15
RMAKE.EXE, See also RMAKE general discussion of environment, 3-1
command line syntax, 14-2 list of parameters, 12-12
Routine errors, finding with MAP file, 11-33 preventing idle time detection at, 3-13
restoring EMM page frame, 3-10
Run Animate, 13-47,13-51,13-52,13-105 specifying dynamic overlay file handles,
3-10
Run Go, 13-48,13-50,13-51,13-106
specifying swap file location at, 3-14
Run menu, 13-18 specifying swap file size at, 3-14
Animate option, 13-105 specifying temporary file location at,
Go option, 13-106 3-14
Next option, 13-107
Restart option, 13-108
Speed option, 13-109
Step option, 13-110
To Cursor option, 13-111
Trace option, 13-112
Run Next, 13-48,13-107
lndex-28 CA-Clipper
Source files STORE, 2-55, 2-56
compiling, 10-12
editing, 15-1 Submenus, 8-2, 8-15, 8-17
line numbers, 10-6,10-7 Substring operator, 2-52
Specifying SUM, 4-8
.LIB, 11-2
.OBJ, 11-2 SWAPK, 3-14
CA-Clipper, 5.01 or 5.01a, 11-15 SWAPPATH, 3-14
case sensitivity, 12-29
conversion of symbols to uppercase, Symbol table, compression of, 12-2
12-38 Symbols
default converting to uppercase, 12-38
.EXE options, 11-18 prioritizing of, 12-35
drive of temporary workfile, 12-39 specifying symbols to be excluded,
end of overlay area, 12-26 12-24
executable file to be generated, 11-29
file name of temporary workfile, 12-39 System
files to be in external overlays, 12-36 hanging, 11-34
name of object files, 12-27 viruses, 11-33
name of output executable file, 12-34
object files to be linked, 11-24
path of temporary workfile, 12-39 Τ
required library files for linking, 11-25
setting to read-only status, 12-35
stack size of application, 11-30 Target file, 14-6,14-12
stack size of executable files, 12-37 creating, 14-8
suppressing of beep, 12-32 searching for, 14-8
symbols to be excluded, 12-24
XMS memory use, 12-15 TBColumn class
block, 6-13, 6-20
Specifying the Location of Executable Files, cargo, 6-12
3-4 colorBlock, 6-20, 6-23
Stack size defColor, 6-19, 6-20, 6-23
of application, 11-30 TBrowse
of executable files, 12-37 adding Color, 6-18
Standard header file,changing, 10-8 browsing search results, 6-30
browsing with Get, 6-13
Startup procedure, 10-6 Controlling highlight, 6-22
controlling scope, 6-24
Status information
Creating TBrowse Objects, 6-3
displaying, 12-38
DBEVAL(), 6-30
during linking, 12-38
multi-user applications, 6-9
STD.CH, 10-8 obtaining quicker response time, 6-8
Optimization, 6-7
Storage classes,defined, 2-27
repositioning record pointer, 6-10
lndex-30 CA-Clipper
lexically scoped, 2-6, 2-27
υ lifetime of, 2-29
local, 2-34
UNIVESA.EXE, 5-17 monitored, 13-37,13-51,13-82,13-83,
13-84,13-85,13-86,13-87
UNLOCK, 4-11 naming, 2-31
UPDATE, 4-4, 4-7 passing as parameters, 2-16
private, 2-36
and inline assignment, 2-57 public, 2-37
Upgrade offer, 12-3 scoping in code blocks, 2-30, 2-90
scoping of, 2-6, 2-27, 2-30
USE, 2-101, 2-110, 2-111,4-3, 4-4 static, 2-35
undefined, 2-47
User-defined commands, 2-89, 2-109
visibility of, 2-29
User-defined functions
calling conventions, 2-5 VCPI extended memory protocol, 11-44
declaring, 2-7
VDISK.SYS device driver, 11-47
executing, 2-5
passing arguments to, 2-14, 2-81 Version number
representing, 12-40
Using high memory area, 11-38 return as integer, 12-40
View, 13-112, See also File Open, 16-13,16-17,
V 16-24,16-35
definition, 16-3,16-9
View App, 13-52,13-114
VALTYPE()
and arrays, 2-75 View Callstack, 13-39,13-60,13-115, See also
used to test for omitted parameters, 2-19 Callstack
Variable names View menu, 13-18
changing of, 3-15 App Screen option, 13-114
resolving references, 2-32 Callstack option, 13-115
Sets option, 13-42,13-116
Variables
Workareas option, 13-43,13-117
ambiguous references to, 2-32
changing values of, 13-34,13-37,13-55 View Sets, 13-42,13-116
creating new, 13-56,13-64
View Sets window, See Windows
creation, 2-29
declaration, 2-6, 2-27, 2-33, 2-47 View Workareas, 13-43,13-117
definition of, 2-27
displaying, 13-64 View Workareas window, See Windows
dynamically scoped, 2-27 Viewing
field, 2-38 header files, 13-5,13-61,13-72,13-112
initialization, 2-33, 2-47 preprocessed output, 13-6,13-96
inspecting, 13-51,13-55 program code, 13-61,13-72,13-73,
13-105,13-112
program output, 13-52,13-91,13-114
lndex-32 CA-Clipper
χ
Χ, 3-15
XMS
enabling use of, 12-22
extended memory protocol, 11-44
maximum amount of, 12-8
minimum amount of, 12-8
specifying memory use, 12-15
ZAP, 4-4