JPH0455937A - Program clean copy processor - Google Patents

Program clean copy processor

Info

Publication number
JPH0455937A
JPH0455937A JP16751590A JP16751590A JPH0455937A JP H0455937 A JPH0455937 A JP H0455937A JP 16751590 A JP16751590 A JP 16751590A JP 16751590 A JP16751590 A JP 16751590A JP H0455937 A JPH0455937 A JP H0455937A
Authority
JP
Japan
Prior art keywords
program
line
characters
remaining
processing
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.)
Pending
Application number
JP16751590A
Other languages
Japanese (ja)
Inventor
Masayuki Taguchi
雅之 田口
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.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP16751590A priority Critical patent/JPH0455937A/en
Publication of JPH0455937A publication Critical patent/JPH0455937A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

PURPOSE:To obtain an easy-to-see structure of a program by dividing the program into the meaningful least structure units and performing the clean copy processing based on these least structure units. CONSTITUTION:A source file 3 serving as an input device is produced when a user starts an editor 2 through a terminal 1 and performs the input and editing operations. In the clean copy processing, the file 3 is divided into the meaningful least structure units by a program structure analyzing part 4. A clean copy processing part 6 performs the clean copy processing while receiving those least structure units one by one from the part 4 and writes the processing result in a buffer 7. A remaining character counter part 5 which counts the remaining characters up to the end of a line has the largest number of characters per line as the initial value and receives the number of used characters from the part 6 to subtract these characters in sequence. When the due processing is through up to the end of a sentence, the contents of the buffer 7 are transferred to an output file 8. Then the next line is processed. Thus an easy-to-see structure is secured even with such programs that includes the long calculation formulas, the formulas including the multiple parentheses, or the indention due to the multiple repetitive and multiple decision structures.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は計算機ソースプログラムの清書処理に利用する
。本発明は計算機プログラムのソースプログラムに対し
プログラム構造を見易くするための清書処理に関し、特
に一つの文を二つの行に分割する処理を行う装置に関す
る。
DETAILED DESCRIPTION OF THE INVENTION [Industrial Field of Application] The present invention is used in the fair copying process of computer source programs. The present invention relates to a cleanup process for making the program structure of a source program of a computer program easier to see, and particularly to an apparatus that performs a process of dividing one sentence into two lines.

〔概要〕〔overview〕

本発明は計算機の装置プログラム構造を見易くなるよう
に清書するプログラム清書処理装置において、 プログラムを意味のある最小構造単位に分割し、この最
小構造単位をベースにして清書処理を行うことにより、 プログラムの構造を見易くなるようにしたものである。
The present invention is a program cleanup processing device that cleans up computer program structure so that it is easy to read.The present invention divides a program into meaningful minimum structural units and performs cleanup processing based on these minimum structural units. This makes the structure easier to see.

〔従来の技術〕[Conventional technology]

計算機プログラムの入力は“エディタ”と呼ばれる人力
編集プログラムを用いて人手で行う方法が一般的である
。プログラム構造を見易くするためには適当に空白を挿
入したり、繰り返しや分岐などの構造を明確にするため
に字下げを行うことが多い。
Computer programs are generally entered manually using a manual editing program called an "editor." To make the program structure easier to read, spaces are often inserted as appropriate, and indentation is often used to clarify structures such as repetition and branching.

このようにして作成されたプログラムは、一定のルール
に則った形で作成されていれば後々のデバッグやメンテ
ナンスの工程で効率化が図れるが、エディタで入力を行
うときにそこまで注意して作業することは逆に入力の効
率を下げることになる。
Programs created in this way can be created more efficiently in later debugging and maintenance processes if they are created in accordance with certain rules, but care must be taken when entering input into the editor. On the contrary, doing so will reduce input efficiency.

従って、第4図に示すように、入力時にはプログラム構
造の見易さは犠牲にして必要最低限の空白を入れる程度
にとどめ、人力完了後に一括して清書処理を行う方法が
効率的であり、個人差のない標準化されたソースプログ
ラムを作成することができる。
Therefore, as shown in Figure 4, an efficient method is to sacrifice the legibility of the program structure and insert only the minimum necessary blank spaces during input, and then perform the clean-up process all at once after manual input is completed. It is possible to create standardized source programs with no individual differences.

従来のこの種の清書処理は計算機上でソースプログラム
清書ユーティリティとして利用者に提供されている。入
力となるソースプログラムファイル、清書後の出力光フ
ァイルおよび種々のオプション機能(例えば字下げ幅や
空白の処理方法など)を指定すると致命的な誤りがない
限り所定のルールに則って清書処理が行われ出力ファイ
ルが得られるようになっている。第5図は第4図のソー
スプログラムをFORTRANの清書ユーティリティに
より清書処理を施したもので、ループ構造、条件分岐、
制御文の飛び先などが容易に認識でき、プログラム構造
が見易くなっている(ここでは説明を簡単にするため1
行を50文字とした)。
Conventionally, this type of cleanup processing is provided to users as a source program cleanup utility on a computer. If you specify the input source program file, the output optical file after cleansing, and various optional functions (for example, indent width and white space processing method), the cleansing process will be performed according to the specified rules unless there are fatal errors. Now you can get the output file. Figure 5 is a version of the source program in Figure 4 that has been edited using the FORTRAN formatting utility, with loop structures, conditional branches,
You can easily recognize the destinations of control statements, and the program structure is easier to see.
50 characters per line).

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

従来の清書処理方法では、元々複数行にまたがる文や繰
り返しや判定文による字下げ処理により2行に分割処理
する際、コマンドやステートメントの意味に関わらず行
末で無条件に分割していた。
In conventional formatting processing methods, when a sentence spans multiple lines or is split into two lines due to indentation due to repetition or judgment, the line is unconditionally split at the end of the line, regardless of the meaning of the command or statement.

したがって、長い計算式や多重括弧を含む式、多重繰り
返しや多重判定構造による字下げの影響でもともと一行
だった文が、無条件に切り離されてしまい、かえってプ
ログラムが見にくくなってしまう欠点があった。第5図
の210〜220行がその例を示すもので、1行を50
文字としたときに“C3*Y (K−1)”という項が
行末で分断されてしまっている。実際の場面では1行あ
たり80とか136文字が使われることが多いが、“D
O”文や“IP”文が多重化されると字下げにより1行
あたりの配置可能文字数が制限されてしまうため、この
ようなケースは頻繁に見受けられる。
Therefore, due to the effects of long calculation formulas, formulas containing multiple parentheses, and indentation due to multiple repetitions and multiple judgment structures, sentences that were originally on a single line are unconditionally separated, making the program difficult to read. . Lines 210 to 220 in Figure 5 show an example of this.
When converted into characters, the term "C3*Y (K-1)" is separated at the end of the line. In actual situations, 80 or 136 characters are often used per line, but “D
When multiplexed "O" and "IP" statements are created, the number of characters that can be placed per line is limited due to indentation, so such cases are frequently seen.

本発明はこのような問題を解決するもので、文末でコマ
ンドやステートメントが分割されることをなくし、プロ
グラム構造を見易くすることができる装置を提供するこ
とを目的とする。
The present invention is intended to solve these problems, and aims to provide a device that can eliminate commands and statements from being divided at the end of sentences and make the program structure easier to see.

〔課題を解決するための手段〕[Means to solve the problem]

本発明は、端末からの入力指示を受けエディタによりソ
ースファイルに編集入力されたソースプログラムの清書
処理を行うプログラム清書処理装置において、プログラ
ムのコマンド、ステートメントを意味のある最小構造に
分解するプログラム構造解析部と、行末までの残りの文
字数を計数する残り文字数計数部と、分解された最小構
造ごとに行頭から清書処理を行い前記残り文字数計数部
の出力値が負の値になったときに残りの文を次の行に継
続行として分割させる清書処理部とを備えたことを特徴
とする。
The present invention is a program structure analysis device that processes a source program edited and input into a source file by an editor in response to an input instruction from a terminal. a remaining character count unit that counts the number of characters remaining to the end of the line, and a cleanup process from the beginning of the line for each decomposed minimum structure, and when the output value of the remaining character count unit becomes a negative value, The present invention is characterized by comprising a formatting processing unit that divides a sentence into the next line as a continuation line.

〔作用〕[Effect]

プログラムのコマンドやステートメントを意味のある最
小構造に分解し、行末までの残り文字数を計数する。分
解された最小構造ごとに行頭から清書処理を行い計数値
が負の値になったときに残りの文を次の行に継続行とし
て分割する。
Breaks down program commands and statements into the smallest meaningful structure and counts the number of characters left until the end of the line. For each decomposed minimum structure, a clean-up process is performed from the beginning of the line, and when the count value becomes a negative value, the remaining sentence is divided into the next line as a continuation line.

これにより、文末でコマンドやステートメントが無条件
に分割されることがなくなり、長い計算式や多重括弧を
含む式、あるいは多重繰返しや多重判定構造による字下
げが含まれるプログラムであってもそのプログラムの構
造を見易くすることができる。
This prevents commands and statements from being unconditionally split at the end of a sentence, and even if the program contains long calculation expressions, expressions with multiple parentheses, or indentation due to multiple repetitions or multiple judgment structures, the program The structure can be made easier to see.

〔実施例〕〔Example〕

次に、本発明実施例を図面に基づいて説明する。 Next, embodiments of the present invention will be described based on the drawings.

第1図は本発明実施例の構成を示すブロック図である。FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention.

本発明実施例は、端末1からの人力指示を受けエディタ
2によりソースファイル3に編集人力されたプログラム
のコマンド、ステートメントを意味のある最小構造に分
解するプログラム構造解析部4と、行末までの残りの文
字数を計数する残り文字数計数部5と、分解された最小
構造ごとに行頭から清書処理を行い残り文字数計数部5
の出力値が負の値になったときに残りの文を次の行に継
続性として分割させる清書処理部6と、処理結果を一時
格納し出力ファイル8に転送するバッファ7を備える。
The embodiment of the present invention includes a program structure analysis unit 4 that decomposes program commands and statements manually edited into a source file 3 by an editor 2 in response to manual instructions from a terminal 1 into a meaningful minimum structure, and a remaining character number counting unit 5 that counts the number of characters in the text, and a remaining character number counting unit 5 that performs a cleanup process from the beginning of the line for each decomposed minimum structure.
The present invention includes a fair copy processing unit 6 that divides the remaining sentence into the next line for continuity when the output value of becomes a negative value, and a buffer 7 that temporarily stores the processing result and transfers it to an output file 8.

入力となるソースファイル3は利用者が端末1からエデ
ィタ2を起動して入力、編集を行って作成される。清書
処理ではまずソースファイル3はプログラム構造解析部
4により意味のある最小構造に分解される。清書処理部
6はこの解析部から一つずつ構造単位を受取りながら清
書処理を行いその結果をバッフ77に書き込む。行末ま
での残り文字数計数部5は初期値として1行の最大文字
数を持ち、清書処理部6から使用した文字数を受取り順
次減算する。文末まで処理が完了するとバッファ7の内
容を出力ファイル8に転送し、次の行に対する処理に移
る。
The input source file 3 is created by the user starting the editor 2 from the terminal 1 and performing input and editing. In the cleanup process, the source file 3 is first decomposed into a meaningful minimum structure by the program structure analysis section 4. The fair copying processing section 6 performs fair copying processing while receiving the structural units one by one from the analysis section, and writes the result to the buffer 77. The remaining character number counting unit 5 until the end of a line has the maximum number of characters in one line as an initial value, and receives the number of used characters from the fair copying processing unit 6 and subtracts them sequentially. When the processing is completed to the end of the sentence, the contents of the buffer 7 are transferred to the output file 8, and processing moves on to the next line.

これら行単位に行う一連の処理過程を第2図のフローチ
ャートに示す。まず処理11で残り文字数を例えば50
に設定する。次に行頭の文番号、コメント行かどうかの
マーク、制御文の飛び先番号の処理を行い、これに要し
た文字数を計算する。該当項目がない場合は相当する空
白を挿入する。これを残り文字数から減算するとともに
処理結果をバッファ7に書き込む。
A series of processing steps performed on a line-by-line basis is shown in the flowchart of FIG. First, in process 11, the number of remaining characters is set to, for example, 50.
Set to . Next, the statement number at the beginning of the line, the mark to indicate whether it is a comment line, and the jump destination number of the control statement are processed, and the number of characters required is calculated. If there is no corresponding item, insert a blank space. This is subtracted from the number of remaining characters and the processing result is written into the buffer 7.

続いて、繰り返し構造や条件判断文に関する字下げ処理
を行う。処理14からが清書処理のメインとなるもので
、まずプログラム構造解析部4から最初の最小構造単位
(コマンドやステートメントの一区切り)を受取り文字
数を計算する。これを残り文字数から減算し、結果が負
にならなければ該当行に配置可能と判断しその最小構造
単位をそのままバッファ7に書き込む。これを文の終わ
りまで繰り返す。
Subsequently, indentation processing is performed regarding repetitive structures and conditional judgment sentences. The main part of the fair copying process starts from process 14, in which the first minimum structural unit (one delimiter of a command or statement) is received from the program structure analysis section 4 and the number of characters is calculated. This is subtracted from the number of remaining characters, and if the result is not negative, it is determined that it can be placed in the corresponding line, and the minimum structural unit is written into the buffer 7 as is. Repeat this until the end of the sentence.

もし途中で減算結果が負になった場合は、改行コードを
バッファ7に書き込み、それまで処理していた次の行番
号を書き込み必要数の字下げを行った後にその最小構造
単位をバッファ7に書き込む。このようにしてソースフ
ァイル3から読み8した処理対象行に対する処理がすべ
て完了したら処理20でバッファ7の内容を清書処理結
果として出力ファイル8に書き込み次の処理対象行への
処理に移る。
If the subtraction result becomes negative during the process, write the line feed code to buffer 7, write the next line number that has been processed up to that point, perform the necessary indentation, and then write the minimum structural unit to buffer 7. Write. In this way, when all the processing for the target line read from the source file 3 is completed, in step 20 the contents of the buffer 7 are written to the output file 8 as the result of the clean-up process, and the process moves on to the next target line.

第3図は本発明実施例における清書処理後のプログラム
リストを示す図である。第5図に示す従来例で問題とな
った210行に対する処理は、第3図においては文末を
意味のある表現で区切ることにより解決している。すな
わち4番目の最小構造単位である“C2*X (K−2
)”を配置した時点で残り文字数は3であったため、次
の“03*Y(K−1)” (文字数9)を配置すると
減算結果が3−9=−6と負になってしまうので5番目
の最小構造単位は210行には配置せず、新たに行番号
220を継続性として配置したものである。なお継続付
以外の清書処理に関しては従来例と何ら変わらない。
FIG. 3 is a diagram showing a program list after fair copy processing in the embodiment of the present invention. The problem of processing 210 lines in the conventional example shown in FIG. 5 is solved in FIG. 3 by delimiting the end of the sentence with a meaningful expression. In other words, the fourth minimum structural unit “C2*X (K-2
)”, the number of characters remaining was 3, so if we placed the next “03*Y(K-1)” (number of characters 9), the subtraction result would be negative, 3-9=-6. The fifth minimum structural unit is not placed at line 210, but is newly placed at line number 220 for continuity.The formatting process other than adding continuations is no different from the conventional example.

以上ソースプログラムとしてFORTRAN77のファ
イルを例に説明したが、本発明による清書処理方法はF
 ORT RA N77に限られたものではな(、他の
計算機プログラム言語についてもまったく同様に適用す
ることができる。
The foregoing explanation has been given using a FORTRAN77 file as an example of a source program, but the fair copy processing method according to the present invention
This is not limited to ORT RA N77 (it can be applied to other computer programming languages in exactly the same way).

〔発明の効果〕〔Effect of the invention〕

以上説明したように本発明によれば、プログラムを意味
のある最小構造単位に分割し、この最小構造単位をベー
スに清書処理を行うことにより、文末でコマンドやステ
ートメントが無条件に分割されることをなくし、長い計
算式や多重括弧を含む式、あるいは多重繰り返しや多重
判定構造による字下げが含まれるプログラムにおいても
プログラム構造を見易くすることができる効果がある。
As explained above, according to the present invention, by dividing a program into meaningful minimum structural units and performing a cleanup process based on these minimum structural units, commands and statements can be unconditionally divided at the end of sentences. This has the effect of making the program structure easier to see even in programs that include long calculation formulas, formulas containing multiple parentheses, or indentation due to multiple repetitions or multiple judgment structures.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は本発明実施例の構成を示すブロック図。 第2図は本発明実施例の処理過程を示すフローチャート
。 第3図は本発明実施例における清書処理後のプログラム
リストを示す図。 第4図は本発明実施例における利用者がエディタにより
人力したソースプログラムリストを示す図。 第5図は従来のFORTRANの清書ユーティリティに
より清書処理を施したプログラムリストを示す図。 1・・・端末、2・・・エディタ、3・・・ソースファ
イル、4・・・プログラム構造解析部、5・・・残り文
字数計数部、6・・・清書処理部、7・・・バッファ、
訃・・出力ファイル。
FIG. 1 is a block diagram showing the configuration of an embodiment of the present invention. FIG. 2 is a flowchart showing the processing steps of the embodiment of the present invention. FIG. 3 is a diagram showing a program list after fair copy processing in the embodiment of the present invention. FIG. 4 is a diagram showing a source program list manually created by the user using an editor in the embodiment of the present invention. FIG. 5 is a diagram showing a program list that has been formatted using a conventional FORTRAN formatting utility. 1... Terminal, 2... Editor, 3... Source file, 4... Program structure analysis section, 5... Remaining character number counting section, 6... Fair copy processing section, 7... Buffer ,
Death...output file.

Claims (1)

【特許請求の範囲】 1、端末からの入力指示を受けエディタによりソースフ
ァイルに編集入力されたソースプログラムの清書処理を
行うプログラム清書処理装置において、 プログラムのコマンド、ステートメントを意味のある最
小構造に分解するプログラム構造解析部と、 行末までの残りの文字数を計数する残り文字数計数部と
、 分解された最小構造ごとに行頭から清書処理を行い前記
残り文字数計数部の出力値が負の値になったときに残り
の文を次の行に継続行として分割させる清書処理部と を備えたことを特徴とするプログラム清書処理装置。
[Claims] 1. In a program cleanup processing device that cleans up a source program edited and input into a source file by an editor in response to input instructions from a terminal, program commands and statements are decomposed into a meaningful minimum structure. A program structure analysis section that counts the number of remaining characters to the end of the line, a remaining character count section that counts the number of characters remaining until the end of the line, and a cleanup process from the beginning of the line for each decomposed minimum structure, so that the output value of the remaining character count section becomes a negative value. A program formatting processing device comprising: a formatting processing unit that sometimes divides a remaining sentence into the next line as a continuation line.
JP16751590A 1990-06-25 1990-06-25 Program clean copy processor Pending JPH0455937A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP16751590A JPH0455937A (en) 1990-06-25 1990-06-25 Program clean copy processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP16751590A JPH0455937A (en) 1990-06-25 1990-06-25 Program clean copy processor

Publications (1)

Publication Number Publication Date
JPH0455937A true JPH0455937A (en) 1992-02-24

Family

ID=15851119

Family Applications (1)

Application Number Title Priority Date Filing Date
JP16751590A Pending JPH0455937A (en) 1990-06-25 1990-06-25 Program clean copy processor

Country Status (1)

Country Link
JP (1) JPH0455937A (en)

Similar Documents

Publication Publication Date Title
US5367468A (en) Design aid method and design aid apparatus for integrated circuits
JPS61282935A (en) Method and apparatus for alloting and inspecting attribute in program
JP2007128378A (en) Programming device for programmable controller
JPH0455937A (en) Program clean copy processor
JPH042961B2 (en)
JP3003459B2 (en) Program creation support device
JP2765911B2 (en) Data driven control method and compiling device
JPS60116035A (en) Generation system for software graphic data
JPS61234434A (en) Program editing system
JPH04153737A (en) Output system for compile updating information
JP3532603B2 (en) Automatic number assignment method
JPH0196732A (en) Output system for macro-evolution list
JPH04209029A (en) Parallel process program translation processor
JPH04237365A (en) Difference detecting system and automatic editing system for text processor
JPH02159629A (en) Computer language translating system
JPH03176744A (en) Software testing system
JPH0589103A (en) Document editing processor
JPS60100226A (en) Test processor for tree structure chart
JPH03150664A (en) Syntax analysis device
JPH0368028A (en) Picture phrase analyzing system
JPH025132A (en) Automatic document forming system
JPH0237429A (en) Speed up system for retranslation processing
JPS61234435A (en) Program development supporting system
JPS63127331A (en) Program generating device
JPH0540638A (en) Vocabulary analyzing/editing system