This morning I wrote an article on how to implement try/catch mechanism in C lanuage. The key is how to use the syscalls
setjmp() and longjmp(). To prevent from confusing, the status of current exception frame was defined from 0. There are four
states on a exception frame, entered, raised, handled and finally. The enumeration type is used to defined them.
I don't know what is the structure of jmp_buf. But it is not important to implement the mechanism. Firstly, invoking setjmp(),
the setjmp() not only save the current run environment, but also return 0 to the caller. When invoking longjmp(), it not only
restore the run enviornment saved by setjmp(), but also return a value by setjmp().
If you learnt the assembly lanuage, known how to implement thread mechanism, it is easy to understand what is the run environment.
The rest is easy to dealt with. It just is to dispatch exception branchs. Wrapped it by macros, we will be at ease when resuing them.
Wrapping macros are just like veils. Instead of those veils, you can put those sources into your codes. Therefore, you can debug
it step by step.
昨日、売変設定情報作成プロクラムを修正してしまいました。明日はC語言の教えることがあるので、今朝には、そろそろ、準備をしておかなければ
なりません。電子郵件で、社員たを知らせてみました。
今日、商品マスタブロクラムの定義書は始まって読んでいます。
setjmp() and longjmp(). To prevent from confusing, the status of current exception frame was defined from 0. There are four
states on a exception frame, entered, raised, handled and finally. The enumeration type is used to defined them.
I don't know what is the structure of jmp_buf. But it is not important to implement the mechanism. Firstly, invoking setjmp(),
the setjmp() not only save the current run environment, but also return 0 to the caller. When invoking longjmp(), it not only
restore the run enviornment saved by setjmp(), but also return a value by setjmp().
If you learnt the assembly lanuage, known how to implement thread mechanism, it is easy to understand what is the run environment.
The rest is easy to dealt with. It just is to dispatch exception branchs. Wrapped it by macros, we will be at ease when resuing them.
Wrapping macros are just like veils. Instead of those veils, you can put those sources into your codes. Therefore, you can debug
it step by step.
昨日、売変設定情報作成プロクラムを修正してしまいました。明日はC語言の教えることがあるので、今朝には、そろそろ、準備をしておかなければ
なりません。電子郵件で、社員たを知らせてみました。
今日、商品マスタブロクラムの定義書は始まって読んでいます。