-------------------------------------------------------------------- ISO/IEC JTC1 SC22 WG16 N180 Canada proposal for graphics in ISLISP ------------------------------------------------------------------------- I am enclosing a statement that I have just presented to the Fortran WG5 committee of which I am also a member, dealing with the possible addition of a primitive graphic capability in the language. I believe that the situation is rather similar for Islisp. Whitman Wright Ottawa, Canada ------------------------------------------------------------------------- GRAPHICS PROPOSAL FOR FORTRAN 2000 DRAFT NO. 1 PREFACE At the ISO WG5 Fortran meeting held in Dresden in the summer of 1996, a primitive graphic capability for Fortran 2000 became a serious issue with the establishment of ISO WG5 Committee 3. Primitive graphics in Fortran was designated as one of the topics to be dealt with by that committee and I became a member of that committee with the expectation that I, at least, would pursue the graphics issue. This present document is the first draft of a report concerning the possibility of computer graphics in Fortran 2000, which I am directing to the repository for Committee No. 3 under the charge of Dr. Christian Weber of Munich, Germany. After returning home to Ottawa, Canada, I have devoted what time I could spare to this topic. First, I studied the topic at the Assembler level on the MS DOS system, in order to obtain a better appreciation of the technical problems to be encountered by compiler writers. Then the Canadian Standards Association Programming Languages Committee designated me as their liaison person to the Canadian SC24 Graphics Committee. So far, I have been able to have a very limited amount of Email contact with Professor Tom Kurtz of Dartmouth College and Basic fame. The ISO and ANSI Basic standards have certainly incorporated graphics, substantially more so than I am advocating for Fortran. I hope to have further communication with Professor Kurtz and find out more about how well industry has received the Basic standards. Living in Ottawa, I am fortunate to have easy access to the library of the Standards Council of Canada, which contains all the standards documents that I have required access to so far, although photocopying and borrowing are not permitted. In addition to the GKS, PHIGS, Graphic Metafile and Basic standards, I have discovered two relatively new groups of standards, as follows: (1) ISO/IEC 9636-1991, Parts 1 through 6, Information technology - Computer graphics - Interfacing techniques for dialogues with graphical devices (CGI) - Functional specifications. (2) ISO/IEC 9637-1994, Parts 1 and 2, Information technology - Computer Graphics - Interfacing techniques for dialogues with graphical devices (CGI) - Data stream binding. Reference to these two groups of standards in the Fortran 2000 Specification and the use of these standards by compiler writers should make the incorporation of primitive graphics in Fortran 2000 much simpler. There is a great deal of relevant information in the standards and text books. I have only been able to digest a relatively small part of it so far, and feel very much in need of constructive comment from those more expert in this area than I am. I hope that such comment will be forthcoming and that it will be constructive. The task will be to select from the capabilities described in the standards what is essential for a graphics capability in Fortran 2000 and not too much more. As a result of my work on the topic since Dresden in the summer of this year, I am if anything more convinced than ever of the need for a primitive graphics capability in Fortran. With today's combination of high technical complexity and rapid change, many things fall through the cracks or between the chairs. One of these things has been computer graphics for limited market professional use software on low cost systems. An example has been the practical unavailability of GKS on MS DOS and on the various levels of Microsoft Windows. This is an issue which I have raised before but will not expand upon further here. Whitman Wright Member of WG5 Committee No. 3 Planning for Fortran 2000 CONTENTS 1. General ....................................................... 2 2. The Programming Languages 'ANSI Basic and ISO Full Basic as Demonstrations that It Can Be Done ........................... 2 3. The Place of Graphic Primitives in the Fortran Standard ....... 2 4. The Use of the GKS Fortran Binding Standard (ISO 8651-1) as the Starting Point for Fortran 2000 Graphics .................. 3 5. Graphic Subroutines Proposed for Inclusion in Fortran 2000 .... 3 6. Binding of the Fortran Code to the Graphic Hardware ........... 6 7. References .................................................... 6 1. GENERAL The intent of this proposal is to provide the minimum graphics that will be useful for producing portable software with a graphics component. No attempt will be made to duplicate any feature pertaining to graphics that can be produced with reasonable efficiency using existing or anticipated Fortran. For example, there will be no need to provide for the following features: The third dimension. Scaling. Panning. Possibly clipping. 2. THE PROGRAMMING LANGUAGES 'ANSI BASIC' AND 'FULL BASIC' AS DEMONSTRATIONS THAT IT CAN BE DONE It has been argued by compiler writers and others that a graphic capability in standard Fortran would place an unreasonable burden on writers of compilers for Fortran. The production of the recent standards for ANSI Basic and Full Basic is a demonstration that a capability for graphics primitives in Fortran 2000 is an achievable objective. 3. THE PLACE OF GRAPHICS PRIMITIVES IN THE FORTRAN STANDARD We recommend that, for at least the Fortran 2000 standard, the graphics features be optional. For compilers for which it is claimed the graphics features are implemented, it would be required that a list of the levels of graphics supported be published as part of the documentation. For example, a particular compiler might support VGA graphics for Windows 95, but not EGA graphics for DOS. Whether a particular Fortran compiler will contain an ISO graphic capability will become an economic decision for the compiler writer. 4. THE USE OF THE GKS FORTRAN BINDING STANDARD (ISO 8651-1) AS THE STARTING POINT FOR FORTRAN 2000 GRAPHICS The use of the GKS Fortran Binding Standard ISO 8651-1:1988 as a starting point for Fortran 2000 graphics is recommended for the following reasons: (1) The great deal of thought already embodied in that standard could be utilized. (2) The transition between the use of graphics in GKS and graphics in Fortran can be made easier for programmers already familiar with one of those two alternatives. The substantial tasks in proposing a graphics capability are then: (1) Selecting an appropriate subset of the GKS Fortran binding subroutines for inclusion in Fortran 2000. (2) Examining the subroutines selected in order to see whether they should be modified in some way when they are included in the Fortran 2000 standard. The GKS Fortran Binding subroutines are intended for Fortran 77. It is not anticipated that there will be any great difficulty in adapting these subroutines to Fortran 2000. 5. GRAPHIC SUBROUTINES PROPOSED FOR INCLUSION IN FORTRAN 2000 (Taken from GKS Fortran Binding) ISO 8651-1 - 9.2 Control Functions SUBROUTINE GOPKS (ERRFIL,BUFA) Enter integer ERRFIL: Error message file. Enter integer BUFA: Amount of memory units (implementation dependent): if -1, use implementation dependent default. Question: How does one match up a number with a specific graphics board, say VGA? GKS equivalent: OPEN GKS SUBROUTINE GCLKS GKS equivalent: CLOSE GKS SUBROUTINE GOPWK (WKID,CONID,WTYPE) Enter integer WKID: Workstation identifier. Comment: Could be display surface identifier. Question: How does one associate a particular integer with a particular display surface. Enter integer CONID: Connection identifier. Enter integer WTYPE: Workstation type. GKS equivalent: OPEN WORKSTATION SUBROUTINE GCLWK (WKID) Enter integer WKID: Workstation identifier. GKS equivalent: CLOSE WORKSTATION SUBROUTINE GACWK (WKID) Enter integer: WKID: Workstation identifier. GKS equivalent: ACTIVATE WORKSTATION SUBROUTINE GDAWK (WKID) Enter integer WKID: Workstation identifier. GKS equivalent: DEACTIVATE WORKSTATION SUBROUTINE GCLRWK (WKID,COFL) Enter integer WKID: Workstation identifier. Enter integer COFL: Control flag (GCONDI,GALWAY) GKS equivalent: CLEAR WORKSTATION SUBROUTINE GRSGWK (WKID) Enter integer WKID: Workstation identifier. GKS equivalent: REDRAW ALL SEGMENTS ON WORKSTATION SUBROUTINE GUWK (WKID,REGFL) Enter integer WKID: Workstation identifier. Enter integer REGFL: Update regeneration flag (GPOSTP,GPERFO) GKS equivalent: UPDATE WORKSTATION SUBROUTINE GMSG (WKID,MESS) Integer WKID: Workstation identifier. Character* (*) MES = message. GKS equivalent: MESSAGE ISO 8651-1 - 9.3 Output Functions SUBROUTINE GPL (N,PXA,PYA) Enter integer N: Number of points to be drawn. Enter real PXA(N), PYA(N): World coordinates of points to be drawn. Comment 1: See ISO 8651-1, page 102. Comment 2: Dashed lines and other special lines are built up using standard Fortran. Curved lines are built up using short polyline segments and are constructed using standard Fortran. Line widths are controlled by standard Fortran subroutine CALL LINEWIDTH. GKS equivalent: POLYLINW SUBROUTINE GMP (N,PXA,PYA) Enter integer N: Number of points to be drawn. Enter real PXA(N),PYA(N): World coordinates of points on display. GKS equivalent: POLYMARKER SUBROUTINE GTX (PX,PY,CHARS) Enter real PX,PY: Text position, in world coordinates. Enter character* (*) CHARS: String of characters. Comment: See Standard, page 114. GKS equivalent: TEXT SUBROUTINE GFA (N,PXA,PYA) Enter integer N: Number of points to be drawn. Real PXA(N),PYA(N): World coordinates of points to be drawn. Comment: It would be desirable to coordinate the "fill" points with the "natural grid" of the display surface. GKS equivalent: FILL AREA The following are not taken from ISO 8651-1: SUBROUTINE LWDTH (LWIDTH) Enter real LWIDTH: Line width for the next objects, in world coordinates. SUBROUTINE COLOR (COLR) Enter integer COLR: Color code for the next objects. SUBROUTINE TXTSIZ (TSIZ) Enter real TSIZ: Text height for the next lines of text, in world coordinates. SUBROUTINE TXANG (TANGL) Enter real TANGL: Text angle from the horizontal for the next lines of text, counterclockwise positive (radians). SUBROUTINE MSPIK (XPIK,YPIK) Return real XPIK,YPIK: World X and Y coordinates picked on the display surface by a picking device. SUBROUTINE DMAP (LLX,LLY,URX,URY) Enter real LLX,LLY,URX,URY: Lower left and upper right X and Y, expressed in world coordinates. Note: This subroutine effectively sets the scale of the graphic display. The scale is set so that both the lower left and upper right control points LLX, LLY, URX and URY are on boundaries of the display surface. If the aspect ratio implied by these two points does not correspond to the aspect ratio of the display surface, the aspect ratio implied by the control points will be maintained, with the graphic display centered on the display surface. 6. BINDING OF THE FORTRAN CODE TO THE GRAPHIC HARDWARE The binding of the Fortran code to the graphic hardware shall be through two groups of ISO standards, as follows: (1) ISO/IEC 9636-1991, Information technology - Computer graphics - Interfacing techniques for dialogues with graphical devices (CGI) - Functional Specifications: Part 1 Overview, profiles and conformance Part 2 Control Part 3 Output Part 4 Segments Part 5 Input and echoing Part 6 Raster (2) ISO/IEC 9637-1994, Information technology - Computer graphics - Interfacing techniques for dialogues with graphical devices (CGI) - Data stream binding: Part 1 Character encoding Part 2 Binary encoding 7. REFERENCES ISO/IEC 10279 Full Basic ISO 7942-1 GKS Part 1 ISO 8651-1 GKS - Fortran Binding ISO/IEC 8806-4 GKS - 3D ISO/IEC-9592-1 PHIGS Part 1 ISO/IEC-9592-2 PHIGS Part 2 ISO/IEC 8632-1992 Computer Graphics Metafile ISO/IEC 9636-1991, parts 1 through 6, Information technology - Computer graphics - Interfacing techniques for dialogues with graphical devices (CGI) - Functional specifications ISO/IEC 9637-1994, parts i and 2, Information technology - Computer graphics - Interfacing techniques for dialogues with computer graphical devices (CGI) - Data stream binding ISO 2382-13: 1984 Data Processing - Vocabulary Part 13: Computer Graphics ANSI X3.113-1987 ANSI Full Basic. Graphics is dealt with in Section 13. The facilities provided are a subset of ISO GKS 7942-1985 (which has been superseded).