home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_se / type.e < prev    next >
Text File  |  1999-06-05  |  41KB  |  1,536 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. deferred class TYPE
  17. --
  18. -- Handling of an Eiffel type mark.
  19. --
  20. -- Handling of Eiffel kernel classes :
  21. --
  22. --      Type Mark         |         Handle by Class
  23. --      -------------------------------------------
  24. --      BOOLEAN           |            TYPE_BOOLEAN
  25. --      CHARACTER         |          TYPE_CHARACTER
  26. --      INTEGER           |            TYPE_INTEGER
  27. --      REAL              |               TYPE_REAL
  28. --      DOUBLE            |             TYPE_DOUBLE
  29. --      POINTER           |            TYPE_POINTER
  30. --      NONE              |               TYPE_NONE
  31. --      ANY               |                TYPE_ANY
  32. --      STRING            |             TYPE_STRING
  33. --      ARRAY[FOO]        |              TYPE_ARRAY
  34. --      NATIVE_ARRAY[BAR] |       TYPE_NATIVE_ARRAY
  35. --      BIT 45            |              TYPE_BIT_1
  36. --      BIT Foo           |              TYPE_BIT_2
  37. --
  38. -- Handling of other classes :
  39. --
  40. --      TYPE_CLASS : when original type mark is not generic,
  41. --            not outside expanded and it is not a formal
  42. --            generic argument. Thus, this is the most common
  43. --            case.
  44. --
  45. --      TYPE_FORMAL_GENERIC : when original declaration type mark
  46. --            is a formal generic argument.
  47. --
  48. --      TYPE_LIKE_CURRENT : when written `like Current'
  49. --
  50. --      TYPE_LIKE_FEATURE : `like' <feature_name>
  51. --
  52. --      TYPE_LIKE_ARGUMENT : `like' <argument>
  53. --
  54. --      TYPE_EXPANDED : when original type is outside expanded (for
  55. --            example when written   `foo : expanded BAR').
  56. --
  57. --      TYPE_GENERIC : when original type is generic, is not ARRAY,
  58. --            not NATIVE_ARRAY and is not outside expanded.
  59. --
  60. --      TYPE_BIT_REF : corresponding reference type for TYPE_BIT.
  61. --
  62. --      TYPE_REF_TO_EXP : corresponding reference type for some
  63. --            expanded type.
  64. --
  65.  
  66. inherit GLOBALS;
  67.  
  68. feature
  69.  
  70.    written_mark: STRING is
  71.          -- The original written type mark (what's in the source code).
  72.       deferred
  73.       ensure
  74.          Result = string_aliaser.item(Result)
  75.       end;
  76.  
  77.    start_position: POSITION is
  78.          -- Of the written mark.
  79.       deferred
  80.       end;
  81.  
  82.    frozen written_in: CLASS_NAME is
  83.       do
  84.          if start_position /= Void then
  85.             Result := start_position.base_class_name;
  86.          end;
  87.       end;
  88.  
  89.    frozen pretty_print is
  90.       do
  91.          fmt.put_string(written_mark);
  92.       end;
  93.  
  94.    frozen short is
  95.       do
  96.          short_print.hook("Btm");
  97.          short_hook;
  98.          short_print.hook("Atm");
  99.       end;
  100.  
  101.    is_anchored: BOOLEAN is
  102.          -- Is it written "like ..." ?
  103.       do
  104.       end;
  105.  
  106.    is_like_current: BOOLEAN is
  107.          -- Is it written "like Current" ?
  108.       deferred
  109.       ensure
  110.          Result implies is_anchored
  111.       end;
  112.  
  113.    is_like_feature: BOOLEAN is
  114.          -- Is it written "like <feature>" ?
  115.       deferred
  116.       ensure
  117.          Result implies is_anchored
  118.       end;
  119.  
  120.    is_like_argument: BOOLEAN is
  121.          -- Is it written "like <argument>" ?
  122.       deferred
  123.       ensure
  124.          Result implies is_anchored
  125.       end;
  126.  
  127.    is_generic: BOOLEAN is
  128.          -- Is the written type a generic type ?
  129.       deferred
  130.       ensure
  131.          is_array implies Result
  132.       end;
  133.  
  134.    is_formal_generic: BOOLEAN is
  135.          -- Is it a formal generic argument ?
  136.       do
  137.       end;
  138.  
  139. feature
  140.  
  141.    is_run_type: BOOLEAN is
  142.          -- True when the running type is known (ie, when anchors
  143.          -- are computed and when formal generic names are
  144.          -- substitutes with real class names.
  145.       deferred
  146.       ensure
  147.          Result implies run_type /= Void
  148.       end;
  149.  
  150. feature  -- Working with the run TYPE :
  151.  
  152.    run_type: TYPE is
  153.          -- Corresponding running type mark.
  154.       require
  155.          is_run_type
  156.       deferred
  157.       ensure
  158.          Result.run_type = Result
  159.       end;
  160.  
  161.    is_expanded: BOOLEAN is
  162.       require
  163.          is_run_type
  164.       deferred
  165.       ensure
  166.          Result implies not is_reference
  167.       end;
  168.  
  169.    is_reference: BOOLEAN is
  170.       require
  171.          is_run_type
  172.       deferred
  173.       ensure
  174.          Result implies not is_expanded
  175.       end;
  176.  
  177.    like_feature: FEATURE_NAME is
  178.       require
  179.          is_like_feature
  180.       do
  181.       ensure
  182.          Result /= Void
  183.       end;
  184.  
  185.    generic_list: ARRAY[TYPE] is
  186.          -- Assume this is really a generic type, otherwise, print
  187.          -- a fatal error message with `fatal_error_generic_list'.
  188.       deferred
  189.       ensure
  190.          Result.lower = 1;
  191.          not Result.empty
  192.       end;
  193.  
  194.    run_time_mark: STRING is
  195.          -- The corresponding type mark at execution time.
  196.       require
  197.          is_run_type
  198.       deferred
  199.       ensure
  200.          Result = string_aliaser.item(Result)
  201.       end;
  202.  
  203.    is_boolean: BOOLEAN is
  204.       require
  205.          is_run_type
  206.       do
  207.       end;
  208.  
  209.    is_character: BOOLEAN is
  210.       require
  211.          is_run_type
  212.       do
  213.       end;
  214.  
  215.    is_integer: BOOLEAN is
  216.       require
  217.          is_run_type
  218.       do
  219.       end;
  220.  
  221.    is_real: BOOLEAN is
  222.       require
  223.          is_run_type
  224.       do
  225.       end;
  226.  
  227.    is_double: BOOLEAN is
  228.       require
  229.          is_run_type
  230.       do
  231.       end;
  232.  
  233.    is_string: BOOLEAN is
  234.       require
  235.          is_run_type
  236.       do
  237.       end;
  238.  
  239.    is_array: BOOLEAN is
  240.       require
  241.          is_run_type
  242.       deferred
  243.       ensure
  244.          Result implies generic_list.count = 1
  245.       end;
  246.  
  247.    is_bit: BOOLEAN is
  248.       require
  249.          is_run_type
  250.       do
  251.       end;
  252.  
  253.    is_any: BOOLEAN is
  254.       require
  255.          is_run_type
  256.       deferred
  257.       end;
  258.  
  259.    is_none: BOOLEAN is
  260.       require
  261.          is_run_type
  262.       deferred
  263.       end;
  264.  
  265.    is_pointer: BOOLEAN is
  266.       require
  267.          is_run_type
  268.       do
  269.       end;
  270.  
  271.    is_basic_eiffel_expanded: BOOLEAN is
  272.          -- True for BOOLEAN, CHARACTER, INTEGER, REAL, DOUBLE
  273.          -- and POINTER.
  274.          -- Note : all these types have the corresponding foo_REF
  275.          -- class with the `item' attribute.
  276.       require
  277.          is_run_type
  278.       deferred
  279.       end;
  280.  
  281.    frozen is_native_array: BOOLEAN is
  282.       local
  283.          tna: TYPE_NATIVE_ARRAY;
  284.       do
  285.          tna ?= Current;
  286.          Result := tna /= Void;
  287.       end;
  288.  
  289. feature
  290.  
  291.    frozen convertible_to(other: TYPE): BOOLEAN is
  292.       require
  293.          is_run_type;
  294.          other.is_run_type;
  295.          eh.empty
  296.       do
  297.          if is_a(other) then
  298.             Result := true;
  299.          else
  300.             eh.cancel;
  301.             if other.is_a(Current) then
  302.                Result := true;
  303.             else
  304.                eh.cancel;
  305.             end;
  306.          end;
  307.       ensure
  308.          eh.empty
  309.       end;
  310.  
  311. feature
  312.  
  313.    base_class_name: CLASS_NAME is
  314.       require
  315.          is_run_type
  316.       deferred
  317.       ensure
  318.          Result /= Void
  319.       end;
  320.  
  321.    static_base_class_name: CLASS_NAME is
  322.          -- Try to compute statically the good one.
  323.          -- It is not alway possible to compute this information
  324.          -- because some error may occurs for example.
  325.       deferred
  326.       end;
  327.  
  328.    to_runnable(ct: TYPE): like Current is
  329.          -- Compute the run time mark when the receiver is
  330.          -- written in `ct'.
  331.          -- Example : INTEGER always gives INTEGER.
  332.          --           `like Current' gives `ct'.
  333.          --           ...
  334.       require
  335.          ct.run_type = ct
  336.       deferred
  337.       ensure
  338.          no_errors implies written_mark = Result.written_mark;
  339.          no_errors implies start_position = Result.start_position;
  340.          no_errors implies Result.is_run_type;
  341.          no_errors implies Result.run_type = Result.run_type.run_type
  342.       end;
  343.  
  344.    frozen base_class: BASE_CLASS is
  345.       local
  346.          bcn: CLASS_NAME;
  347.       do
  348.          bcn := base_class_name;
  349.          if bcn /= Void then
  350.             Result := bcn.base_class;
  351.          else
  352.             eh.append("Cannot find Base Class for ");
  353.             eh.add_type(Current,fz_dot);
  354.             eh.print_as_fatal_error;
  355.          end;
  356.       end;
  357.  
  358.    frozen path: STRING is
  359.       -- Of the corresponding `base_class'.
  360.       do
  361.          Result := base_class.path;
  362.       end;
  363.  
  364. feature
  365.  
  366.    is_a(other: TYPE): BOOLEAN is
  367.          -- Type conformance checking : Is it a kind of `other' ?
  368.          -- Assume that the context is identical.
  369.          --
  370.          -- When false, `eh' is filled if needed with the corresponding
  371.          -- bad types, but the error report is not printed for the caller
  372.          -- to add some comments or for the caller to cancel `eh'.
  373.          --
  374.       require
  375.          is_run_type;
  376.          other.is_run_type
  377.       deferred
  378.       ensure
  379.          nb_errors = old nb_errors;
  380.          (not Result) implies (not eh.empty)
  381.       end;
  382.  
  383.    frozen is_a_in(other: TYPE; rc: RUN_CLASS): BOOLEAN is
  384.          -- Is the written type mark `other' interpreted in `rc'
  385.          -- is a kind of Current written type mark interpreted in `rc' ?
  386.       require
  387.          other /= Void;
  388.          rc /= Void
  389.       local
  390.          t1, t2, ct: TYPE;
  391.       do
  392.          if written_mark = other.written_mark then
  393.             Result := true;
  394.          else
  395.             ct := rc.current_type;
  396.             t1 := to_runnable(ct); -- ** Memory LEAKS
  397.             t2 := other.to_runnable(ct); -- ** Memory LEAKS
  398.             if t1.run_time_mark = t2.run_time_mark then
  399.                Result := true;
  400.             else
  401.                Result := t1.is_a(t2);
  402.             end;
  403.          end;
  404.       ensure
  405.          (not Result) implies (not eh.empty)
  406.       end;
  407.  
  408.    has_creation(fn: FEATURE_NAME): BOOLEAN is
  409.          -- Is `fn' the name of procedure of creation.
  410.       require
  411.          fn.start_position /= Void;
  412.          is_run_type
  413.       deferred
  414.       end;
  415.  
  416.    smallest_ancestor(other: TYPE): TYPE is
  417.          -- Return the smallest common ancestor.
  418.       require
  419.          is_run_type;
  420.          other.is_run_type
  421.       deferred
  422.       ensure
  423.          Result.run_type = Result;
  424.          Current.is_a(Result);
  425.          other.is_a(Result)
  426.       end;
  427.  
  428.    run_class: RUN_CLASS is
  429.       require
  430.          is_run_type
  431.       deferred
  432.       ensure
  433.          Result /= Void
  434.       end;
  435.  
  436.    frozen at_run_time: BOOLEAN is
  437.       require
  438.          is_run_type
  439.       do
  440.          Result := run_type.run_class.at_run_time;
  441.       end;
  442.  
  443.    expanded_initializer: RUN_FEATURE_3 is
  444.          -- Non Void when it is an `is_user_expanded' with a user
  445.          -- creation procedure.
  446.       require
  447.          is_run_type
  448.       deferred
  449.       end;
  450.  
  451. feature
  452.  
  453.    c_header_pass1 is
  454.       require
  455.          cpp.on_h;
  456.          run_class.at_run_time
  457.       deferred
  458.       ensure
  459.          cpp.on_h
  460.       end;
  461.  
  462.    c_header_pass2 is
  463.       require
  464.          cpp.on_h;
  465.          run_class.at_run_time
  466.       deferred
  467.       ensure
  468.          cpp.on_h
  469.       end;
  470.  
  471.    c_header_pass3 is
  472.       require
  473.          cpp.on_h;
  474.          run_class.at_run_time
  475.       deferred
  476.       ensure
  477.          cpp.on_h
  478.       end;
  479.  
  480.    c_header_pass4 is
  481.       require
  482.          cpp.on_h;
  483.          run_class.at_run_time
  484.       deferred
  485.       ensure
  486.          cpp.on_h
  487.       end;
  488.  
  489. feature {NONE}
  490.  
  491.    frozen standard_c_typedef is
  492.       require
  493.          cpp.on_h;
  494.          run_class.at_run_time
  495.       local
  496.          mem_id: INTEGER;
  497.       do
  498.          mem_id := id;
  499.          tmp_string.clear;
  500.          if need_c_struct then
  501.             tmp_string.append(fz_typedef);
  502.             tmp_string.append(fz_struct);
  503.             tmp_string.extend('S');
  504.             mem_id.append_in(tmp_string);
  505.             tmp_string.extend(' ');
  506.             tmp_string.extend('T');
  507.             mem_id.append_in(tmp_string);
  508.             tmp_string.append(fz_00);
  509.          elseif is_dummy_expanded then
  510.             tmp_string.append(fz_typedef);
  511.             tmp_string.append(fz_int);
  512.             tmp_string.extend(' ');
  513.             tmp_string.extend('T');
  514.             mem_id.append_in(tmp_string);
  515.             tmp_string.append(fz_00);
  516.          elseif is_reference then
  517.             tmp_string.append(fz_typedef);
  518.             tmp_string.append(fz_void);
  519.             tmp_string.extend('*');
  520.             tmp_string.extend('T');
  521.             mem_id.append_in(tmp_string);
  522.             tmp_string.append(fz_00);
  523.          end;
  524.          cpp.put_string(tmp_string);
  525.       ensure
  526.          cpp.on_h
  527.       end;
  528.  
  529. feature {NONE}
  530.  
  531.    frozen standard_c_struct is
  532.          -- Produce C code for the standard C struct (for user's
  533.          -- expanded or reference as well).
  534.       require
  535.          run_type = Current;
  536.          need_c_struct;
  537.          cpp.on_h
  538.       local
  539.          wa: ARRAY[RUN_FEATURE_2];
  540.          i, mem_id: INTEGER;
  541.          a: RUN_FEATURE_2;
  542.          t: TYPE;
  543.       do
  544.          mem_id := id;
  545.          wa := run_class.writable_attributes;
  546.          tmp_string.copy(fz_struct);
  547.          tmp_string.extend('S');
  548.          mem_id.append_in(tmp_string);
  549.          tmp_string.extend('{');
  550.          if is_reference then
  551.             if run_class.is_tagged then
  552.                tmp_string.append("int id;");
  553.             end;
  554.          end;
  555.          if wa /= Void then
  556.             from
  557.                i := wa.upper;
  558.             until
  559.                i = 0
  560.             loop
  561.                a := wa.item(i);
  562.                t := a.result_type.run_type;
  563.                t.c_type_for_result_in(tmp_string);
  564.                tmp_string.extend(' ');
  565.                tmp_string.extend('_');
  566.                tmp_string.append(a.name.to_string);
  567.                tmp_string.extend(';');
  568.                i := i - 1;
  569.             end;
  570.          end;
  571.          tmp_string.extend('}');
  572.          tmp_string.append(fz_00);
  573.          cpp.put_string(tmp_string);
  574.          if is_expanded then
  575.             -- For expanded comparison :
  576.             tmp_string.copy(fz_int);
  577.             tmp_string.extend(' ');
  578.             tmp_string.append(fz_se_cmpt);
  579.             mem_id.append_in(tmp_string);
  580.             tmp_string.append("(T");
  581.             mem_id.append_in(tmp_string);
  582.             tmp_string.append(" o1,T");
  583.             mem_id.append_in(tmp_string);
  584.             tmp_string.append(" o2)");
  585.             cpp.put_c_function(tmp_string,
  586.             "return memcmp(&o1,&o2,sizeof(o1));");
  587.          end;
  588.       ensure
  589.          cpp.on_h
  590.       end;
  591.  
  592.    frozen standard_c_object_model is
  593.          -- Produce C code to define the model object.
  594.       require
  595.          run_type = Current;
  596.          cpp.on_h
  597.       local
  598.          mem_id: INTEGER;
  599.          rc: RUN_CLASS;
  600.       do
  601.          rc := run_class;
  602.          mem_id := rc.id;
  603.          tmp_string.clear;
  604.          tmp_string.extend('T');
  605.          mem_id.append_in(tmp_string);
  606.          tmp_string.extend(' ');
  607.          tmp_string.extend('M');
  608.          mem_id.append_in(tmp_string);
  609.          cpp.put_extern7(tmp_string);
  610.          cpp.swap_on_c;
  611.          tmp_string.clear;
  612.          rc.c_object_model_in(tmp_string);
  613.          tmp_string.append(fz_00);
  614.          cpp.put_string(tmp_string);
  615.          cpp.swap_on_h;
  616.       ensure
  617.          cpp.on_h
  618.       end;
  619.  
  620.    frozen standard_c_print_function is
  621.          -- Produce `prinTid' function.
  622.       require
  623.          run_type = Current;
  624.       do
  625.          if run_control.no_check then
  626.             run_class.c_print_function;
  627.          end;
  628.       end;
  629.  
  630. feature
  631.  
  632.    id: INTEGER is
  633.          -- All `at_run_time' has a Tid C type.
  634.       require
  635.          is_run_type
  636.       deferred
  637.       ensure
  638.          Result > 0
  639.       end;
  640.  
  641.    is_dummy_expanded: BOOLEAN is
  642.          -- True when is it a user's expanded type with no attribute.
  643.       require
  644.          is_run_type;
  645.          small_eiffel.is_ready
  646.       deferred
  647.       end;
  648.  
  649.    is_user_expanded: BOOLEAN is
  650.          -- Is it really a user expanded type ?
  651.       require
  652.          is_run_type
  653.       deferred
  654.       end;
  655.  
  656.    c_type_for_argument_in(str: STRING) is
  657.          -- Append in `str' the C type to use when current
  658.          -- Eiffel type is used for an argument of a feature.
  659.       require
  660.          small_eiffel.is_ready;
  661.          str /= Void
  662.       deferred
  663.       end;
  664.  
  665.    c_type_for_target_in(str: STRING) is
  666.          -- Append in `str' the C type to use when current
  667.          -- Eiffel type is used for an argument of a feature.
  668.       require
  669.          small_eiffel.is_ready;
  670.          str /= Void
  671.       deferred
  672.       end;
  673.  
  674.    c_type_for_result_in(str: STRING) is
  675.          -- Append in `str' the C type to use when current Eiffel
  676.          -- type is used as a result type of a C function.
  677.       require
  678.          small_eiffel.is_ready;
  679.          str /= Void
  680.       deferred
  681.       end;
  682.  
  683.    frozen c_type_for_external_in(str: STRING) is
  684.       do
  685.          if is_reference then
  686.             str.append(fz_void);
  687.             str.extend('*');
  688.          else
  689.             c_type_for_result_in(str);
  690.          end;
  691.       end;
  692.  
  693.    frozen mapping_cast is
  694.          -- Produce a C cast for conversion into current C type.
  695.       require
  696.          is_run_type;
  697.          run_type.run_class.at_run_time
  698.       do
  699.          mapping_cast_memory.clear;
  700.          mapping_cast_memory.extend('(');
  701.          c_type_for_target_in(mapping_cast_memory);
  702.          mapping_cast_memory.extend(')');
  703.          cpp.put_string(mapping_cast_memory);
  704.       end;
  705.  
  706. feature {NONE}
  707.  
  708.    mapping_cast_memory: STRING is "................";
  709.  
  710. feature
  711.  
  712.    cast_to_ref is
  713.          -- Produce the good C cast to use INTEGER_REF, BOOLEAN_REF,
  714.          -- CHARACTER_REF, REAL_REF or DOUBLE_REF.
  715.       require
  716.          is_run_type;
  717.          is_basic_eiffel_expanded
  718.       do
  719.          run_type.cast_to_ref;
  720.       end;
  721.  
  722.    used_as_reference is
  723.          -- Do what's to be done when current type may be cast into
  724.          -- a reference type.
  725.       deferred
  726.       end;
  727.  
  728.    to_reference is
  729.          -- Print the C name of the automatic conversion function.
  730.       deferred
  731.       end;
  732.  
  733.    to_expanded is
  734.          -- Print the C name of the automatic conversion function.
  735.       do
  736.       end;
  737.  
  738.    need_c_struct: BOOLEAN is
  739.          -- Is it necessary to define a C struct ?
  740.       require
  741.          small_eiffel.is_ready
  742.       deferred
  743.       end;
  744.  
  745.    space_for_variable: INTEGER is
  746.          -- In number of bytes.
  747.       require
  748.          is_run_type
  749.       deferred
  750.       ensure
  751.          Result >= 1
  752.       end;
  753.  
  754.    space_for_object: INTEGER is
  755.          -- In number of bytes.
  756.       require
  757.          is_run_type
  758.       deferred
  759.       ensure
  760.          Result >= 0
  761.       end;
  762.  
  763.    c_initialize is
  764.          -- Produce C code for initialisation of local variables
  765.          -- or attributes.
  766.       require
  767.          is_run_type;
  768.          small_eiffel.is_ready
  769.       deferred
  770.       end;
  771.  
  772.    c_initialize_in(str: STRING) is
  773.          -- In order to initialize local variables or attributes
  774.          -- with the default simple value (0, NULL, 0.0, etc.).
  775.       require
  776.          is_run_type;
  777.          small_eiffel.is_ready
  778.       deferred
  779.       end;
  780.  
  781.    frozen c_frame_descriptor is
  782.       do
  783.          c_frame_descriptor_format.extend('%%');
  784.          if is_reference then
  785.             c_frame_descriptor_format.extend('R');
  786.          else
  787.             c_frame_descriptor_format.extend('E');
  788.          end;
  789.          id.append_in(c_frame_descriptor_format);
  790.          c_frame_descriptor_format.extend('%%');
  791.       end;
  792.  
  793. feature {NONE}
  794.  
  795.    frozen space_for_pointer: INTEGER is
  796.       require
  797.          is_run_type
  798.       local
  799.          p: POINTER;
  800.       do
  801.          Result := p.object_size;
  802.       end;
  803.  
  804.    frozen space_for_integer: INTEGER is
  805.       require
  806.          is_run_type
  807.       do
  808.          Result := (1).object_size;
  809.       end;
  810.  
  811.    frozen standard_space_for_object: INTEGER is
  812.          -- In number of bytes.
  813.       require
  814.          is_run_type
  815.       local
  816.          rc: RUN_CLASS;
  817.          wa: ARRAY[RUN_FEATURE_2];
  818.          a: RUN_FEATURE_2;
  819.          i: INTEGER;
  820.       do
  821.          rc := run_class;
  822.          if rc.is_tagged then
  823.             Result := space_for_integer;
  824.          end;
  825.          wa := rc.writable_attributes;
  826.          if wa /= Void then
  827.             from
  828.                i := wa.upper;
  829.             until
  830.                i = 0
  831.             loop
  832.                a := wa.item(i);
  833.                Result := Result + a.result_type.space_for_variable;
  834.                i := i - 1;
  835.             end;
  836.          end;
  837.          if Result = 0 then
  838.             Result := space_for_integer;
  839.          end;
  840.       end;
  841.  
  842. feature
  843.  
  844.    need_gc_mark_function: BOOLEAN is
  845.          -- True when objects of the current type must be marked
  846.          -- or when `gc_mark_to_follow' is true in corresponding run
  847.          -- class.
  848.       deferred
  849.       end;
  850.  
  851. feature {RUN_CLASS,TYPE}
  852.  
  853.    gc_define1 is
  854.          -- Define prototypes and C struct for the Garbage Collector
  855.       require
  856.          not gc_handler.is_off;
  857.          cpp.on_h;
  858.          run_class.at_run_time
  859.       deferred
  860.       end;
  861.  
  862.    gc_define2 is
  863.          -- Define C functions for the Garbage Collector
  864.       require
  865.          not gc_handler.is_off;
  866.          cpp.on_c;
  867.          run_class.at_run_time
  868.       deferred
  869.       end;
  870.  
  871.    gc_info_in(str: STRING) is
  872.          -- Produce C code to print GC information.
  873.       require
  874.          not gc_handler.is_off;
  875.          gc_handler.info_flag;
  876.          run_class.at_run_time
  877.       deferred
  878.       end;
  879.  
  880.    just_before_gc_mark_in(str: STRING) is
  881.       require
  882.          not gc_handler.is_off;
  883.          run_class.at_run_time
  884.       deferred
  885.       end;
  886.  
  887. feature {NONE}
  888.  
  889.    standard_just_before_gc_mark_in(str: STRING) is
  890.       require
  891.          not gc_handler.is_off;
  892.          run_class.at_run_time
  893.       do
  894.          gc_free_in(str);
  895.          str.extend('=');
  896.          str.append(fz_null);
  897.          str.append(fz_00);
  898.       end;
  899.  
  900. feature {NATIVE_SMALL_EIFFEL,GC_HANDLER}
  901.  
  902.    gc_call_new_in(str: STRING) is
  903.       do
  904.          str.append(fz_new);
  905.          id.append_in(str);
  906.          str.extend('(');
  907.          str.extend(')');
  908.       end;
  909.  
  910. feature
  911.  
  912.    jvm_method_flags: INTEGER is
  913.          -- Return the appropriate flag (static/virtual) when the
  914.          -- receiver has this type.
  915.       deferred
  916.       end;
  917.  
  918.    frozen jvm_stack_space: INTEGER is
  919.       require
  920.          is_run_type
  921.       do
  922.          if is_double then
  923.             Result := 2;
  924.          else
  925.             Result := 1;
  926.          end;
  927.       ensure
  928.          Result >= 1
  929.       end;
  930.  
  931.    jvm_descriptor_in(str: STRING) is
  932.          -- Append in `str' the appropriate JVM type descriptor for
  933.          -- arguments and Result of a method.
  934.       require
  935.          str /= Void
  936.       deferred
  937.       end;
  938.  
  939.    jvm_target_descriptor_in(str: STRING) is
  940.          -- Append in `str' the appropriate JVM type descriptor for
  941.          -- the target only.
  942.       require
  943.          str /= Void;
  944.          run_class.at_run_time
  945.       deferred
  946.       end;
  947.  
  948.    jvm_return_code is
  949.          -- Add the good JVM opcode to return Result.
  950.       require
  951.          run_type = Current
  952.       deferred
  953.       end;
  954.  
  955.    jvm_push_local(offset: INTEGER) is
  956.          -- Push value of the local variable at `offset'.
  957.       deferred
  958.       end;
  959.  
  960.    jvm_push_default: INTEGER is
  961.          -- Push the default value for the Current type.
  962.          -- Result gives the space in the JVM stack;
  963.       deferred
  964.       end;
  965.  
  966.    jvm_write_local(offset: INTEGER) is
  967.          -- Write the local variable at `offset' using the stack top.
  968.       deferred
  969.       end;
  970.  
  971.    jvm_check_class_invariant is
  972.          -- If needed, add some byte code to check the class invariant
  973.          -- of the pushed object.
  974.       deferred
  975.       end;
  976.  
  977.    jvm_xnewarray is
  978.          -- Produce the appropriate byte-code to create a new JVM
  979.          -- array with elements of `Current' type.
  980.          -- Assume the count of the new array to create is already
  981.          -- pushed.
  982.       deferred
  983.       end;
  984.  
  985.    jvm_xastore is
  986.       deferred
  987.       end;
  988.  
  989.    jvm_xaload is
  990.       deferred
  991.       end;
  992.  
  993.    jvm_if_x_eq: INTEGER is
  994.          -- Assume two operands of the same type are pushed.
  995.       deferred
  996.       end;
  997.  
  998.    jvm_if_x_ne: INTEGER is
  999.          -- Assume two operands of the same type are pushed.
  1000.       deferred
  1001.       end;
  1002.  
  1003.    jvm_convert_to(destination: TYPE): INTEGER is
  1004.          -- Convert the pushed value (which is an object of
  1005.          -- the current type) into an object of `destination' type.
  1006.       require
  1007.          convertible_to(destination)
  1008.       deferred
  1009.       ensure
  1010.          Result >= 1
  1011.       end;
  1012.  
  1013.    jvm_standard_is_equal is
  1014.          -- Produce byte-code for `standard_is_equal' for the
  1015.          -- top objects pair.
  1016.       deferred
  1017.       end;
  1018.  
  1019. feature {NONE}
  1020.  
  1021.    frozen standard_jvm_check_class_invariant is
  1022.       do
  1023.          if run_control.invariant_check then
  1024.             run_class.jvm_check_class_invariant;
  1025.          end;
  1026.       end;
  1027.  
  1028. feature {TYPE}
  1029.  
  1030.    jvm_to_reference is
  1031.          -- If needed, convert the pushed value into the
  1032.          -- corresponding reference type.
  1033.       deferred
  1034.       end;
  1035.  
  1036.    jvm_expanded_from_reference(other: TYPE): INTEGER is
  1037.          -- Convert the pushed value of type `other' which is a reference
  1038.          -- type into the corresponding expanded type.
  1039.       require
  1040.          is_expanded;
  1041.          other.is_reference;
  1042.          is_a(other)
  1043.       deferred
  1044.       ensure
  1045.          Result >= 1
  1046.       end;
  1047.  
  1048. feature {NONE}
  1049.  
  1050.    c_initialize_expanded is
  1051.       require
  1052.          is_user_expanded or is_dummy_expanded
  1053.       local
  1054.          wa: ARRAY[RUN_FEATURE_2];
  1055.          i: INTEGER;
  1056.          rf: RUN_FEATURE_2;
  1057.       do
  1058.          if is_dummy_expanded then
  1059.             cpp.put_character('0');
  1060.          else
  1061.             cpp.put_character('{');
  1062.             wa := run_class.writable_attributes;
  1063.             from
  1064.                i := wa.upper;
  1065.             until
  1066.                i = 0
  1067.             loop
  1068.                rf := wa.item(i);
  1069.                rf.result_type.c_initialize;
  1070.                i := i - 1;
  1071.                if i > 0 then
  1072.                   cpp.put_character(',');
  1073.                end;
  1074.             end;
  1075.             cpp.put_character('}');
  1076.          end;
  1077.       end;
  1078.  
  1079. feature {PARENT,TYPE}
  1080.  
  1081.    frozen look_up_for(rc: RUN_CLASS; fn: FEATURE_NAME): E_FEATURE is
  1082.       -- Look for the good one to compute `rc' X `fn'.
  1083.       require
  1084.          rc /= Void;
  1085.          fn /= Void;
  1086.          not is_anchored;
  1087.          not is_formal_generic;
  1088.       do
  1089.          Result := base_class.look_up_for(rc,fn);
  1090.       end;
  1091.  
  1092. feature {RUN_CLASS}
  1093.  
  1094.    frozen demangling_in(str: STRING) is
  1095.       do
  1096.          if is_reference then
  1097.             str.extend('R');
  1098.          else
  1099.             str.extend('E');
  1100.          end;
  1101.          str.extend(' ');
  1102.          str.append(run_time_mark);
  1103.       end;
  1104.  
  1105. feature {NONE}
  1106.  
  1107.    tmp_string: STRING is "................................................................%
  1108.                          %................................................................";
  1109.  
  1110.    header: STRING is "................................................................%
  1111.                      %................................................................";
  1112.  
  1113.    body: STRING is "................................................................%
  1114.                    %................................................................%
  1115.                    %................................................................%
  1116.                    %................................................................";
  1117.  
  1118. feature {TYPE}
  1119.  
  1120.    short_hook is
  1121.       deferred
  1122.       end;
  1123.  
  1124. feature {NONE}
  1125.  
  1126.    fatal_error_generic_list is
  1127.       do
  1128.          check
  1129.             not is_generic;
  1130.          end;
  1131.          eh.add_type(Current," is (not) generic ?");
  1132.          eh.print_as_fatal_error;
  1133.       end;
  1134.  
  1135. feature {NONE}
  1136.  
  1137.    frozen standard_gc_info_in(str: STRING) is
  1138.       do
  1139.          -- Print gc_info_nbXXX :
  1140.          str.append(fz_printf);
  1141.          str.extend('(');
  1142.          str.extend('%"');
  1143.          str.append(run_time_mark);
  1144.          str.append(fz_10);
  1145.          gc_info_nb_in(str);
  1146.          str.append(fz_14);
  1147.          -- Print store_leftXXX :
  1148.          str.append(fz_printf);
  1149.          str.extend('(');
  1150.          str.extend('%"');
  1151.          gc_store_left_in(str);
  1152.          str.append(fz_10);
  1153.          gc_store_left_in(str);
  1154.          str.append(fz_14);
  1155.       end;
  1156.  
  1157.    frozen standard_gc_define1 is
  1158.          -- For Fixed Size Objects.
  1159.       require
  1160.          not gc_handler.is_off;
  1161.          cpp.on_h;
  1162.          run_class.at_run_time
  1163.       local
  1164.          rc: RUN_CLASS;
  1165.          rcid: INTEGER;
  1166.       do
  1167.          rc := run_class;
  1168.          rcid := rc.id;
  1169.          -- --------------- Define struct BXXX and typedef gcXXX :
  1170.          header.copy(fz_typedef);
  1171.          header.append(fz_struct);
  1172.          header.extend('B');
  1173.          rcid.append_in(header);
  1174.          header.extend(' ');
  1175.          header.append(fz_gc);
  1176.          rcid.append_in(header);
  1177.          header.append(fz_00);
  1178.          header.append(fz_struct);
  1179.          header.extend('B');
  1180.          rcid.append_in(header);
  1181.          header.append("{T");
  1182.          rcid.append_in(header);
  1183.          header.append(" object;union {int flag;gc");
  1184.          rcid.append_in(header);
  1185.          header.append("*next;} header;};%N");
  1186.          cpp.put_string(header);
  1187.          -- ----------------------------------- Declare storeXXX :
  1188.          header.copy(fz_gc);
  1189.          rcid.append_in(header);
  1190.          header.extend('*');
  1191.          gc_store_in(header);
  1192.          cpp.put_extern5(header,fz_null);
  1193.          -- ------------------------------ Declare store_leftXXX :
  1194.          header.copy(fz_int);
  1195.          header.extend(' ');
  1196.          gc_store_left_in(header);
  1197.          cpp.put_extern2(header,'0');
  1198.          -- ----------------------------------- Declare store_chunkXXX :
  1199.          header.copy("fsoc*");
  1200.          gc_store_chunk_in(header);
  1201.          cpp.put_extern5(header,fz_null);
  1202.          -- --------------------------------- Declare gc_freeXXX :
  1203.          header.copy(fz_gc);
  1204.          rcid.append_in(header);
  1205.          header.extend('*');
  1206.          gc_free_in(header);
  1207.          cpp.put_extern5(header,fz_null);
  1208.          -- -------------------------------- Declare gc_info_nbXXX :
  1209.          if gc_handler.info_flag then
  1210.             header.copy(fz_int);
  1211.             header.extend(' ');
  1212.             gc_info_nb_in(header);
  1213.             cpp.put_extern2(header,'0');
  1214.          end;
  1215.       end;
  1216.  
  1217.    frozen standard_gc_define2 is
  1218.       require
  1219.          is_reference;
  1220.          not gc_handler.is_off;
  1221.          cpp.on_c;
  1222.          run_class.at_run_time
  1223.       local
  1224.          rc: RUN_CLASS;
  1225.          rcid: INTEGER;
  1226.          gc_check_id: BOOLEAN;
  1227.       do
  1228.          rc := run_class;
  1229.          rcid := rc.id;
  1230.          -- --------------------------- Definiton for gc_sweepXXX :
  1231.          header.copy(fz_void);
  1232.          header.extend(' ');
  1233.          header.append(fz_gc_sweep);
  1234.          rcid.append_in(header);
  1235.          header.append("(fsoc*c)");
  1236.          body.copy("gc");
  1237.          rcid.append_in(body);
  1238.          body.append(
  1239.             "*o1,*o2,*flt,flh;%N%
  1240.             %o1=((void*)(&(c->first_object)));%N%
  1241.             %if(c->header.state_type==FSO_STORE_CHUNK){%N%
  1242.             %for(;o1<");
  1243.          gc_store_in(body);
  1244.          body.append(
  1245.             ";o1++){%N%
  1246.             %if((o1->header.flag)==FSOH_MARKED){%N%
  1247.             %o1->header.flag=FSOH_UNMARKED;%N}%N%
  1248.             %else{%N");
  1249.          gc_handler.memory_dispose(body,"o1",run_class);
  1250.          body.append("o1->header.next=");
  1251.          gc_free_in(body);
  1252.          body.append(fz_00);
  1253.          gc_free_in(body);
  1254.          body.append(
  1255.             "=o1;%N%
  1256.             %}%N}%N}%N%
  1257.             %else{%N%
  1258.             %int dead=1;%N%
  1259.             %flh.header.next=NULL;%N%
  1260.             %flt=&flh;%N%
  1261.             %o2=o1+c->count_minus_one;%N%
  1262.             %for(;o1<=o2;o2--){%N%
  1263.             %if((o2->header.flag)==FSOH_MARKED){%N%
  1264.             %o2->header.flag=FSOH_UNMARKED;%N%
  1265.             %dead=0;}%N%
  1266.             %else{%N");
  1267.          gc_handler.memory_dispose(body,"o2",run_class);
  1268.          body.append(
  1269.             "flt->header.next=o2;%N%
  1270.             %flt=o2;%N%
  1271.             %}%N}%N%
  1272.             %if (dead){%N%
  1273.             %c->next=fsocfl;%N%
  1274.             %fsocfl=c;%N%
  1275.             %c->header.state_type=FSO_FREE_CHUNK;%N}%N%
  1276.             %else if(flh.header.next!=NULL){%N%
  1277.             %flt->header.next=");
  1278.          gc_free_in(body);
  1279.          body.append(fz_00);
  1280.          gc_free_in(body);
  1281.          body.append(
  1282.             "=flh.header.next;%N%
  1283.             %}%N}%N");
  1284.          cpp.put_c_function(header,body);
  1285.          -- ----------------------------- Definiton for gc_markXXX :
  1286.          header.copy(fz_void);
  1287.          header.extend(' ');
  1288.          gc_mark_in(header);
  1289.          header.append("(T");
  1290.          rcid.append_in(header);
  1291.          header.append("*o)");
  1292.          body.clear;
  1293.          gc_check_id := rc.is_tagged and then run_control.no_check;
  1294.          if gc_check_id then
  1295.             body.append("se_gc_check_id(o,");
  1296.             rcid.append_in(body);
  1297.             body.append(");%N{");
  1298.          end;
  1299.          rc.gc_mark_fixed_size(false,body);
  1300.          if gc_check_id then
  1301.             body.append("%N}");
  1302.          end;
  1303.          cpp.put_c_function(header,body);
  1304.          -- ----------------------- Definiton for gc_align_markXXX :
  1305.          header.copy(fz_void);
  1306.          header.extend(' ');
  1307.          gc_align_mark_in(header);
  1308.          header.append("(fsoc*c,gc");
  1309.          rcid.append_in(header);
  1310.          header.append("*p)");
  1311.          body.clear;
  1312.          rc.gc_align_mark_fixed_size(body);
  1313.          cpp.put_c_function(header,body);
  1314.          -- ------------------------ Definiton of chunk model HXXX :
  1315.          header.copy("fsoc H");
  1316.          rcid.append_in(header);
  1317.          body.copy(
  1318.             "{{FSOC_SIZE,FSO_STORE_CHUNK,%N%
  1319.             %(void(*)(mch*,void*))gc_align_mark");
  1320.          rcid.append_in(body);
  1321.          body.append(
  1322.             ",%N%
  1323.             %(void(*)(mch*))gc_sweep");
  1324.          rcid.append_in(body);
  1325.          body.append(
  1326.             "},NULL,(((FSOC_SIZE-sizeof(fsoc)+sizeof(double))/sizeof(gc");
  1327.          rcid.append_in(body);
  1328.          body.append("))-1)}");
  1329.          cpp.put_extern5(header,body);
  1330.          -- --------------------------------- Definiton for newXXX :
  1331.          header.clear;
  1332.          header.extend('T');
  1333.          rcid.append_in(header);
  1334.          header.extend('*');
  1335.          header.append(fz_new);
  1336.          rcid.append_in(header);
  1337.          header.append(fz_c_void_args);
  1338.          body.copy(fz_gc);
  1339.          rcid.append_in(body);
  1340.          body.append("*n;%N");
  1341.          if gc_handler.info_flag then
  1342.             gc_info_nb_in(body);
  1343.             body.append("++;%N");
  1344.          end;
  1345.          --
  1346.          body.append("if(");
  1347.          gc_store_left_in(body);
  1348.          body.append(">1){%N")
  1349.          gc_store_left_in(body);
  1350.          body.append("--;%Nn=");
  1351.          gc_store_in(body);
  1352.          body.append("++;%N}%N%
  1353.                      %else if (");
  1354.          gc_free_in(body);
  1355.          body.append("!=NULL){%N%
  1356.                      %n=");
  1357.          gc_free_in(body);
  1358.          body.append(fz_00);
  1359.          gc_free_in(body);
  1360.          body.append("=n->header.next;%N}%N%
  1361.                      %else if(");
  1362.          gc_store_left_in(body);
  1363.          body.append("==1){%N");
  1364.          gc_store_left_in(body);
  1365.          body.append("=0;%N");
  1366.          gc_store_chunk_in(body);
  1367.          body.append("->header.state_type=FSO_USED_CHUNK;%N%
  1368.                      %n=");
  1369.          gc_store_in(body);
  1370.          body.append("++;%N}%N%
  1371.                      %else if(");
  1372.          body.append("fsocfl!=NULL) {%N");
  1373.          gc_store_chunk_in(body);
  1374.          body.append("=fsocfl;%N%
  1375.                      %fsocfl=fsocfl->next;%N%
  1376.                      %*");
  1377.          gc_store_chunk_in(body);
  1378.          body.append(fz_eq_h);
  1379.          rcid.append_in(body);
  1380.          body.append(fz_00);
  1381.          gc_store_in(body);
  1382.          body.append("=(void*)(&(");
  1383.          gc_store_chunk_in(body);
  1384.          body.append("->first_object));%N");
  1385.          gc_store_left_in(body);
  1386.          body.append(fz_eq_h);
  1387.          rcid.append_in(body);
  1388.          body.append(".count_minus_one;%N%
  1389.                      %n=");
  1390.          gc_store_in(body);
  1391.          body.append("++;%N}%N%
  1392.                      %else if(fsoc_count_ceil>fsoc_count) {%N");
  1393.          gc_store_chunk_in(body);
  1394.          body.append("=malloc(FSOC_SIZE);%N%
  1395.                      %fsoc_count++;%N%
  1396.                      %{mch**p;%N%
  1397.                      %if(gcmt_used==gcmt_max){%N%
  1398.                      %gcmt_max<<=1;%N%
  1399.                      %gcmt=realloc(gcmt,(gcmt_max+1)*sizeof(void*));%N}%N%
  1400.                      %for(p=gcmt+(gcmt_used++ -1);(p>=gcmt)&&(*p>((mch*)");
  1401.          gc_store_chunk_in(body);
  1402.          body.append("));p--)%N%
  1403.                      %*(p+1)=*p;%N%
  1404.                      %*(p+1)=(mch*)");
  1405.          gc_store_chunk_in(body);
  1406.          body.append(";%N}%N%
  1407.                      %*");
  1408.          gc_store_chunk_in(body);
  1409.          body.append(fz_eq_h);
  1410.          rcid.append_in(body);
  1411.          body.append(fz_00);
  1412.          gc_store_in(body);
  1413.          body.append("=(void*)(&(");
  1414.          gc_store_chunk_in(body);
  1415.          body.append("->first_object));%N");
  1416.          gc_store_left_in(body);
  1417.          body.append(fz_eq_h);
  1418.          rcid.append_in(body);
  1419.          body.append(".count_minus_one;%N%
  1420.                      %n=");
  1421.          gc_store_in(body);
  1422.          body.append("++;%N}%Nelse{%N%
  1423.                      %gc_start();%N%
  1424.                      %if(NULL!=");
  1425.          gc_free_in(body);
  1426.          body.append("){%N%
  1427.                      %n=");
  1428.          gc_free_in(body);
  1429.          body.append(fz_00);
  1430.          gc_free_in(body);
  1431.          body.append("=n->header.next;%N}%Nelse{%N");
  1432.          gc_store_chunk_in(body);
  1433.          body.append("=new_fsoc();%N%
  1434.                      %*");
  1435.          gc_store_chunk_in(body);
  1436.          body.append(fz_eq_h);
  1437.          rcid.append_in(body);
  1438.          body.append(fz_00);
  1439.          gc_store_in(body);
  1440.          body.append("=(void*)(&(");
  1441.          gc_store_chunk_in(body);
  1442.          body.append("->first_object));%N");
  1443.          gc_store_left_in(body);
  1444.          body.append(fz_eq_h);
  1445.          rcid.append_in(body);
  1446.          body.append(".count_minus_one;%N%
  1447.                      %n=");
  1448.          gc_store_in(body);
  1449.          body.append("++;%N}%N}%N%
  1450.                      %n->header.flag=FSOH_UNMARKED;%N");
  1451.          if need_c_struct then
  1452.             body.append("n->object=M");
  1453.             rcid.append_in(body);
  1454.             body.append(fz_00);
  1455.          end;
  1456.          body.append("return (void*)n;%N");
  1457.          cpp.put_c_function(header,body);
  1458.       end;
  1459.  
  1460.    frozen standard_gc_define2_for_expanded is
  1461.          -- For user's expanded with reference attribute to mark.
  1462.       require
  1463.          is_expanded;
  1464.          not gc_handler.is_off;
  1465.          cpp.on_c;
  1466.          run_class.at_run_time
  1467.       local
  1468.          rc: RUN_CLASS;
  1469.          rcid: INTEGER;
  1470.       do
  1471.          rc := run_class;
  1472.          if rc.gc_mark_to_follow then
  1473.             rcid := rc.id;
  1474.             -- -------------------------- Definiton for gc_markXXX :
  1475.             header.copy(fz_void);
  1476.             header.extend(' ');
  1477.             gc_mark_in(header);
  1478.             header.append("(T");
  1479.             rcid.append_in(header);
  1480.             header.append("*o)");
  1481.             body.clear;
  1482.             rc.gc_mark_fixed_size(true,body);
  1483.             cpp.put_c_function(header,body);
  1484.          end;
  1485.       end;
  1486.  
  1487.    frozen gc_store_in(str: STRING) is
  1488.       do
  1489.          str.append("store");
  1490.          id.append_in(str);
  1491.       end;
  1492.  
  1493.    frozen gc_store_left_in(str: STRING) is
  1494.       do
  1495.          str.append("store_left");
  1496.          id.append_in(str);
  1497.       end;
  1498.  
  1499.    frozen gc_store_chunk_in(str: STRING) is
  1500.       do
  1501.          str.append("store_chunk");
  1502.          id.append_in(str);
  1503.       end;
  1504.  
  1505.    frozen gc_free_in(str: STRING) is
  1506.       do
  1507.          str.append("gc_free");
  1508.          id.append_in(str);
  1509.       end;
  1510.  
  1511.    frozen gc_align_mark_in(str: STRING) is
  1512.       do
  1513.          str.append("gc_align_mark");
  1514.          id.append_in(str);
  1515.       end;
  1516.  
  1517.    frozen gc_info_nb_in(str: STRING) is
  1518.       do
  1519.          str.append("gc_info_nb");
  1520.          id.append_in(str);
  1521.       end;
  1522.  
  1523. feature {TYPE, GC_HANDLER}
  1524.  
  1525.    frozen gc_mark_in(str: STRING) is
  1526.       do
  1527.          str.append(fz_gc_mark);
  1528.          id.append_in(str);
  1529.       end;
  1530.  
  1531. invariant
  1532.  
  1533.    written_mark = string_aliaser.item(written_mark)
  1534.  
  1535. end -- TYPE
  1536.