HFORTH: A High Level Business Language in FORTH Pierre Moreton 990 Arnold Way San Jose, CA 95128



Similar documents
How to change the decimal precision of qty, price and cost in the PROMPT Inventory System

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Microsoft Access is an outstanding environment for both database users and professional. Introduction to Microsoft Access and Programming SESSION

Producing Listings and Reports Using SAS and Crystal Reports Krishna (Balakrishna) Dandamudi, PharmaNet - SPS, Kennett Square, PA

Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick Reference Guide

The Clean programming language. Group 25, Jingui Li, Daren Tuzi

Importing and Exporting With SPSS for Windows 17 TUT 117

P/O Forms Printing Enhancement PO-1012

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

MODULE 7: TECHNOLOGY OVERVIEW. Module Overview. Objectives

MAKER FOR VTIGER CRM

S7 for Windows S7-300/400

Engineering Change Order

In the same spirit, our QuickBooks 2008 Software Installation Guide has been completely revised as well.

Intro to Excel spreadsheets

Sources: On the Web: Slides will be available on:

SPSS: Getting Started. For Windows

Configuration Management: An Object-Based Method Barbara Dumas

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Sequential Program Execution

PRT-CTRL-SE. Protege System Controller Reference Manual

Memory Systems. Static Random Access Memory (SRAM) Cell

DBF Chapter. Note to UNIX and OS/390 Users. Import/Export Facility CHAPTER 7

Database Query 1: SQL Basics

INTEGRATING MICROSOFT DYNAMICS CRM WITH SIMEGO DS3

for Sage 100 ERP Library Master Overview Document

Microsoft Access 2010 Part 1: Introduction to Access

NASA Workflow Tool. User Guide. September 29, 2010

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Xcode User Default Reference. (Legacy)

USER CONVERSION P3, SURETRAK AND MICROSOFT PROJECT ASTA POWERPROJECT PAUL E HARRIS EASTWOOD HARRIS

Exercise 4 Learning Python language fundamentals

Knocker main application User manual

Component, Model and Library Concepts

Windows 95: Features. Windows. Introduction. Minimum System Requirements. The Desktop. Where to Start

Windows File Management A Hands-on Class Presented by Edith Einhorn

The Design of a Graphical User Interface for a Network Management Protocol

MAS 90 Demo Guide: Accounts Payable

Forms Printer User Guide

Vim, Emacs, and JUnit Testing. Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor

Cataloging: Save Bibliographic Records

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

So today we shall continue our discussion on the search engines and web crawlers. (Refer Slide Time: 01:02)

Special Edition for FastTrack Software

MAKER FOR VTIGER CRM

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

Visual Basic Programming. An Introduction

C++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output

Applications Development

Java in Education. Choosing appropriate tool for creating multimedia is the first step in multimedia design

A L E P H 5 0 0, V E R S I O N Vendors in Acquisitions

Introduction to IBM SPSS Statistics

Access Tutorial 1 Creating a Database. Microsoft Office 2013 Enhanced

Accounts Payable Invoice Data Import AP-1012

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

MICROSOFT ACCESS A. CREATING A DATABASE B. CREATING TABLES IN A DATABASE

EDI Advantage Integration SO-1184

FEEG Applied Programming 5 - Tutorial Session

BARCODE LABELING SOFTWARE

Hermes.Net IVR Designer Page 2 36

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

KB_SQL SQL Reference Guide Version 4

Python Programming: An Introduction to Computer Science

TNM093 Practical Data Visualization and Virtual Reality Laboratory Platform

Tips and Tricks SAGE ACCPAC INTELLIGENCE

SQL Server An Overview

Section of DBMS Selection & Evaluation Questionnaire

M O D U L E - 7 E Model CS-Caliprompter Operator s Manual

Guide to Performance and Tuning: Query Performance and Sampled Selectivity

MEDIAplus administration interface

Library Management System

WESTMORELAND COUNTY PUBLIC SCHOOLS Integrated Instructional Pacing Guide and Checklist Computer Math

1 Using a SQL Filter in Outlook 2002/2003 Views. 2 Defining the Problem The Task at Hand

Hitachi Universal Storage Platform V Hitachi Universal Storage Platform VM Hitachi Data Retention Utility User s Guide

Website Development Komodo Editor and HTML Intro

Moving from CS 61A Scheme to CS 61B Java

Programming LEGO NXT Robots using NXC

Access Queries (Office 2003)

Maitre D Back Office User Manual

Creating Drawings in Pro/ENGINEER

pc/mrp RELEASES 8.60 VERSION

Operating Systems 4 th Class

Microsoft Access Basics

Simple Document Management Using VFP, Part 1 Russell Campbell russcampbell@interthink.com

Functions of NOS Overview of NOS Characteristics Differences Between PC and a NOS Multiuser, Multitasking, and Multiprocessor Systems NOS Server

OPERATING SYSTEM SERVICES

13 File Output and Input

Microsoft Access 3: Understanding and Creating Queries

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code

ECE 341 Coding Standard

Point of Sale Procedures. Quick Reference

Introducing XERA TM POS

Chapter 13: Program Development and Programming Languages

Access Tutorial 3 Maintaining and Querying a Database. Microsoft Office 2013 Enhanced

FINACS INVENTORY Page 1 of 9 INVENTORY TABLE OF CONTENTS. 1. Stock Movement Physical Stock Adjustment...7. (Compiled for FINACS v 2.12.

Printer Connection Manager

TMA Management Suite. For EAD and TDM products. ABOUT OneAccess. Value-Adding Software Licenses TMA

Tutorial 3 Maintaining and Querying a Database

Transcription:

Proceedings of the 1985 Rochester Forth Conference 37 HFORTH: A High Level Business Language in FORTH Pierre Moreton 990 Arnold Way San Jose, CA 95128 ABSTRACT A presentation of some features of HFORTH, a high level business language written in FORTH, some recent applications, and the extension to THE ROBOT, a menu driven program generator. INTRODUCTION FO RTH has demonstrated the interest of its concepts essentially in the scientific domain, in process control and in graphics. Its main arguments are speed, compactness, and interactivity. However, I have spent over seven years using FORTH exclusively for writing business applications, a domain for which FORTH was not originally designed, and where none of these characteristics are critical. I selected the language for other original features it has: 1) the capability to easily define a very high level, English-like language on top of it, to which anyone can be trained in a couple of hours. 2) the ease of building a library of standard business routines, so that a new application can be written from existing modules. 3) the impressive flexibility to change any feature of an application. 4) the portability of the resulting packages. The main characteristic of the business software, in vertical markets like banking, insurance, real estate, medical analysis, law offices, and food industries, in which I have been involved, is that the specifications are continually changing. This is because the user does not really know what he wants until he actually uses the product, because each user has his own way of managing his business, and because his needs are in constant evolution. Looking back to all these applications, for which the size of the compiled code varies from 300k to 2000k, it seems to me that the major desirable points of a business language are: 1) speed of development, provided by a very high level set of business oriented instructions. 2) low cost for entirely modifying an application, even in a final stage, provided by a straightforward readable syntax. This paper is about the steps accomplished in this direction.

38 The Journal of Forth Application and Research Volume 3 Number 2 The structure of the system is the following: user program or generated program THE ROBOT Program generator HFORTH MFORTH KFORTH high level language multiuser database any type of FORTH HFORTH This language is intended to be used by programmers, totally ignoring what FORTH is about. It is made of about 120 basic words with which any business application (so far) can be written. For very specific functions, or in the very rare cases where speed may become critical, the underlying FORTH can be used and mixed in the HFORTH code. I do not intend to give here a tutorial on HFORTH, but examples in two areas, data declarations and files, show some significant caracteristics and explain why it is so cost effective to program in HFORTH. In what follows the HFORTH words are underlined. 1. Data Declarations The basic syntax is v CLIENT# :N: 50 where V is a defining word for an HFORTH variable. N means that the preceding variable is numerical, in this case with 5 integers and 0 decimals. This will be used to control the entry format and to display accordingly, although all the numbers are internally handled in double precision marks the end of the definition. There are four basic types of HFO RTH variables: Numerical, as above Strings (text) V NAME T : 21 Dates - -- V DATE.OF.BIRTH : D : Boolean (true or false)-with LOGIC MARRIED 6 0 : TEST-DATE: DIS-DATE another defining word Automatic Controls To the variable can be attached two optional procedures, as above in the definition DATE.OF.BIRTH. The first one will be executed at entry time, in addition to the simple format checking, to control that the entered value conforms to some special characteristic. TEST-DATE is an HFORTH

Proceedings of the 1985 Rochester Forth Conference 39 word which controls that the entered number is consistent with a date and stores it as an absolute day on which calculations can be performed. The second one redisplays the entered value as desired. DIS-DATE is an HFORTH word which redisplays the date with slashes and the name of the day of the week. The control procedures can be either existing HFORTH words or further defined by the programmer: V FAMILY-SITUATION: T. 2: CTL.SIT : DIS.SIT with :CONTROL CTL.SIT 1.. IF( ENT-VALUE =/= " MA " AND - ENT-VALU~~" sf ")TRUE " Enter MA or SI please.:. -> TEXT-ERROR THEN An entry not equal to MA or SI will issue the above message and will prompt for another entry. L :DISPLAY DIS.SIT ACCORDING-TO DIS-VALUE VALUE" MA " ==> PRINT" Married" VALUE'" SI I' ==> PRINT I' Single.:. END-VALUES In this example the content of the variable never appears to the user because it is displayed differently. These HFO RTH procedures have a strong flavor of FO RTH, because the. and ; are used the same way, but they show the use of some HFORTH words, which have the "natural" notation instead of RPN. ENT-VALUE and DIS-VALUE are general names that replace any HFORTH variable and take all its characteristics (dynamic vectoring). It allows one to build libraries of procedures of general use. In the above example, if we wanted the progi!am to accept more than these two programmed values, but control that the entered value matches with a series of values stored in a file filled in by the user, this can be executed automatically if the definition mentions it: V PROFESSION.CODE : T : 3.. TABLE PROFESSIONS In this case the system will forbid any entry of a value which does not exist in the named file (PR OFES SIONS) and if this value exists, the system will display the field of its related file which is associated with THE-KEY, called its REFERENCE (PROFESSION.NAME, for instance). At entry time some essential commands are built in: * If the user wants to enter a value which has not yet been entered in the related file, typing a * will open a window to add a new entry in this file, and the entry of-this value will then be permitted without

40 The Journal of Forth Application and Research Volume 3 Number 2 interrupting the normal transaction. The word NO* can disable this remote creation (in file systems for instance).? The entry? will open a window to display all the keys of the related file and the entry of?xxx will display only the keys of this file starting with XXX. A last optional feature can be added to the data definition, which is the attribute HM meaning Help Message. This will display the data for which a help message, of variable length, can be entered by the word HMESSAGES and stored in a file independently from the code. The appropriate message will be displayed when typing? instead of an entry for this data. It supercedes the listing of a related file in case both attributes are given to a datum. All these attributes that can be given to a variable at definition time are stored in the parameter field, of variable length, and executed automatically, without any additional code. 2. Files All the business applications use a great number of data files, and the need for high level words to manipulate them is obvious. 2.1 Declarations The typical syntax is un STR CLIENTS ORO CLIENT# RFR NAME DATE.OF.BIRTH FAMILY.SITUATION PROFESSION END-STR This descriptor is a logical file called structure. By its label (here 101) it is assigned, through a table (unknown by the programmer) of assignments, to a physical file on disk. The assignment of the physical file is done by 101 LABELFILE C:PCLIENTS assuming that the file PCLIENTS has been created on disk. This assignment can be changed dynamically by a command like 102 ASSIGN CLIENTS. STR is a defining word for the name of the structure (CLIENTS). ORO means that we want a file ordered (balanced AVL tree) by the key whose name follows (CLIENT#). RFR means that we want to associate the field whose name follows to the key; that is to say, each time the program will mention PRINT CLIENT# it will display not only the content of CLIENT# but the NAME too. I call this feature automatic decodification. END-STR ends the definition and stores in the parameter field of

Proceedings of the 1985 Rochester Forth Conference 41 CLIENTS, in addition to the PFAs of all the fields, the type of file and the record length that it computes from each field. Each field can be given an attribute like AH always hidden AD always displayed OH optionally hidden OD optionally displayed This feature is of considerable interest in customizing a running application for a specific customer without either changing the code or recompiling, but as an installation procedure. 2.2 File Manipulation A set of very general words allow us to enlarge our library of modules: THE-KEY REFERENCE ENTER-RECORD prompts for an entry for each field of the record, and eventual modifications of the entries. Here are some examples of these words. : ADD L L ENTER-NEW-KEY \ prompts for the key field JUMP E"N'TER-NKEY <SECUR SAVE \ and controls that it does not exist \ = C R but scroll inside a window \ prompts for all other fields SECUR> \ stores the record under \ security protection : DISP IN CLIENTS \ makes this file current BEGIN ENTER-KEY \ accepts only an existing key WHILE( THE-KEY =/= BLANK )TRUE ACCESS \ reads disk and copy to files buffer DISPLAY-RECORD REPEAT OUT \ closes the file As these routines can be totally written in general terms, a super high level word MANAGE does all the usual actions on a file: ADD, UPDATE, DELETE, DISPLAY, for a given record, and LIST a series of records with the option to print or not. Example: V FILE.TO.MANAGE : T : 20 : RUN ENTER FILE.TO.MANAGE \ prompts for a file name IN [ FILE.TO. MANAGE ] \ makes this file current --\ by executing whatever is in the string between brackets MANAGE \ prompts for the action and executes it OUT

42 The Journal of Forth Application and Research Volume 3 Number 2 2.3 Relations Between Files They are automatic when the same field name belongs to two different files and is the key of one of them. They can be forced between fields with different names by the TABLE function discussed previously. All these instructions and functions considerably reduce the number of lines of code to write, and subsequently the time spent in coding and testing, which has alway been one of the important goals of FORTH. APPLICATIONS Here are two examples of applications written in HFORTH. 1. PERSONAL INJURY System for Law Offices This application manages the database of all the information involved in an action to sue for personal damages that occurred in an accident. The structure of the database is the following: courts attorneys 20 GLOBAL FILES general info. accident litigation closing n per each I claims n LETTERS with Tickles to anybody above I employers

Proceedings of the 1985 Rochester Forth Conference 43 2. FOOD Management System This application is used to build recipes made either of basic items or of other previously defined recipes. A menu is made of several recipes, a day is made of several menus, and finally a cycle is made of several days. An order can be entered at any level, and the system scales the various paths in units and quantities to give the order to the vendors, to the kitchen, and to the inventory. It also performs a Cost/Sales analysis. The basic database design is the following: units departments GLOBAL FILES cycle variable number of levels THE ROBOT THE ROBOT is a program generator which can generate business applications that do not require a complex database structure. It can, however, handle a 2 level tree structure, and any relation between an almost unlimited number of files. It includes a Report Generator and a Word Processor capable of retrieving any information from the database. Its features are very similar to DBASE II, but with a greater ease of use by the fact that it is entirely menu driven and does not require any programming at all. Here is the automatic documentation that the user gets from his entries in the generator.

44 The Journal of Forth Application and Research Volume 3 Number 2 SYSTEMS INC. THE ROBOT : BILLING DATE : 06/12/85 FILES Define the files DIP Display a record on printer Nbre : 7 FILE NAME LINES FILE CODE LIN [ MASTER FILE NAME ].INVOICES RECORD LENGTH 58 GENERATED? Yes L# FIELD NAME INDEX TYPE INT DEC CONTROL OlD FILES/CALCULAT KY CHRONO.LINES Yes Number 5 0 INC 03 INVOICES Yes Number 3 0 ENT 04 PRODOCT# Number 3 0 ENT 05 PRODUCT. NAME Text 25 RIM PRODOCTS 06 CATEGORY Yes Text 3 R/O PRODOCTS 07 UNIT.PRICE Number 3 2 R/M PRODOCTS 08 QUANTITY Number 3 0 ENT TO+ PRODOCTS 09 TOTAL. PRICE Number 5 2 CAL 07+08 TO+ PRODOCTS 10 AMOUNT Number 5 2 CAL 09 TO+ INVOICES REPORT DEFINITION : REPORT CODE LINl REPORT NAME..Ordered list of NAME (continued) LlNES FILE NAME.... LINES REPORT INDEX. INVOICE# REPORT WIDTH 72 GENERATED?. Yes NAME OF FIELDS INDEX SEQ TOTAL WIDTH HEADING 01 CHRONO.LINES Yes 2 7 CHRONO. 02 INVOICE# Yes 6 4 INV# 03 CATAGORY Yes 7 3 CAT 04 PRODUCT# Yes 8 4 PROD 05 PRODUCT.NAME 9 25 PRODUCT. NAME 06 UNIT. PRICE 10 7 UNIT.PR 07 QUANTITY 12 4 QUAN 08 TOTAL. PRICE 14 Yes 10 TOT. PRICE

Proceedings of the 1985 Rochester Forth Conference 45 The generator creates an HFO RTH source code from the specific entries of the user, which is then automatically compiled and unloaded on disk in various file overlays. The user menu is generated, too. For larger applications this code can be used as a basis, leaving to the professional programmer only the most complex part of the application. CONCLUSION These two products demonstrate, assuming this is still to be done, the high capability of FORTH to compete with the most popular products in a domain for which it was obviously never designed. I personally made the decision to develop all my tools and packages in FORTH in 1978, and today I am glad I did.

46 The Journal of Forth Application and Research Volume 3 Number 2