|
|
|
|
||
|
DEFINITION MODULE DMLanguage; (******************************************************************* Module DMLanguage ('Dialog Machine' DM_V3.0) Copyright (c) 1986-2006 by Andreas Fischlin and ETH Zurich. Purpose Provides basic routines required for the 'Dialog Machine', such as the default language and generally used strings depending on the current language. Remarks This module is distributed in source and its implementation can be easily adapted to any other languages currently not supported by using the language designators MyLanguage1 or MyLanguage2. This module belongs to the 'Dialog Machine'. Programming o Design Andreas Fischlin 28/07/1986 o Implementation Andreas Fischlin 28/07/1986 ETH Zurich Systems Ecology CHN E 35.1 Universitaetstrasse 16 8092 Zurich SWITZERLAND URLs: <mailto:RAMSES@env.ethz.ch> <http://www.sysecol.ethz.ch> <http://www.sysecol.ethz.ch/SimSoftware/RAMSES> Last revision of definition: 24/08/1997 AF *******************************************************************) TYPE Language = (English, German, French, Italian, MyLanguage1, MyLanguage2); PROCEDURE DefltAboutProc; (*default about procedure adjusted to the current language*) PROCEDURE SetLanguage(l: Language); (* Sets language l to display "Dialog Machine" messages, like about and error messages. Note that SetLanguage clears any eventually already installed about messages (see DMMenus.InstallAbout). Hence, always call this procedure as early as possible in your Dialog Machine program. *) PROCEDURE CurrentLanguage(): Language; (*returns language currently in use*) (* The following objects are only for internal usage by the "Dialog Machine": *) VAR defltControlMenu, defltQuitCommand, defltAboutCommand, defltQuitSubCommand, defltAboutSubCommand: ARRAY [0..255] OF CHAR; okButtonText, cancelButtonText: ARRAY [0..15] OF CHAR; (* The following constants may be used to denote a particular message to be returned by routine GetMsgString (see below). This supports a convenient error message display. Ex.: to display an error condition with unsufficient memory use from module DMMessages the routine DoInform similar to this statement: DoInform(insuffMem,"MyModule","MyProcedure",""); By default DMMessages uses routine GetMsgString from this module to retrieve the actual message. Another typical usage is after attempting to open a file with module DMFiles: IF myFile.res<>done THEN errCode := fileResBase+ORD(myFile.res); DoInform(errCode,"MyModule","MyProcedure",myFile.filename); ELSE ... *) CONST allOk = 0; (* General ('Dialog Machine' and other software layers) *) badProgState (* should not occurr *) = -4; onlyAnInsert = -3; unknownErr = -2; insuffMem = -1; tooOldMac = 9; tooManyTermProc = 10; notImplemented = 100; (* DMWindIO arithmetic *) intOverflow = 1; lowUpSame = 2; (* User Input (DMEntryForms etc.) *) numExpected = 5; outOfRange = 7; wrongChar = 3; wrongCharOrNone = 14; only1Char = 4; only1CharOrNone = 15; stringTooLong = 16; (* Object access *) unknownWindow = 8; unknownEditField = 6; unknownGraph = 11; (* DM2DGraphs *) noLogScale = 12; graphTooSmall = 17; (* DMFiles: Subsequent message order fits DMFiles.Response, i.e. code = fileResBase+ORD(f.res) *) fileResBase = 20; fileNotFound = 21; volNotFound = 22; fileDlgCancelled = 23; unknownFile = 24; tooManyFiles = 25; diskFull = 26; insuffMemForFileFct = 27; fileAlreadyOpen = 28; fileIsBusy = 29; fileIsLocked = 30; fileFctNotDone = 31; (* Error constants beyond userBase may be used freely and do not conflict with any constants used by the 'Dialog Machine' *) userBase = 300; PROCEDURE GetMsgString(msgNr: INTEGER; VAR str: ARRAY OF CHAR); END DMLanguage.
|
||
|
|
|