source: to-imperative/trunk/samples/check.rf @ 2470

Last change on this file since 2470 was 2317, checked in by orlov, 14 years ago
  • Fixed typo.
  • Property svn:eol-style set to native
File size: 996 bytes
Line 
1// $Id$
2
3$use Box Compare Dir File StdIO System;
4
5$func Check s.failed s.passed e.path = s.failed s.passed;
6
7Main =
8  {
9    <Arg 2> : v.path = v.path;
10    '.';
11  } :: v.path,
12  <Check 0 0 v.path> :: s.failed s.passed,
13  <PrintLN "Failed: "s.failed", passed: "s.passed>,
14  {
15    <">" (s.failed) (0)> = <Exit 1>;;
16  };
17
18Check s.failed s.passed e.path = {
19  <Is-Directory? e.path> =
20    <Open-Dir e.path> :: s.dir,
21    s.failed s.passed $iter {
22      <Check s.failed s.passed e.path <? &Dir-Separator> <Read-Dir s.dir>>;
23      s.failed s.passed Stop;
24    } :: s.failed s.passed e.stop?,
25    e.stop? : Stop =
26    <Close-Dir s.dir>,
27    s.failed s.passed;
28  e.path : e.fname '.rf',
29    <Exists? e.fname '.out'> =
30    <Arg 1> " " e.fname <Arg 3> :: e.cmd,
31    <Print e.cmd ": ">,
32    <System e.cmd> :: s.e,
33    <PrintLN s.e>,
34    {
35      s.e : 0;
36      <PrintLN "Command \""<Arg 1> " " e.fname <Arg 3>"\" exited with code "s.e>,
37        <Exit 2>;
38    },
39    s.failed s.passed;
40  s.failed s.passed;
41};
42
Note: See TracBrowser for help on using the repository browser.