Annotation of parser3/tests/160.html, revision 1.5

1.1       misha       1: @main[]
1.3       misha       2: $sDir[outputs/160]
                      3: $iStep(1)
                      4: $iSleepTime(3)
                      5: $iCacheTime(2)
1.1       misha       6: 
1.3       misha       7: <table border="1" cellpadding="3">
                      8: <tr>
1.4       misha       9: <th>Info</th>
1.3       misha      10: <th>File: 1</th>
                     11: <th>File: 2</th>
                     12: <th>File: 3</th>
1.4       misha      13: <th>File: 4</th>
1.3       misha      14: </tr>
1.1       misha      15: 
1.4       misha      16: # row 1
                     17: <tr valign="top">
                     18: <td>Exec body on 1st step, then just get cached result</td>
1.3       misha      19: <td>
                     20:        ^do[1](3){One}
                     21: </td>
                     22: <td>
                     23:        ^do[2](3){Two}
                     24: </td>
                     25: <td>
                     26:        ^do[3](3){Three}
                     27: </td>
1.4       misha      28: <td><br /></td>
1.3       misha      29: </tr>
1.1       misha      30: 
1.3       misha      31: 
1.4       misha      32: #row 2
                     33: <tr valign="top">
                     34: <td>Value in cache not expired yet.</td>
1.3       misha      35: <td><br /></td>
                     36: <td><br /></td>
                     37: <td>
                     38: ^do[3](3){
                     39:        ^method[]
                     40: }{
                     41:        $exception.handled(1)
                     42:        ^cache(2)
1.4       misha      43:        Error while executing body
1.3       misha      44: }
                     45: </td>
                     46: </tr>
                     47: 
                     48: # wait till cache expire
1.4       misha      49: <tr valign="top">
                     50: <td>Wait for 3 secs. Cache expired for sure.</td>
1.3       misha      51: <td colspan="3">
                     52: ^sleep($iSleepTime)
                     53: ^^sleep($iSleepTime)
                     54: </td>
1.4       misha      55: <td><br /></td>
1.3       misha      56: </tr>
                     57: 
                     58: 
1.4       misha      59: # row 3
                     60: <tr valign="top">
                     61: <td>
                     62: 1. Body code has an exception but force get cached result<br />
                     63: 2. Execute body and set ^^cache(0) for prevent cacheing<br />
                     64: 3. Body code has an exception, execute catch section and set ^^cache(0)
                     65: </td>
1.3       misha      66: <td>
                     67: ^do[1](3){
                     68:        ^method[]
                     69: }{
                     70:        ^cache(1)
                     71:        $exception.handled[cache]
1.4       misha      72:        force get cached resuls
1.3       misha      73: }
                     74: </td>
                     75: 
                     76: <td>
                     77: ^do[2](3){
                     78:        Two
                     79:        ^cache(0)
                     80: }
                     81: </td>
                     82: 
                     83: <td>
                     84: ^do[3](3){
                     85:        ^method[]
                     86: }{
                     87:        $exception.handled(1)
                     88:        ^cache(0)
1.4       misha      89:        Catch section results
                     90: }
                     91: </td>
                     92: 
                     93: <td>
                     94: ^do[4](3){
                     95:        ^method[]
1.3       misha      96: }
                     97: </td>
                     98: 
                     99: 
                    100: </tr>
                    101: </table>
                    102: 
1.4       misha     103: @do[sFile;iSteps;jBody;jExceptionHandler][i;n;bProcessBody;bProcessErrorHandler;iTime;sBody;bError]
1.3       misha     104: ^for[i](1;$iSteps){
                    105:        $iTime[]
                    106:        $bProcessBody(0)
                    107:        $bProcessErrorHandler(0)
1.4       misha     108:        
                    109:        $nTry(0)
                    110:        $nCatch(0)
                    111:        ^try{
                    112:                $sBody[^cache[$sDir/$sFile]($iCacheTime){
                    113:                        ^nTry.inc(1)
                    114:                        $jBody ($i)
                    115:                        $bProcessBody(1)
                    116:                        $iTime(^cache[])
                    117:                }{$bProcessErrorHandler(1)^nCatch.inc(1)$jExceptionHandler}]
                    118:                
                    119:                ^if($bProcessBody){
                    120:                        Executed body, ^^cache[] value ^if(def $iTime){defined}{undefined},
1.3       misha     121:                }{
1.4       misha     122:                        ^if($bProcessErrorHandler){
                    123:                                Processing catch section, 
                    124:                        }{
                    125:                                Get cached result,
                    126:                        }
1.1       misha     127:                }
1.4       misha     128:        }{
                    129:                $bError(1)
                    130:                $exception.handled(1)
1.1       misha     131:        }
1.3       misha     132:        
1.4       misha     133:        ^if($bError){
                    134:                Error. Body executed $nTry times, catch executed $nCatch times.
                    135:        }{
                    136:                result: '$sBody'
                    137:        }
1.3       misha     138: }[<br />]
                    139: ^iStep.inc(1)

E-mail: