1、INTERNATIONAL STANDARD INTERNATIONAL ORGANIZATION FOR STANDARDIZATION ORGANISATION INTERNATIONALE DE NORMALISATION ME)(AYHAPOJJHAR OPrAHkl3Al use GKS-TYPES; procedure ERROR-HANDLING (ERRORJNDICATOR : in ERRORJUMBER; GKS-FUNCTION : inSTRING; ERROR-FILE : inSTRING :=DEFAULT_ERRORJILE); - The procedure
2、 ERROR-HANDLING is defined as a library subprogram, and is not - declared within package GKS. This binding defines two different bodies for this subprogram; each must be supplied by the implementation. The default body is the one required by GKS semantics. It simply caIls ERROR-LOGGING and returns.
3、The second body calls ERROR-LOGGING and then raises the exception GKS-ERROR. The GKS function must be written so as not to handle GKS-ERROR (this is a requirement of the tmplementation). Thus, by Ada rules, the exception will be propagated back to the application program that called the GKS function
4、 in which the error was detected. The means by which the user replaces the default body of either the exception-raising version or another one of his or her choosing is dependent upon the Ada library manager. Some implementations support multiple versions of a body with a single specification or oth
5、erwise allow hierarchical libraries with the sharing of common units. In other implementations it may be necessary to duplicate the GKS library for each version of ERROR-HANDLING. GKS errors are mapped to the single exception GKSTERROR, declared in the GKS package. The expected style in dealing with
6、 errors using exception handling is to provide a handler for the GKS-ERROR exception. 3.2.4 Data mapping The simple and compound data types of GKS are bound to a variety of Ada scalar and compound types. Constraints on permitted values are reflected where possible in the type definitions. The genera
7、l correspondence between the GKS data types and Ada binding data types is summarized below: GKS integers aremapped to Ada integer types. GKS reals are mapped to Ada floating-point types. GKS strings are mapped to the predefined Ada type STRING, or to a type providing for variable length strings. GKS
8、 points are mapped to Ada record types. GKS names are mapped to Ada discrete types. GKS enumeration types are mapped to Ada enumeration types. GKS vectors are mapped to Ada record types. 5 IS0 8651-3 : 1988 (E) GKS matrices are mapped to Ada array types. GKS lists (of elements of a particular type)
9、are mapped to an Ada private type declared in an instantiation of the generic GKSLIST_UTILITIES package. GKS arrays are mapped to either an unconstrained Ada array type, or to a record type providing for variable length arrays. GKS ordered pairs are mapped to Ada record types. GKS data records are m
10、apped to Ada private types. In some cases a set of subprograms for operating on the data records are explicitly defined by this binding. This is because the content and structure of the data record is implementation-dependent. An implementation of GKS may provide other subprograms for manipulating i
11、mplementation-dependent data records. 3.2.5 Multi-tasking The Ada language definition provides explicit support for concurrency. The Ada tasking model includes facilities for declaring and allocating tasks, and operations allowing intertask communication and synchronization. The GKS standard, and he
12、nce this binding, neither requires nor prohibits an implementation from protecting against problems which could arise from asynchronous access to the GKS data structures from concurrent tasks. Implementors of GKS should provide information in the users documentation regarding whether protection agai
13、nst such problems is implemented. Annex D contains guidelines for implementors who want to support multi-tasking application programs. This annex does not form an integral part of the binding standard, but provides additional information. 3.2.6 Packaging The GKS standard defines nine levels of graph
14、ic functionality, with level Oa as the lowest level and level 2c as the highest level. An implementation of GKS may implement every level individually or as a single system. To support this concept this binding defines nine Ada packages which correspond to each of the GKS levels. Each of these packa
15、ges is named package GKS is . . . end GKS; to provide portability of application programs for levels of GKS. However, the contents of the packages differ depending on the level of GKS that they provide. Each of these packages provides the subprograms defined for its level and all subprograms defined
16、 in “lower” levels as described in 5.1 of this binding. Associated with each of these packages is a data type package which provides the type declarations for the appropriate level as defined in 4.2 and the GKS defined exception defined in 4.3.1. These packages are named package GKS-TYPES is . . . e
17、nd GKS-TYPES; The Ada program library facility should be used to provide the levels separation. Thus, an Ada graphics application program which uses GKS would “with” the appropriate GKS packages which provide the subprogram, types, and exceptions for that level by compiling and linking to the corres
18、ponding Ada library which contains that level of GKS. For example, an application which uses level Oa would “with” the packages as follows: with GKS; use GKS-TYPES; procedure APPLICATION is begin null; end APPLICATION: IS0 8651-3 : 1988 (E) Then the program is compiled and linked to the Ada program
19、library that corresponds to level Oa. Several additional Ada units are defined in this binding. These are: o generic package GKS-COORDINATE-SYSTEM o generic package GKS-LIST_UTILITIBS These generic packages support the declaration types in the GKS-TYPES package described above. The GKS-COORDINATE -S
20、YSTEM is a generic package that defines an assortment of types for supporting each of the GKS coordinate systems. GKS-LIST_UTILITIBS is also a generic package which provides type declarations and operations for list types which correspond to the GKS list types. 3.2.7 Application program environment
21、An application program utilizing an Ada implementation of GKS will need to be aware of the environment in which both GKS and the application program(s) reside. One such interface is the Ada program library. The Ada language requires that the application program have access to the program library in
22、which the GKS software resides. The IS0 8652 Ada Reference Manual does not specify whether there is a single library or multiple libraries, or how access to the libraries is granted, managed, etc. The users documentation for the GKS implementation should specify where the GKS library exists in the s
23、ystem, and how access to the library is acquired. Input/Output interfaces are also implementation-dependent, and are required to be described in the users documentation. Besides the obvious graphics device interface information, interfaces to the file system shall be included in the documentation. S
24、pecifically, this includes the interface to the GKS error file and also the metafile storage. 3.2.8 Registration l) The GKS standard reserves certain value ranges for registration as graphical items. The registered graphical items will be bound to Ada (and other programming languages). The registere
25、d item bindings will be consistent with the binding presented in the document. 1) For the purpose of this part of IS0 8651 and according to the rules for the designation and operation of registration authorities in the IS0 Directives, the IS0 Council has designated the National Bureau of Standards (Institute of Computer Sciences and Technology) A266 Technology Building, Gaithersburg, MD, 20899, USA to act as registration authority. 7