JP2006293437A - Program code generation device and generation method - Google Patents

Program code generation device and generation method Download PDF

Info

Publication number
JP2006293437A
JP2006293437A JP2005109219A JP2005109219A JP2006293437A JP 2006293437 A JP2006293437 A JP 2006293437A JP 2005109219 A JP2005109219 A JP 2005109219A JP 2005109219 A JP2005109219 A JP 2005109219A JP 2006293437 A JP2006293437 A JP 2006293437A
Authority
JP
Japan
Prior art keywords
program code
generation
deletion
design drawing
information
Prior art date
Legal status (The legal status 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 status listed.)
Withdrawn
Application number
JP2005109219A
Other languages
Japanese (ja)
Inventor
Masataka Bessho
正隆 別所
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2005109219A priority Critical patent/JP2006293437A/en
Publication of JP2006293437A publication Critical patent/JP2006293437A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To generate a program code which can use a dynamic memory management unit included in an embedded OS in a program code generation device. <P>SOLUTION: The program code generation method equipped with a generation process to generate a program code from a design drawing is equipped with; a process (step S704) which analyzes information in the design drawing and extracts description about generation and deletion of each object included in program code to be generated; and a process which determines a life cycle of each object (step S705) based on extracted description. The generation process is characterized by deciding a memory area in which each object is arranged when this program code is read into the memory and executed based on the life cycle determined according to the above process (step S705), in generating the program code based on the above design drawing. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、ソフトウェアの設計図面からプログラムコードを自動生成するプログラムコード生成装置における情報処理技術に関するものである。   The present invention relates to an information processing technique in a program code generation device that automatically generates a program code from a software design drawing.

近年、ソフトウェア設計技術として、モデル駆動型アーキテクチャー(Model Driven Architecture技術(以降、MDA技術と称す)が広まり、採用されるようになってきている。   2. Description of the Related Art In recent years, model driven architecture (Model Drive Architecture technology (hereinafter referred to as MDA technology)) has become widespread and adopted as software design technology.

一般的にMDA技術によれば、オペレータが入力したソフトウェアの設計図面情報から各種プラットフォームのプログラムコードを自動的に生成したり、入力したソフトウェアの設計図面情報をMDA専用ツール上で動作させ検証したりすることが可能である。   In general, according to the MDA technology, program codes for various platforms are automatically generated from software design drawing information input by an operator, or input software design drawing information is operated on an MDA-dedicated tool for verification. Is possible.

また、ソフトウェアの設計図面情報を記述するためには、例えばオブジェクト指向技術のモデル表記言語であるUML(Unified Modeling Language)やSDL(Specification & Description Language)などの言語が一般に用いられる。   For describing software design drawing information, for example, languages such as UML (Unified Modeling Language) and SDL (Specification & Description Language) which are model notation languages of object-oriented technology are generally used.

ここで、既存のプログラムコード生成装置により生成されるプログラムコードの場合、設計図面情報からプログラムコードに変換するルールによっては、そのサイズが大きくなってしまうことがある。このため、生成されたプログラムコードが実行される装置において、実行のために多くのRAMが必要となることがあり、組み込みシステムなどメモリ容量の制限が厳しい環境下では、MDA技術の導入に躊躇するケースが少なくない。このため、実行時に必要となるRAM容量が小さいプログラムコードの生成が望まれている。   Here, in the case of a program code generated by an existing program code generation device, the size may increase depending on a rule for converting design drawing information into a program code. For this reason, in a device in which the generated program code is executed, a lot of RAM may be required for execution. In an environment where the memory capacity is severely limited such as an embedded system, the introduction of MDA technology is hesitant. There are many cases. For this reason, it is desired to generate a program code with a small RAM capacity required at the time of execution.

一方で、これまで、プログラムコード実行時に必要とされるメモリ容量を削減するための様々な提案がなされている。例えば、設計図面の段階において最適化を行う技術として、特開平11−237980号公報掲載の「オブジェクト指向最適化コード生成装置および方法」、特開2004−118865号公報掲載の「最適化ソフトウエア生成方法」が挙げられる。同公報によれば、オブジェクト指向機能排除手段を用いて仮想関数の機能を排除、もしくはインスタンスの動的生成の機能を排除することで必要なメモリ容量を増加させることなく組み込みシステムに適用可能なプログラムコードの最適化を行うことができる。   On the other hand, various proposals have been made so far for reducing the memory capacity required for executing the program code. For example, as techniques for performing optimization at the stage of a design drawing, “Object-oriented optimization code generation apparatus and method” disclosed in Japanese Patent Laid-Open No. 11-237980 and “Optimization software generation” disclosed in Japanese Patent Application Laid-Open No. 2004-118865 are disclosed. Method ". According to this publication, a program that can be applied to an embedded system without increasing the required memory capacity by eliminating the function of a virtual function using object-oriented function exclusion means, or eliminating the function of dynamic generation of instances. The code can be optimized.

また、組み込みシステム用のソフトウェア開発においてRAM容量を削減する技術として、特開2000−40005号公報掲載の「プログラム変換装置」や、特開2001−184214号公報掲載の「メモリ配置方法、及びオブジェクトクラス設計方法」が挙げられる。同公報によれば、プログラムコード中でconst指定されたインスタンス変数やオブジェクトをROM上に配置することにより、RAM容量の削減を実現する。   Further, as a technology for reducing the RAM capacity in software development for embedded systems, “Program conversion device” disclosed in Japanese Patent Laid-Open No. 2000-40005 and “Memory allocation method and object class” disclosed in Japanese Patent Laid-Open No. 2001-184214 are disclosed. Design method ". According to the publication, reduction of RAM capacity is realized by arranging instance variables and objects designated in the program code as const on the ROM.

さらに、特開2002−91762号公報掲載の「プログラム生成装置」では、ROMのデータのアドレスをRAMへ再配置する際のアドレス変換に関する技術が開示されている。
特開平11−237980号公報 特開2004−118865号公報 特開2000−40005号公報 特開2001−184214号公報 特開2002−91762号公報
Furthermore, “Program generation device” disclosed in Japanese Patent Application Laid-Open No. 2002-91762 discloses a technique related to address conversion when a ROM data address is rearranged in a RAM.
Japanese Patent Laid-Open No. 11-237980 JP 2004-118865 A JP 2000-40005 A JP 2001-184214 A JP 2002-91762 A

しかしながら、上記特許文献1乃至特許文献5に開示された技術は、いずれもMDA技術の実行可能モデルを考慮したものではない。したがって、MDA技術に適用可能な技術の提案が望まれる。   However, none of the techniques disclosed in Patent Documents 1 to 5 considers an executable model of the MDA technique. Therefore, a proposal of a technique applicable to the MDA technique is desired.

ここで、現状のMDAツールで生成できるプログラムコードは、汎用OS上のアプリケーションであることが多く、組み込みシステム向けソフトウェアの領域では実績が乏しい。とりわけ、メモリ領域の使用方法については可変長メモリ管理を前提とするプログラムコードが生成される場合がほとんどで、MDAツールで生成したプログラムコードの組み込み向けの修正は開発者に任されている場合が多い。   Here, the program code that can be generated by the current MDA tool is often an application on a general-purpose OS, and has a poor track record in the area of software for embedded systems. In particular, with regard to the method of using the memory area, program code that assumes variable-length memory management is mostly generated, and modifications for embedding the program code generated by the MDA tool may be left up to the developer. Many.

一般的に、汎用OS上にて行われるアプリケーション開発の場合、C言語ではmallocやfree、C++言語ではnewやdeleteなどを使い、メモリ領域の確保と解放とを行っている。また、メモリ領域の確保と解放とは動的に行うことができ、メモリ領域の要求に際してはサイズを指定して行うこともできる。   In general, in the case of application development performed on a general-purpose OS, the memory area is secured and released using malloc and free in the C language and new and delete in the C ++ language. In addition, the securing and releasing of the memory area can be performed dynamically, and when the memory area is requested, the size can be designated.

しかし、これら可変長メモリの割り当てはその管理が煩わしく、一般的に実行速度が遅く時間がかかる。とくにメモリ領域内に要求したサイズ分の空き領域がない場合にはさらに実行時間が増加する。加えて、システムを長時間稼動する場合、フラグメンテーションが発生し、システムの安定動作を保証できなくなる可能性が高い。   However, these variable length memory allocations are cumbersome to manage and generally slow in execution speed and take time. In particular, when there is no free area of the requested size in the memory area, the execution time further increases. In addition, when the system is operated for a long time, fragmentation occurs, and there is a high possibility that the stable operation of the system cannot be guaranteed.

こうした理由から、組み込みシステムにおけるソフトウェアの開発では動的な可変長メモリ管理は利用されることは少ない。その代わり、組み込みシステムのOS(以下、組み込みOS)においては、RAM上のメモリ領域を固定長で確保し、その領域内を可変長や固定長で確保したり解放したりするメモリ管理機構を備えている場合が多い。   For these reasons, dynamic variable-length memory management is rarely used in software development in embedded systems. Instead, an embedded system OS (hereinafter referred to as an embedded OS) has a memory management mechanism that secures a memory area in the RAM with a fixed length and secures or releases the area in a variable length or a fixed length. There are many cases.

例えば、組み込みOSで知られるμITRON仕様では、ソフトウェアによる動的なメモリの管理を実現するために、固定長メモリプールや可変長メモリプールと呼ばれるメモリ管理機能が搭載されている。管理機構が単純なため、実行速度が速く、とくに固定長メモリプールでは、フラグメンテーションが起きないという利点がある。これらのメモリ管理機構は、実行速度や安定性保証の面でも有効なため、組み込みシステムのソフトウェアに利用されることは勿論、汎用OS上のアプリケーションにも利用されることが多い。   For example, in the μITRON specification known for an embedded OS, a memory management function called a fixed-length memory pool or a variable-length memory pool is installed in order to realize dynamic memory management by software. Since the management mechanism is simple, the execution speed is fast, and there is an advantage that fragmentation does not occur particularly in a fixed-length memory pool. Since these memory management mechanisms are also effective in terms of execution speed and stability guarantee, they are often used not only for embedded system software but also for applications on general-purpose OSs.

このようなことから、組み込みシステム向けのプログラムコードとしてメモリ管理機能を利用可能なプログラムコードを、MDAツールを用いて生成することが望まれる。   For this reason, it is desirable to generate a program code that can use the memory management function as a program code for an embedded system by using an MDA tool.

しかしながら、MDA技術では設計図面はプラットフォームに非依存であるため、固定長および可変長メモリプールに代表されるメモリ管理機構を利用するプログラムコードが生成されることはなく、メモリプール領域やそのサイズの指定を行う部分は、プログラムコード生成後、開発者自らが生成コードを修正して設定しなしているのが現状である。   However, since the design drawing is independent of the platform in the MDA technology, a program code using a memory management mechanism represented by a fixed-length and variable-length memory pool is not generated, and the memory pool area and its size are not generated. At present, the part to be specified is set by the developer himself after correcting the generated code after generating the program code.

本発明は、上記課題に鑑みてなされたものであり、MDA技術を用いてソフトウェアの設計図面からプログラムコードを生成するプログラムコード生成装置において、組み込みシステムのOSが有する動的なメモリ管理機構を利用可能なプログラムコードを生成することを目的とする。   The present invention has been made in view of the above problems, and uses a dynamic memory management mechanism possessed by an OS of an embedded system in a program code generation apparatus that generates a program code from a software design drawing using MDA technology. The aim is to generate possible program code.

上記の目的を達成するために本発明に係るプログラムコード生成装置は以下のような構成を備える。即ち、
オブジェクト指向プログラミングにおけるモデル表記言語により記述された設計図面から、プログラムコードを生成する生成手段を備えるプログラムコード生成装置であって、
前記設計図面の情報を解析し、生成されるプログラムコードに含まれる各オブジェクトの生成及び削除に関する記述を抽出する抽出手段と、
前記抽出手段により抽出された記述に基づいて、各オブジェクトの生成から削除までのサイクルを判定する判定手段と、を備え、
前記生成手段は、前記設計図面に基づいたプログラムコードの生成にあたり、該プログラムコードがメモリに読み込まれ実行された場合に各オブジェクトが配置されるメモリ領域を、前記判定手段により判定されたサイクルに基づいて決定することを特徴とする。
In order to achieve the above object, a program code generation device according to the present invention comprises the following arrangement. That is,
A program code generation device comprising a generation means for generating a program code from a design drawing described in a model notation language in object-oriented programming,
Extracting means for analyzing the information of the design drawing and extracting a description relating to generation and deletion of each object included in the generated program code;
Determination means for determining a cycle from generation to deletion of each object based on the description extracted by the extraction means,
The generation means generates a program code based on the design drawing. A memory area in which each object is arranged when the program code is read into a memory and executed is determined based on the cycle determined by the determination means. It is characterized by determining.

本発明によれば、MDA技術を用いてソフトウェアの設計図面からプログラムコードを生成するプログラムコード生成装置において、組み込みシステムのOSが有する動的なメモリ管理機構を利用可能なプログラムコードを生成することが可能となる。   According to the present invention, in a program code generation apparatus that generates a program code from a software design drawing using MDA technology, it is possible to generate a program code that can use a dynamic memory management mechanism of an embedded system OS. It becomes possible.

はじめに本発明の実施形態の概要について説明する。一般に、MDA技術では、設計図面を解析することにより、オブジェクトの生成や削除箇所を明確にすることができる。そこで、以下の実施形態にかかるプログラムコード生成装置では、当該設計図面の解析によりオブジェクトの生成箇所や削除箇所を明確にし、さらに、該オブジェクトごとのライフサイクルを把握することで、オブジェクト生成に必要なメモリ領域をどう確保するか、すなわち、静的または動的に確保すべきかを判断することができるように構成した。この結果、組み込みシステムのOSが有する動的なメモリ管理機構を利用可能なプログラムコードを生成することが可能となった。以下、必要に応じて添付図面を参照しながら本発明の各実施形態を詳細に説明する。   First, an outline of an embodiment of the present invention will be described. In general, in the MDA technique, the generation or deletion of an object can be clarified by analyzing a design drawing. Therefore, in the program code generation device according to the following embodiment, the generation location and deletion location of an object are clarified by analysis of the design drawing, and further, the life cycle of each object is grasped, so that it is necessary for object generation. It was configured to be able to determine how to secure the memory area, that is, whether to allocate statically or dynamically. As a result, it has become possible to generate a program code that can use the dynamic memory management mechanism possessed by the OS of the embedded system. Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings as necessary.

<プログラムコード生成装置の構成>
図1は本発明の一実施形態にかかるプログラムコード生成装置の全体構成を示す図である。図1において、1はCPUであり、以下に説明する3〜10の各装置に対してバス2を介してアクセスし、その制御を行なう。
<Configuration of program code generator>
FIG. 1 is a diagram showing an overall configuration of a program code generation device according to an embodiment of the present invention. In FIG. 1, reference numeral 1 denotes a CPU, which accesses and controls each of 3 to 10 devices described below via a bus 2.

3はバス2を介してCPU1からアクセス可能な読み出し専用メモリ(ROM)であり、処理プログラム3a及び処理プログラム3aにより使用されるパラメータ3bが格納されている。   A read-only memory (ROM) 3 is accessible from the CPU 1 via the bus 2 and stores a processing program 3a and a parameter 3b used by the processing program 3a.

4は読み書き可能なメモリ(RAM)であり、RAM4上には、上記処理プログラム3aにより作成/変更がなされる、設計図面情報、プラットフォーム情報、オブジェクト生成削除箇所情報、オブジェクトライフサイクル情報、プログラムコード、ライブラリ、実行可能形式をそれぞれ格納するための領域(順に4a、4b、4c、4d、4e、4f、4g)が確保されている。   Reference numeral 4 denotes a readable / writable memory (RAM). On the RAM 4, design drawing information, platform information, object generation / deletion location information, object life cycle information, program code, created / changed by the processing program 3a, Areas (4a, 4b, 4c, 4d, 4e, 4f, 4g in order) for storing the library and the executable format are secured.

5は入力インターフェイスであり、6で示したキーボード、ボタン、マウス、ダイアル等の入力装置を介してなされる入力を受け取る。7は出力インターフェイスであり、8で示したCRT、LCD等の表示媒体、更にはプリンタ、プロッタ等の出力装置に対し、データの表示/出力を行なう。また、9は外部記憶装置インターフェイスであり、10で示したHD、FD、CD−ROM、MD、CF等の外部記憶装置に対するデータの入出力を行なう。   Reference numeral 5 denotes an input interface that receives an input made via an input device such as a keyboard, button, mouse, or dial shown in 6. Reference numeral 7 denotes an output interface, which displays / outputs data to a display medium such as a CRT or LCD shown in 8 and an output device such as a printer or plotter. Reference numeral 9 denotes an external storage device interface, which inputs / outputs data to / from an external storage device such as HD, FD, CD-ROM, MD, and CF shown at 10.

なお、本実施形態では、処理プログラム3aやパラメータ3bがROM3上にあるものとして、また、処理対象となる各データの格納領域(4a〜4g)がRAM4上にあるものとして説明を行なうが、これらはすべて、外部記憶装置10上に配置することも可能であり、更に、必要に応じて、外部記憶装置10からRAM4上にロードし、使用することもできる。また、CPU1のキャッシュメモリ上に配置することも可能である。   In the present embodiment, it is assumed that the processing program 3a and the parameter 3b are on the ROM 3, and the storage area (4a to 4g) for each data to be processed is on the RAM 4. Can be arranged on the external storage device 10 and can be loaded from the external storage device 10 onto the RAM 4 and used as necessary. It can also be arranged on the cache memory of the CPU 1.

<処理プログラム3aによる処理の概要>
図2は、処理プログラム3aによる処理の概要を示すものであり、処理プログラム3aの構成要件とそれら構成要件が図1の4a〜4gで示した格納領域に格納されるデータとどのような関係にあるかを示している。
<Outline of processing by processing program 3a>
FIG. 2 shows an outline of processing by the processing program 3a, and the relationship between the configuration requirements of the processing program 3a and the data stored in the storage areas indicated by 4a to 4g in FIG. It shows whether there is.

200は図1における入力インターフェイス5を介して入力されるデータを扱うGUI入力処理部であり、ユーザはこのGUI入力処理部によりデータの入力や編集と、各処理部への指示ができるようになっている。なお、本実施形態にかかるプログラムコード生成装置の場合、GUI入力処理部は自動生成装置起動部200の一機能として動作するものとする。   Reference numeral 200 denotes a GUI input processing unit that handles data input via the input interface 5 in FIG. 1, and the user can input and edit data and give instructions to each processing unit using this GUI input processing unit. ing. In the case of the program code generation device according to the present embodiment, the GUI input processing unit operates as a function of the automatic generation device activation unit 200.

201は外部記憶装置10内から実行可能な設計図面を読み込み、構文解析を行う設計図面入力部であり、処理プログラム3aが実行可能な設計図面を解釈し、設計図面情報を生成することを可能にする。   A design drawing input unit 201 reads an executable design drawing from the external storage device 10 and performs syntax analysis. The processing program 3a can interpret the executable design drawing and generate design drawing information. To do.

202は外部記憶装置10内から実行ファイルの動作するOSやCPUやプログラミング言語やフレームワークといったプラットフォームデータを読み込み、構文解析を行うプラットフォーム情報入力部であり、処理プログラム3aがプラットフォーム情報を生成することを可能にする。   Reference numeral 202 denotes a platform information input unit that reads platform data such as an OS, CPU, programming language, and framework on which an executable file operates from the external storage device 10 and performs syntax analysis. The processing program 3a generates platform information. enable.

203は設計図面入力部201において生成された、処理プログラム3aが解釈することが可能な設計図面情報である。204はプラットフォーム情報入力部202において生成された、処理プログラム3aが解釈することが可能なプラットフォーム情報である。   Reference numeral 203 denotes design drawing information generated by the design drawing input unit 201 and interpretable by the processing program 3a. Reference numeral 204 denotes platform information generated by the platform information input unit 202 and interpretable by the processing program 3a.

205は設計図面情報203を解析することで、オブジェクトの生成箇所および削除箇所を抽出するオブジェクト生成削除箇所抽出部であり、設計図面情報203からオブジェクトの生成や削除についての記述を抽出し、それがシステム初期化時やシステム稼動後のいかなるタイミングであるかを処理プログラム3aが解釈することを可能にする。206はオブジェクト生成削除箇所抽出部205が生成したオブジェクト生成削除箇所情報である。   Reference numeral 205 denotes an object generation / deletion part extraction unit that extracts a generation part and a deletion part of an object by analyzing the design drawing information 203, and extracts a description about generation and deletion of the object from the design drawing information 203. It is possible for the processing program 3a to interpret the timing when the system is initialized or after the system is operated. Reference numeral 206 denotes object generation / deletion location information generated by the object generation / deletion location extraction unit 205.

207はオブジェクト生成削除箇所抽出部205において生成されたオブジェクト生成削除箇所情報206から、オブジェクトのライフサイクルを判定するオブジェクトライフサイクル判定部であり、オブジェクトのライフサイクルがシステムの起動終了と同期した長期的なライフサイクルか、システム稼動中に生成と削除を繰り返す短期的なライフサイクルか、関数内のブロックスコープ内で生成と削除を行うライフサイクルかを処理プログラム3aが判定することを可能にする。   Reference numeral 207 denotes an object life cycle determination unit that determines the life cycle of the object from the object generation / deletion point information 206 generated by the object generation / deletion point extraction unit 205. The object life cycle is synchronized with the end of activation of the system. It is possible for the processing program 3a to determine whether the life cycle is a short life cycle in which generation and deletion are repeated while the system is operating, or a life cycle in which generation and deletion are performed within a block scope within a function.

208はオブジェクトライフサイクル判定部207が生成するオブジェクトライフサイクル情報であり、判定したオブジェクトのライフサイクル情報をもち、加えて、オブジェクトのデータサイズ、オブジェクトの生成や削除を行うオブジェクトに関する情報を有することもある。   Reference numeral 208 denotes object life cycle information generated by the object life cycle determination unit 207, which has life cycle information of the determined object, and additionally has information on the object data size, and the object that generates and deletes the object. is there.

209は設計図面情報203やプラットフォーム情報204やオブジェクトライフサイクル情報208から、プログラムコードを自動生成するプログラムコード生成部で、組み込みOSで一般的に利用される動的なメモリ管理機構を使って、オブジェクトを配置するメモリ領域を選択および指定可能なプログラムコードを生成することが可能である。   Reference numeral 209 denotes a program code generation unit that automatically generates a program code from the design drawing information 203, platform information 204, and object life cycle information 208, and uses a dynamic memory management mechanism that is generally used in an embedded OS. It is possible to generate a program code capable of selecting and designating a memory area in which the data is arranged.

210はプログラムコード生成部209から生成されたプログラムコードである。211はプログラムコードから参照されるライブラリである。212はプログラムコード210とライブラリ211とを用いて生成されたプログラムコード210をコンパイル、リンクするコードコンパイラである。   Reference numeral 210 denotes a program code generated from the program code generation unit 209. Reference numeral 211 denotes a library referenced from the program code. A code compiler 212 compiles and links the program code 210 generated using the program code 210 and the library 211.

213はコードコンパイラ212にて生成されたプログラム実行形式で、組み込みOSで一般的に利用される動的なメモリ管理機構を使って、オブジェクトを配置するためのメモリ領域を選択および指定可能なプログラム実行形式である。   213 is a program execution format generated by the code compiler 212. A program execution format that can select and specify a memory area for placing an object using a dynamic memory management mechanism generally used in an embedded OS. Format.

<設計図面についての説明>
次に実行可能な設計図面について説明する。実行可能な設計図面の全体構成を規定する図面は、一般にドメイン図と呼ばれている。具体的な例を図3を用いて説明する。図3は、オペレータからの入力を受け、ライトを付けたり、時間を指定してライトを消すシステムを表したドメイン図の一例である。301はライトを明滅するシステムの制御を行うControllerドメイン、302はオペレータからの操作を受け取るUIドメイン、303はライトを制御するLightドメイン、304はタイムサービスを提供するTimerドメインを示している。
<Description of design drawings>
Next, an executable design drawing will be described. A drawing that defines the overall structure of an executable design drawing is generally called a domain diagram. A specific example will be described with reference to FIG. FIG. 3 is an example of a domain diagram showing a system that receives an input from an operator, turns on a light, and designates a time to turn off the light. Reference numeral 301 denotes a controller domain that controls a system that blinks light, 302 denotes a UI domain that receives an operation from an operator, 303 denotes a light domain that controls light, and 304 denotes a timer domain that provides a time service.

なお、ドメイン同士の結びつきは「関連」と呼ばれ、図3においては矢印付きの点線で表現されており、ここではドメイン間の通信であるイベントの送受信があることを示している。関連305は、Controllerドメイン301とTimerドメイン304の間で、双方向のイベント通信を行うため、両方向に矢印のついた点線で示している。関連306は、Controllerドメイン301とLightドメイン303の間で、片方向のイベント通信を行うため、Lightドメイン303側だけに矢印のついた点線で示している。   The connection between domains is called “association”, and is represented by a dotted line with an arrow in FIG. 3, which indicates that there is an event transmission / reception that is communication between domains. The association 305 is indicated by a dotted line with arrows in both directions in order to perform bidirectional event communication between the Controller domain 301 and the Timer domain 304. The association 306 is indicated by a dotted line with an arrow only on the Light domain 303 side in order to perform one-way event communication between the Controller domain 301 and the Light domain 303.

実行可能な設計図面において、処理を行うオブジェクトの静的な構造を示す設計図面は、クラス図と呼ばれている。具体的な例を図4を用いて説明する。図4は、図3に示すドメイン図において、ライトを明滅するシステムの制御を行うControllerドメイン301のクラス図の一例である。   In an executable design drawing, a design drawing showing a static structure of an object to be processed is called a class diagram. A specific example will be described with reference to FIG. FIG. 4 is an example of a class diagram of the Controller domain 301 that controls the system that blinks light in the domain diagram shown in FIG.

図4において、401はクラスの名称を示す。ここでは「Controller」がクラスの名称である。402はControllerクラスが「name」というString型のインスタンス変数を持つことを表現している。403はControllerクラスが「getName」というメソッドをもち、「evOn」、「evOff」、「alarm」という3つのイベントを受け取ることを示している。このようにメソッドには処理の内容が書かれており、イベントにはクラス間での通信オブジェクトが書かれている。   In FIG. 4, 401 indicates the name of the class. Here, “Controller” is the name of the class. Reference numeral 402 represents that the Controller class has a string type instance variable “name”. Reference numeral 403 indicates that the Controller class has a method “getName” and receives three events “evOn”, “evOff”, and “alarm”. In this way, the contents of processing are written in the method, and the communication object between classes is written in the event.

実行可能な設計図面において、クラスの動的な振る舞いは、状態の遷移を表現する図や表などで表現する。具体的な例を図5を用いて説明する。図5は状態遷移図を用いてクラスの動的な振る舞いを表現した例で、図4におけるControllerクラスの状態遷移図の一例である。   In an executable design drawing, the dynamic behavior of a class is represented by a diagram or table that represents a state transition. A specific example will be described with reference to FIG. FIG. 5 is an example of expressing the dynamic behavior of the class using the state transition diagram, and is an example of the state transition diagram of the Controller class in FIG.

図5において、501は初期状態を示し、Controllerクラスのインスタンスが生成されたときに入る状態を表す。初期状態501はその状態に留まることはなく、すぐに次の状態502に遷移する。502は「Off」と名づけた状態を表し、Controllerクラスのインスタンスが生成された後、この状態に留まる。   In FIG. 5, reference numeral 501 represents an initial state, and represents a state that is entered when an instance of the Controller class is generated. The initial state 501 does not stay in that state, and immediately transitions to the next state 502. Reference numeral 502 denotes a state named “Off”, and remains in this state after an instance of the Controller class is generated.

503は状態から状態への遷移を示し、Off状態502のときにevOnイベントが発行されると特定のアクションevOn()を実行して、状態504に遷移する。505は、On状態504のときにalarmイベントが発行されると特定のアクションalarm()を実行して、再度、On状態504に遷移する。なお、一般に、状態遷移図にはアクションを記述することも可能であるが、図5に示した状態遷移図の例では別のファイルに定義して利用する場合を示している。   Reference numeral 503 denotes a transition from state to state. When an evOn event is issued in the off state 502, a specific action evOn () is executed, and the state 504 is transitioned to. When an alarm event is issued in the On state 504, 505 executes a specific action alarm () and transitions to the On state 504 again. In general, an action can be described in the state transition diagram, but the example of the state transition diagram shown in FIG. 5 shows a case where it is defined and used in another file.

プラットフォーム非依存であり、実行可能であり、かつオブジェクト指向である、設計図面において、各クラスの状態における処理手順の記述は一般的に「アクション」と呼ばれる。なお、本実施形態ではアクションの記述を別ファイルにて提供する場合を例に説明するが、状態遷移図などに記入するようにしてもよい。   In a design drawing that is platform-independent, executable, and object-oriented, the description of the processing procedure in each class state is generally called an “action”. In the present embodiment, the case where the description of the action is provided in a separate file will be described as an example, but it may be entered in a state transition diagram or the like.

次にプラットフォーム非依存であり、実行可能であり、かつオブジェクト指向である、設計図面におけるアクション記述の例を図6に示す。   Next, FIG. 6 shows an example of an action description in a design drawing that is platform-independent, executable, and object-oriented.

図6において、601は図3のドメイン図で示したシステムの初期化時に実行されるアクションを示した例である。システムで必要となるControllerクラス、UIクラス、Lightクラスのインスタンスを、それぞれnewにより作成する。   In FIG. 6, reference numeral 601 denotes an example of an action executed when the system shown in the domain diagram of FIG. 3 is initialized. Instances of the Controller class, UI class, and Light class necessary for the system are respectively created by new.

ここで作成したインスタンスは、システム全体で操作可能な変数として登録するため、registLinkにより登録する。602は図5で示したControllerクラスの状態遷移図において、Off状態502からOn状態504に遷移するアクションevOnを記述した例である。   The instance created here is registered by registerLink in order to register it as a variable that can be manipulated by the entire system. Reference numeral 602 denotes an example in which an action evOn for transitioning from the Off state 502 to the On state 504 is described in the state transition diagram of the Controller class shown in FIG.

evOnアクション602では、このアクション内で、クラスTimerのインスタンスを新たに生成し、このアクションを実行するControllerクラスのインスタンス内で操作可能な変数として登録するため、resigtLinkにより登録する。さらに、evOnアクション602では、既にシステム全体で操作可能として登録したLightクラスの唯一のインスタンスをqueryLinkにより入手して、ライトを点灯するためのイベントlightOnをsendEventにより送信する。   In the evOn action 602, an instance of the class Timer is newly generated in this action, and is registered as a variable that can be manipulated in the instance of the Controller class that executes this action. Further, in the evOn action 602, the only instance of the Light class that has already been registered as operable by the entire system is obtained by queryLink, and an event “lightOn” for turning on the light is transmitted by sendEvent.

603は図5で示したControllerクラスの状態遷移図において、On状態504からOff状態502に遷移するアクションevOffを記述した例である。evOffアクション603では、既にシステム全体で操作可能として登録したLightクラスの唯一のインスタンスをqueryLinkにより入手して、ライトを消灯するためのイベントlightOffをsendEventにより送信する。   Reference numeral 603 denotes an example in which an action evOff for transitioning from the On state 504 to the Off state 502 is described in the state transition diagram of the Controller class shown in FIG. In the evOff action 603, a single instance of the Light class that has already been registered as operable in the entire system is obtained by queryLink, and an event “lightOff” for turning off the light is transmitted by sendEvent.

さらに、evOffアクション603では、evOnアクション602でControllerクラスのインスタンス内で操作可能な変数として登録したTimerクラスのインスタンスをqueryLinkにより入手してtimerインスタンスを削除する。加えて、evOffアクション603では、既にシステム全体で操作可能として登録したUIクラスの唯一のインスタンスuiをqueryLinkにより入手して、ライトを消灯したことを知らせるイベントstopをsendEventにより送信する。   Further, in the evOff action 603, the instance of the Timer class registered as a variable that can be manipulated in the instance of the Controller class by the evOn action 602 is obtained by queryLink, and the timer instance is deleted. In addition, in the evOff action 603, the only instance ui of the UI class that has already been registered as operable in the entire system is obtained by queryLink, and an event stop that notifies that the light has been turned off is transmitted by sendEvent.

なお、図6に示したアクションの例では、インスタンスの識別に生成時の変数名を利用しているが、インスタンスを識別するための情報、例えばシステム内で特定できる識別番号などを用いる別の方法でも実現可能である。   In the example of the action shown in FIG. 6, the variable name at the time of generation is used to identify the instance. However, another method using information for identifying the instance, for example, an identification number that can be specified in the system But it is feasible.

また、図6に示したアクションの例では、生成したクラスのインスタンスが、システム全体で利用可能なインスタンスであるのか、特定のインスタンス内で利用可能なインスタンスであるのか、アクション記述のブロック内だけで利用可能なインスタンスであるのかを、ユーザがアクションで記述することとしているが、図4で示したドメイン図や図5で示したクラス図からこれらの変数の利用範囲を特定する情報を得ることができるため、特にこの方法によるものでないことはいうまでもない。   In the example of the action shown in FIG. 6, whether the generated class instance is an instance that can be used in the entire system, an instance that can be used in a specific instance, or only in an action description block. Whether the instance can be used is described by an action by the user, but information specifying the use range of these variables can be obtained from the domain diagram shown in FIG. 4 or the class diagram shown in FIG. Needless to say, this is not the case.

<プログラムコード生成装置における処理の詳細>
以下、本発明の一実施形態にかかるプログラムコード生成装置における処理の詳細を図面およびフローチャートを参照して説明する。
<Details of processing in program code generation device>
Details of processing in the program code generation device according to the embodiment of the present invention will be described below with reference to the drawings and flowcharts.

図7は、本実施形態にかかるプログラムコード生成装置全体の処理手順を示したフローチャートである。はじめにステップS701において外部記憶装置10内などに記憶してある実行可能な設計図面を読み込み、設計図面入力部201により設計図面情報203を生成する。   FIG. 7 is a flowchart showing a processing procedure of the entire program code generation device according to the present embodiment. First, in step S <b> 701, an executable design drawing stored in the external storage device 10 or the like is read, and the design drawing information 203 is generated by the design drawing input unit 201.

ステップS702では、プラットフォーム情報の入力があるか否かを判断し、プラットフォーム情報の入力があると判断した場合にはステップS703へ分岐し、プラットフォーム情報204を生成する。一方、ステップS702にてプラットフォーム情報の入力がないと判断した場合にはステップS704へ分岐する。プラットフォーム情報の入力とは、例えば、タスクやスレッドをどこのドメインやクラスなどにマッピングさせるか、実行スピード優先なのか、メモリ容量節約優先なのか、などの生成したプログラムコードが実行されるプラットフォームに依存した情報である。   In step S702, it is determined whether there is platform information input. If it is determined that platform information is input, the process branches to step S703 to generate platform information 204. On the other hand, if it is determined in step S702 that there is no input of platform information, the process branches to step S704. Platform information input depends on the platform on which the generated program code is executed, such as whether to map tasks and threads to which domain or class, whether execution speed is prioritized, or memory capacity is prioritized Information.

ステップS704では、設計図面情報203を解析してオブジェクトの生成削除箇所を抽出し、オブジェクト生成削除箇所情報206を生成する。ステップS705では、ステップS704にて抽出したオブジェクト生成削除箇所情報206からオブジェクトのライフサイクルを判定し、オブジェクトライフサイクル情報208を生成する。   In step S704, the design drawing information 203 is analyzed to extract an object generation / deletion point, and object generation / deletion point information 206 is generated. In step S705, the life cycle of the object is determined from the object generation / deletion location information 206 extracted in step S704, and object life cycle information 208 is generated.

ステップS706では設計図面情報203とプラットフォーム情報204とオブジェクトライフサイクル情報208とを用いてプログラムコード210を生成する。ステップS707ではプログラムコード210とライブラリ211から、コードコンパイラ212によりコンパイル、リンクを実施し、プログラム実行形式213を生成する。   In step S706, the program code 210 is generated using the design drawing information 203, the platform information 204, and the object life cycle information 208. In step S707, the code compiler 212 compiles and links the program code 210 and the library 211 to generate a program execution format 213.

<オブジェクト生成削除箇所抽出部における処理の流れ>
図8は、図2に示すオブジェクト生成削除箇所抽出部205における処理の流れを示すフローチャートである。オブジェクト生成削除箇所抽出部205は設計図面情報203を解析することで、オブジェクトの生成箇所および削除箇所を抽出する。処理プログラム3aでは、抽出された記述に基づいて、それがシステム初期化時やシステム稼動後のいかなるタイミングであるかを解釈することができる。
<Flow of processing in the object generation / deletion location extraction unit>
FIG. 8 is a flowchart showing the flow of processing in the object generation / deletion location extraction unit 205 shown in FIG. The object generation / deletion location extraction unit 205 analyzes the design drawing information 203 to extract an object generation location and a deletion location. Based on the extracted description, the processing program 3a can interpret the timing when the system is initialized or after the system is operated.

ステップS801では、処理実行時に利用するオブジェクトの生成削除箇所を管理するリストをクリアする。ステップS802では設計図面情報203からアクション記述を読み込む。なお、以下、ステップS802からステップS811までの処理は、設計図面情報203から読み込まれる全てのアクション記述に対して行われる。   In step S801, the list for managing the generation / deletion location of the object used when executing the process is cleared. In step S802, an action description is read from the design drawing information 203. Hereinafter, the processing from step S802 to step S811 is performed for all action descriptions read from the design drawing information 203.

ステップS803では設計図面情報203から読み込んだアクション記述がオブジェクトの生成アクションかを判断し、生成アクションであればステップS804に分岐し、生成アクションでなければステップS807に分岐する。   In step S803, it is determined whether the action description read from the design drawing information 203 is an object generation action. If it is a generation action, the process branches to step S804, and if it is not a generation action, the process branches to step S807.

ステップS804では、対象となるオブジェクトについてのオブジェクト削除情報が既にリストに登録されているか否かを判断し、登録されていると判断した場合には、ステップS806に分岐し、登録されていないと判断した場合には、ステップS805に分岐する。   In step S804, it is determined whether or not the object deletion information for the target object is already registered in the list. If it is determined that the object deletion information is registered, the process branches to step S806 and is determined not to be registered. If so, the process branches to step S805.

ステップS805では、オブジェクトの生成情報をリストに新規に追加登録する。一方、ステップS806では、リストにそのオブジェクトの削除情報がある場合の処理で、リストに既に登録されているオブジェクト削除情報に、オブジェクト生成情報を追記する。   In step S805, object generation information is newly registered in the list. On the other hand, in step S806, object generation information is added to the object deletion information already registered in the list in the process in the case where there is deletion information of the object in the list.

なお、オブジェクトがクラスの実体であるインスタンスの場合、オブジェクト生成情報には、生成されたオブジェクトのクラス名、インスタンス名、生成したインスタンス名、生成したアクション名をリスト記載する。システム起動時に生成されるオブジェクトの場合、生成したインスタンス名にはシステムを表す識別子、例えば「system」をリストに記載する。   If the object is an instance that is a class entity, the object generation information includes a list of the class name, instance name, generated instance name, and generated action name of the generated object. In the case of an object generated when the system is activated, an identifier representing the system, for example, “system” is described in the list in the generated instance name.

また、オブジェクトがクラスのインスタンス間で送受信されるイベントなどの通信オブジェクトの場合、通信オブジェクトを送信する側がオブジェクト生成アクションとなり、送信するオブジェクトのクラス名、インスタンス名、生成した通信オブジェクトの識別子となる通信オブジェクト名または通信オブジェクトIDをリストに記載する。   If the object is a communication object such as an event that is sent and received between instances of the class, the side that sends the communication object becomes the object generation action, and the communication is the class name, instance name, and identifier of the generated communication object. The object name or communication object ID is listed.

次に、ステップS807では設計図面情報203から読み込んだアクション記述がオブジェクトの削除アクションかを判断し、削除アクションであればステップS808に分岐し、削除アクションでなければステップS811に分岐する。   Next, in step S807, it is determined whether the action description read from the design drawing information 203 is an object delete action. If it is a delete action, the process branches to step S808, and if it is not a delete action, the process branches to step S811.

ステップS808では、対象となるオブジェクトについてのオブジェクト生成情報が既にリストに登録されているか否かを判断し、登録されていると判断した場合には、ステップS810に分岐し、登録されていないと判断した場合には、ステップS809に分岐する。   In step S808, it is determined whether or not the object generation information for the target object is already registered in the list. If it is determined that the object generation information is registered, the process branches to step S810 and is determined not to be registered. If so, the process branches to step S809.

ステップS809では、オブジェクトの削除情報をリストに新規に追加登録する。一方、ステップS810では、リストに既に登録されているオブジェクト生成情報に、オブジェクト削除情報を追記する。   In step S809, object deletion information is newly registered in the list. On the other hand, in step S810, object deletion information is added to the object generation information already registered in the list.

ステップS811は設計図面情報203から読み込んだアクション記述の全てに対し、ステップS802からの処理を繰り返すことを示す。   Step S811 indicates that the processing from step S802 is repeated for all the action descriptions read from the design drawing information 203.

<オブジェクト生成削除箇所情報の例>
図9は、図6で示したアクション記述に基づいて、オブジェクト生成削除箇所抽出部205が生成したオブジェクト生成削除箇所情報206の一例を示す図である。図6で示したアクション記述のうち、システムの初期化時に実行されるアクション601からnewを使ったオブジェクト生成箇所を抽出する。
<Example of object creation / deletion location information>
FIG. 9 is a diagram showing an example of the object generation / deletion location information 206 generated by the object generation / deletion location extraction unit 205 based on the action description shown in FIG. From the action description shown in FIG. 6, an object generation location using new is extracted from action 601 executed at the time of system initialization.

同様に、Off状態502からOn状態504に遷移するevOnアクション602からnewを使ったオブジェクト生成箇所を抽出する。さらに、On状態504からOff状態502に遷移するevOffアクション603からdeleteを使ったオブジェクトの削除箇所を抽出する。こうして全てのアクション記述を含む全ての設計図面情報203を解析した結果、deleteを使ったオブジェクトの削除箇所がなかった場合は、図9の表のエントリに「−」を記載する。   Similarly, an object generation location using new is extracted from the evOn action 602 that transitions from the Off state 502 to the On state 504. Furthermore, the deletion part of the object using delete is extracted from the evOff action 603 that makes a transition from the On state 504 to the Off state 502. As a result of analyzing all the design drawing information 203 including all action descriptions in this manner, if there is no deleted part of the object using delete, “-” is described in the entry of the table of FIG.

<オブジェクトライフサイクル判定部における処理の流れ>
図10は、オブジェクトライフサイクル判定部207における処理の流れを示すフローチャートで、図9に例として示したオブジェクト生成削除箇所情報206からオブジェクトライフサイクル情報208を生成するための処理の手順を示す。
<Flow of processing in the object life cycle determination unit>
FIG. 10 is a flowchart showing a processing flow in the object life cycle determination unit 207, and shows a processing procedure for generating the object life cycle information 208 from the object generation / deletion location information 206 shown as an example in FIG.

ステップS1001では図9に例として示したオブジェクト生成削除箇所情報206に記載されているオブジェクトを読み込む。なお、以下、ステップS1001からステップS1014までの処理は、オブジェクト生成削除箇所情報206から読み込まれる全てのオブジェクトに対して行われる。   In step S1001, the object described in the object generation / deletion location information 206 shown as an example in FIG. 9 is read. Hereinafter, the processing from step S1001 to step S1014 is performed for all objects read from the object generation / deletion location information 206.

ステップS1002では、図9に例として示したオブジェクト生成削除箇所情報206の表にオブジェクトの生成アクションと生成したオブジェクトの情報とが記載されているかを判断し、記載されていればステップS1003に、記載されていなければステップS1004に分岐する。   In step S1002, it is determined whether the object generation action and the information of the generated object are described in the table of the object generation / deletion location information 206 shown as an example in FIG. 9, and if it is described, it is described in step S1003. If not, the process branches to step S1004.

ステップS1003では、オブジェクトの削除アクションと削除したオブジェクトの情報が記載されているかを判断し、記載されていればステップS1005に、記載されていなければステップS1006に分岐する。   In step S1003, it is determined whether the object deletion action and the information of the deleted object are described. If they are described, the process branches to step S1005, and if not described, the process branches to step S1006.

ステップS1005では、ステップS1003でオブジェクトの生成情報と削除情報の両方が記載されていた場合に、生成したオブジェクトと削除したオブジェクトが同じかを判断する。同じであれば、ステップS1009に、違っていればステップS1010に分岐する。   In step S1005, if both the object generation information and the deletion information are described in step S1003, it is determined whether the generated object is the same as the deleted object. If they are the same, the process branches to step S1009, and if they are different, the process branches to step S1010.

一方、ステップS1006では、生成したオブジェクトがシステムの初期化処理を表す「system」であるかどうかを判断する。systemであった場合にはステップS1008に、systemでなかった場合にはステップS1007に分岐する。   On the other hand, in step S1006, it is determined whether or not the generated object is “system” representing system initialization processing. If it is a system, the process branches to step S1008, and if it is not a system, the process branches to step S1007.

ステップS1007では、オブジェクトを削除するアクションの記述忘れを検知したと判断して、オペレータに対して削除し忘れの警告を通知する。   In step S1007, it is determined that the description of the action for deleting the object has been forgotten, and the operator is notified of the deletion forgetting warning.

一方、ステップS1008では、ライフサイクルをシステムと同じだと判断して、オブジェクトライフサイクル情報にライフサイクル「system」を記載する。   On the other hand, in step S1008, it is determined that the life cycle is the same as the system, and the life cycle “system” is described in the object life cycle information.

また、ステップS1009では、生成したオブジェクトと削除したオブジェクトとが同じかを判断する。同じであればステップS1011に、違っていればステップS1010に分岐する。   In step S1009, it is determined whether the generated object is the same as the deleted object. If they are the same, the process branches to step S1011. If they are different, the process branches to step S1010.

ステップS1010では、システム稼動後に生成と削除が行われるライフサイクルと判断し、オブジェクトライフサイクル情報に、「short」と記載する。   In step S1010, it is determined that the life cycle is generated and deleted after the system is operated, and “short” is described in the object life cycle information.

ステップS1011では、オブジェクトの生成と削除のアクションを記述するのではなく、アクションの関数のローカル変数として代用が可能である旨の警告をオペレータに通知する。   In step S1011, instead of describing the action of creating and deleting the object, the operator is notified of a warning that it can be substituted as a local variable of the function of the action.

一方、ステップS1004では、オブジェクトの削除アクションと削除したオブジェクトの情報とが記載されているかを判断し、記載されていればステップS1013に、記載されていなければステップS1012に分岐する。   On the other hand, in step S1004, it is determined whether the delete action of the object and the information of the deleted object are described. If they are described, the process branches to step S1013, and if not described, the process branches to step S1012.

ステップS1012では、オブジェクト生成削除箇所抽出リストが不正である旨の処理エラーをオペレータに通知する。   In step S1012, the operator is notified of a processing error indicating that the object generation / deletion location extraction list is invalid.

ステップS1013では、アクションを記述すること自体が不正であると判断し、アクション記述エラーであることをオペレータに通知する。   In step S1013, it is determined that the action description itself is illegal, and the operator is notified of an action description error.

ステップS1014では、ステップS1001で開始した、図9に例として示したオブジェクト生成削除箇所情報206に記載されているすべてのオブジェクトについて処理を繰り返すことを示す。   In step S1014, the process is repeated for all the objects described in the object generation / deletion location information 206 shown as an example in FIG.

オブジェクトライフサイクル判定部207が生成するオブジェクトライフサイクル情報208の例を図11に示す。図11には、図9で示したオブジェクト生成削除箇所情報206にオブジェクトのライフサイクルを記載した部分が追加されているが、システム内で特定することのできるオブジェクトの識別情報とライフサイクル情報のみを記載するようにしてもよい。   An example of the object life cycle information 208 generated by the object life cycle determination unit 207 is shown in FIG. In FIG. 11, a part describing the life cycle of the object is added to the object generation / deletion location information 206 shown in FIG. 9, but only the object identification information and life cycle information that can be specified in the system are shown. You may make it describe.

このように、オブジェクトライフサイクル判定部207では、オブジェクトライフサイクル情報208から、ライフサイクルとして、図10のステップS1008の処理で示したシステムと同じである「system」か、図10のステップS1010で示したシステム稼動後に生成と削除を行う「short」かを判定する。加えて、ライフサイクル情報を記載すると同時に、図10のステップS1007で示したオブジェクト削除し忘れ警告、ステップS1011で示したローカル変数代用可能警告、ステップS1012で示した処理エラー、ステップS1013で示したアクション記述エラーをオペレータに通知する。   In this way, the object life cycle determination unit 207 determines from the object life cycle information 208 that “system” is the same as the system shown in the process of step S1008 in FIG. 10 as the life cycle, or is shown in step S1010 of FIG. It is determined whether or not “short” is generated and deleted after the system is activated. In addition, at the same time as describing the life cycle information, the object deletion forgetting warning shown in step S1007 of FIG. 10, the local variable substitution warning shown in step S1011, the processing error shown in step S1012, and the action shown in step S1013 Notify the operator of the description error.

<生成されたプログラムコードについての説明>
図12は、本実施形態にかかるプログラムコード生成装置により生成されたプログラムコードの一例を示す図である。図12は、図11で示したオブジェクトライフサイクル情報208を元に、ライフサイクル「system」および「short」として分類されたオブジェクトを生成するプログラムコードの例を示している。なお、図6に示したアクションのうち、クラスのインスタンスを作成するnewアクションを生成した場合を示している。また、生成されたプログラムコードは、組み込みOSで知られるμITRON仕様の動的なメモリ管理機構、固定長メモリプールを利用することができる。
<Description of generated program code>
FIG. 12 is a diagram illustrating an example of a program code generated by the program code generation device according to the present embodiment. FIG. 12 shows an example of program code for generating objects classified as life cycles “system” and “short” based on the object life cycle information 208 shown in FIG. In addition, the case where the new action which produces the instance of a class is produced | generated among the actions shown in FIG. 6 is shown. The generated program code can use a μITRON-specific dynamic memory management mechanism and a fixed-size memory pool, which are known for embedded OSs.

図12において、ライフサイクル「system」はシステム起動後にオブジェクトが生成され、システム稼動中は削除されることがないため、配列として定義し、アクションnewから生成したプログラムコード上の関数alloc_systemSpanは、その配列のアドレスを返す関数getAddrFromObjTableとして実装する。   In FIG. 12, an object is generated in the life cycle “system” after the system is started and is not deleted while the system is running. Therefore, the life cycle “system” is defined as an array, and the function alloc_systemSpan on the program code generated from the action new is the array It is implemented as a function getAddrFromObjTable that returns the address of.

図12において、ライフサイクル「short」はシステム稼動中に生成と削除を繰り返すオブジェクトであるため、サイズごとに割り当てた固定長メモリプールからオブジェクトのメモリ領域を確保する。アクションnewから生成したプログラムコード上の関数alloc_shortSpanは、サイズごとに割り当てた固定長メモリプールからメモリ領域を確保するμITRONのサービスコール get_mpf として実装する。   In FIG. 12, since the life cycle “short” is an object that is repeatedly generated and deleted while the system is operating, a memory area of the object is secured from the fixed-sized memory pool allocated for each size. The function alloc_shortSpan on the program code generated from the action new is implemented as a service call get_mpf of μITRON that secures a memory area from a fixed-sized memory pool allocated for each size.

図12に示すプログラムコードの例では、静的に確保した配列のアドレスを返す関数やμITRON仕様の固定長メモリプールを利用する例を示したが、本発明はこの方法に限られるものではない。また、図12に示すプログラムコードの例では、ライフサイクル「short」と判定したオブジェクトをサイズごとに分けて用意したメモリプールから確保することとしているが、本発明は特にこれに限られず、図11に例として示したオブジェクトライフサイクル情報から得られるクラス、インスタンスなどの他の情報を使って別々のメモリプールを用意して、そこからメモリ領域を確保する実装も可能である。   In the example of the program code shown in FIG. 12, an example of using a function that returns the address of a statically secured array or a fixed-length memory pool of μITRON specifications is shown, but the present invention is not limited to this method. In the example of the program code shown in FIG. 12, the object determined as the life cycle “short” is secured from the prepared memory pool for each size. However, the present invention is not particularly limited to this, and FIG. It is also possible to prepare a separate memory pool by using other information such as classes and instances obtained from the object life cycle information shown as an example, and secure a memory area therefrom.

以上の説明から明らかなように、本実施形態にかかるプログラムコード生成装置によれば、設計図面を解析し、オブジェクトのライフサイクルを判定することで、そのオブジェクト自身とそのオブジェクトが利用するメモリ領域の確保をいつ行うべきかを判断することができる。   As is clear from the above description, according to the program code generation device according to the present embodiment, by analyzing the design drawing and determining the life cycle of the object, the object itself and the memory area used by the object are determined. It is possible to determine when the reservation should be made.

これにより、たとえば、静的な配列で確保するのか、動的なメモリ管理機構を利用するかを分類することができる。この結果、組み込みOSが有する動的なメモリ管理機構を利用可能なプログラムコードを生成することが可能となる。そして、動的なメモリ管理機構を利用する場合にあっては、利用サイズごとに用意した固定長メモリプールから確保する従来の方法以外にも、メモリ領域を利用するオブジェクト専用にメモリプールを割り当てたり、特定インスタンスの特定サイズに専用のメモリプールを割り当てたり、様々な形態でのメモリ領域利用が可能になる。   Thereby, for example, it is possible to classify whether to secure by a static array or to use a dynamic memory management mechanism. As a result, it is possible to generate program code that can use the dynamic memory management mechanism of the embedded OS. When using a dynamic memory management mechanism, in addition to the conventional method of securing from a fixed-sized memory pool prepared for each usage size, a memory pool may be allocated exclusively for objects that use memory areas. A dedicated memory pool can be allocated to a specific size of a specific instance, and memory areas can be used in various forms.

さらに、使用するメモリ管理機構は、従来から組み込みOSで搭載されてきたメモリ管理機構であるため、実行速度やフラグメンテーションの不安がなく、組み込みソフトウエアでの利用も可能である。   Further, since the memory management mechanism to be used is a memory management mechanism that has been conventionally installed in an embedded OS, there is no concern about the execution speed or fragmentation, and it can be used in embedded software.

<他の実施形態>
なお、本発明は、複数の機器(例えばホストコンピュータ、インタフェイス機器、リーダ、プリンタなど)から構成されるシステムに適用しても、一つの機器からなる装置(例えば、複写機、ファクシミリ装置など)に適用してもよい。
<Other embodiments>
Note that the present invention can be applied to a system including a plurality of devices (for example, a host computer, an interface device, a reader, and a printer), and a device (for example, a copying machine and a facsimile device) including a single device. You may apply to.

また、本発明の目的は、前述した実施形態の機能を実現するソフトウェアのプログラムコードを記録した記憶媒体を、システムあるいは装置に供給し、そのシステムあるいは装置のコンピュータ(またはCPUやMPU)が記憶媒体に格納されたプログラムコードを読出し実行することによっても、達成されることは言うまでもない。   Another object of the present invention is to supply a storage medium storing software program codes for implementing the functions of the above-described embodiments to a system or apparatus, and the computer (or CPU or MPU) of the system or apparatus stores the storage medium. Needless to say, this can also be achieved by reading and executing the program code stored in the.

この場合、記憶媒体から読出されたプログラムコード自体が前述した実施形態の機能を実現することになり、そのプログラムコードを記憶した記憶媒体は本発明を構成することになる。   In this case, the program code itself read from the storage medium realizes the functions of the above-described embodiments, and the storage medium storing the program code constitutes the present invention.

プログラムコードを供給するための記憶媒体としては、例えば、フロッピ(登録商標)ディスク、ハードディスク、光ディスク、光磁気ディスク、CD−ROM、CD−R、磁気テープ、不揮発性のメモリカード、ROMなどを用いることができる。   As a storage medium for supplying the program code, for example, a floppy (registered trademark) disk, hard disk, optical disk, magneto-optical disk, CD-ROM, CD-R, magnetic tape, nonvolatile memory card, ROM, or the like is used. be able to.

また、コンピュータが読出したプログラムコードを実行することにより、前述した実施形態の機能が実現されるだけでなく、そのプログラムコードの指示に基づき、コンピュータ上で稼働しているOS(オペレーティングシステム)などが実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される場合も含まれることは言うまでもない。   Further, by executing the program code read by the computer, not only the functions of the above-described embodiments are realized, but also an OS (operating system) operating on the computer based on the instruction of the program code. It goes without saying that a case where the function of the above-described embodiment is realized by performing part or all of the actual processing and the processing is included.

さらに、記憶媒体から読出されたプログラムコードが、コンピュータに挿入された機能拡張ボードやコンピュータに接続された機能拡張ユニットに備わるメモリに書込まれた後、そのプログラムコードの指示に基づき、その機能拡張ボードや機能拡張ユニットに備わるCPUなどが実際の処理の一部または全部を行い、その処理によって前述した実施形態の機能が実現される場合も含まれることは言うまでもない。   Further, after the program code read from the storage medium is written into a memory provided in a function expansion board inserted into the computer or a function expansion unit connected to the computer, the function expansion is performed based on the instruction of the program code. It goes without saying that the CPU or the like provided in the board or the function expansion unit performs part or all of the actual processing, and the functions of the above-described embodiments are realized by the processing.

本発明の一実施形態にかかるプログラムコード生成装置の全体構成を示す図である。It is a figure which shows the whole structure of the program code production | generation apparatus concerning one Embodiment of this invention. プログラムコード生成装置の処理プログラム3aにおける処理の概要を示す図である。It is a figure which shows the outline | summary of the process in the processing program 3a of a program code generation apparatus. 設計図面情報のうちドメイン図の一例を示す図である。It is a figure which shows an example of a domain diagram among design drawing information. 設計図面情報のうちクラス図の一例を示す図である。It is a figure which shows an example of a class diagram among design drawing information. 設計図面情報のうち状態遷移図の一例を示す図である。It is a figure which shows an example of a state transition diagram among design drawing information. 設計図面情報に含まれるアクション記述について説明した図である。It is a figure explaining the action description contained in design drawing information. 本発明の一実施形態にかかるプログラムコード生成装置全体の処理手順を示したフローチャートである。It is the flowchart which showed the process sequence of the whole program code generation apparatus concerning one Embodiment of this invention. オブジェクト生成削除箇所抽出部における処理の流れを示すフローチャートである。It is a flowchart which shows the flow of a process in an object production | generation deletion location extraction part. オブジェクト生成削除箇所抽出部において抽出されたオブジェクト生成削除箇所情報の一例を示す図である。It is a figure which shows an example of the object production | generation deletion location information extracted in the object production | generation deletion location extraction part. オブジェクトライフサイクル判定部における処理の流れを示すフローチャートである。It is a flowchart which shows the flow of the process in an object life cycle determination part. オブジェクトライフサイクル判定部において生成されたオブジェクトライフサイクル情報の一例をを示す図である。It is a figure which shows an example of the object life cycle information produced | generated in the object life cycle determination part. 本発明の一実施形態にかかるプログラムコード生成装置において生成されたプログラムコードの一例を示す図である。It is a figure which shows an example of the program code produced | generated in the program code production | generation apparatus concerning one Embodiment of this invention.

符号の説明Explanation of symbols

1:CPU
2:バス
3:ROM
4:RAM
4a:設計図面情報
4b:プラットフォーム情報
4c:オブジェクト生成削除箇所情報
4d:オブジェクトライフサイクル情報
4e:プログラムコード
4f:ライブラリ
4g:実行可能形式
5:入力インターフェース
6:キーボード、ボタン、マウス、ダイアル
7:出力インターフェース
8a:CRT、LCD
8b:プリンタ、プロッタ
9:外部記憶装置インターフェース
10:HD、FD、CD−ROM、MD、CF、・・・(ファイル)
1: CPU
2: Bus 3: ROM
4: RAM
4a: Design drawing information 4b: Platform information 4c: Object generation / deletion location information 4d: Object life cycle information 4e: Program code 4f: Library 4g: Executable format 5: Input interface 6: Keyboard, button, mouse, dial 7: Output Interface 8a: CRT, LCD
8b: Printer, plotter 9: External storage device interface 10: HD, FD, CD-ROM, MD, CF,... (File)

Claims (9)

オブジェクト指向プログラミングにおけるモデル表記言語により記述された設計図面から、プログラムコードを生成する生成手段を備えるプログラムコード生成装置であって、
前記設計図面の情報を解析し、生成されるプログラムコードに含まれる各オブジェクトの生成及び削除に関する記述を抽出する抽出手段と、
前記抽出手段により抽出された記述に基づいて、各オブジェクトの生成から削除までのサイクルを判定する判定手段と、を備え、
前記生成手段は、前記設計図面に基づいたプログラムコードの生成にあたり、該プログラムコードがメモリに読み込まれ実行された場合に各オブジェクトが配置されるメモリ領域を、前記判定手段により判定されたサイクルに基づいて決定することを特徴とするプログラムコード生成装置。
A program code generation device comprising a generation means for generating a program code from a design drawing described in a model notation language in object-oriented programming,
Extracting means for analyzing the information of the design drawing and extracting a description relating to generation and deletion of each object included in the generated program code;
Determination means for determining a cycle from generation to deletion of each object based on the description extracted by the extraction means,
The generation means generates a program code based on the design drawing. A memory area in which each object is arranged when the program code is read into a memory and executed is determined based on the cycle determined by the determination means. A program code generation device characterized in that the determination is performed.
前記各オブジェクトの生成及び削除に関する記述とは、所定のクラスのインスタンスの生成及び削除に関する記述であることを特徴とする請求項1に記載のプログラムコード生成装置。 2. The program code generation apparatus according to claim 1, wherein the description related to generation and deletion of each object is a description related to generation and deletion of an instance of a predetermined class. 前記各オブジェクトの生成及び削除に関する記述とは、各クラスのインスタンス間で送受信される通信オブジェクトの生成及び削除に関する記述であることを特徴とする請求項1に記載のプログラムコード生成装置。 2. The program code generation apparatus according to claim 1, wherein the description related to generation and deletion of each object is a description related to generation and deletion of a communication object transmitted and received between instances of each class. 前記判定手段は、前記各オブジェクトの生成から削除までのサイクルが、前記プログラムコードが実行された場合の起動から終了までのサイクルに等しいか、あるいは前記プログラムコードの実行中に繰り返される前記各オブジェクトの生成から削除までのサイクルに等しいかを判定することを特徴とする請求項1に記載のプログラムコード生成装置。 The determination unit is configured such that a cycle from generation to deletion of each object is equal to a cycle from start to end when the program code is executed, or each object that is repeated during execution of the program code. 2. The program code generation device according to claim 1, wherein it is determined whether the cycle is equal to a cycle from generation to deletion. 前記判定手段は、関数内のブロックスコープ内で生成と削除を行うオブジェクトについて前記サイクルを判定することを特徴とする請求項1に記載のプログラムコード生成装置。 2. The program code generation apparatus according to claim 1, wherein the determination unit determines the cycle for an object to be generated and deleted within a block scope within a function. 前記判定手段により判定されたサイクルをオペレータに通知する通知手段と、
前記プログラムコードがメモリに読み込まれ実行された場合に各オブジェクトが配置されるメモリ領域を、オペレータの指示に基づいて指定する指定手段と、を備え、
前記生成手段は、前記設計図面に基づいたプログラムコードの生成にあたり、該プログラムコードがメモリに読み込まれ実行された場合に各オブジェクトが配置されるメモリ領域を、前記指定手段による指定に基づいて決定することを特徴とする請求項1に記載のプログラムコード生成装置。
Notification means for notifying the operator of the cycle determined by the determination means;
A designation unit for designating a memory area in which each object is arranged when the program code is read into a memory and executed based on an instruction of an operator;
The generation unit determines a memory area where each object is arranged when the program code is read into the memory and executed when generating the program code based on the design drawing based on the designation by the designation unit. The program code generation device according to claim 1.
オブジェクト指向プログラミングにおけるモデル表記言語により記述された設計図面から、プログラムコードを生成する生成工程を備えるプログラムコード生成方法であって、
前記設計図面の情報を解析し、生成されるプログラムコードに含まれる各オブジェクトの生成及び削除に関する記述を抽出する抽出工程と、
前記抽出工程により抽出された記述に基づいて、各オブジェクトの生成から削除までのサイクルを判定する判定工程と、を備え、
前記生成工程は、前記設計図面に基づいたプログラムコードの生成にあたり、該プログラムコードがメモリに読み込まれ実行された場合に各オブジェクトが配置されるメモリ領域を、前記判定工程により判定されたサイクルに基づいて決定することを特徴とするプログラムコード生成方法。
A program code generation method comprising a generation step of generating a program code from a design drawing described in a model notation language in object-oriented programming,
An extraction step of analyzing the information of the design drawing and extracting a description relating to generation and deletion of each object included in the generated program code;
A determination step of determining a cycle from generation to deletion of each object based on the description extracted by the extraction step,
In the generation process of the program code based on the design drawing, a memory area in which each object is arranged when the program code is read into the memory and executed is determined based on the cycle determined by the determination process. A program code generation method characterized by:
請求項8に記載のプログラムコード生成方法をコンピュータによって実現させるための制御プログラムを格納した記憶媒体。 A storage medium storing a control program for realizing the program code generation method according to claim 8 by a computer. 請求項8に記載のプログラムコード生成方法をコンピュータによって実現させるための制御プログラム。 A control program for realizing the program code generation method according to claim 8 by a computer.
JP2005109219A 2005-04-05 2005-04-05 Program code generation device and generation method Withdrawn JP2006293437A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005109219A JP2006293437A (en) 2005-04-05 2005-04-05 Program code generation device and generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005109219A JP2006293437A (en) 2005-04-05 2005-04-05 Program code generation device and generation method

Publications (1)

Publication Number Publication Date
JP2006293437A true JP2006293437A (en) 2006-10-26

Family

ID=37413985

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005109219A Withdrawn JP2006293437A (en) 2005-04-05 2005-04-05 Program code generation device and generation method

Country Status (1)

Country Link
JP (1) JP2006293437A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008269273A (en) * 2007-04-20 2008-11-06 Meidensha Corp Software development support system, development support method and program
JP2014206976A (en) * 2013-04-11 2014-10-30 ザ・ボーイング・カンパニーTheBoeing Company Managing model having object cycle

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008269273A (en) * 2007-04-20 2008-11-06 Meidensha Corp Software development support system, development support method and program
JP2014206976A (en) * 2013-04-11 2014-10-30 ザ・ボーイング・カンパニーTheBoeing Company Managing model having object cycle

Similar Documents

Publication Publication Date Title
JP4514105B2 (en) Extended runtime hosting
KR101366402B1 (en) Virtual execution system for resource-constrained devices
JP5387415B2 (en) Virtual computer system, policy enforcement system, policy enforcement method, and virtual computer control program
CN102449599A (en) System and method for converting a java application into a virtual server image for cloud deployment
JP2014528603A (en) Generate compiled code indicating register survival
KR20200014378A (en) Job management
KR101478619B1 (en) Method and Apparatus of Inputting/Outputting Data Using Virtualization Technique
WO2022227409A1 (en) Embedded terminal remote software updating method
JP2007012064A (en) Allowing non-generified method to override generified method
JP2006293437A (en) Program code generation device and generation method
JP4144885B2 (en) How to reuse application objects
JP4938991B2 (en) Program code generating apparatus, program code generating method, and computer program
Monnier et al. Evolution of emacs lisp
JP4986598B2 (en) Application management system and control method thereof
JP2006228138A (en) Semiconductor storage device, storage control method, and information equipment
JP2007213417A (en) Program code generation system, method, and computer program
Gorodetski et al. Multi-agent system development kit: MAS software tool implementing Gaia methodology
JP4504756B2 (en) Memory management method and memory management program in Java (registered trademark) execution environment
JPH10293619A (en) Information processor, information processing system, and storage medium
CN112328180B (en) File management method based on single chip microcomputer
JP2006285583A (en) Program code generating device, program code generating method, and computer program
JP2006285584A (en) Program code generation device, program code generation method, and computer program
JP2007108956A (en) Communication equipment and its control method
Allen et al. A day in the life of a grid-enabled application: Counting on the Grid
CN114385279A (en) Subprocess management method, device, equipment and medium

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20080701