home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / e_require.e < prev    next >
Text File  |  1999-06-05  |  4KB  |  112 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  4. --                       http://SmallEiffel.loria.fr
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
  11. -- for  more  details.  You  should  have  received a copy of the GNU General
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class E_REQUIRE
  17.    --
  18.    -- To store a `require' clause.
  19.    --
  20.  
  21. inherit ASSERTION_LIST;
  22.  
  23. creation make, make_runnable
  24.  
  25. feature
  26.  
  27.    is_require_else: BOOLEAN;
  28.  
  29. feature
  30.  
  31.    name: STRING is
  32.       do
  33.          if is_require_else then
  34.             Result := "require else";
  35.          else
  36.             Result := "require";
  37.          end;
  38.       end;
  39.  
  40.    short(h1,r1: STRING) is
  41.       local
  42.          i: INTEGER;
  43.       do
  44.          short_print.hook_or(h1,r1);
  45.          if header_comment = Void then
  46.             short_print.hook_or("hook412","");
  47.          else
  48.             short_print.hook_or("hook413","");
  49.             header_comment.short("hook414","         -- ","hook415","%N");
  50.             short_print.hook_or("hook416","");
  51.          end;
  52.          if list = Void then
  53.             short_print.hook_or("hook417","");
  54.          else
  55.             short_print.hook_or("hook418","");
  56.             from
  57.                i := 1;
  58.             until
  59.                i = list.upper
  60.             loop
  61.                list.item(i).short("hook419","         ", -- before each assertion
  62.                                   "hook420","", -- no tag
  63.                                   "hook421","", -- before tag
  64.                                   "hook422",": ", -- after tag
  65.                                   "hook423","", -- no expression
  66.                                   "hook424","", -- before expression
  67.                                   "hook425",";", -- after expression except last
  68.                                   "hook426","%N", -- no comment
  69.                                   "hook427","", -- before comment
  70.                                   "hook428"," -- ", -- comment begin line
  71.                                   "hook429","%N", -- comment end of line
  72.                                   "hook430","", -- after comment
  73.                                   "hook431",""); -- end of each assertion
  74.  
  75.                i := i + 1;
  76.             end;
  77.             list.item(i).short("hook419","         ", -- before each assertion
  78.                                "hook420","", -- no tag
  79.                                "hook421","", -- before tag
  80.                                "hook422",": ", -- after tag
  81.                                "hook423","", -- no expression
  82.                                "hook424","", -- before expression
  83.                                "hook432","", -- after expression except last
  84.                                "hook426","%N", -- no comment
  85.                                "hook427","", -- before comment
  86.                                "hook428"," -- ", -- comment begin line
  87.                                "hook429","%N", -- comment end of line
  88.                                "hook430","", -- after comment
  89.                                "hook431","");
  90.             short_print.hook_or("hook433","");
  91.          end;
  92.          short_print.hook_or("hook434","");
  93.       ensure
  94.          fmt.indent_level = old fmt.indent_level;
  95.       end;
  96.  
  97. feature {TMP_FEATURE}
  98.  
  99.    set_require_else is
  100.       do
  101.          is_require_else := true;
  102.       end;
  103.  
  104. feature {NONE}
  105.  
  106.    check_assertion_mode: STRING is
  107.       do
  108.          Result := "req";
  109.       end;
  110.  
  111. end -- E_REQUIRE
  112.