WO2001016719A1 - Method and device for translating a program unit - Google Patents

Method and device for translating a program unit Download PDF

Info

Publication number
WO2001016719A1
WO2001016719A1 PCT/DE2000/002856 DE0002856W WO0116719A1 WO 2001016719 A1 WO2001016719 A1 WO 2001016719A1 DE 0002856 W DE0002856 W DE 0002856W WO 0116719 A1 WO0116719 A1 WO 0116719A1
Authority
WO
WIPO (PCT)
Prior art keywords
program unit
translated
modules
translation
program
Prior art date
Application number
PCT/DE2000/002856
Other languages
German (de)
French (fr)
Inventor
Andreas Geisler
Original Assignee
Siemens Aktiengesellschaft
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Siemens Aktiengesellschaft filed Critical Siemens Aktiengesellschaft
Publication of WO2001016719A1 publication Critical patent/WO2001016719A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Definitions

  • the invention relates to a method and an arrangement for translating a program unit.
  • a program unit is in particular a program code (also: source code) comprising several modules of a given programming language, which is to be translated by means of a compiler
  • the program unit includes a definition unit that references one or more declaration units, i.e. refers to this. For each unit of declaration there is a definition unit that defines the declared part, i.e. filled with content.
  • H files declaration files
  • C files definition files
  • the program unit's C file references several H files, whereby an H file can in turn contain several H files.
  • the "#mclude" instruction common to the C programming language is usually used for this purpose, which inserts a (declaration) file in the place of this instruction during translation.
  • ob ect files also O-files
  • each C file the program unit also includes a C file
  • the declarations mentioned in the H files for translating the C file into an O file are required, but not the definitions of the declarations!
  • the definitions (further C files) are translated into an O file, whereby each C file can refer to no, one or more H files (here: contain).
  • the O-files are combined in the binding process to form an (executable) program.
  • a library file can also be created from the O-Files.
  • the object of the invention is to carry out a translation of a program unit only when this is necessary.
  • a method for translating a program unit is specified, in which several modules are referenced by the program unit.
  • the program unit is translated if one of the modules is a younger one
  • the time stamp preferably represents a date for the time when the module or the program unit was last saved.
  • a change of a module or the program unit is usually completed with the last storage. If the date of the last saving of the translation of the program unit (O-file) is later than any date of the storage of a module, the program unit does not have to be translated again. In the other case, the program unit is translate again. This ensures that the translated program unit always has the most recent date compared to (the source code) the program unit and the modules referenced therein.
  • One embodiment consists in that (at least) one interface compiler is translated by an interface compiler if there is no translation of the interface module yet or the interface module is more recent than an existing translation of the interface module.
  • the interface module is not translated if the translation of the interface module already exists and the interface module itself is not more recent than its translation. In this case the translation is the most current version, a further translation would be a waste of time. It is also a further development that the program unit is re-compiled as soon as a used interface module has been compiled by the interface compiler.
  • Another embodiment is that the translated program unit is used to control or to design a technical system.
  • Another embodiment comprises the use of the program unit as an executable program or a part of the same.
  • the program unit can be part of a library module. Especially when used in a large software system, it is common to make a functional part accessible to other programs in the form of a library.
  • the library comprises a predetermined, mostly generally applicable, selection of functions which can be used in many ways.
  • the library is integrated into an executable program, the module can then use the predefined functions of the library.
  • program unit in a common programming language, e.g. the programming language C, C ++, Java, FORTRAN, BASIC or PASCAL.
  • an arrangement for translating a program unit which has a processor unit, which processor unit is set up in such a way that a) the program unit can be specified in the form of a plurality of modules which reference one another; b) the program unit is translated if one of the modules is more recent than an existing translation of the program unit; c) otherwise the program unit is not re-translated.
  • This arrangement is particularly suitable for performing the method according to the invention or one of its developments explained above.
  • Fig.l is a tree diagram depicting dependencies on modules contained in a program unit
  • Figure 2 is a sketch illustrating a translation process
  • FIG. 3 shows a sketch which represents a combination of translation (compilation) and binding (left);
  • Figure 4 is a sketch showing a translation of interface modules
  • FIG. 6 shows a processor unit
  • FIG. 1 shows dependencies on modules contained in a program unit 101.
  • the program unit 101 with the file name “test.c” contains program code to be translated (also: source code or source code) in a programming language, for example in the programming language C.
  • the de- in the referenced modules 102 to 104 Clarified instructions are required by program unit 101.
  • the declaration file "filel.h” contains declarations (prototype agreements) of functions that are defined or implemented in the file "filel.c".
  • declarations prototype agreements
  • the definition of the declared function is not made at the time of the translation, but at the l.d.R. later bandages taken into account.
  • the implementation "filel.c” can be changed regardless of a new translation of the program unit. In this case, only the file “filel.c” has to be translated; when an executable file or a library from the program unit 101 is created, the translated file “filel.c” is linked to the translated file “test.c” ( "linked”).
  • Module 103 refers to another module 105 "f ⁇ le4.h” and module 104 refers to modules 106 “file5.h” and 107 “file ⁇ .h”, which in turn refers to modules 108 "f ⁇ le7.h”, 109 “file ⁇ .h “and 110" f ⁇ le9.h “refers.
  • the process of translating is illustrated again in FIG.
  • the tree from FIG. 1 with the program unit and the modules 102 to 110 is contained in a block 202.
  • the translation (compilation) of the program unit results in an O-file "test.o" 201.
  • This O-file contains object code and is preferably used as input for a subsequent binding process (linking).
  • the program unit is translated as soon as a module is discovered that is newer than the file (the O file) of the previous translation.
  • a block 301 shows how a file "filel.c”, among other things, references the file “filel.h” and how a file “filel.o” 302 is created as a result of a translation process.
  • Analogous co ) tv> NJ P> cn ⁇ cn O (_ ⁇ L ⁇
  • TJ • 1 • C ⁇ ⁇ C ⁇ uq C l-h o P- ⁇ s: ⁇ V
  • the modules "List.cpp", “Stack. Cpp” and “Queue. Cpp” are located in a directory "/ home / schmidt / bulk / src".
  • the interfaces to these modules are in the directory
  • Lines 60-110 define variables.
  • the syntax for defining variables is:
  • va ⁇ ableDef identifier (value
  • the definitions given correspond to the Backus-Naur form (BNF), which is briefly explained below.
  • the characters x, y and z represent visible characters from the ASCII character set.
  • a list of values of any length can be assigned to a variable.
  • Identifiers are structured as in the programming language C; "visibleChar” are all visible characters except the characters " ⁇ " and ">” used for variable replacement.
  • the "objDir" variable belongs to variables that have a certain meaning. With the value of "objDir” the compiler is set to write the generated code in the directory to which this variable points. Analogously mean:
  • Lines 130-230 define C ++ compilers, options and search paths.
  • the search paths are not only used to parameterize the compiler and linker, but also to ensure that affected program files (source code) and object files can be found and their last modification time can be determined.
  • Lines 250-470 describe the composition of the test program and the library.
  • targets i.e. executable programs or libraries.
  • Target identifiers preferably do not contain file extensions. This simplifies porting to other formats.
  • a target forms its own namespace for variables.
  • the user preferably defines the following variables within a target:
  • libs The libraries (without file extensions) that are used by the target's modules are listed under the "libs" variable. This information is irrelevant for the command to create a library, but it is important for the generation of a correct link command for executable targets. If libraries depend on one another, it is important for most linkers in which order the libraries are called. If the variable "libs" is defined within a library target X, the libraries specified there need within Exe cutable targets that use X will no longer be paid, unless it is desired explicitly dynamic or stati ⁇ MOORISH binding. The following variables can be used for this:
  • VISIBILITY AND SUBSTITUTION OF VARIABLES Variables can be redefined within targets.
  • a typical application is the redefinition of global compiler options or directory variables (objDir, libDir etc.) for a specific target.
  • the "srcDir" variable has been redefined within the "bulktest” target, which hides the global definition.
  • a variable is substituted by its value as follows: First the variable is searched for in the namespace of the current target. If the variable is not found there, If available, the search is carried out in the namespace of the surrounding project (see project term below). If the search also fails here, the search is global.
  • variable is not defined there either, a search is carried out in an operating system environment (eg using the standard function "getenv"). Immediately after reading in an identifier surrounded by angle brackets, it is replaced by its value. If the value is a list, the embedding value also becomes a list if it was not previously.
  • cpp -I / home / schmidt / include -I / home / schmidt / bulk / include -c -g + al
  • cpp -I / home / schmidt / include -I / home / schmidt / bulk / include -c - g -f-al H-eh -o / home / schmidt / bulk / debug / List.o;
  • cpp -I / home / schmidt / include -I / home / schmidt / bulk / include - c -g + al + eh -o / home / schmidt / bulk / debug / Queue.o;
  • the file "libbulk.a” is preferably deleted before the new translation, since a new version could contain fewer modules than the previous one. Furthermore, the search paths are automatically added to the relevant commands using the corresponding variables. Before translation and link commands, if necessary, a change is made to the directory in which the source texts or object modules are located. Finally, a change is made to the directory from which the new translation was started.
  • Source files "#include” statements read out. Only those files are preferred that are enclosed in double quotation marks (" --) in an "#include” statement. Angle brackets should generally only be used for headers that are not part of the ongoing software development, eg for system headers or interfaces to external (purchased) products. Conditional compilation (“#ifdef") is not taken into account when parsing the "#include” instructions. EXTENSION OF THE EXAMPLE TO THE CLIENT SERVER APPLICATION In order to demonstrate how calls to the IDL compiler are generated, the example of Fig. 5 is extended by the following target:
  • So-called server modules which are generated by the IDL compiler from the interfaces listed in the "serverSources” variable, are compiled and linked to the program (linked).
  • Client modules that are generated by the IDL compiler from the interfaces listed in the "clientSources” variable are also compiled and linked to the program.
  • Variables within a project can be preceded by the project name, followed directly by a ".” in connection with the variable name can be accessed (see BNF production "refldent").
  • Aim generator converts the description file and thus - at least indirectly - generates the desired results (files):
  • a call syntax of the is:
  • a reason is given for each generated update command, e.g. by listing the include relationship and outputting the modification times of Target and the source file that is younger than the target.
  • the environment variable "aimopt” is evaluated and its content added to the command line options.
  • “aimopt” standard options can be defined (e.g. paths that have to be considered when searching for files).
  • RETURN VALUE As the return value, the generator delivers a number of actual update processes (e.g. compiler or linker calls). In the event of an error, the value "-1" is returned,
  • a processor unit PRZE is shown in FIG.
  • the processor unit PRZE comprises a processor CPU, a memory SPE and an input / output interface IOS, which is used in different ways via an interface IFC: an output is visible and / or displayed on a monitor MON via a graphics interface output to a printer PRT. The input is made using a mouse MAS or a keyboard TAST.
  • the processor unit PRZE also has a data bus BUS, which ensures the connection of a memory MEM, the processor CPU and the input / output interface IOS.
  • additional grain components can be connected, e.g. additional memory, data storage (hard disk) or scanner.

Abstract

According to the inventive method for translating a program unit, the program unit references several modules. If one of the modules has a more recent time stamp than a preexisting translation of the program unit, the program unit is translated. Otherwise there is no new translation of the program unit.

Description

Beschreibungdescription
Verfahren und Anordnung zur Übersetzung einer ProgrammemheitMethod and arrangement for translating a program unit
Die Erfindung betrifft ein Verfahren und eine Anordnung zur Übersetzung einer Programmemheit.The invention relates to a method and an arrangement for translating a program unit.
Eine Programmemheit ist insbesondere em mehrere Module einer vorgegebenen Programmiersprache umfassender Programmcode (auch: Quellcode), der mittels eines Compilers zu übersetzenA program unit is in particular a program code (also: source code) comprising several modules of a given programming language, which is to be translated by means of a compiler
Die Programmemheit umfaßt dabei eine Definitionseinheit, die eine oder mehrere Deklarationse heit (en) referenziert, d.h. auf diese Bezug nimmt. Zu eder Deklarationsemheit gibt es eine Definitionseinheit, die den deklarierten Teil definiert, d.h. mit Inhalt ausfüllt.The program unit includes a definition unit that references one or more declaration units, i.e. refers to this. For each unit of declaration there is a definition unit that defines the declared part, i.e. filled with content.
Im Beispiel eines C-Programms gibt es sogenannten H-Files als Deklarationsdateien und sogenannte C-Files als Definitionsdateien. Das C-File der Programmemheit referenziert mehrere H- Files, wobei em H-File wiederum mehrere H-Files enthalten kann. Dafür wird zumeist die m der Programmiersprache C übliche "#mclude"-Anweisung eingesetzt, die bei der Übersetzung eine (Deklarations-) Datei an die Stelle dieser Anweisung einf gt .In the example of a C program, there are so-called H files as declaration files and so-called C files as definition files. The program unit's C file references several H files, whereby an H file can in turn contain several H files. The "#mclude" instruction common to the C programming language is usually used for this purpose, which inserts a (declaration) file in the place of this instruction during translation.
Da bei großen Systemen enorme Mengen an H-Files (und korrespondierenden C-Files) vorhanden sind, dauert eine Übersetzung der gesamten Programmemheit entsprechend lange. Dies ist insbesondere deshalb von Nachteil, da oftmals nur an em- zelnen C-Files gearbeitet wird und eine Übersetzung des gesamten Systems (aller H-Files einschließlich der Definitionseinheit der Programmemheit) unterbleiben kann.Since there are enormous amounts of H files (and corresponding C files) in large systems, it takes a long time to translate the entire program unit. This is particularly disadvantageous because often only individual C files are worked on and a translation of the entire system (all H files including the definition unit of the program unit) can be omitted.
Dabei ist zu beachten, daß generell unterschieden wird zwi- sehen dem Übersetzungsvorgang (Compiliervorgang) und einem Bindevorgang (Linken) . Im obigen Beispiel des C-Programms werden beim übersetzen sogenannte Ob ect-Files (auch O-Files) generiert, die insbesondere je ein C-File (auch die Programmeinheit umfaßt ein C-File) und die darin referenzierten H- Files umfassen. Dabei sind die in den H-Files erwähnten Deklarationen zur Übersetzung des C-Files in ein O-File, nicht aber die Definitionen der Deklarationen notwendig! Die Defin- tionen (weitere C-Files) werden in jeweils ein O-File übersetzt, wobei jedes C-File wiederum kein, ein oder mehrere H- Files referenzieren (hier: beinhalten) kann. Die O-Files werden in dem Bindevorgang zu einem (ausführbaren) Programm zu- sammengebunden. Wahlweise wird auch eine Bibliotheksdatei aus den O-Files erstellt.It should be noted that a general distinction is made between the translation process (compiling process) and a binding process (linking). In the above example of the C program, so-called ob ect files (also O-files) are generated, which in particular each include a C file (the program unit also includes a C file) and the H files referenced therein. The declarations mentioned in the H files for translating the C file into an O file are required, but not the definitions of the declarations! The definitions (further C files) are translated into an O file, whereby each C file can refer to no, one or more H files (here: contain). The O-files are combined in the binding process to form an (executable) program. A library file can also be created from the O-Files.
Die Aufgabe der Erfindung besteht darin, eine Übersetzung ei- ner Programmeinheit nur dann durchzuführen, wenn dies notwendig ist.The object of the invention is to carry out a translation of a program unit only when this is necessary.
Diese Aufgabe wird gemäß den Merkmalen der unabhängigen Patentansprüche gelöst. Weiterbildungen der Erfindung ergeben sich auch aus den abhängigen Ansprüchen.This object is achieved in accordance with the features of the independent claims. Further developments of the invention also result from the dependent claims.
Zur Lösung der Aufgabe wird ein Verfahren zur Übersetzung einer Programmeinheit angegeben, bei dem von der Programmeinheit mehrere Module referenziert werden. Die Programmeinheit wird übersetzt, falls eines der Module einen jüngerenTo solve the problem, a method for translating a program unit is specified, in which several modules are referenced by the program unit. The program unit is translated if one of the modules is a younger one
Zeitstempel als eine bereits vorhandene Übersetzung der Programmeinheit aufweist, ansonsten erfolgt keine erneute Übersetzung der Programmeinheit.Has a timestamp as an existing translation of the program unit, otherwise the program unit is not re-translated.
Der Zeitstempel stellt bevorzugt ein Datum für den Zeitpunkt der letzten Speicherung des Moduls bzw. der Programmeinheit dar. Mit der letzten Speicherung wird in der Regel eine Änderung eines Moduls oder der Programmeinheit abgeschlossen. Ist das Datum der letzten Speicherung der Übersetzung der Pro- grammeinheit (O-File) jünger als irgendein Datum der Speicherung eines Moduls, so muß die Programmeinheit nicht erneut übersetzt werden. Im anderen Fall ist die Programmeinheit er- neut zu übersetzen. Somit ist sichergestellt, daß die übersetzte Programmemheit immer das jüngste Datum im Vergleich mit (dem Quellcode) der Programmemheit und den darin refe- renzierten Modulen aufweist.The time stamp preferably represents a date for the time when the module or the program unit was last saved. A change of a module or the program unit is usually completed with the last storage. If the date of the last saving of the translation of the program unit (O-file) is later than any date of the storage of a module, the program unit does not have to be translated again. In the other case, the program unit is translate again. This ensures that the translated program unit always has the most recent date compared to (the source code) the program unit and the modules referenced therein.
Hierbei sei angemerkt, daß es sich auch bei der Programmemheit selbst um em zu übersetzendes Modul, z.B. em C-File, handelt, wobei die Programmemheit mehrere weitere Module re- ferenziert, d.h. auf diese weiteren Module verweist.It should be noted here that even the program unit itself is a module to be translated, e.g. em C-file, the program unit references several other modules, i.e. refers to these other modules.
Eine Weiterbildung besteht darin, daß die Übersetzung der Programmemheit, und damit auch der darin enthaltenen Module, durchgeführt wird, sobald em Modul mit einem neueren (=jungeren) Zeitstempel als die bereits übersetzte Program- memheit ermittelt wird.A further development consists in the fact that the translation of the program unit, and thus also the modules contained therein, is carried out as soon as a module is determined with a newer (= younger) time stamp than the program unit already translated.
Damit ist vorteilhaft eine frühestmögliche Entscheidung darüber möglich, ob eine Übersetzung notwendig ist oder nicht.This advantageously enables the earliest possible decision as to whether a translation is necessary or not.
Insbesondere ist es eme Weiterbildung, bei Übersetzung der Programmemheit auch alle m Bezug genommenen Module zu übersetzen.In particular, it is a further training to translate all modules referred to when translating the program unit.
Eine Ausgestaltung besteht darin, daß (mindestens) em Schnittstellen-Modul von einem Schnittstellencompiler übersetzt wird, falls noch keine Übersetzung des Schnittstellen- Moduls vorhanden ist oder das Schnittstellen-Modul junger als eine bereits existierende Übersetzung des Schnittstellen- Moduls ist.One embodiment consists in that (at least) one interface compiler is translated by an interface compiler if there is no translation of the interface module yet or the interface module is more recent than an existing translation of the interface module.
Eine andere Ausgestaltung besteht darin, daß das Schnittstellen-Modul nicht übersetzt wird, falls bereits die Übersetzung des Schnittstellen-Moduls existiert und das Schnittstellen- Modul selbst nicht jüngeren Datums als seine Übersetzung ist. In diesem Fall ist die Übersetzung die aktuellste Fassung, eme weitere Übersetzung wäre Zeitverschwendung. Auch ist es eine Weiterbildung, daß die Programmeinheit neu übersetzt wird, sobald ein verwendetes Schnittstellen-Modul von dem Schnittstellencompiler übersetzt worden ist.Another embodiment is that the interface module is not translated if the translation of the interface module already exists and the interface module itself is not more recent than its translation. In this case the translation is the most current version, a further translation would be a waste of time. It is also a further development that the program unit is re-compiled as soon as a used interface module has been compiled by the interface compiler.
Ferner besteht eine Ausgestaltung darin, daß die übersetzte Programmeinheit zur Steuerung bzw. zum Entwurf eines technischen Systems eingesetzt wird.Another embodiment is that the translated program unit is used to control or to design a technical system.
Eine andere Ausgestaltung umfaßt den Einsatz der Programmein- heit als ein ausführbares Programm oder eines Teils desselben.Another embodiment comprises the use of the program unit as an executable program or a part of the same.
Im Rahmen einer zusätzlichen Weiterbildung kann die Programmeinheit Teil eines Bibliotheksmoduls sein. Gerade beim Ein- satz in einem großen Softwaresystem ist es üblich, einen funktionalen Teil in Form einer Bibliothek anderen Programmen zugänglich zu machen. Die Bibliothek umfaßt eine vorbestimmte, zumeist allgemein einsetzbare, Auswahl von Funktionen, die in vielerlei Hinsicht sinnvoll einsetzbar ist. Dazu wird die Bibliothek in ein ausführbares Programm eingebunden, das Modul kann dann die vordefinierten Funktionen der Bibliothek nutzen.As part of additional training, the program unit can be part of a library module. Especially when used in a large software system, it is common to make a functional part accessible to other programs in the form of a library. The library comprises a predetermined, mostly generally applicable, selection of functions which can be used in many ways. For this purpose, the library is integrated into an executable program, the module can then use the predefined functions of the library.
Eine Weiterbildung besteht auch darin, daß die Programmein- heit in einer gängigen Programmiersprache, z.B. der Programmiersprache C, C++, Java, FORTRAN, BASIC oder PASCAL, abgefaßt ist.Another development is that the program unit in a common programming language, e.g. the programming language C, C ++, Java, FORTRAN, BASIC or PASCAL.
Ferner wird zur Lösung der Aufgabe eine Anordnung zur Über- setzung einer Programmeinheit angegeben, die eine Prozessoreinheit aufweist, welche Prozessoreinheit derart eingerichtet ist, daß a) die Programmeinheit in Form mehrerer sich untereinander referenzierender Module vorgebbar ist; b) eine Übersetzung der Programmeinheit erfolgt, falls eines der Module neueren Datums ist als eine bereits vorhandene Übersetzung der Programmeinheit; c) ansonsten keine erneute Übersetzung der Programmeinheit erfolgt.Furthermore, to achieve the object, an arrangement for translating a program unit is provided, which has a processor unit, which processor unit is set up in such a way that a) the program unit can be specified in the form of a plurality of modules which reference one another; b) the program unit is translated if one of the modules is more recent than an existing translation of the program unit; c) otherwise the program unit is not re-translated.
Diese Anordnung ist insbesondere geeignet zur Durchführung des erfindungsgemäßen Verfahrens oder einer seiner vorstehend erläuterten Weiterbildungen.This arrangement is particularly suitable for performing the method according to the invention or one of its developments explained above.
Ausführungsbeispiele der Erfindung werden nachfolgend anhand der Zeichnung dargestellt und erläutert.Embodiments of the invention are illustrated and explained below with reference to the drawing.
Es zeigenShow it
Fig.l ein Baumdiagramm, das Abhängigkeiten von in einer Programmeinheit enthaltenen Modulen darstellt;Fig.l is a tree diagram depicting dependencies on modules contained in a program unit;
Fig.2 ein Skizze, die einen Übersetzungsvorgang veranschaulicht;Figure 2 is a sketch illustrating a translation process;
Fig.3 eine Skizze, die eine Kombination aus Übersetzung (Compilierung) und Bindung (Linken) darstellt;3 shows a sketch which represents a combination of translation (compilation) and binding (left);
Fig.4 eine Skizze, die eine Übersetzung von Schnittstellen- Modulen zeigt;Figure 4 is a sketch showing a translation of interface modules;
Fig.5 einen Ausschnitt aus einem Programmcode;5 shows a section of a program code;
Fig.6 eine Prozessoreinheit.6 shows a processor unit.
In Fig.l ist ein Baumdiagramm dargestellt, das Abhängigkeiten von in einer Programmeinheit 101 enthaltenen Modulen aufzeigt. Die Programmeinheit 101 mit dem Dateinamen "test.c" enthält zu übersetzenden Programmcode (auch: Quellcode oder Sourcecode) in einer Programmiersprache, beispielhaft in der Programmiersprache C. Von der Programmeinheit 101 werden drei Module 102 "filel.h", 103 "file2.h" und 104 "file3.h" refe- renziert. Die in den referenzierten Modulen 102 bis 104 de- klarierten Anweisungen werden von der Programmemheit 101 benotigt.A tree diagram is shown in FIG. 1, which shows dependencies on modules contained in a program unit 101. The program unit 101 with the file name “test.c” contains program code to be translated (also: source code or source code) in a programming language, for example in the programming language C. Three modules 102 “filel.h”, 103 “file2. h "and 104" file3.h "are referenced. The de- in the referenced modules 102 to 104 Clarified instructions are required by program unit 101.
Der Unterschied zwischen Definition und Deklaration sei an folgendem Beispiel erläutert: Die Deklarationsdatei "filel.h" enthält Deklarationen (Prototypvereinbarungen) von Funktionen, die in der Datei "filel.c" definiert bzw. implementiert sind. Zur Übersetzung der Programmeinheit 101 ist lediglich die Deklaration notwendig, die Definition der deklarierten Funktion wird nicht zum Zeitpunkt des Ubersetzens, sondern beim l.d.R. spateren Binden berücksichtigt. Demgemäß kann die Implementierung "filel.c" unabhängig von einer Neuubersetzung der Programmeinheit verändert werden. In diesem Fall muß lediglich die Datei "filel.c" bersetzt werden, bei der Erstel- lung einer ausfuhrbaren Datei oder einer Bibliothek aus der Programmemheit 101 wird die übersetzte Datei "filel.c" zu der übersetzten Datei "test.c" hinzugebunden ("gelinkt").The following example explains the difference between definition and declaration: The declaration file "filel.h" contains declarations (prototype agreements) of functions that are defined or implemented in the file "filel.c". For the translation of the program unit 101, only the declaration is necessary; the definition of the declared function is not made at the time of the translation, but at the l.d.R. later bandages taken into account. Accordingly, the implementation "filel.c" can be changed regardless of a new translation of the program unit. In this case, only the file "filel.c" has to be translated; when an executable file or a library from the program unit 101 is created, the translated file "filel.c" is linked to the translated file "test.c" ( "linked").
Das Modul 103 verweist auf ein weiteres Modul 105 "fιle4.h" und das Modul 104 verweist auf Module 106 "file5.h" und 107 "fileβ.h", das wiederum auf die Module 108 "fιle7.h", 109 "fileδ.h" und 110 "fιle9.h" verweist.Module 103 refers to another module 105 "fιle4.h" and module 104 refers to modules 106 "file5.h" and 107 "fileβ.h", which in turn refers to modules 108 "fιle7.h", 109 "fileδ .h "and 110" fιle9.h "refers.
In Fig.2 ist nochmals der Vorgang des Ubersetzens veranschau- licht. In einem Block 202 ist der Baum aus Fig.l mit der Programmemheit und den Modulen 102 bis 110 enthalten. Die Übersetzung (Compilierung) der Programmeinheit resultiert in einem O-File "test.o" 201. Dieses O-File enthält Objektcode und dient vorzugsweise als Eingabe für einen sich anschließenden Bindevorgang (Linken) . Eme Übersetzung der Programmeinheit erfolgt, sobald em Modul entdeckt wird, das junger ist als die Datei (das O-File) der vorangegangenen Übersetzung.The process of translating is illustrated again in FIG. The tree from FIG. 1 with the program unit and the modules 102 to 110 is contained in a block 202. The translation (compilation) of the program unit results in an O-file "test.o" 201. This O-file contains object code and is preferably used as input for a subsequent binding process (linking). The program unit is translated as soon as a module is discovered that is newer than the file (the O file) of the previous translation.
Dieser Zusammenhang ist m Fig.3 veranschaulicht. In einem Block 301 ist gezeigt, wie eme Datei "filel.c" u.a. die Datei "filel.h" referenziert und im Rahmen eines Ubersetzungs- vorgangs daraus eme Datei "filel.o" 302 entsteht. Analog co ) tv> NJ P> cn σ cn O (_π LπThis relationship is illustrated in Fig.3. A block 301 shows how a file "filel.c", among other things, references the file "filel.h" and how a file "filel.o" 302 is created as a result of a translation process. Analogous co ) tv> NJ P> cn σ cn O (_π Lπ
Ό ^ CΛ ≤ CΛ 1 CΛ φΌ ^ CΛ ≤ CΛ 1 CΛ φ
P- P rf o P- rr Pf n P φ uq P- P P Φ t HiP- P rf o P- rr Pf n P φ uq P- P P Φ t Hi
• g uq C P1 »fl o tr PJ σ (Ji § Φ P1 H P-• g uq CP 1 »fl o tr PJ σ (Ji § Φ P 1 H P-
— PJ rr cn N r+ u φ uq r+ N φ P J> rt- PJ rr cn N r + u φ uq r + N φ P J> rt
P N 2 α N φ Φ pr P in φP N 2 α N φ Φ pr P in φ
P P1 c P P- P S Φ α pi ΦPP 1 c P P- PS Φ α pi Φ
CL P P- P uq PJ ts Φ P- α P tr tr P rt CΛ Φ tr P cn i o ö P P to 3 tl Φ rt Φ ΦCL P P- P uq PJ ts Φ P- α P tr tr P rt CΛ Φ tr P cn io ö P P to 3 tl Φ rt Φ Φ
O Φ tr φ Hl Φ P P P PO Φ tr φ Hl Φ P P P P
3 Pn P ω DJ P P σ ω 3 Φ pi ≥;3 Pn P ω DJ P P σ ω 3 Φ pi ≥;
TJ P * P- o So P p- PJ Φ P- Φ φTJ P * P- o So P p- PJ Φ P- Φ φ
P- P 3 o pr rr P- rt rt Hl iP- P 3 o pr rr P- rt rt Hl i
P- — ' rt P uq 3 φ N o ≥! c φ r+ *•• tr Φ P φ P P- P1 > φ trP- - 'rt P uq 3 φ N o ≥! c φ r + * •• tr Φ P φ P P- P 1 > φ tr
P P- φ P- P rt ts uq C c ΦP P- φ P- P rt ts uq C c Φ
1 O f tr ω uq φ V) P; P o 2 φ c tr P £ φ P cn tr ω1 O f tr ω uq φ V) P; P o 2 φ c tr P £ φ P cn tr ω
TJ P p Φ CΛ Φ P- 3 α n Φ φ r+ <! uq ω CΛ tf φ Φ pr P rtTJ P p Φ CΛ Φ P- 3 α n Φ φ r + <! uq ω CΛ tf φ Φ pr P rt
P o ^- o n n φ tr p) P< cn NP o ^ - onn φ tr p ) P <cn N
O 3 CΛ <! P tr tr P P P- Φ P p o o 3 Φ Φ pι rt r+ P φ < t p Φ P- 3 cn P J rt N uqO 3 CΛ <! P tr tr P P- Φ P p o o 3 Φ Φ pι rt r + P φ <t p Φ P- 3 cn P J rt N uq
3 PJ P rt o Φ tr c3 PJ P rt o Φ tr c
P C PJ Φ rr ^ uq P Φ J pi tr P- ω C Φ o Φ P C uq ΦP C PJ Φ rr ^ uq P Φ J pi tr P- ω C Φ o Φ P C uq Φ
CD PJ CΛ CΛ 3 P S cn cn p er φ Pi P PJ 3 0» o tr α o PJ P Φ P PJ tl α Φ Φ φ CΛ rt φ s: t P CΛ P 3 p: rr P P O -JCD PJ CΛ CΛ 3 PS cn cn p er φ Pi P PJ 3 0 »o tr α o P J P Φ P PJ tl α Φ Φ φ CΛ rt φ s: t P CΛ P 3 p: rr PPO -J
P- 3 o P 0- rr P pf t uq ** P tr CΛ Φ o Φ Φ PJ Φ PJ i n- rt PJ * P P n 3 P P-P- 3 o P 0- rr P pf t uq * * P tr CΛ Φ o Φ Φ PJ Φ PJ i n- rt PJ * PP n 3 P P-
P P p P P- tr o rtP P p P P-tr o rt
Ξ P - Φ rt φ tr < !3 rt <V uq rt fD Φ Φ 3 PJ P Φ Φ Φ P P CΛΞ P - Φ rt φ tr <! 3 rt <V uq rt fD Φ Φ 3 PJ P Φ Φ Φ P P CΛ
P X ? P P φ rr o PJ rtP X? P P φ rr o PJ rt
P- N Φ <v r+ CΛ CΛ Φ p- u 3P- N Φ <v r + CΛ CΛ Φ p- u 3
• n P P- o Φ P P< §: P 3 P1 • n P P- o Φ P P <§: P 3 P 1
3 Cd P o ω P- rr P φ P- DJ φ P1 3 Cd P o ω P- rr P φ P- DJ φ P 1
• rt uq O n N tr P P P φ• rt uq O n N tr P P P φ
0) P t tr rt PJ 3 i pi0 ) P t tr rt PJ 3 i pi
Pn tr (D φ Φ P cn • n tr 1Pn tr (D φ Φ P cn • n tr 1
P 3 tf s: c TJ o φ SP 3 tf s: c TJ o φ S
P Φ 3 Φ p φ P-. P oP Φ 3 Φ p φ P-. P o
2 Φ o σ P uq N o φ rt P_2 Φ o σ P uq N o φ rt P_
CΛ 0 tf tu CΛ P P • p:CΛ 0 tf tu CΛ P P • p:
P tr ω ri- Φ . φ N α P1 n N P rt- Φ P PJ 1 c PJ ω pr s: P P P- rt P-1 u PP tr ω ri- Φ. φ N α P 1 n NP rt- Φ P PJ 1 c PJ ω pr s: PP P- rt P- 1 u P
TJ • 1= • CΛ φ CΛ uq C l-h o P- α s: Φ VTJ • 1 = • CΛ φ CΛ uq C l-h o P- α s: Φ V
PJ s r - 1 ω φ l O. o Φ P1 Hl PPJ sr - 1 ω φ l O. o Φ P 1 Hl P
Φ 1 tr P; cn PJ Φ P φΦ 1 tr P; cn PJ Φ P φ
1 1
Figure imgf000008_0001
1 1
Figure imgf000008_0001
c) zur Definition von Namensraumen für Variablen (Schlüsselwort "project") ; d) zum Importieren anderer Vereinbarungsdateien (Schlüsselwort "mclude").c) to define namespaces for variables (keyword "project"); d) to import other agreement files (keyword "mclude").
BEISPIEL:EXAMPLE:
Im einem Verzeichnis "/home/schmidt/bulk/src" liegen die Module "List.cpp", "Stack. cpp" und "Queue. cpp". Die Schnitt- stellen zu diesen Modulen liegen in dem VerzeichnisThe modules "List.cpp", "Stack. Cpp" and "Queue. Cpp" are located in a directory "/ home / schmidt / bulk / src". The interfaces to these modules are in the directory
"/home/schmidt/bulk/mclude" . Die Module sollen zu einer Bibliothek "libbulk.a" zusammengefaßt werden. Außerdem gibt es em Modul "bulktest . cpp" im Verzeichnis "/home/schmidt/bulk/src/test", mit dem die Bibliothek gete- stet werden und das mit der Bibliothek zusammen zu einem ausfuhrbaren Programm gebunden werden soll. Mit der Übersetzung erzeugter Objektcode soll in einem Verzeichnis "/home/schmidt/bulk/debug" abgespeichert werden. Weiterhin existiert eme Bibliothek m der Programmiersprache C in ei- nem Verzeichnis "/home/schmιdt/lιb/lιbutιl . a", die zur Implementierung der C++-Klassen benutzt werden soll. Die Schnittstellen zu dieser C-Bibliothek liegen m einem Verzeichnis "/home/schmidt/mclude" ."/ home / schmidt / bulk / mclude". The modules are to be combined into a library "libbulk.a". There is also a module "bulktest. Cpp" in the directory "/ home / schmidt / bulk / src / test" with which the library is tested and which is to be linked with the library to form an executable program. Object code generated with the translation should be saved in a directory "/ home / schmidt / bulk / debug". Furthermore, there is a library m in the programming language C in a directory "/ home / schmιdt / lιb / lιbutιl. A", which is to be used to implement the C ++ classes. The interfaces to this C library are in a directory "/ home / schmidt / mclude".
VARIABLEN UND KOMMENTAREVARIABLES AND COMMENTS
In Fig.5 Zeilen 10-40 werden die üblichen Kommentarklammern /* ... */ eingesetzt. Auch werden zur Kommentierung die in Zeile 80 benutzten Schrägstriche, die einzeilige Kommentare einleiten, verwendet.The usual comment brackets / * ... * / are used in Fig. 5 lines 10-40. The slashes used in line 80, which introduce single-line comments, are also used for commenting.
In den Zeilen 60-110 werden Variablen definiert. Die Syntax zur Variablendefmition lautet:Lines 60-110 define variables. The syntax for defining variables is:
vaπableDef = identifier (value | vaiueüst) vaiueüst = "{" {value} "}" value = "<"refIdent,,>,'{{vιsιbleChar}["<"refIdent">"]} | vιsbleChar{{vιsιbleChar}["<"refIdent">"]} refldent : : = [projectName"."]identifier projectName : : = identifiervaπableDef = identifier (value | vaiueüst) vaiueüst = "{" {value} "}" value = "<" refIdent ,, > , '{{vιsιbleChar} ["<" refIdent ">"]} | vιsbleChar {{vιsιbleChar} [ "<" refIdent ">"]} refldent:: = [projectName "."] identifier projectName:: = identifier
Die angegebenen Definitionen entsprechen der Backus-Naur-Form (BNF) , die nachfolgend kurz erklärt wird. Die Buchstaben A, B und D stellen syntaktische Ausdrücke dar, die auf beiden Seiten des Definitionszeichens "::=" verwendet werden können. Die Zeichen x, y und z repräsentieren sichtbare Zeichen aus dem ASCII-Zeichensatz.The definitions given correspond to the Backus-Naur form (BNF), which is briefly explained below. The letters A, B and D represent syntactic expressions that can be used on both sides of the definition character ":: =". The characters x, y and z represent visible characters from the ASCII character set.
Figure imgf000010_0001
Figure imgf000010_0001
Einer Variablen kann eine beliebig lange Liste von Werten zugewiesen werden. Bezeichner (identifier) sind wie in der Programmiersprache C aufgebaut; "visibleChar" sind alle sichtbaren Zeichen außer den zur Variablenersetzung benutzten Zeichen "<" und ">".A list of values of any length can be assigned to a variable. Identifiers are structured as in the programming language C; "visibleChar" are all visible characters except the characters "<" and ">" used for variable replacement.
In Zeile 70 wird mittels spitzer Klammern der Wert einer Variablen referenziert . Nach dem Parsing von Zeile 70 lautet die Definition alsoIn line 70, the value of a variable is referenced using angle brackets. So after line 70 parsing, the definition is
objDir /home/schmidt/bulk/debug.objDir / home / schmidt / bulk / debug.
Die Variable "objDir" gehört zu Variablen, die eine vorbe- stimmte Bedeutung aufweisen. Mit dem Wert von "objDir" wird der Compiler so eingestellt, daß er den erzeugten Code in das Verzeichnis schreibt, auf das diese Variable zeigt. Analog bedeuten :The "objDir" variable belongs to variables that have a certain meaning. With the value of "objDir" the compiler is set to write the generated code in the directory to which this variable points. Analogously mean:
Figure imgf000011_0001
Figure imgf000011_0001
In den Zeilen 130-230 werden C++-Compιler, Optionen und Suchpfade definiert. Die Suchpfade dienen nicht nur zur Parame- trierung von Compiler und Linker, sondern auch dazu, daß betroffene Programmdateien (Quellcode) und Objektdateien gefunden werden können und deren letzte Modifikationszeit ermittelt werden kann.Lines 130-230 define C ++ compilers, options and search paths. The search paths are not only used to parameterize the compiler and linker, but also to ensure that affected program files (source code) and object files can be found and their last modification time can be determined.
Weiterhin bedeuten:Furthermore mean:
Figure imgf000011_0002
Figure imgf000012_0001
Figure imgf000013_0001
TARGETS
Figure imgf000011_0002
Figure imgf000012_0001
Figure imgf000013_0001
TARGETS
In den Zeilen 250-470 wird die Zusammensetzung des Testprogramms und der Bibliothek beschrieben. Die allgemeine Syntax zur Definition von sog. Targets, d.h. ausführbaren Programmen oder Bibliotheken, lautet:Lines 250-470 describe the composition of the test program and the library. The general syntax for the definition of so-called targets, i.e. executable programs or libraries is:
target : : = targetKind value "{" {vaπableDef} "}" targetKind : : = "executable" | "hbrary" .target:: = targetKind value "{" {vaπableDef} "}" targetKind:: = "executable" | "hbrary".
Target-Bezeichner enthalten vorzugsweise keine Dateierweiterungen. Dies vereinfacht die Portierung in andere Formate.Target identifiers preferably do not contain file extensions. This simplifies porting to other formats.
Ein Target bildet einen eigenen Namensraum für Variablen. Innerhalb eines Targets definiert der Benutzer vorzugsweise folgende Variablen:A target forms its own namespace for variables. The user preferably defines the following variables within a target:
Figure imgf000014_0001
Figure imgf000014_0001
Unter der Variablen "libs" werden diejenigen Bibliotheken angeführt (ohne Dateierweiterungen) , die von den Modulen des Targets benutzt werden. Diese Information ist für das Kommando zum Erstellen einer Bibliothek irrelevant, dafür aber zur Generierung eines korrekten Link-Kommandos für Executable- Targets von Bedeutung. Wenn Bibliotheken voneinander abhangen, ist es für die meisten Linker wichtig, m welcher Rei- henfolge die Bibliotheken genannt werden. Wird also innerhalb eines Library-Targets X die Variable "libs" definiert, so brauchen die dort genannten Bibliotheken innerhalb von Exe- cutable-Targets, die X verwenden, nicht mehr aufgezahlt werden, es sei denn, es wird explizit dynamisches oder stati¬ sches Binden gewünscht. Dazu sind die folgenden Variablen einsetzbar:The libraries (without file extensions) that are used by the target's modules are listed under the "libs" variable. This information is irrelevant for the command to create a library, but it is important for the generation of a correct link command for executable targets. If libraries depend on one another, it is important for most linkers in which order the libraries are called. If the variable "libs" is defined within a library target X, the libraries specified there need within Exe cutable targets that use X will no longer be paid, unless it is desired explicitly dynamic or stati ¬ MOORISH binding. The following variables can be used for this:
Figure imgf000015_0001
Figure imgf000015_0001
Die beiden zuletzt genannten Variablen sind für den Fall nutzlich, m dem Module nicht Form einer Bibliothek, sondern als einzelne Objektdateien vorliegen.The last two variables mentioned are useful if the module is not in the form of a library, but rather as individual object files.
Mit folgender Definition wird, meist innerhalb eines Library- Targets, angegeben, ob die Erzeugung einer Shared Library, einer statischen Bibliothek oder beider gewünscht wird:The following definition, usually within a library target, indicates whether the creation of a shared library, a static library or both is desired:
hbKind static | shared | both.hbKind static | shared | both.
Die Voreinstellung ist "static".The default is "static".
SICHTBARKEIT UND SUBSTITUTION VON VARIABLEN Variablen können innerhalb von Targets neu definiert werden. Eine typische Anwendung ist die Neudefinition globaler Compi- leroptionen oder Verzeichmsvaπablen (objDir, libDir etc.) für em bestimmtes Target. Im Beispiel ist innerhalb des Targets "bulktest" die Variable "srcDir" redefmiert, wodurch die globale Definition verdeckt wird. Die Substitution einer Variable durch ihren Wert geschieht wie folgt: Es wird zunächst im Namensraum des aktuellen Targets nach der Variablen gesucht. Wird die Variable dort nicht gefunden, wird, falls vorhanden, im Namensraum des umgebenden Projektes (näheres zum Projektbegriff s.u.) gesucht. Schlägt die Suche auch hier fehl, wird global gesucht. Ist die Variable auch dort nicht definiert, wird in einer Betriebssystemumgebung gesucht (z.B. mit Hilfe der Standardfunktion "getenv"). Unmittelbar nach dem Einlesen eines von spitzen Klammern umgebenen Bezeichners, wird dieser durch seinen Wert ersetzt. Ist der Wert eine Liste, wird der einbettende Wert auch zur Liste, falls er es nicht schon vorher war.VISIBILITY AND SUBSTITUTION OF VARIABLES Variables can be redefined within targets. A typical application is the redefinition of global compiler options or directory variables (objDir, libDir etc.) for a specific target. In the example, the "srcDir" variable has been redefined within the "bulktest" target, which hides the global definition. A variable is substituted by its value as follows: First the variable is searched for in the namespace of the current target. If the variable is not found there, If available, the search is carried out in the namespace of the surrounding project (see project term below). If the search also fails here, the search is global. If the variable is not defined there either, a search is carried out in an operating system environment (eg using the standard function "getenv"). Immediately after reading in an identifier surrounded by angle brackets, it is replaced by its value. If the value is a list, the embedding value also becomes a list if it was not previously.
AUS DEM BEISPIEL ERZEUGTE KOMMANDOSCOMMANDS GENERATED FROM THE EXAMPLE
Mit der oben besprochenen Vereinbarungsdatei als Eingabe, und unter der Voraussetzung, daß alle Module aufgrund ihrer letzten Modifikationszeit neu übersetzt werden müssen, werden mit einem AufrufWith the agreement file discussed above as input, and provided that all modules have to be recompiled due to their last modification time, with one call
aim -f bulk.aimaim -f bulk.aim
folgende Kommandos (hier speziell für Unix als beispielhaft angenommenes Betriebssystem) erzeugt:generates the following commands (here especially for Unix as an operating system assumed as an example):
cd /home/schmidt/bulk/src;cd / home / schmidt / bulk / src;
CC Stack. cpp -I/home/schmidt/include -I/home/schmidt/bulk/include -c -g +alCC stack. cpp -I / home / schmidt / include -I / home / schmidt / bulk / include -c -g + al
-f-eh -o/home/schmidt/bulk/debug/Stack.o;-f-eh -o / home / schmidt / bulk / debug / Stack.o;
CC List. cpp -I/home/schmidt/include -I/home/schmidt/bulk/include -c - g -f-al H-eh -o/home/schmidt/bulk/debug/List.o;CC List. cpp -I / home / schmidt / include -I / home / schmidt / bulk / include -c - g -f-al H-eh -o / home / schmidt / bulk / debug / List.o;
CC Queue. cpp -I/home/schmidt/include -I/home/schmidt/bulk/include - c -g +al +eh -o/home/schmidt/bulk/debug/Queue.o;CC queue. cpp -I / home / schmidt / include -I / home / schmidt / bulk / include - c -g + al + eh -o / home / schmidt / bulk / debug / Queue.o;
rm -f /home/schmidt/bulk/debug/libbulk.a; cd /home/schmidt/bulk/debug; ar ru /home/schmidt/bulk/debug/libbulk.a Stack. o List.o Queue. o;rm -f /home/schmidt/bulk/debug/libbulk.a; cd / home / schmidt / bulk / debug; ar ru /home/schmidt/bulk/debug/libbulk.a stack. o List.o Queue. O;
cd /home/schmidt/bulk/src/test;cd / home / schmidt / bulk / src / test;
CC bulktest.cpp -I/home/schmidt/bulk/include -c -g +al +eh -o/home/schmidt/bulk/debug/bulktest.o;CC bulktest.cpp -I / home / schmidt / bulk / include -c -g + al + eh -o / home / schmidt / bulk / debug / bulktest.o;
cd /home/schmidt/bulk/debug;cd / home / schmidt / bulk / debug;
CC -g +al +eh bulktest.o -L/home/schmidt/lib - L/home/schmidt/bulk/debug -Ibulk -lutil -o/home/schmidt/lib/bulktest;CC -g + al + eh bulktest.o -L / home / schmidt / lib - L / home / schmidt / bulk / debug -Ibulk -lutil -o / home / schmidt / lib / bulktest;
cd /home/schmidt/bulk;cd / home / schmidt / bulk;
Bevorzugt wird die Datei "libbulk.a" vor der neuen Übersetzung gelöscht wird, da eine neue Version weniger Module als die vorige beinhalten könnte. Ferner werden die Suchpfade an- hand der entsprechenden Variablen automatisch den betreffenden Kommandos hinzugefügt. Vor Übersetzungs- und Link- Befehlen wird, falls nötig, in das Verzeichnis gewechselt, in dem sich die Quelltexte bzw. Objektmodule befinden. Abschließend wird in das Verzeichnis gewechselt, von dem aus die Neu- Übersetzung gestartet wurde.The file "libbulk.a" is preferably deleted before the new translation, since a new version could contain fewer modules than the previous one. Furthermore, the search paths are automatically added to the relevant commands using the corresponding variables. Before translation and link commands, if necessary, a change is made to the directory in which the source texts or object modules are located. Finally, a change is made to the directory from which the new translation was started.
PARSING VON # INC LUDE -ANWEISUNGENPARSING FROM # INC LUDE INSTRUCTIONS
Bei Bestimmung von Abhängigkeiten der Module werden aus denWhen determining the dependencies of the modules, the
Quelldateien "#include"-Anweisungen ausgelesen. Bevorzugt werden nur diejenigen Dateien berücksichtigt, die bei einer "#include"-Anweisung in doppelten Anführungszeichen ("...") stehen. Spitze Klammern sollten generell nur für Header verwendet werden, die nicht Gegenstand der laufenden Software- Entwicklung sind, z.B. für System-Header oder Schnittstellen zu externen (gekauften) Produkten. Beim Parsing der "#inclu- de" -Anweisungen wird eine bedingte Kompilierung ("#ifdef") nicht berücksichtigt. ERWEITERUNG DES BEISPIELS ZUR CLIENT-SERVER-ANWENDUNG Um zu demonstrieren, wie Aufrufe des IDL-Compilers generiert werden, wird das Beispiel von Fig.5 um folgendes Target er- weitert:Source files "#include" statements read out. Only those files are preferred that are enclosed in double quotation marks ("...") in an "#include" statement. Angle brackets should generally only be used for headers that are not part of the ongoing software development, eg for system headers or interfaces to external (purchased) products. Conditional compilation ("#ifdef") is not taken into account when parsing the "#include" instructions. EXTENSION OF THE EXAMPLE TO THE CLIENT SERVER APPLICATION In order to demonstrate how calls to the IDL compiler are generated, the example of Fig. 5 is extended by the following target:
serverExt S.cpp clientExt C.cpp clientHeaderExt .h idIComp idl idIOptions {-s <serverExt> -c <clientExt> -h <clientHeaderExt>}serverExt S.cpp clientExt C.cpp clientHeaderExt .h idIComp idl idIOptions {-s <serverExt> -c <clientExt> -h <clientHeaderExt>}
target banktarget bank
{ serverSources{serverSources
{ BankIDL.idl AccountIDL.idl{BankIDL.idl AccountIDL.idl
} sources} sources
{ Account. cpp{Account. cpp
Bank. cpp bank_main.cpp }Bank. cpp bank_main.cpp}
}}
Sogenannte Server-Module, die aus den bei der Variablen "ser- verSources" aufgezählten Schnittstellen vom IDL-Compiler erzeugt werden, werden übersetzt und zum Programm dazugebunden (gelinkt) .So-called server modules, which are generated by the IDL compiler from the interfaces listed in the "serverSources" variable, are compiled and linked to the program (linked).
Um einen korrespondierendes Client-Modul zu erzeugen, wird das bisherige Target "bulktest" folgendermaßen erweitert:In order to create a corresponding client module, the previous "bulktest" target is expanded as follows:
executable bulktest { ... // wie in Fig.5 clientSourcesexecutable bulk test { ... // as in Fig. 5 clientSources
{ BankIDL.idl AccountIDL.idl{BankIDL.idl AccountIDL.idl
}}
... // wie in Fig.5... // as in Fig. 5
}}
Auch werden Client-Module, die aus den bei der Variablen "clientSources" aufgezählten Schnittstellen vom IDL-Compiler generiert werden, werden übersetzt und zum Programm dazuge- bunden.Client modules that are generated by the IDL compiler from the interfaces listed in the "clientSources" variable are also compiled and linked to the program.
Im Zusammenschau der obigen Ausführungen werden also folgende Variablen eingesetzt:In the overview of the above statements, the following variables are used:
Figure imgf000019_0001
Figure imgf000019_0001
Die Variablenauswertung zum Aufbau der Aufrufe des IDL- Compilers erfolgt wie am Beispiel des " . cpp"-Compilers be- schrieben. Demgemäß sind insbesondere die Variablen "id- lComp", "idlOptions", etc. zu definieren. Das Beispiel zeigt eine typische Belegung dieser Variablen bei Verwendung einer CORBA-Implementierung. STRUKTURIERUNG GROßER PROJEKTEThe variables are evaluated to structure the calls to the IDL compiler as described using the example of the ". Cpp" compiler. Accordingly, the variables "id-lComp", "idlOptions", etc. must be defined in particular. The example shows a typical assignment of these variables when using a CORBA implementation. STRUCTURING LARGE PROJECTS
Werden mehrere voneinander abhängige Programmsysteme mit jeweils mehreren Targets gleichzeitig bearbeitet, ist die Definition sogenannter Namensräumen für Variablen sinnvoll. Die Syntax eines Namensraums ("project") lautet:If several interdependent program systems, each with several targets, are processed at the same time, the definition of so-called namespaces for variables makes sense. The syntax of a namespace ("project") is:
project = "project" identifier "{" {definition} "}" definition = target | variableDef | include include = "include" valueproject = "project" identifier "{" {definition} "}" definition = target | variableDef | include include = "include" value
Auf Variablen innerhalb eines Projektes kann durch Voranstellen des Projektnamens, direkt gefolgt von einem "." in Verbindung mit dem Variablennamen, zugegriffen werden (siehe BNF-Produktion "refldent") .Variables within a project can be preceded by the project name, followed directly by a "." in connection with the variable name can be accessed (see BNF production "refldent").
"Include"-Anweisungen können innerhalb von Projekten eingesetzt werden. Ist eine Beschreibungsdatei X bereits eingelesen, haben nachfolgende Anweisungen "include X" keine Wirkung, mehrfaches Importieren derselben Dateierweiterung ist demnach ausgeschlossen."Include" statements can be used within projects. If a description file X has already been read in, the following instructions "include X" have no effect, multiple imports of the same file extension are therefore excluded.
Der Vollständigkeit halber sei hier noch die Definition der BNF-Produktion für eine vollständige Beschreibungsdatei in oben angegebenem Sinne erwähnt:For the sake of completeness, the definition of BNF production for a complete description file in the above sense should be mentioned here:
aimDescription : : = {definition | project}aimDescription:: = {definition | project}
AUFRUF DES GENERATORS Der Generator (nachfolgend als "Aim-Generator" bezeichnet) setzt die Beschreibungsdatei um und erzeugt somit - zumindest indirekt - die gewünschten Ergebnisse (Dateien) :CALLING THE GENERATOR The generator (hereinafter referred to as "Aim generator") converts the description file and thus - at least indirectly - generates the desired results (files):
Eine Aufrufsyntax des lautet:A call syntax of the is:
aim {option} [targetName [subtargetName]]. Beim Aufruf gelten insbesondere die folgenden Besonderheiten:aim {option} [targetName [subtargetName]]. The following special features apply when calling:
- Wird kein Target angegeben, werden alle in der Beschreibungsdatei gefundenen Targets erstellt.- If no target is specified, all targets found in the description file are created.
- Wird ein Target angegeben, wird nur dieses bearbeitet. Durch Angabe eines "subtargetName " wird ein einzelnes- If a target is specified, only this is processed. By specifying a "subtargetName" a single
Modul übersetzt, sofern es innerhalb des Targets "targetName " in der Variablen "sources" genannt ist.Module translated, provided that it is named in the "sources" variable in the "targetName" target.
- Zu jedem generierten Update-Kommando wird eine Begründung ausgegeben, z.B. durch Auflistung der Include- Beziehung und Ausgabe der Modifikationszeiten von Target und derjenigen Quelldatei, die jünger als das Target ist.- A reason is given for each generated update command, e.g. by listing the include relationship and outputting the modification times of Target and the source file that is younger than the target.
- Manche Linker erzeugen ausführbare Programme, auch wenn diese nicht aufgelöste Symbole enthalten. Diese Pro- gramme haben dann allerdings keine Ausführungsrechte .- Some linkers create executable programs, even if they contain unresolved symbols. However, these programs then have no execution rights.
- Nach Beendigung von des Generators und Abarbeitung der Beschreibungsdatei wird eine Rückmeldung über die Beendigung ausgegeben (auch bei Benutzung der Option "-s"), die die Anzahl der erforderlichen Updates sowie die An- zahl der tatsächlich durchgeführten Updates umfaßt.- After the generator has been terminated and the description file has been processed, feedback on the termination is output (also when using the "-s" option), which includes the number of updates required and the number of updates actually carried out.
OPTIONENOPTIONS
Für "option" können insbesondere die folgenden Erweiterungen eingesetzt werden:The following extensions can be used for "option":
Figure imgf000021_0001
Figure imgf000022_0001
Figure imgf000021_0001
Figure imgf000022_0001
Figure imgf000023_0001
Figure imgf000023_0001
UMGEBUNGSVARIABLE DES GENERATORSENVIRONMENTAL VARIABLE OF THE GENERATOR
Beim Aufruf des Generators wird die Umgebungsvariable "ai- mopt" ausgewertet und ihr Inhalt zu den Kommandozeilenoptio- nen hinzugefügt. Mit "aimopt" können also Standardoptionen definiert werden (z.B. Pfade, die bei der Suche nach Dateien itzuberucksichtigen sind) .When the generator is called, the environment variable "aimopt" is evaluated and its content added to the command line options. With "aimopt" standard options can be defined (e.g. paths that have to be considered when searching for files).
RUCKGABEWERT Als Ruckgabewert liefert der Generator eine Anzahl tatsachlich durchgeführter Update-Vorgange (z.B. Compiler- oder Linker-Aufrufe) . Im Fehlerfall wird der Wert "-1" zurückgegeben,RETURN VALUE As the return value, the generator delivers a number of actual update processes (e.g. compiler or linker calls). In the event of an error, the value "-1" is returned,
In Fig.6 ist eine Prozessoreinheit PRZE dargestellt. Die Pro- zessoremheit PRZE umfaßt einen Prozessor CPU, einen Speicher SPE und eine Input/Output-Schnittstelle IOS, die über ein Interface IFC auf unterschiedliche Art und Weise genutzt wird: Über eme Grafikschnittstelle wird eme Ausgabe auf einem Monitor MON sichtbar und/oder auf einem Drucker PRT ausgegeben. Eme Eingabe erfolgt über eine Maus MAS oder eine Tastatur TAST. Auch verfugt die Prozessoreinheit PRZE über einen Datenbus BUS, der die Verbindung von einem Speicher MEM, dem Prozessor CPU und der Input/Output-Schnittstelle IOS gewahrleistet. Weiterhin sind an den Datenbus BUS zusatzliche Korn- ponenten anschließbar, z.B. zusätzlicher Speicher, Datenspeicher (Festplatte) oder Scanner. A processor unit PRZE is shown in FIG. The processor unit PRZE comprises a processor CPU, a memory SPE and an input / output interface IOS, which is used in different ways via an interface IFC: an output is visible and / or displayed on a monitor MON via a graphics interface output to a printer PRT. The input is made using a mouse MAS or a keyboard TAST. The processor unit PRZE also has a data bus BUS, which ensures the connection of a memory MEM, the processor CPU and the input / output interface IOS. In addition, additional grain components can be connected, e.g. additional memory, data storage (hard disk) or scanner.

Claims

Patentansprüche claims
1. Verfahren zur Übersetzung einer Programmeinheit, a) bei dem von der Programmeinheit mehrere Module refe- renziert werden; b) bei dem die Programmeinheit übersetzt wird, falls eines der Module neueren Datums ist als eine bereits vorhandene Übersetzung der Programmeinheit und c) bei dem ansonsten keine erneute Übersetzung der Pro- grammeinheit erfolgt.1. Method for translating a program unit, a) in which several modules are referenced by the program unit; b) in which the program unit is translated if one of the modules is more recent than an already existing translation of the program unit and c) in which the program unit is otherwise not translated again.
2. Verfahren nach Anspruch 1, bei dem die Übersetzung der Programmeinheit durchgeführt wird, sobald ein Modul neueren Datums als die bereits vorhandene Übersetzung der Programmeinheit bestimmt wird.2. The method of claim 1, wherein the translation of the program unit is carried out as soon as a module of a more recent date than the already existing translation of the program unit is determined.
3. Verfahren nach Anspruch 1 oder 2, bei dem bei der Übersetzung der Programmeinheit auch die Module übersetzt werden.3. The method according to claim 1 or 2, in which the modules are also translated when the program unit is translated.
4. Verfahren nach einem der vorhergehenden Ansprüche, bei dem ein als ein zusätzliches Modul vorhandenes Schnittstellen-Modul von einem Schnittstellencompiler übersetzt wird, falls noch kein übersetztes Schnittstel- len-Modul existiert oder das mindestens eine Schnittstellen-Modul jünger als sein bereits existierendes übersetztes Schnittstellen-Modul ist.4. The method as claimed in one of the preceding claims, in which an interface module which is present as an additional module is translated by an interface compiler if no translated interface module exists or the at least one interface module is younger than its already existing translated interface Module is.
5. Verfahren nach Anspruch 4, bei dem das Schnittstellen-Modul nicht übersetzt wird, falls bereits das übersetzte Schnittstellen-Modul existiert und das Schnittstellen-Modul nicht jünger als das bereits übersetzte Schnittstellen-Modul ist.5. The method of claim 4, wherein the interface module is not translated if the translated interface module already exists and the interface module is not younger than the already translated interface module.
6. Verfahren nach Anspruch 4 oder 5, bei dem die Programmeinheit neu übersetzt wird, sobald das Schnittstellen-Modul von dem Schnittstellencompiler übersetzt worden ist.6. The method according to claim 4 or 5, wherein the program unit is re-translated as soon as the interface module has been compiled by the interface compiler.
7. Verfahren nach einem der vorhergehenden Ansprüche, bei dem die übersetzte Programmeinheit zur Steuerung bzw. zum Entwurf eines technischen Systems eingesetzt wird.7. The method according to any one of the preceding claims, wherein the translated program unit is used to control or to design a technical system.
8. Verfahren nach einem der vorhergehenden Ansprüche, bei dem die Programmeinheit ein ausführbares Programm oder ein Teil desselben ist.8. The method according to any one of the preceding claims, wherein the program unit is an executable program or a part thereof.
9. Verfahren nach einem der vorhergehenden Ansprüche, bei dem die übersetzte Programmeinheit in einem Bibliotheksmodul enthalten ist.9. The method according to any one of the preceding claims, wherein the translated program unit is contained in a library module.
10. Verfahren nach einem der vorhergehenden Ansprüche, bei dem die Programmeinheit in einer gängigen Programmiersprache abgefaßt ist.10. The method according to any one of the preceding claims, wherein the program unit is written in a common programming language.
11. Anordnung zur Übersetzung einer Programmeinheit mit einer Prozessoreinheit, die derart eingerichtet ist, daß a) die Programmeinheit in Form mehrerer sich untereinan- der referenzierender Module vorgebbar ist; b) eine Übersetzung der Programmeinheit erfolgt, falls eines der Module neueren Datums ist als eine bereits vorhandene Übersetzung der Programmeinheit; c) ansonsten keine erneute Übersetzung der Programmein- heit erfolgt. 11. Arrangement for translating a program unit with a processor unit, which is set up in such a way that a) the program unit can be specified in the form of a plurality of modules referencing one another; b) the program unit is translated if one of the modules is more recent than an existing translation of the program unit; c) otherwise there is no renewed translation of the program unit.
PCT/DE2000/002856 1999-08-26 2000-08-22 Method and device for translating a program unit WO2001016719A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
DE19940566 1999-08-26
DE19940566.2 1999-08-26

Publications (1)

Publication Number Publication Date
WO2001016719A1 true WO2001016719A1 (en) 2001-03-08

Family

ID=7919726

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/DE2000/002856 WO2001016719A1 (en) 1999-08-26 2000-08-22 Method and device for translating a program unit

Country Status (1)

Country Link
WO (1) WO2001016719A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1599799A2 (en) * 2003-02-28 2005-11-30 Bea Systems Inc. System and method for determining when an ejb compiler needs to be executed

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4558413A (en) * 1983-11-21 1985-12-10 Xerox Corporation Software version management system
WO1998014869A1 (en) * 1996-10-02 1998-04-09 Alcatel Usa Sourcing, L.P. Software release control system and method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4558413A (en) * 1983-11-21 1985-12-10 Xerox Corporation Software version management system
WO1998014869A1 (en) * 1996-10-02 1998-04-09 Alcatel Usa Sourcing, L.P. Software release control system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
BAALBERGEN E H ET AL: "ON THE DESIGN OF THE AMOEBA CONFIGURATION MANAGER", ACM SIGSOFTSOFTWARE ENGINEERING NOTES,XX,XX, vol. 17, no. 7, 1 November 1989 (1989-11-01), pages 15 - 22, XP000255897 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1599799A2 (en) * 2003-02-28 2005-11-30 Bea Systems Inc. System and method for determining when an ejb compiler needs to be executed
EP1599799A4 (en) * 2003-02-28 2008-05-14 Bea Systems Inc System and method for determining when an ejb compiler needs to be executed
US8181166B2 (en) 2003-02-28 2012-05-15 Oracle International Corporation System and method for determining when an EJB compiler needs to be executed

Similar Documents

Publication Publication Date Title
DE69819188T2 (en) PROGRAM INTERFACE CONVERTER FOR COMPUTERS WITH MULTIPLE ENVIRONMENTS
DE10121790B4 (en) Software configuration method for use in a computer system
EP1176482B1 (en) Method and computer program for generating a regulation or control system
EP1723513B1 (en) Method for configuring a computer program
DE60317654T2 (en) METHOD AND DEVICE FOR CHANGING A CORE MODULE TO MAKE IT LOW ON MULTIPLE CORE VERSIONS
WO2013004389A1 (en) Method and device for the programming and configuration of a programmable logic controller
EP1738257B1 (en) Method for preventing data inconsistency between accesses of different functions of an application to a global variable in a data processing installation
WO2007006671A1 (en) Method and software system for the configuration of a modular system
DE69907714T2 (en) COMPONENT-BASED SOURCE CODE GENERATOR METHOD
DE19535519A1 (en) Reducing range of compiled object-oriented programs for class library
DE10333088A1 (en) Method for providing access to the internal signals of a dynamic system model from outside regarding the modeling environment
DE102004009676A1 (en) Methods and systems for generating command support files
DE10324594A1 (en) Method for providing improved simulation capabilities of a dynamic system outside of the original modeling environment
DE102021116315A1 (en) Method for merging architectural information
DE112018002316T5 (en) CODE COVERAGE TRACKING FOR A MICROCONTROLLER PROGRAM
EP1010070A1 (en) Method for converting an object code into a programme code
DE3321131A1 (en) SELF-LEARNING CALCULATOR
DE112010003774T5 (en) COMPATIBILITY AT OBJECT LEVEL AND CLASS SCALING USING SEMANTIC VALUES
WO2001016719A1 (en) Method and device for translating a program unit
DE102020111051A1 (en) ARRANGEMENT, SOFTWARE PROGRAM AND COMPUTER-IMPLEMENTED METHOD FOR EXECUTING A RELOADABLE PROGRAM ON AN EMBEDDED SYSTEM OF A VEHICLE
EP0662226B1 (en) Method of processing an application program on a parallel-computer system
DE102010032765B4 (en) Automatic verification of translations
EP0996888B1 (en) Method and data processing system for testing an assembler program for transferability
EP1861796A2 (en) Documentation generation process
DE19954793A1 (en) Compiling machine program involves re-compiling only these source text data files using changed Include data files and those source text data files that have been changed

Legal Events

Date Code Title Description
AK Designated states

Kind code of ref document: A1

Designated state(s): CA JP US

AL Designated countries for regional patents

Kind code of ref document: A1

Designated state(s): AT BE CH CY DE DK ES FI FR GB GR IE IT LU MC NL PT SE

121 Ep: the epo has been informed by wipo that ep was designated in this application
DFPE Request for preliminary examination filed prior to expiration of 19th month from priority date (pct application filed before 20040101)
122 Ep: pct application non-entry in european phase
NENP Non-entry into the national phase

Ref country code: JP