IF/Prologは、例外処理を容易に行うための汎用的なメカニズムを備えています。...
移動
次へ 前へ
上へ 最上
参考
バージョン3から4への移行
イントロダクション
abolish
abort
# append
arg
計算式(arithmetic)
アリティ(arity)
ASCII文字
assert
asserta_term, asserto_term, assertz_term
atom, atomic_length
\(バックスラッシュ)
#bagof, #setof
block, exit_block, cut_block
break
bye
call, execute
文字セット, char_code
#clause, #clause_term
clear_eol, clear_eos, clear_screen
close
コメント
compare
項の比較
値の比較
compiles
concat
連言(conjunction)
consult
コントロールスタック(control stack)
データの型変換(conversion)
copy_term
correct
cpu時間
#current_predicate, #current_atom, current_language
!(カット)
データベース(database)
debug, nodebug, debug_goal
debug_mode
decompcons
指令(directives)
選言(disjunction)
display
編集(edit)
終了(end)
end_of_file文字
equiv_char, image_length, byte_length
例外処理(exceptions)
error_protect, exception, exception_handler
exists
exit
expand_term, phrase(+ゴール,?リスト)
?- export, ?- common, ?- import, ?-hidden
事実(fact)
fail
filepos, files, flush, reset_streams
findall
float_format
# for
functor
gc
get, get0, get_until
getchar
getenv, get_home, get_last, move_cursor
get_global, # global_variable
ゴール(goal)
文法規則(grammar rules)
リストの先頭(head of list)
節のヘッド(head of clause)
help
ifprolog
ifsem
include
index
入力ストリーム(input stream)
インタプリタレベル(interpreter level)
is
length, #reverse
list_mode, listing
リスト(lists)
load, loaded
localtime
ループ(loops)
lower_upper, national_letters
make_atom, make_number
match, # match
# member
modify_mode
?- module, ?- module_body
name
nl
:- nonotify, nonotify
not
number
once
オペレータ(operator)
op, # current_op
outpos, outtab
出力ストリーム(output stream)
program_parameters, system_parameters, user_parameters
parse_atom
parse_position
predicate, predicate_mode
predicate_type
print
手続き(procedure)
program
# prolog_flag
prolog_library
prolog_system, prolog_version, proroot
put
put_byte, get_byte
raise_error
read, read_term
read_error, report_read_error
reconsult(+ファイル名)
# repeat
#retract
retractop
save_system, save_module
see, seeing, seen
set_global
set_home, setoutpos, setupterm
signal, signal_handler, alarm
skip
sort, keysort
spy
dbsize, ssize, gused, dbused, tused, lused
statistics
open, close, stream_control, #current_stream, link_stream
文字列(strings)
複合項(structures)
subatomic
sum, inc
symbol
計算式の構文(syntax of arithmetic expression)
構文チェッカー(syntax checker)
syntax_error
項の構文 (Syntax of terms)
system
system_date, system_time
system_predicate
tab
tell, telling, told
項(term)
X is time
trace, notrace, trace_mode, trace_goal
trace, tracing, traced
トレイル(trail)
true
tty_size
type_of, atom, nonvar, atomic, numeric, digit, realn, integer, struct, letter, var
未定義の述語(undefined_predicate)
?項1 = ?項2, +項1 \= +項2
?複合項 =.. -Univリスト, -複合項 =.. ?Univリスト
unload
unset_global
user
変数(variables)
write
イフコンピュータ > IF/Prolog > マニュアル > IF/Prolog V4.1 マニュアル > IF/Prolog V4.1 レファレンスマニュアル > 例外処理(exceptions)

例外処理(exceptions)

MINERVA superseeded IF/Prolog. Please see http://www.ifcomputer.co.jp/MINERVA for details.

We discontinued to sell IF/Prolog Dec 31. 2003. For current customers, we continue to provide professional support for IF/Prolog until Dec 31, 2008.

IF/Prologは、例外処理を容易に行うための汎用的なメカニズムを備えています。

例外処理は、ゴ−ルの評価中にエラ−が起きた場合、あるいはユ−ザがexception/2やraise_error/0,/1を使った場合に生じます。例外処理は、エラ−の性質を示す例外メッセ−ジによって識別されます。エラ−は通常、組み込み述語の引数の制限に違反することによって生じます。

ゴ−ルの評価中にエラ−によって例外処理(例外メッセ−ジであるMsgで識別される)が起きると、インタプリタは評価を中断し、例外処理"ExceptHandler"を探します(例外処理には、ユ−ザの望みのコ−ドを含めることができます)。

まず最初にIF/Prologは、現在の例外がユ−ザによってexception_handler/3で定義された(アサ−トされた)例外処理を持っているかどうかを調べます。

そうでない場合は、IF/Prologはerror_protect/2の最も最近の呼び出しで定義された例外処理を探します。

error_protect/2の場合には、現在の例外の例外メッセ−ジがExcept_handlerの最初の引数に単一化され、Except_handlerが実行されます。exception_handler/3の場合には、Except_handlerが単に実行されます。exception_handler/3は、error_protect/2を無効にすることに注意して下さい!

ユ−ザの定義した例外処理がない場合 デフォルトで、最も最近のerror_protect/2の呼び出しが、現在のインタプリタル−プによって呼び出されます。インタプリタによって定義された例外処理が実行されます。このデフォルトの例外処理は、標準エラ−出力に以下のようにプリントされます。

E X C E P T I O N:ExceptionMessage:CurrentGoal

"undefined_predicate"の例外は特別に扱われており、以下の述語を宣言することで例外の発生を避けることができます。

    predicate([ +関数子1/アリティ1, +関数子2/アリティ2, ....])

この述語により宣言された、未定義の述語の呼び出しは、単に失敗します。

続く..
IF/Prolog by Siemens
言語
English
Japanese
German
サーバー
USA
Japan
サイトマップ
索引
目次
全体目次
全体索引
印刷向き
imode
PDA
探索
document: http://www.ifcomputer.co.jp/IFProlog/Manuals/v4.1/reference/exception/home_jp.html
published 2008/10/6 update 1995/11/6 (c) 1996-2006 IF Computer Japan
IF Computer 〒113-0022 Tel 03-5814-3352 start (AT) ifcomputer.com
Customer Support 東京都文京区千駄木5-28-2   http://www.ifcomputer.co.jp
冒頭へ managed with ubiCMS