Welcome to the Bartels Group of Companies
Interpreter - Deutsche Version Interpreter - English Version
Bartels

Bartels System GmbH
Bartels
Bartels AutoEngineer
BAE Product Info
BAE Price List
BAE Downloads
BAE Documentation
BAE Installation Guide
BAE User Manual
BAE Libraries
User Language Programmer's Guide
Preface
1 Introduction
2 Language Description
3 Programming System
3.1 Conventions
3.2 Compiler
3.3 Interpreter
3.3.1 Mode of Operation
3.3.2 Program Call
3.3.3 Error Handling
4 BAE User Language Programs
A Conventions and Definitions
B Index Variable Types
C System Functions
BAE Update History
BAE Next Version Release Notes Preliminary
BAE V8.0 Release Notes
BAE V7.8 Release Notes
BAE V7.6 Release Notes
BAE V7.4 Release Notes
BAE V7.2 Release Notes
BAE V7.0 Release Notes
BAE V6.8 Release Notes
BAE V6.6 Release Notes
BAE V6.4 Release Notes
BAE V6.2 Release Notes
BAE V6.0 Release Notes
BAE V5.4 Release Notes
BAE V5.0 Release Notes
BAE V4.6 Release Notes
BAE V4.4 Release Notes
BAE V4.2 Release Notes
BAE V4.0 Release Notes
BAE V3.4 Release Notes
BAE Support
BAE Contributions
BAE Development and Service Companies
Electronics Development
Bartels Sport Service
Company Profile
Corporate Info
Bartels :: Bartels AutoEngineer :: BAE Documentation :: User Language Programmer's Guide :: Programming System :: Interpreter
Bartels User Language - Programmer's Guide

3.3 Interpreter

Bartels AutoEngineer® Dokumentation

The Bartels User Language Interpreter is integrated to the Schematic Editor, the Layout Editor, the Autorouter, the CAM Processor, the CAM View module and the Chip Editor of the Bartels AutoEngineer. I.e., the Bartels User Language Interpreter can be used for calling Bartels User Language programs from each of these BAE modules.

 

3.3.1 Mode of Operation

The User Language Interpreter is activated by calling a User Language program from one of the valid interpreter environments. Any User Language program call is processed by applying the subsequently described sequence of operations.

Program Load, Dynamic Link

When calling a User Language program, the User Language Interpreter first of all must load the required User Language machine program with the specified program name from the ulcprog.vdb file of the BAE programs directory. The User Language Interpreter applies a compatibility check; a consistency check is not necessary since this time-consuming work has been carried out by the User Language Compiler already. A User Language program is compatible to and executable in the current interpreter environment, if the program's User Language Compiler version is equal to the User Language Interpreter version, and if the program only references index variable types and system functions which are implemented in the current interpreter environment.

Each User Language program can contain dynamic link requests, i.e. requests on binding User Language library machine code to program machine code at runtime. Dynamic linking is automatically applied during program load. Each dynamic link library (DLL) must be available, and the definitions (variables, functions, function parameters) provided with each DLL machine code must match its definitions at compile time (otherwise the Interpreter might try to access non-existent or wrong library objects, which would result in undefined behavior or even system crash with design data loss). The built-in linker of the User Language Interpreter checks on dynamic link library compatibility and refuses to run the program when encountering any inconveniences (error message Incompatible index/function reference(s)!). In case of incompatible DLLs, the User Language program must be recompiled.

Program Execution

After loading (and dynamically linking) the User Language machine program, the User Language Interpreter starts executing the program. Program execution can be understood to be the simulation of the User Language machine architecture by processing the instructions of the machine program. Program execution starts with the first machine program instruction and is completed when the program counter refers to a non-existent machine program instruction.

Program Termination

After executing the machine program a program termination must be applied to release the main memory allocated during program execution (Program Cleanup), and to remove the machine program from main memory (Program Unload).

 

3.3.2 Program Call

When calling a User Language program, the name of the program to be executed must be specified. This program name specification can be accomplished either explicitly or implicitly according to one of the subsequently described methods.

Menu Call

The Run User Script function from the File menu is used for explicit User Language program calls. The Run User Script function activates a dialog with a program name prompt and a List button for interactive User Language program selection:

FileLeft Mouse Button (LMB)
Run User ScriptLeft Mouse Button (LMB)
Program Name ?programname Return/Enter Key (CR)

Keyboard Call

One method of implicit User Language program call is provided by pressing special keys of the keyboard whilst working in the BAE function menu, i.e., this type of implicit User Language program call is possible at any time unless another interactive keyboard input currently is awaited by the system. The specification of the program name is accomplished implicitly by pressing a special key. Table 3-2 contains the list of key bindings provided with the User Language interpreter environments. Programs named bae_* have higher priority than those with module-specific names. When pressing one of the keys listed in table 3-2, the User Language program with the corresponding name is automatically started (if it is available).

Table 3-2: Key-driven Program Call

Key Designator Interpreter Environment / Program Name
BAESCMGEDARCAMCVCED
Function Key F1 bae_f1scm_f1ged_f1ar_f1cam_f1cv_f1ced_f1
Function Key F2 bae_f2scm_f2ged_f2ar_f2cam_f2cv_f2ced_f2
Function Key F: bae_f:scm_f:ged_f:ar_f:cam_f:cv_f:ced_f:
Function Key F12 bae_f12scm_f12ged_f12ar_f12cam_f12cv_f12ced_f12
Digit Key 0 bae_0scm_0ged_0ar_0cam_0cv_0ced_0
Digit Key 1 bae_1scm_1ged_1ar_1cam_1cv_1ced_1
Digit Key : bae_:scm_:ged_:ar_:cam_:cv_:ced_:
Digit Key 9 bae_9scm_9ged_9ar_9cam_9cv_9ced_9
Standard Key a bae_ascm_aged_aar_acam_acv_aced_a
Standard Key b bae_bscm_bged_bar_bcam_bcv_bced_b
Standard Key c bae_cscm_cged_car_ccam_ccv_cced_c
Standard Key : bae_:scm_:ged_:ar_:cam_:cv_:ced_:

Event-driven Program Call

The User Language Interpreter environments are featuring event-driven User Language program calls, where User Language programs with predefined names are automatically started at certain events and/or operations such as after BAE module start, after loading and/or before saving a design element, when changing the zoom factor or when selecting a toolbar item. Table 3-3 lists the assignment of predefined User Language program names to corresponding interpreter environment events and/or operations. Programs named bae_* have higher priority than those with module-specific names. The BAE module start User Language program call method is most useful for automatic system parameter setup as well as for key programming and menu assignments (see also below). The element save and load program call methods can be used to save and restore element-specific parameters such as the zoom area, color setup, etc.

Table 3-3: Event-driven Program Call

Event Interpreter Environment / Program Name
BAE SCM GED AR CAM CV CED
On BAE Module Start bae_st.ulc scm_st ged_st ar_st cam_st cv_st ced_st
Before BAE Module Exit bae_exit.ulc scm_exit ged_exit ar_exit cam_exit cv_exit ced_exit
After Element Load/Close bae_load.ulc scm_load ged_load ar_load cam_load cv_load ced_load
After Element Creation bae_new.ulc scm_new ged_new ar_new cam_new cv_new ced_new
Before Element Save bae_save.ulc scm_save ged_save ar_save cam_save cv_save ced_save
After Element Save bae_savd.ulc scm_savd ged_savd ar_savd cam_savd cv_savd ced_savd
On Dialog Activation bae_dial.ulc scm_dial ged_dial ar_dial cam_dial cv_dial ced_dial
On Toolbar Selection bae_tool.ulc scm_tool ged_tool ar_tool cam_tool cv_tool ced_tool
On Zoom Factor Change bae_zoom.ulc scm_zoom ged_zoom ar_zoom cam_zoom cv_zoom ced_zoom
On Mouse Interaction
(left mouse button click)
bae_ms scm_ms.ulc ged_ms.ulc ar_ms.ulc cam_ms.ulc cv_ms.ulc ced_ms.ulc
On Frame selection with mouse bae_rect.ulc scm_rect ged_rect ar_rect cam_rect cv_rect ced_rect
After Symbol/Part Placement bae_plc scm_plc.ulc ged_plc.ulc ar_plc     ced_plc
After Group Load Operations bae_grpl scm_grpl.ulc ged_grpl       ced_grpl
On Incoming Message
(BAE HighEnd)
bae_msg scm_msg.ulc ged_msg.ulc ar_msg cam_msg cv_msg ced_msg

Key Programming and Menu Assignments

Bartels User Language provides system functions for performing key programming and defining menu assignments. It is possible to define key bindings such as key m for activating the mirron User Language program or key U for activating the Undo BAE menu function. New or existing menus and/or menu entries can be (re-)configured to support special User Language program and/or BAE menu function calls. These features provide a powerful tool for configuring the menus of the AutoEngineer modules with integrated User Language Interpreter. It is a good idea to utilize the User Language startup programs for performing automatic key binding and menu setup. For an example on how to provide key bindings and menu assignments see the uifsetup User Language program distributed with the BAE software; this program is indirectly called from the startup programs listed in table 3-3. Even dynamic changes to the AutoEngineer user interface can be supported with special User Language programs for performing online key and menu programming. See the keyprog User Language program for implementations of online key programming facilities.

Menu Function Key Bindings

The keyprog key programming utility available through key 5 can be used in BAE pulldown menu interfaces for assigning BAE menu functions to keys by chosing Key Programming and Set HotKeys, double-clicking a key, clicking the Menu Selection button in the program menu and selecting the desired BAE menu function.

Macro Command Interpreter

A macro command interpreter is built into the Run User Script, function, the ulsystem User Language system function, the bae.ini key and menu function assignment facilities and the keyprog online key programming utility to allow for the specification of interaction/command sequences (macros) instead of User Language program names. Intercation codes must be separated with the : character. The p prefix is used to identify User Language program names (this prefix should be omitted if the User Language program name is the first item in the macro). The # prefix emulates a bae_callmenu User Language function call for activating a BAE menu function. Text input is specified through single-quoted strings. t awaits user text input. s activates a menu selection, which, if followed by l, m or r and a (zero-based) menu index triggers a menu function similar to a bae_storemenuiact function call. m awaits a mouse click, which, if followed by l, m or r, triggers a mouse click with input coordinates retrieved from the mouse position at the beginning of the interaction sequence if the mouse key in the macro isn't followed by coordinate specifications.

With macro specifications, it is possible to assign submenu functions such as Symbol/Label Query (macro scmpart:s5:m:t:mr) to keys. It is also possible to define macros for frequently required interaction sequences such as the Schematic Editor macro #500:m:mr:sl3:'4':'0':mr:sl0 for creating a 4mm horizontal graphic line from the current mouse position to the right (SCM symbol graphic pin connection).

Customized Parameter Settings and Menu Configurations

Customized parameter settings, key definitions and menu assignments can be stored to the bae.ini file in the BAE programs directory. The definitions from this file are loaded once upon BAE startup and can subsequently be accessed with the varget User Language system function.

The BAE User Language programs are designed to evaluate relevant definitions from bae.ini. Changes to bae.ini are activated by simply restarting the affected BAE program module, thus eliminating the need to recompile any of the affected User Language programs. I.e., with bae.ini, user-specific parameter settings can easily be transferred between different BAE versions and/or installations.

The bae.ini file provides specific sections for different BAE program modules. Each BAE program module only loads relevant sections from bae.ini. The definitions from the std section are relevant for all modules.

bae.ini allows for generic parameter value assignments. The key and fkey commands are used for standard and function key assignments. The addmenu, addmenuitem, addsmenuitem and addioitem kewords allow for menu extensions. Please note that menu items can only be appended to main menus and import/export menus. Menu item insertion is prohibited to preserve online help topic assignment.

A bae.ini file with inline documentation for command syntax explanation is supplied with the BAE software. The original version of this file activates the parameter settings from the supplied BAE User Language programs. I.e., these (default) settings are also activated if the bae.ini is not available in the BAE programs directory.

 

3.3.3 Error Handling

User Language Interpreter errors might occur whilst executing a User Language program call. These errors are reported to the interpreter environment, and a corresponding error message is displayed in the status line of the interpreter environment. The following listings contain all error message definitions of the User Language Interpreter.

Fatal Internal Errors

The following internal User Language Interpreter errors either refer to memory management problems or indicate User Language Interpreter implementation gaps; these errors are fatal, i.e., they force an abortion of the current interpreter environment:

ERROR : Out of memory!
ERROR : Unspecified User Language interpreter error!
ERROR : INTERNAL ERROR -- PLEASE REPORT!

Program Loader Errors

The following User Language Interpreter errors refer to program load failures or compatibility problems:

ERROR : Program 'n' already loaded (recursive call)!
ERROR : Program 'n' not found!
ERROR : Incompatible User Language program version!
ERROR : Incompatible index/function reference(s)!

Program Runtime Errors

The following User Language Interpreter errors refer to problems whilst executing a User Language program, i.e., they might occur at program runtime; these error messages include a program counter (PCl) indicating the corresponding machine program line which caused the errors (this information can be used for finding the location of the corresponding source code line if a listing file has been produced by the User Language Compiler):

(PCl) ERROR : Stack underflow (program structure damaged)!
(PCl) ERROR : Stack overflow!
(PCl) ERROR : Division by zero is attempted!
(PCl) ERROR : Function call error!
(PCl) ERROR : System function not available here!
(PCl) ERROR : System function not implemented!
(PCl) ERROR : User function not found!
(PCl) ERROR : Referenced function is of wrong type!
(PCl) ERROR : Invalid parameter for referenced function!
(PCl) ERROR : Memory protection fault on array access!
(PCl) ERROR : Array index out of range!
(PCl) ERROR : File access error!
(PCl) ERROR : File read error!
(PCl) ERROR : File write error!

Database Access Errors

The following User Language Interpreter errors refer to problems accessing the Bartels AutoEngineer design database (DDB); such errors might indicate an erroneous Bartels AutoEngineer software installation, if they occur whilst loading a User Language program; a database access error occurring whilst program runtime usually is caused by an implementation error in the executed User Language program:

ERROR : Cannot create database file 'n'!
ERROR : Read/write error whilst accessing file 'n'!
ERROR : Too many open files!
ERROR : File 'n' is not a database/DDB file!
ERROR : File structure is damaged in file 'n'!
ERROR : File structure is erroneous in file 'n'!
ERROR : Function not available for old format!
ERROR : Database limit exceeded!
ERROR : File 'n' is not compatible with program version!
ERROR : Element 'n' not found!
ERROR : Element 'n' exists already!
ERROR : File 'n' not found!
ERROR : Record end reached!
ERROR : Unspecified database error!
Bartels :: Bartels AutoEngineer :: BAE Documentation :: User Language Programmer's Guide :: Programming System :: Interpreter

Interpreter
© 1985-2017 Oliver Bartels F+E • Updated: 11 October 2010, 10:33 [UTC]

© 1985-2017 Oliver Bartels F+E Bartels Homepage Contact and Corporate Info

Web Development by Baumeister Mediasoft Engineering

Interpreter - Deutsche Version Interpreter - English Version