「Push-error-using-command」の版間の差分
(ページの作成:「{{AutoLISP}} ; 構文 : (*push-error-using-command*) ; 機能 : カスタム *error* ハンドラ内での command 関数の使用を示すエラー処理関数。 ;...」) |
細編集の要約なし |
||
| 10行目: | 10行目: | ||
; 引数 | ; 引数 | ||
なし | なし | ||
; 戻り値 | ; 戻り値 | ||
2016年2月23日 (火) 22:12時点における版
- 構文
- (*push-error-using-command*)
- 機能
- カスタム *error* ハンドラ内での command 関数の使用を示すエラー処理関数。
- 引数
なし
- 戻り値
- T (値 T が返される。)
- MEMO:*push-error-using-command* に対する呼び出しは、command 関数の使用を含むカスタム *error* ハンドラ関数を設定した後に実行する必要がある。
- *push-error-using-command* を使用する場合、カスタム *error* ハンドラからアクセスできるのはグローバル変数だけに制限され、エラーが発生した関数内で定義されているローカル変数にはアクセスできない。ローカル変数にアクセスする必要がある場合、command 関数のすべてのインスタンスを command-s 関数と置き換え、*push-error-using-stack* に対する呼び出しを使用する。
- 注 : カスタム *error* ハンドラ内で command 関数が使われている場合、この関数は使用できない。
- サンプル
;; *pop-error-mode* 関数の使用例
(defun my_err (err_msg)
(if (/= err_msg "Function cancelled")
(prompt (strcat "\nError: " err_msg))
)
(command "._undo" "_e")
(command "._U")
(setq *error* olderr)
(princ)
)
(defun myUtil (key / )
(setq olderr *error*
*error* my_err)
(*push-error-using-command*) ; カスタム エラー ハンドラーのコマンド-s の代わりに command 関数の使用
(command "._undo" "_group") ; このサンプルでは実行されませんが、エラー ハンドラーを設定するための良いフレームワーク。
(/ 1 0) ; コードを設定するときに、カスタム エラー handlerRemove をトリガーする不適切な値を持つ関数を呼び出す
;; ここに何かの処理を実行。
(command "._undo" "_e")
(setq *error* olderr) ; 古い *error* ハンドラーを復元
(*pop-error-mode*) ; *pop-error-mode* を使用
)
関連事項