\setcounter{section}{35} >
例外処理
構造処理や内容処理の処理中に,多様な例外状態が発生する場合がある。
この節では,起きる可能性のある例外の集合,及びSPDL提示プロセスの
例外処理機構について定義する。
例外処理は,例外を引き起こすような動作を避けたり,例外による影響を
抑えたりするような重要な場面で,処理を継続するための方法を提供する。
例外は,二つのレベルで定義され,処理される。
BLOCK> level.
]]>
構造例外は,ブロック>構造要素のレベルで発生し,処理される。
.
]]>
構造において起きる可能性のある例外についてはで定義する。
.
]]>
構造例外処理はで定義する。
内容例外は,内容のレベルで発生する。
.
]]>
起きる可能性のある例外は,で定義する。
.
]]>
内容例外処理は,で定義する。
.
]]>
内容例外及びその処理に関係のある演算子群は,で定義する。
インタプリタエラーは,内容中で起きる可能性のある例外状態のなかで,
ある特別なクラスを形成している。
.
]]>
これらについては,で定義する。
構造例外
BLOCK>,
upon any of the following occurrances:
]]>
構造例外は,ブロック>構造要素内で次に示すいずれかが起こった場合に発生する。
- BLOCK>;
]]>
その
ブロック>の下位構造中に構文エラーがある。
- BLOCK>;
]]>
その
ブロック>の下位構造中に不正な指定がある。
- BLOCK>;
]]>
その
ブロック>の下位構造中にDPI制約違反がある。
- BLOCK>;
]]>
その
ブロック>の下位構造中で構造警告が発生した。
- BLOCK>;
]]>
その
ブロック>の下位構造中に実装制約違反がある。
- BLOCK>;
]]>
その
ブロック>の下位の内容中で,処理されない内容例外が発生した。
- BLOCK> subordinate
to the
BLOCK>.
]]>
そのブロック>の下位ブロック>中で,処理されない構造例外が発生した
。
BLOCK> most immediately superior to the structure
in which the violation occurs.
]]>
上の違反のうちのいずれかが発生した場合,その違反が生じた構造の直接の上位
ブロック>中で例外が発生する。
構造中における構文エラー
BLOCK> when the structure processor
encounters structures or parts thereof, subordinate to the BLOCK>,
which violate the syntax prescribed in
and of this
International Standard.
]]>
構造プロセサが,あるブロック>構造要素の下位において,及びに規定
されている構文に違反する構造又はその一部を見つけた場合に,構文エラーが
そのブロック>において発生する。
構造中における不正な指定
BLOCK> when the
structure processor encounters structure elements, subordinate to the
BLOCK>, which specify a value or values which are not allowed by this
International Standard.
]]>
構造プロセサが,あるブロック>構造要素の下位において,この規格で許されていない
値に指定された構造要素を見つけた場合に,不正指定例外がそのブロック>に
おいて発生する。
実装制約違反
BLOCK> when the
structure processor encounters structure elements, subordinate to the
BLOCK>, which specify values which are not supported by the
implementation.
]]>
構造プロセサが,あるブロック>構造要素の下位において,実装がサポートしていない
値を指定している構造要素を見つけた場合,実装制約違反がそのブロック>に
おいて発生する。
.
]]>
この規格に適合する実装(参照)の場合,この例外は,この規格が定義する特定の制限事項に
関してだけ発生しうる。
内容中で処理されない内容例外
BLOCK> when the Content
Processor encounters an unhandled content exception in content subordinate to
the BLOCK>. (See and for content exceptions and content
exception handling.)
]]>
内容プロセサが,あるブロック>構造要素の下位にある内容中で処理されない内容例外
を見つけた場合に,処理されない内容例外がそのブロック>において発生する。
(内容例外及び内容例外処理については,及び参照。)
BLOCK>
]]>
下位ブロック>中における処理されない構造例外
BLOCK>,
if that BLOCK> does not handle the exception (see ), then the same
structure exception arises in the most immediately superior BLOCK>.
]]>
上の五つの構造例外のいずれかが,あるブロック>構造要素中で発生し,
そのブロック>がその例外(参照)を処理しない場合,同じ構造例外が,
その直接の上位ブロック>中において発生する。
DOCUMENT>
(to which there is no superior BLOCK>) then the exception is handled
as specified in .
]]>
処理されない構造例外が文書>(これには上位ブロック>は存在しない。)中
で発生した場合,この例外は,で規定するとおりに処理される。
構造例外処理
BLOCK> has an abort-policy>
presentation parameter, which may have values of
dpi::abort-policy::on-warning>, dpi::abort-policy::on-error>,
or dpi::abort-policy::struggle-on> (see ).
]]>
各ブロック>構造要素のブロック状態は,abort-policy>提示パラメータをもつ。
これは,値としてdpi::abort-policy::on-warning>,
dpi::abort-policy::on-error>又はdpi::abort-policy::struggle-on>を
もつことができる(参照)。
BLOCK> whose abort-policy>
presentation parameter has a value of dpi::abort-policy::on-error>,
it typically does not cause a structure exception to occur.
]]>
abort-policy>提示パラメータがdpi::abort-policy::on-error>値をもつ
ブロック>中で構造警告が発生した場合,それは,一般には構造例外を
引き起こさない。
そのかわり,それは,ある実装依存の方法で印刷依頼元に対して警告メッセージを
発行する。
BLOCK> whose abort-policy>
presentation parameter has a value of dpi::abort-policy::on-warning>,
a structure exception is raised in addition to a warning message
being sent to the print requestor.
]]>
abort-policy>提示パラメータがdpi::abort-policy::on-warning>値を
もつブロック>中で構造警告が発生した場合,
印刷依頼元に警告メッセージが送られることに加えて構造例外が引き起こされる。
次の36.2.1からまでで構造例外の処理について述べる。
dpi::abort-policy::struggle-on>
BLOCK> for which the
abort-policy> presentation parameter value is
dpi::abort-policy::struggle-on>,
then the exception is said to be handled>.
]]>
abort-policy>提示パラメータの値がdpi::abort-policy::struggle-on>
であるブロック>中で構造例外が発生した場合,その例外は,処理される>。
実装依存の警告メッセージが印刷依頼元に送られてもよい。
この警告メッセージは,逆の経路を使ってSPDLプロセスを呼び出した処理へ
転送されてもよいし,ブレークページ又はバナーページ上に印刷されてもよい。
この経路の構造とプロトコルについては,この規格では定義しない。
BLOCK> is performed by the presentation process.
]]>
このブロック>の下位にある内容又は構造が,それ以上提示プロセスによって
処理されることはない。
BLOCK> in which the exception occurs is a PAGE>,
then the PAGE> shall be presented.
]]>
しかし,例外が発生しているブロック>がページ>構造要素である場合,その
ページ>は,提示される。
そのページ上に提示されるページ像は,実装依存とする。
BLOCK> in which the exception occurred.
]]>
構造処理は,例外が起きたブロック>の直後の構造から再開される。
BLOCK> subordinate to a PAGE>,
the cumulative state of the resultant Current Page Image shall be
implementation-dependent.
]]>
例外があるページ>の下位ブロック>中で発生した場合,結果として
得られる現ページ像の蓄積された状態は,実装依存とする。
蓄積された状態とは最終的に残される状態のこと。
結果として得られる現ページ像は,文書中に例外の原因がなかった場合の
提示プロセスの結果に可能な限り近いことが望ましい。
dpi::abort-policy::on-error, dpi::abort-policy::on-warning>
BLOCK>
for which the abort-policy> presentation parameter value is
dpi::abort-policy::on-error> or dpi::abort-policy::on-warning>,
then the exception is said to be unhandled>.
]]>
abort-policy>提示パラメータの値がdpi::abort-policy::on-error>
又はdpi::abort-policy::on-warnig>である
ブロック>構造要素中で
構造例外が発生した場合,その例外は,処理されない>。
印刷依頼元に対して,実装依存の警告メッセージが発行されてもよい。
この警告メッセージは,逆の経路を使ってSPDLプロセスを呼び出した処理へ
転送されてもよいし,ブレークページ又はバナーページ上に印刷されてもよい。
この経路の構造とプロトコルについては,この規格では定義しない。
BLOCK> is performed by the presentation process.
]]>
このブロック>の下位にある内容又は構造が,
それ以上提示プロセスによって処理されることはない。
BLOCK> in which the exception occurs is a PAGE>,
then the PAGE> shall be presented.
]]>
しかし,例外が発生しているブロック>がページ>である場合,
そのページ>は,提示される。
そのページ上に提示されるページ像は,実装依存とする。
PAGE> in which the exception arose had not been present.
]]>
このページより前のすべてのページは,例外が発生したページ>など無かった
かのように,正しく提示されなければならない。
BLOCK>, the same structure
exception arises in the most immediately superior BLOCK>.
]]>
あるブロック>で処理されない例外が発生した場合,同じ構造例外が,
直接の上位ブロック>においても発生する。
BLOCK> will depend on the value of the abort-policy> presentation
parameter in that BLOCK>.
]]>
直接の上位ブロック>内の構造例外の結果は,
そのブロック>におけるabort-policy>提示パラメータの値によって異なる。
DOCUMENT>
(to which there is no superior BLOCK>) then processing of the document
terminates.
]]>
処理されない例外が文書>(これについては,上位ブロック>が存在しない。)
で発生した場合,その文書の処理は,終了する。
DOCUMENT> is a single PAGE>, then one page image shall be
presented; the page image presented on this page shall be implementation
dependent.
]]>
文書>が単一のページ>である場合,1個のページ像が提示される。
このページ上に提示されるページ像は,実装依存とする。
内容例外
RaiseException>, and (in some
circumstances) RaiseError> or RaiseWarning>.
]]>
内容例外は,内容処理の過程において,RaiseException>及び
(状況によっては)RaiseError>又はRaiseWarnig>のいずれかの演算子を
実行した結果として発生する。
RaiseException> operator immediately causes a
content exception to occur.
]]>
RaiseException>演算子の実行は,ただちに内容例外を発生させる。
) or not.
]]>
この例外は,内容中で処理されても,されなくてもよい(参照)。
).
]]>
内容において処理されなかった場合,構造例外が発生する(参照)。
RaiseError> operator does not itself cause
a content exception to occur.
]]>
RaiseError>演算子の実行自体は,内容例外を引き起こさない。
error Procedure> to be selected from the
dictionary bound to the key ErrorDict> in SystemDict>,
and the error Procedure is then executed.
]]>
そのかわり,この演算子は、SystemDict>のErrorDict>キーに結び付けられた
辞書から一つのエラー処理手続き>を選択し,このエラー処理手続きが
実行される。
RaiseException>
operator, thus causing a content exception to occur. (See for complete
specification of error Procedures and their uses.)
]]>
エラー処理手続きは,通常,RaiseException>演算子を実行して終了し,
この結果,内容例外が発生する。(エラー処理手続き及びその使用法についての詳しい
規定については,参照。)
ErrorDict> may be modified in content (see ).
]]>
ErrorDict>は,内容中で変更されてもよい(参照)。
error Procedure> bound to a particular interpreter error name
may be replaced, for example.
]]>
例えば,特別なインタプリタエラー名に結び付けられたエラー処理手続き>
は,置き換えられてもよい。
RaiseWarning> operator typically does not
cause a content exception to occur.
]]>
RaiseWarning>演算子の実行は,一般的には内容例外を発生させない。
そのかわり,この演算子は,実装依存の方法を用いて印刷依頼元に対して警告メッセージを
発行する。
dpi::abort-policy::on-warning>, then,
after issuing the warning message, RaiseError> shall be invoked with
ContentWarning> as its operand.
]]>
しかし,仮想機械の現中断方針構成要素がdpi::abort-policy::on-warning>値
をもつ場合,警告メッセージが発行された後で,ContentWarning>を
オペランドとして,RaiseError>を実行する。
).
]]>
これは,例外を引き起こす可能性がある(参照)。
内容例外処理
RaiseException>
operator.
]]>
内容例外は,RaiseException>演算子実行の結果として生じる。
この演算子の解釈文脈によって,例外は,処理される場合も
されない場合もある。
ExecuteTrapped> operator, then the exception will be handled.
]]>
ExecuteTrapped>演算子によって呼び出される手続きの解釈中に,
例外が発生した場合,その例外は,処理される。
ExecuteTrapped> operator is said to be
executed in a trapped context>.
]]>
ExecuteTrapped>演算子によって実行された手続きは,
トラップされた文脈>の中で実行される手続きと言われる。
その他の場合には,例外は処理されない。
処理される例外
ExecuteTrapped> operator provides a mechanism for executing
a Procedure in a context in which content exceptions will be trapped>.
]]>
ExecuteTrapped>演算子は,内容例外をトラップ>することのできる,
ある文脈の中で手続きを実行するための機構を提供する。
ExecuteTrapped>
operator.
]]>
例外が発生した場合,手続き及びその副手続きの実行は,すべて停止する。
そして,ExecuteTrapped>演算子の後に続く次のオブジェクトで
内容の処理が継続される。
例外がトラップされたことを示すために,
論理値の真がオペランドスタック上に置かれる。
(その手続きが,例外を引き起こすことなく最後まで解釈された場合,
論理値の偽がオペランドスタック上に置かれる。)
ExecuteTrapped> operator allows it to
be followed by an exception handler Procedure, defined by the document,
which can be conditionally executed if an exception occurs.
]]>
ExecuteTrapped>演算子によって返された論理値の後に,
文書が定義する例外処理手続きが続いても良い。
これは,例外が生じた場合に選択的に実行することができる。
このように例外がトラップされて処理される場合,
その結果は,完全に文書の管理下に置かれる。
処理されない例外
例外をトラップしていない文脈の中で内容例外が発生した場合,この内容例外は
処理されない。
ReportErrorInfo> from ErrorDict> is executed, and
then a structure exception in the immediately superior BLOCK> occurs.
]]>
ErrorDict>中の手続きReportErrorInfo>が実行され,次に,構造例外が
直接の上位ブロック>で発生する。
内容例外関連の演算子及び手続き
これらの演算子及びその意味に関する規定は,演算子を解釈した結
果として内容例外を発生させうる条件についての規定を含む。
共通エラーには,一つのクラスがある。
その中の幾つかの部分集合は,各演算子によって引き起こされ,
それに対応した共通例外を発生させる可能性がある。
.
]]>
これらの共通エラー及び意味については,で述べる。
through
identify operator-specific errors that may lead to exceptions.
]]>
加えて,からまでで規定する個々の演算子仕様では,
例外を発生させる可能性のある演算子固有のエラーについて規定する。
.
]]>
これらのエラーについても,で述べる。
RaiseException>
RaiseException> operator takes no arguments and returns no results.
]]>
RaiseException>演算子は,引数をとらず,結果も返さない。
これは,字句的な関係に関わらず,動的に閉じた最も内側のトラップされた文脈の
実行を終了させる。
, and the
ExecuteTrapped> operator itself in .
]]>
トラップされた文脈の使用方法は,で,ExecuteTrapped>演算子そのもの
については,で述べる。
content-warning> or content-error> as appropriate.
]]>
このようなトラップされた文脈がない場合,内容処理は,終了される。
そして,構造プロセサに返される状態は,場合に応じてcontent-warning>
又はcontent-error>とされなければならない。
これらの二つの状態値は,処理されない内容例外であることを示す。
RaiseError>
RaiseError>演算子は,次に示す1個のオペランドをとり,結果を返さない。
<
<
RaiseError> operator is to execute the
Procedure bound to error> in ErrorDict>.
]]>
RaiseError>演算子を実行すると,ErrorDict>の中でerror>に結び
付けられている手続きが実行される。
RaiseWarning>
RaiseWarning> operator takes one operand
]]>
RaiseWarning>演算子は,次に示す1個のオペランドをとり,結果を返さない。
<
<
RaiseWarning> operator is to execute the
Print> operator with warning> as an operand, and then conditionally
invoke RaiseError> with ContentWarning> as its operand.
]]>
RaiseWarning>演算子を実行すると,
warning>をオペランドとしてPrint>演算子が実行され,条件によっては
ContentWarning>をオペランドとしてRaiseError>を実行する。
RaiseError> is based on
the Current AbortPolicy of the Virtual Machine; see .
]]>
RaiseError>を実行するかどうかは,
仮想機械の現中断方針に基づいて決定される(参照)。
Print>
Print>演算子は,次に示す1個のオペランドをとり,結果を返さない。
<
<
message> to be issued to the print requestor in an
implementation-dependent way.
]]>
この演算子は,実装依存の方法を用いて,印刷依頼元に対してmessage>を
発行する。
ExecuteTrapped>
ExecuteTrapped> operator takes one operand
]]>
ExecuteTrapped>演算子は,次に示す1個のオペランドをとる。
<
<
そして,次に示す1個の結果を返す。
<
<
ExecuteTrapped> executes the Procedure P>
(as if by the Execute> operator).
]]>
ExecutedTrapped>は,(あたかもExecute>演算子であるかのように)
手続きP>を実行する。
P> runs to completion normally, ExecuteTrapped> returns a
value of false on the Operand Stack.
]]>
P>が正常に終了した場合,ExecuteTrapped>は,
論理値P> terminates prematurely as a result of executing the
RaiseException> operator, ExecuteTrapped> returns the value true
on the Operand Stack.
]]>
RaiseException>演算子を実行して途中で終了した場合,
ExecuteTrapped>は,論理値ExecuteTrapped> operator.
]]>
結果がどちらであっても,インタプリタは,ExecuteTrapped>演算子の後に続く,
次のオブジェクトから実行を再開する。
StoreErrorInfo
ErrorDict>中のStoreErrorInfo>手続きは,
次に示す1個のオペランドをとる。
<
<
そして,次に示す1個の結果を返す。
<
<
ErrorInfoDict> (see ).
]]>
この手続きは,インタプリタエラーが発生した時にインタプリタによって実行
される。これは,エラー及びそれが発生したときの文脈に関する情報を,
ErrorInfoDict>中に記録する()。
StoreErrorInfo> Procedure sets the value of the
newerror> key to true, then sets the values of the errorname>,