/[eiffelstudio]/FreeELKS/trunk/library/kernel/function.e
ViewVC logotype

Contents of /FreeELKS/trunk/library/kernel/function.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91424 - (show annotations)
Tue Oct 26 18:39:32 2004 UTC (15 years, 2 months ago) by manus_eiffel
File size: 2969 byte(s)
Initial revision

1 indexing
2 description: "[
3 Objects representing delayed calls to a function,
4 with some arguments possibly still open.
5 ]"
6 note: "[
7 Features are the same as those of ROUTINE,
8 with `apply' made effective, and the addition
9 of `last_result' and `item'.
10 ]"
11 status: "See notice at end of class"
12 date: "$Date$"
13 revision: "$Revision$"
14
15 class
16 FUNCTION [BASE_TYPE, OPEN_ARGS -> TUPLE create default_create end, RESULT_TYPE]
17
18 inherit
19 ROUTINE [BASE_TYPE, OPEN_ARGS]
20 redefine
21 is_equal, copy
22 end
23
24 feature -- Access
25
26 last_result: RESULT_TYPE
27 -- Result of last call, if any.
28
29 item (args: OPEN_ARGS): RESULT_TYPE is
30 -- Result of calling function with `args' as operands.
31 require
32 valid_operands: valid_operands (args)
33 callable: callable
34 do
35 set_operands (args)
36 Result := rout_obj_call_function (rout_disp, $internal_operands)
37 last_result := Result
38 if is_cleanup_needed then
39 remove_gc_reference
40 end
41 end
42
43 feature -- Comparison
44
45 is_equal (other: like Current): BOOLEAN is
46 -- Is associated function the same as the one
47 -- associated with `other'?
48 do
49 Result := Precursor (other) and then
50 equal (last_result, other.last_result)
51 end
52
53 feature -- Duplication
54
55 copy (other: like Current) is
56 -- Use same function as `other'.
57 do
58 Precursor (other)
59 last_result := other.last_result
60 end
61
62 feature -- Basic operations
63
64 apply is
65 -- Call function with `operands' as last set.
66 do
67 last_result := rout_obj_call_function (rout_disp, $internal_operands)
68 end
69
70 feature -- Obsolete
71
72 eval (args: OPEN_ARGS): RESULT_TYPE is
73 -- Result of evaluating function for `args'.
74 obsolete
75 "Please use `item' instead"
76 require
77 valid_operands: valid_operands (args)
78 callable: callable
79 do
80 Result := item (args)
81 end
82
83 feature {NONE} -- Implementation
84
85 rout_obj_call_function (rout, args: POINTER): RESULT_TYPE is
86 -- Perform call to `rout' with `args' as operands.
87 external
88 "C inline use %"eif_rout_obj.h%""
89 alias
90 "rout_obj_call_agent($rout, $args, $$_result_type)"
91 end
92
93 indexing
94
95 library: "[
96 EiffelBase: Library of reusable components for Eiffel.
97 ]"
98
99 status: "[
100 Copyright 1986-2001 Interactive Software Engineering (ISE).
101 For ISE customers the original versions are an ISE product
102 covered by the ISE Eiffel license and support agreements.
103 ]"
104
105 license: "[
106 EiffelBase may now be used by anyone as FREE SOFTWARE to
107 develop any product, public-domain or commercial, without
108 payment to ISE, under the terms of the ISE Free Eiffel Library
109 License (IFELL) at http://eiffel.com/products/base/license.html.
110 ]"
111
112 source: "[
113 Interactive Software Engineering Inc.
114 ISE Building
115 360 Storke Road, Goleta, CA 93117 USA
116 Telephone 805-685-1006, Fax 805-685-6869
117 Electronic mail <info@eiffel.com>
118 Customer support http://support.eiffel.com
119 ]"
120
121 info: "[
122 For latest info see award-winning pages: http://eiffel.com
123 ]"
124
125 end -- class FUNCTION
126

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23