OSDN Git Service

こっそり、気持ち程度の日本語化しました (UTF-8 / Windows 環境用)。
[ring-lang-081/annotated-ring-with-OmegaT.git] / source / src / ring_vmtrycatch.c
1 /* Copyright (c) 2013-2019 Mahmoud Fayed <msfclipper@yahoo.com> */
2 #include "ring.h"
3 /* Try Catch Done */
4
5 void ring_vm_try ( VM *pVM )
6 {
7         List *pList  ;
8         pList = ring_list_newlist_gc(pVM->pRingState,pVM->pTry);
9         ring_list_addint_gc(pVM->pRingState,pList,RING_VM_IR_READI);
10         ring_vm_savestate(pVM,pList);
11         pVM->nActiveCatch = 0 ;
12 }
13
14 void ring_vm_catch ( VM *pVM,const char *cError )
15 {
16         List *pList  ;
17         pList = ring_list_getlist(pVM->pTry,ring_list_getsize(pVM->pTry));
18         pVM->nPC = ring_list_getint(pList,1) ;
19         ring_vm_restorestate(pVM,pList,2,RING_STATE_TRYCATCH);
20         /* Define variable cCatchError to contain the error message */
21         ring_list_setstring_gc(pVM->pRingState,ring_list_getlist(ring_vm_getglobalscope(pVM),6),3,cError);
22         /* Tell C-API caller (CALL command) that catch happens! */
23         pVM->nActiveCatch = 1 ;
24         /* Catch Statements must be executed without try effects */
25         ring_vm_done(pVM);
26 }
27
28 void ring_vm_done ( VM *pVM )
29 {
30         ring_list_deleteitem_gc(pVM->pRingState,pVM->pTry,ring_list_getsize(pVM->pTry));
31 }