Forth, metaWINDOW and GUI design

P. D. Lopez
{"title":"Forth, metaWINDOW and GUI design","authors":"P. D. Lopez","doi":"10.1145/199200.316996","DOIUrl":null,"url":null,"abstract":"ELUS by Eleusinian Enterprises is discussed as an example of a mixed language Forth implementation which include~ its own GUI toolkit, the Interactive Screen Designer. The linked Meta WINDOW graphics library (Meta graphics Software Corporation), makes the design and implementation of graphics application user interfaces possible, intuitive, and efficient. The discussed utilities of the Interactive Screen Designer include the design of standard window and control screen objects, paint facilities for creating customdesigned application windows, and a Linker utility which allows any predefined screen region to be linked to executable code. A music application, ELUS:TD, and an ELUS music utility, SETMATRIX, are demonstrated as examples of virtual device panels and control interfaces created with the Interactive Screen Designer. INTRODUCTION The purpose of this document is to describe the Interactive Screen Designer, a Graphics User Interface toolkit which is included as a standard feature of ELUS, a Forth based Music Applications Development Environment. Eleusinian Enterprises is involved in the development of music software targeted at the commercial and experimental markets. Forth was chosen for the development environment because of its many exceptional and superior features. However, very early on it became clear that a traditional Forth system also had a number of significant drawbacks with respect to the development of commercially oriented applications. In particular, no Forth system known a~ that time included support for the development of a Graphics User Interface. In view of the many music applications which have been introduced with GUis, it is all too obvious that the development of a GUI for end user applications was and still is mandatory in order to penetrate the market with a Forth developed application. ELUS was developed to address this lack of GUI support in a Forth based system. as well as to address a variety of other needs. Although ELUS is still under development, a discussion of the current implementation of the Interactive Screen Designer, the ELUS GUI toolkit, will provide a sufficiently informative overview of the graphics capability of the system. MIXED LANGUAGE IMPLEMENTATION ELUS is a mixed language Forth implementation. Currently, two C language external libraries are linked to the Forth kernel: MetaWINDOW by Metagraphics Software Corporation is a graphics library which provides device independent graphics programming; and Baby Driver by Autumn Hill Software, Incorporated, is a table driven printer library. Two layers of code were implemented in order to make these C libraries function with the Forth environment First, an assembly language interface routine was developed for each library; the functions of the. interface routines are to locate the external libraries and to preserve the state of the system stack. Second, high level Forth routines were implemented to compile references to the external libraries and to bring the C calling conventions into conformity with standard Forth stack usage; these high level This paper was presented at the Fourth Annual SIGEorth Workshop, held in Kansas City, MO, March 5-7, 1992, and published in the SIGForth Newsletter, Vol.4 No.4, December 1994. P23 Forth routines took the form of defming words. Because these libraries are available only for DOS 80x86 machines, the resulting Forth implementation is not currently portable to other platforms. In addition, to hold down the price for end users, the royalty-free version of Meta WINDOW is used, but this version does not support the high resolution VGA configurations currently available; the highest resolutions supported in ELUS are 1280x800 monochrome and 640x480 16-color VGA. In return for the increased device dependency and limitations on supported VGA modes, the mixed language Forth implementation does provide a workable solution to the implementation of a Forth GUI toolkit. IHGH LEVEL INTERFACE TO META WINDOW Meta WINDOW Defining Words Each MetaWINDOW function is assigned to a function class which is determined by the stack effects. Each function class is implemented as a defining word. The name of each MetaWINDOW defming word begins with :MG , where MG stands for Meta Group, and ends with two numbers separated by a hyphen, the frrst number indicating the number of stack arguments before the function is called and the second indicating the number of stack arguments returned after the function is executed. The CREATE portions of all MetaWINDOW defming words are identical and consist of: creating a dictionary entry, and compiling the Meta WINDOW procedure ID into the parameter field of the child word. The DOES> portions of all Meta WINDOW defining words are analogous in function and consist of: stack setup (required for some), stack preservation, calling the MetaWINDOW function, and stack cleanup. Two assembler primitives are used for preserving the stack and calling the Meta WINDOW functions: @META-SP ( -n) must be executed prior to calling a MetaWINDOW function. \"n\" is the number of stack elements which the MetaWINDOW function expects. Note that this is always one more than the total number of input arguments as indicated in the stack comment for the DOES> code. The reason for this is that the MetaWINDOW function number is fetched from the parameter field address and placed on top of the stack just before the MetaWINDOW function is called. Since the placement of the appropriate function number on the stack is imbedded in the DOES> code, it is not reflected in the stack commentary. <METACALL> ( nl n2 ... nx BX -AX DX) is'the routine which executes the MetaWINDOW code. Since the MetaWINDOW functions are C language routines, they expect the stack arguments to be in the C calling sequence as documented in the Meta WINDOW Reference Manual, C Language Version. The function ~of the DOES> code prior to @MET A-SP is to reorder the stack to the C calling sequence. After the function has been executed, the system environment prior to the function call is restored, and the contents of the AX and DX registers are pushed to the stack. Depending on the function, one, both, or none of these return values are dropped. C Calling Sequence and Stack Setup Integer Value Parameters The C calling sequence for integer value parameters is opposite to that of Forth. In C, the arguments are pushed onto the stack in the reverse order in which they appear in the procedure's calling sequence. This means· that the last argument is frrst placed on the stack, proceeding from right to left. void MOVETO (X, Y) int X, Y; In this example, the procedure MOVETO expects on the stack the integer values of X andY, where X is placed on the stack after Y, and returns no values (void). In order to simplify the syntax of the high level user vocabulary and retain the convention of entering the'X-coordinate before the y-coordinate, it would be logical and desirable to hide the stac!C setup in the DOES> portion of a defining word. :MG2X-O CREATE n [proc-id]) DOES> n2[parm2] nl[parml]) -ROT SWAP ROT 3 @META-SP @ <METACALL> DDROP Then-a high level FORTH word is defined: 92 :MG2X-0 LINETO ( x y) where 92 is the Meta WINDOW procedure ID code for function LINETO. Executing","PeriodicalId":441527,"journal":{"name":"Annual Workshop on Forth","volume":"1a 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1993-12-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Annual Workshop on Forth","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/199200.316996","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

ELUS by Eleusinian Enterprises is discussed as an example of a mixed language Forth implementation which include~ its own GUI toolkit, the Interactive Screen Designer. The linked Meta WINDOW graphics library (Meta graphics Software Corporation), makes the design and implementation of graphics application user interfaces possible, intuitive, and efficient. The discussed utilities of the Interactive Screen Designer include the design of standard window and control screen objects, paint facilities for creating customdesigned application windows, and a Linker utility which allows any predefined screen region to be linked to executable code. A music application, ELUS:TD, and an ELUS music utility, SETMATRIX, are demonstrated as examples of virtual device panels and control interfaces created with the Interactive Screen Designer. INTRODUCTION The purpose of this document is to describe the Interactive Screen Designer, a Graphics User Interface toolkit which is included as a standard feature of ELUS, a Forth based Music Applications Development Environment. Eleusinian Enterprises is involved in the development of music software targeted at the commercial and experimental markets. Forth was chosen for the development environment because of its many exceptional and superior features. However, very early on it became clear that a traditional Forth system also had a number of significant drawbacks with respect to the development of commercially oriented applications. In particular, no Forth system known a~ that time included support for the development of a Graphics User Interface. In view of the many music applications which have been introduced with GUis, it is all too obvious that the development of a GUI for end user applications was and still is mandatory in order to penetrate the market with a Forth developed application. ELUS was developed to address this lack of GUI support in a Forth based system. as well as to address a variety of other needs. Although ELUS is still under development, a discussion of the current implementation of the Interactive Screen Designer, the ELUS GUI toolkit, will provide a sufficiently informative overview of the graphics capability of the system. MIXED LANGUAGE IMPLEMENTATION ELUS is a mixed language Forth implementation. Currently, two C language external libraries are linked to the Forth kernel: MetaWINDOW by Metagraphics Software Corporation is a graphics library which provides device independent graphics programming; and Baby Driver by Autumn Hill Software, Incorporated, is a table driven printer library. Two layers of code were implemented in order to make these C libraries function with the Forth environment First, an assembly language interface routine was developed for each library; the functions of the. interface routines are to locate the external libraries and to preserve the state of the system stack. Second, high level Forth routines were implemented to compile references to the external libraries and to bring the C calling conventions into conformity with standard Forth stack usage; these high level This paper was presented at the Fourth Annual SIGEorth Workshop, held in Kansas City, MO, March 5-7, 1992, and published in the SIGForth Newsletter, Vol.4 No.4, December 1994. P23 Forth routines took the form of defming words. Because these libraries are available only for DOS 80x86 machines, the resulting Forth implementation is not currently portable to other platforms. In addition, to hold down the price for end users, the royalty-free version of Meta WINDOW is used, but this version does not support the high resolution VGA configurations currently available; the highest resolutions supported in ELUS are 1280x800 monochrome and 640x480 16-color VGA. In return for the increased device dependency and limitations on supported VGA modes, the mixed language Forth implementation does provide a workable solution to the implementation of a Forth GUI toolkit. IHGH LEVEL INTERFACE TO META WINDOW Meta WINDOW Defining Words Each MetaWINDOW function is assigned to a function class which is determined by the stack effects. Each function class is implemented as a defining word. The name of each MetaWINDOW defming word begins with :MG , where MG stands for Meta Group, and ends with two numbers separated by a hyphen, the frrst number indicating the number of stack arguments before the function is called and the second indicating the number of stack arguments returned after the function is executed. The CREATE portions of all MetaWINDOW defming words are identical and consist of: creating a dictionary entry, and compiling the Meta WINDOW procedure ID into the parameter field of the child word. The DOES> portions of all Meta WINDOW defining words are analogous in function and consist of: stack setup (required for some), stack preservation, calling the MetaWINDOW function, and stack cleanup. Two assembler primitives are used for preserving the stack and calling the Meta WINDOW functions: @META-SP ( -n) must be executed prior to calling a MetaWINDOW function. "n" is the number of stack elements which the MetaWINDOW function expects. Note that this is always one more than the total number of input arguments as indicated in the stack comment for the DOES> code. The reason for this is that the MetaWINDOW function number is fetched from the parameter field address and placed on top of the stack just before the MetaWINDOW function is called. Since the placement of the appropriate function number on the stack is imbedded in the DOES> code, it is not reflected in the stack commentary. ( nl n2 ... nx BX -AX DX) is'the routine which executes the MetaWINDOW code. Since the MetaWINDOW functions are C language routines, they expect the stack arguments to be in the C calling sequence as documented in the Meta WINDOW Reference Manual, C Language Version. The function ~of the DOES> code prior to @MET A-SP is to reorder the stack to the C calling sequence. After the function has been executed, the system environment prior to the function call is restored, and the contents of the AX and DX registers are pushed to the stack. Depending on the function, one, both, or none of these return values are dropped. C Calling Sequence and Stack Setup Integer Value Parameters The C calling sequence for integer value parameters is opposite to that of Forth. In C, the arguments are pushed onto the stack in the reverse order in which they appear in the procedure's calling sequence. This means· that the last argument is frrst placed on the stack, proceeding from right to left. void MOVETO (X, Y) int X, Y; In this example, the procedure MOVETO expects on the stack the integer values of X andY, where X is placed on the stack after Y, and returns no values (void). In order to simplify the syntax of the high level user vocabulary and retain the convention of entering the'X-coordinate before the y-coordinate, it would be logical and desirable to hide the stac!C setup in the DOES> portion of a defining word. :MG2X-O CREATE n [proc-id]) DOES> n2[parm2] nl[parml]) -ROT SWAP ROT 3 @META-SP @ DDROP Then-a high level FORTH word is defined: 92 :MG2X-0 LINETO ( x y) where 92 is the Meta WINDOW procedure ID code for function LINETO. Executing
第四,metaWINDOW和GUI设计
Eleusinian Enterprises的ELUS是作为混合语言Forth实现的一个例子来讨论的,它包含了自己的GUI工具包——交互式屏幕设计器。链接的Meta WINDOW图形库(Meta graphics Software Corporation)使图形应用程序用户界面的设计和实现成为可能,直观,高效。所讨论的交互式屏幕设计器实用程序包括标准窗口和控制屏幕对象的设计、用于创建定制设计的应用程序窗口的绘制工具,以及允许将任何预定义的屏幕区域链接到可执行代码的链接器实用程序。一个音乐应用程序,ELUS:TD,和一个ELUS音乐实用程序,SETMATRIX,作为使用交互式屏幕设计器创建的虚拟设备面板和控制界面的示例进行了演示。本文档的目的是描述交互式屏幕设计器,这是一个图形用户界面工具包,作为ELUS的标准功能,ELUS是一个基于Forth的音乐应用程序开发环境。Eleusinian Enterprises参与了针对商业和实验市场的音乐软件的开发。之所以选择Forth作为开发环境,是因为它有许多特殊和优越的特性。然而,很早就很明显,传统的Forth系统在面向商业的应用程序的开发方面也有许多明显的缺点。特别是,当时还没有一个已知的Forth系统支持图形用户界面的开发。考虑到许多音乐应用程序已经与GUI一起引入,很明显,为最终用户应用程序开发GUI是并且仍然是强制性的,以便通过Forth开发的应用程序渗透市场。开发ELUS是为了解决在基于Forth的系统中缺乏GUI支持的问题。以及解决各种其他需求。虽然ELUS仍在开发中,但是对交互式屏幕设计器(ELUS GUI工具包)的当前实现的讨论将提供对系统图形功能的充分信息概述。混合语言实现ELUS是一种混合语言的Forth实现。目前,有两个C语言外部库链接到Forth内核:MetaWINDOW是一个图形库,由metagrapics软件公司提供,它提供独立于设备的图形编程;秋山软件公司的Baby Driver是一个表驱动的打印机库。为了使这些C库在Forth环境下工作,实现了两层代码:首先,为每个库开发了一个汇编语言接口例程;的函数。接口例程用于定位外部库并保存系统堆栈的状态。其次,实现高级Forth例程来编译对外部库的引用,并使C调用约定符合标准的Forth堆栈使用;本文于1992年3月5日至7日在密苏里州堪萨斯城举行的第四届sigearth年度研讨会上发表,并发表在1994年12月的《SIGForth通讯》第4卷第4期。第四个例程采用定义词的形式。由于这些库仅可用于DOS 80x86机器,因此最终的Forth实现目前无法移植到其他平台。此外,为了降低最终用户的价格,使用了免版税版本的Meta WINDOW,但该版本不支持目前可用的高分辨率VGA配置;ELUS支持的最高分辨率是1280x800单色和640x480 16色VGA。作为对增加的设备依赖性和对支持的VGA模式的限制的回报,混合语言Forth实现确实为Forth GUI工具包的实现提供了一个可行的解决方案。每个MetaWINDOW函数被分配给一个函数类,这是由堆栈效果决定的。每个函数类都被实现为一个定义词。每个MetaWINDOW定义词的名称以:MG开头,其中MG代表Meta Group,并以两个用连字符分隔的数字结尾,第一个数字表示函数调用前的堆栈参数数量,第二个数字表示函数执行后返回的堆栈参数数量。所有MetaWINDOW定义词的CREATE部分都是相同的,包括:创建一个字典条目,并将MetaWINDOW过程ID编译到子词的参数字段中。所有元窗口定义词的DOES>部分在函数中是类似的,包括:堆栈设置(某些需要)、堆栈保存、调用MetaWINDOW函数和堆栈清理。 两个汇编原语用于保存堆栈和调用MetaWINDOW函数:@META-SP (-n)必须在调用MetaWINDOW函数之前执行。“n”是MetaWINDOW函数期望的堆栈元素的数量。注意,这总是比DOES>代码的堆栈注释中指出的输入参数总数多一个。这样做的原因是MetaWINDOW函数号是从参数字段地址中获取的,并在调用MetaWINDOW函数之前放在堆栈的顶部。由于适当的函数号在堆栈上的位置嵌入在DOES>代码中,因此它不会反映在堆栈注释中。(nl n2…nx BX -AX DX)是执行MetaWINDOW代码的例程。由于MetaWINDOW函数是C语言例程,因此它们期望堆栈参数在C语言版本的MetaWINDOW参考手册中记录的C调用序列中。在@MET A-SP之前的DOES>代码的功能是将堆栈重新排序到C调用序列。在函数被执行之后,恢复函数调用之前的系统环境,AX和DX寄存器的内容被推入堆栈。根据函数的不同,这些返回值中的一个、两个或一个也不删除。整数值参数的C调用顺序和堆栈设置顺序与Forth相反。在C语言中,参数被压入堆栈的顺序与它们在过程调用序列中出现的顺序相反。这意味着最后一个参数首先放在堆栈上,从右向左进行。void MOVETO (X, Y) int X, Y;在本例中,过程MOVETO在堆栈上期望X andY的整数值,其中X在堆栈上位于Y之后,并且不返回任何值(void)。为了简化高级用户词汇表的语法,并保留在y坐标之前输入x坐标的惯例,隐藏堆栈是合乎逻辑的,也是可取的!在定义词的DOES>部分中的C设置。:MG2X-O CREATE n [proc-id]) DOES> n2[parm2] nl[parml]) -ROT SWAP ROT 3 @ Meta - sp @ DDROP然后定义一个高级FORTH字:92:MG2X-0 LINETO (x y)其中92是LINETO函数的元窗口过程ID代码。执行
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信