DMM Varkon® Tutorial
A Beginner's Guide to the Varkon Parametric Modeling and CAD Application Development System
By David M. MacMillan


4.3 projekt_1 in Detail

To aid in understanding what constitutes a simple Varkon application, let's take a look inside projekt_1.

The project consists of a number of files, but the "root" location is its PID file,

/home/you/varkon/pid/projekt_1.PID

When you tell Varkon to look for a project called "projekt_1" by clicking on its button (or by typing its name), Varkon takes the string "projekt_1" and looks for a file called projekt_1.PID in the default location for project PID files,

/home/you/varkon/pid/

projekt_1.PID has the following contents:

$VARKON_PRD/projekt_1/job
$VARKON_PRD/projekt_1/lib
$VARKON_PRD/projekt_1/sym
$VARKON_PRD/projekt_1/doc
$VARKON_PRD/projekt_1/mdf/projekt_1.MDF

The various lines of this PID file tell Varkon where to find the components of this project. This is such a simple project that in fact only the "job" and "mdf" lines are used; the "lib," "sym," and "doc" lines are, at this stage of complexity in the project, unused.

Perhaps the most important line of this PID file is the "mdf" line,

$VARKON_PRD/projekt_1/mdf/projekt_1.MDF

This line tells Varkon where to find the project's Menu Definition File (MDF). Taking a look at that file, we find that it contains only one line:

#include "$VARKON_MDF/v318.MDF"

"$VARKON_MDF" is set up in the Varkon startup script to be the directory:

VARKON_MDF=$VARKON_ROOT/mdf/english

Looking there, we find the file:

/usr/local/varkon_1.15C/mdf/english/v318.MDF

This file contains the following:

! This is VARKON's standard menufile for the
! X-Windows user interface.

! (C)Microform AB 1996

#include "$VARKON_MDF/x11.INC"
#include "$VARKON_MDF/menus.INC"
#include "$VARKON_MDF/texts.INC"
#include "$VARKON_MDF/plott.INC"

The "x11.INC" "menu" isn't really a menu in the ordinary sense of the word; rather, it sets up key bindings appropriate for the X11 window system. Similarly, the "texts.INC menu sets up the contents of message texts used by Varkon.

The "plott.INC menu sets up both message texts and actual menus used in plotting; we'll deal with plotting later.

The heart of the menu system, though, is the "menus.INC" file. This file sets up all of the visible menus which are made available to standard Varkon applications through the inclusion of v318.MDF. Note, however, that the menus it defines do not include the standard set of buttons that run down the left side of the Varkon drawing screen (ZOOM, Auto, Scale, Pan, Prev, View, Levels, Persp, Delete, Run, Edit P, MBS, Hide, Shade). These seem to be built in to Varkon.

As an example of what they do include, however, consider the "MAIN MENU 2D" which appears when jobb_1 loads.

This menu is defined in the menus.INC MDF file as:

m2 = "MAIN MENU 2D"
"create",m13
"edit",m15
"delete",m22
"variation",m34
"analysis",m75
"graphics",m66
"levels",m65
"attributes",m14
"mbs",m58
"file",m5;

In this definition, the menu is given the identifier "m2" (by convention, menu identifiers begin with "m") and the name "MAIN MENU 2D". Then the various buttons are defined by {name, link} pairs, where the name is the text that appears in the menu and the link is a link what the button does. In this case, all buttons invoke other menus.

Consider the final item on this menu, "file". This button is linked to menu "m5". Menu m5 in turn contains the following:

m5 = "FILE" "open",m47 "save",f175 "save as",m45 "delete",f184 "project",m7 "print",m71 "settings",m8 "macro",f152 "shell",f125 "exit",m46;

Tracing a path further, consider the final item on m5, "exit". This item is linked to menu "m46", which contains:

m46 = "EXIT" "save first",f122 "don't save",f123;

The buttons on m46, the "EXIT" menu, are linked not to other menus, but to Varkon functions; in this case, functions f122 (save and exit) and f123 (exit without saving).

So far, this project seems to consist of a lot of menu definitions but no actual content. The content of a Varkon project is actually a modular program in the MBS programming language. When available the source code for these programs is stored in the "$VARKON_PRD/projectname/mbs" directory (e.g. /home/you/varkon/app/projekt_1/mbs). This directory is defined in the project's PID file.

In the case of projekt_1, no source MBS code was present; instead, only the compiled MBS code was distributed. (Thus there was no definition of the MBS directory in the PID file.) However, it is still possible to read this source code. To do so, bring up varkon and open projekt_1 and jobb_1 as above. Then click on the "MBS" button in the vertical column of buttons on the left of the Varkon drawing window. This will bring up another window in which a session of the vi editor is running, opened on the MBS source code for this project. This MBS code is:

BASIC DRAWING MODULE jobb_1();


BEGINMODULE

text(#3,vec(32.37495543492, 86.653194922253), 0.0, "Welcome to VARKON !":
TFONT=1,PEN=4);

ENDMODULE

To exit this window, exit vi in the usual way (:wq). The redisplay contents of other Varkon windows seem to be disabled while viewing this MBS source code window.


Legal Matters

With the exception of any material noted as being in the public domain, the text, images, and encoding of this document are copyright © 1998 by David M. MacMillan.

The author has no relationship with Microform AB, and this Tutorial is neither a product of nor endorsed by Microform AB.

"Varkon" is a registered trademark of Microform AB, Sweden.

This document is licensed for private, noncommercial, nonprofit viewing by individuals on the World Wide Web. Any other use or copying, including but not limited to republication in printed or electronic media, modification or the creation of derivative works, and any use for profit, is prohibited.

This writing is distributed in the hope that it will be useful, but "as-is," without any warranty of any kind, expressed or implied; without even the implied warranty of merchantability or fitness for a particular purpose.

In no event will the author(s) or editor(s) of this document be liable to you or to any other party for damages, including any general, special, incidental or consequential damages arising out of your use of or inability to use this document or the information contained in it, even if you have been advised of the possibility of such damages.

In no event will the author(s) or editor(s) of this document be liable to you or to any other party for any injury, death, disfigurement, or other personal damage arising out of your use of or inability to use this document or the information contained in it, even if you have been advised of the possibility of such injury, death, disfigurement, or other personal damage.

All trademarks or registered trademarks used in this document are the properties of their respective owners and (with the possible exception of any marks owned by the author(s) or editor(s) of this document) are used here for purposes of identification only. A trademark catalog page lists the marks known to be used on these web pages. Please e-mail dmm@lemur.com if you believe that the recognition of a trademark has been overlooked.


Version 1.5, 1998/06/17. Feedback to dmm@lemur.com
http://www.database.com/~lemur/vk-projekt_1.html


Go to the: