mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-07 15:22:31 +01:00
Updated syntax (removed many useless and bad <div> tags).
Use definition list as well in wikitext syntax. git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@1659 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -9,14 +9,14 @@ We saw in the [[PRODUCING AND EXPORTING DOCUMENTATION|section on documentation]]
|
|||||||
* Producing documentation that purposely omit some parts of Eiffel texts, in line with the ideas applied by the Contract and Flat Contract forms.
|
* Producing documentation that purposely omit some parts of Eiffel texts, in line with the ideas applied by the Contract and Flat Contract forms.
|
||||||
|
|
||||||
This appendix describes EFF and its conventions, enabling you to write filters. Note that in practice the best way to write an EFF filter is usually not from scratch, but by copying an existing filter -- one that seems closest to your needs -- and adapting the copy.
|
This appendix describes EFF and its conventions, enabling you to write filters. Note that in practice the best way to write an EFF filter is usually not from scratch, but by copying an existing filter -- one that seems closest to your needs -- and adapting the copy.
|
||||||
<div>
|
|
||||||
==Where to put filters==
|
==Where to put filters==
|
||||||
|
|
||||||
When you choose to generate documentation, EiffelStudio will ask you to select a filter from a list it obtains by looking up the files of extension <span>.</span> <code>fil</code> in the directory
|
When you choose to generate documentation, EiffelStudio will ask you to select a filter from a list it obtains by looking up the files of extension <span>.</span> <code>fil</code> in the directory
|
||||||
<code>$ISE_EIFFEL/studio/filters</code>
|
<code>$ISE_EIFFEL/studio/filters</code>
|
||||||
|
|
||||||
To make a new filter available to yourself and other users of this installation, just add the corresponding file <code>name</code> <span>.</span> <code>fil</code> to this directory. Make sure to choose the appropriate <code>name</code>, since this is what the menu of available filters will display.
|
To make a new filter available to yourself and other users of this installation, just add the corresponding file <code>name</code> <span>.</span> <code>fil</code> to this directory. Make sure to choose the appropriate <code>name</code>, since this is what the menu of available filters will display.
|
||||||
</div><div>
|
|
||||||
==Filter basics==
|
==Filter basics==
|
||||||
|
|
||||||
An EFF filter follows a very simple structure. As with all other Eiffel-related notations (such as Eiffel itself and Lace, the control language for Eiffel systems), any line or part of a line beginning with two consecutive dashes <code>--</code> is a comment, except if it immediately follows a percent sign since, as will be seen below, <code>- %-</code> is used to denote an Eiffel comment in the class text. Blank lines are also permitted. Comments and blank lines carry no semantic value.
|
An EFF filter follows a very simple structure. As with all other Eiffel-related notations (such as Eiffel itself and Lace, the control language for Eiffel systems), any line or part of a line beginning with two consecutive dashes <code>--</code> is a comment, except if it immediately follows a percent sign since, as will be seen below, <code>- %-</code> is used to denote an Eiffel comment in the class text. Blank lines are also permitted. Comments and blank lines carry no semantic value.
|
||||||
@@ -27,7 +27,7 @@ Except for comments and blank lines, a filter is a sequence of entries, all of t
|
|||||||
where: <code>Construct</code> is one of a set of possible strings, most of which correspond to Eiffel constructs such as <code>Class_declaration</code> or Eiffel keywords such as <code>class</code> ; and <code>Replacement</code> is a string indicating how to format specimens of the <code>Construct</code> that appear in a class text.
|
where: <code>Construct</code> is one of a set of possible strings, most of which correspond to Eiffel constructs such as <code>Class_declaration</code> or Eiffel keywords such as <code>class</code> ; and <code>Replacement</code> is a string indicating how to format specimens of the <code>Construct</code> that appear in a class text.
|
||||||
|
|
||||||
For readability, there may be any number of blanks or tabs between the <code>Construct</code> and the vertical bar <code>|</code>, so that you can align all the bars if you wish. On the right of the bar, however, all characters including blanks and tabs are significant, since they are part of the replacement for the <code>Construct</code>.
|
For readability, there may be any number of blanks or tabs between the <code>Construct</code> and the vertical bar <code>|</code>, so that you can align all the bars if you wish. On the right of the bar, however, all characters including blanks and tabs are significant, since they are part of the replacement for the <code>Construct</code>.
|
||||||
</div><div>
|
|
||||||
==The asterisk==
|
==The asterisk==
|
||||||
|
|
||||||
In the <code>Replacement</code> part, you may use the symbol <code>*</code> (asterisk) to denote the construct specimen itself. So for example the entry
|
In the <code>Replacement</code> part, you may use the symbol <code>*</code> (asterisk) to denote the construct specimen itself. So for example the entry
|
||||||
@@ -42,7 +42,7 @@ means that the Eiffel keyword <code>external</code> must appear in the filtered
|
|||||||
<code>Keyword |<B> * </B></code>
|
<code>Keyword |<B> * </B></code>
|
||||||
|
|
||||||
which, thanks to the asterisk, will govern all construct specimens of the <code>Keyword</code> category. You can still override this specification for an individual keyword by including a specific entry for it.
|
which, thanks to the asterisk, will govern all construct specimens of the <code>Keyword</code> category. You can still override this specification for an individual keyword by including a specific entry for it.
|
||||||
</div><div>
|
|
||||||
==Constructs==
|
==Constructs==
|
||||||
|
|
||||||
The following general syntactic constructs may appear as the left-hand side, <code>Construct</code>, of an entry:
|
The following general syntactic constructs may appear as the left-hand side, <code>Construct</code>, of an entry:
|
||||||
@@ -79,13 +79,13 @@ The constructs corresponding to syntactic constructs are self-explanatory. The o
|
|||||||
* <code>Symbol</code>, denoting any of the Eiffel symbols listed in the corresponding appendix of <span> [[Eiffel: The Language]] </span>.
|
* <code>Symbol</code>, denoting any of the Eiffel symbols listed in the corresponding appendix of <span> [[Eiffel: The Language]] </span>.
|
||||||
* <code>Escape</code>, to protect special characters of the external tool, as explained below.
|
* <code>Escape</code>, to protect special characters of the external tool, as explained below.
|
||||||
* <code>Tab</code>, denoting any tab character appearing in the class text.
|
* <code>Tab</code>, denoting any tab character appearing in the class text.
|
||||||
<div>
|
|
||||||
==Keywords==
|
==Keywords==
|
||||||
|
|
||||||
A <code>Construct</code> part may consist of the name of an Eiffel keyword. To see the complete list of possible keywords, look at the <code>template</code> filter, file <code>format.fil-template</code> in the default filter directory <code>$ISE_EIFFEL/studio/filters</code>, which includes all of them with a single asterisk <code>*</code> as the <code>Replacement</code> part.
|
A <code>Construct</code> part may consist of the name of an Eiffel keyword. To see the complete list of possible keywords, look at the <code>template</code> filter, file <code>format.fil-template</code> in the default filter directory <code>$ISE_EIFFEL/studio/filters</code>, which includes all of them with a single asterisk <code>*</code> as the <code>Replacement</code> part.
|
||||||
|
|
||||||
If entries are present for both the <code>Keyword</code> construct and individual keywords, the individual keyword entries will override the general entry for the keywords listed; the general entry will apply to all other keywords. This makes it possible to have both a general convention for keywords and a special convention for some of them.
|
If entries are present for both the <code>Keyword</code> construct and individual keywords, the individual keyword entries will override the general entry for the keywords listed; the general entry will apply to all other keywords. This makes it possible to have both a general convention for keywords and a special convention for some of them.
|
||||||
</div>
|
|
||||||
==Symbol==
|
==Symbol==
|
||||||
|
|
||||||
A <code>Construct</code> part may consist of an Eiffel symbol, such as <code>:=</code>, <code>/=</code> and many others. Again, you may see the complete list by looking at <code>format.fil-template</code>. Note the following conventions:
|
A <code>Construct</code> part may consist of an Eiffel symbol, such as <code>:=</code>, <code>/=</code> and many others. Again, you may see the complete list by looking at <code>format.fil-template</code>. Note the following conventions:
|
||||||
@@ -93,7 +93,7 @@ A <code>Construct</code> part may consist of an Eiffel symbol, such as <code>:=<
|
|||||||
* Similarly, the Eiffel comment symbol appears as <code>- %-</code>, since just writing <code>- -</code> would introduce a comment in the EFF filter itself.
|
* Similarly, the Eiffel comment symbol appears as <code>- %-</code>, since just writing <code>- -</code> would introduce a comment in the EFF filter itself.
|
||||||
|
|
||||||
As with keywords, you may specify a general convention for symbols, defined by an entry for the construct <code>Symbol</code>, and special conventions for certain individual symbols. Specific symbol entries will override the general <code>Symbol</code> convention.
|
As with keywords, you may specify a general convention for symbols, defined by an entry for the construct <code>Symbol</code>, and special conventions for certain individual symbols. Specific symbol entries will override the general <code>Symbol</code> convention.
|
||||||
</div>
|
|
||||||
==Escape characters==
|
==Escape characters==
|
||||||
|
|
||||||
A text processing system or other external tool may attach a special role to characters that may normally appear in Eiffel texts. For example, the braces <code>{</code> and <code>}</code>, used in Eiffel's Export clauses, have a special meaning for TEX. Including them without precaution in TEX input will cause trouble. Similarly, many text processing formats attach a special meaning to the backslash character <code>\</code> which, although not special for Eiffel, may appear in an Eiffel string.
|
A text processing system or other external tool may attach a special role to characters that may normally appear in Eiffel texts. For example, the braces <code>{</code> and <code>}</code>, used in Eiffel's Export clauses, have a special meaning for TEX. Including them without precaution in TEX input will cause trouble. Similarly, many text processing formats attach a special meaning to the backslash character <code>\</code> which, although not special for Eiffel, may appear in an Eiffel string.
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ The syntax is pretty simple when you understand what you need to export a featur
|
|||||||
ROOT_CLASS (make): foo @ 4 Alias my_foo call_type __stdcall</code>
|
ROOT_CLASS (make): foo @ 4 Alias my_foo call_type __stdcall</code>
|
||||||
|
|
||||||
===Constraints===
|
===Constraints===
|
||||||
* on the class: <div>The class cannot be deferred or generic.</div>
|
; on the class: The class cannot be deferred or generic.
|
||||||
* on the feature: <div>It could be any feature except an attribute, an external feature or a deferred feature.</div>
|
; on the feature: It could be any feature except an attribute, an external feature or a deferred feature.
|
||||||
* on the creation procedure: <div>It must have zero argument, and no return type.</div>
|
; on the creation procedure: It must have zero argument, and no return type.
|
||||||
* on the alias name: <div>It must be a valid name for a C function.</div>
|
; on the alias name: It must be a valid name for a C function.
|
||||||
* on the index: <div>It must be strictly positive.</div>
|
; on the index: It must be strictly positive.
|
||||||
* on the call type: <div>It must be a valid call type for the targeted platform (useful for Windows only). For Visual C++, the valid calling conventions are __stdcall, __cdecl and __fastcall.</div>
|
; on the call type: It must be a valid call type for the targeted platform (useful for Windows only). For Visual C++, the valid calling conventions are __stdcall, __cdecl and __fastcall.
|
||||||
|
|
||||||
For each feature the required fields are the '''class''', the '''creation procedure''', and of course the '''feature''' itself.
|
For each feature the required fields are the '''class''', the '''creation procedure''', and of course the '''feature''' itself.
|
||||||
* If the feature is a creation procedure then do not specify any creation, it will use the feature as creation. For example '''ROOT_CLASS: make'''.
|
* If the feature is a creation procedure then do not specify any creation, it will use the feature as creation. For example '''ROOT_CLASS: make'''.
|
||||||
@@ -60,4 +60,5 @@ BAR (make_a) : print_bar
|
|||||||
-- Here the feature is also a creation
|
-- Here the feature is also a creation
|
||||||
ROOT_CLASS : make
|
ROOT_CLASS : make
|
||||||
ROOT_CLASS (make) : foo
|
ROOT_CLASS (make) : foo
|
||||||
ROOT_CLASS (make) : test_bar</code>
|
ROOT_CLASS (make) : test_bar
|
||||||
|
</code>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Generally, you should use these types when implementing external C functions bou
|
|||||||
{{note|In the following code samples, the class <eiffel>OBJECT</eiffel> is a placeholder for one of your type that you wish to use via CECIL.}}
|
{{note|In the following code samples, the class <eiffel>OBJECT</eiffel> is a placeholder for one of your type that you wish to use via CECIL.}}
|
||||||
|
|
||||||
{{sample|Calling C external `foo` from Eiffel, which takes a pointer and an eiffel object of type OBJECT as arguments and returns an INTEGER. }}
|
{{sample|Calling C external `foo` from Eiffel, which takes a pointer and an eiffel object of type OBJECT as arguments and returns an INTEGER. }}
|
||||||
<div>
|
|
||||||
<code>
|
<code>
|
||||||
c_foo (ptr: POINTER; obj: OBJECT): INTEGER
|
c_foo (ptr: POINTER; obj: OBJECT): INTEGER
|
||||||
external
|
external
|
||||||
@@ -37,14 +37,14 @@ EIF_INTEGER foo (EIF_POINTER ptr, EIF_OBJECT obj)
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
</div>In some cases, you may not be able to change the signature of a C function you want to use. In this case, you must describe its actual signature in the Eiffel code. On the C side, foo is already defined as below: <div>
|
In some cases, you may not be able to change the signature of a C function you want to use. In this case, you must describe its actual signature in the Eiffel code. On the C side, foo is already defined as below:
|
||||||
<code lang="c">
|
<code lang="c">
|
||||||
int foo (void *arg1, char c, FILE *file)
|
int foo (void *arg1, char c, FILE *file)
|
||||||
{
|
{
|
||||||
/* some code */
|
/* some code */
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div><div>To match the signature, you must declare it in Eiffel as:
|
To match the signature, you must declare it in Eiffel as:
|
||||||
<code>
|
<code>
|
||||||
c_foo (arg1: POINTER; c: CHARACTER; file: POINTER): INTEGER
|
c_foo (arg1: POINTER; c: CHARACTER; file: POINTER): INTEGER
|
||||||
external
|
external
|
||||||
@@ -53,16 +53,18 @@ int foo (void *arg1, char c, FILE *file)
|
|||||||
"foo"
|
"foo"
|
||||||
end
|
end
|
||||||
</code>
|
</code>
|
||||||
</div>
|
|
||||||
Not doing this would generally produce warnings during the C compilation, and it could crash with some C compilers.
|
Not doing this would generally produce warnings during the C compilation, and it could crash with some C compilers.
|
||||||
|
|
||||||
To perform the conversion, here is the actual Eiffel types mapping to C types:
|
To perform the conversion, here is the actual Eiffel types mapping to C types:
|
||||||
<div> <eiffel>POINTER</eiffel> is compatible with any C pointer ( ''char *''). <br/>
|
* <eiffel>POINTER</eiffel> is compatible with any C pointer ( ''char *'').
|
||||||
<eiffel>INTEGER</eiffel> is a long. <br/>
|
* <eiffel>INTEGER</eiffel> is a long.
|
||||||
<eiffel>CHARACTER</eiffel> is an ''unsigned char. '' <br/>
|
* <eiffel>CHARACTER</eiffel> is an ''unsigned char''.
|
||||||
<eiffel>DOUBLE</eiffel> is a ''double''. <br/>
|
* <eiffel>DOUBLE</eiffel> is a ''double''.
|
||||||
<eiffel>REAL</eiffel> is a ''float''. <br/>
|
* <eiffel>REAL</eiffel> is a ''float''.
|
||||||
<eiffel>BOOLEAN</eiffel> is an ''unsigned char (EIF_TRUE = '\01', EIF_FALSE = '\0')'' . </div>These are the current correspondences but they may change. The definition of each Eiffel type is located in $ISE_EIFFEL/bench/spec/$PLATFORM/include/eif_portable. h.
|
* <eiffel>BOOLEAN</eiffel> is an ''unsigned char (EIF_TRUE = '\01', EIF_FALSE = '\0')'' .
|
||||||
|
|
||||||
|
These are the current correspondences but they may change. The definition of each Eiffel type is located in `$ISE_EIFFEL/bench/spec/$PLATFORM/include/eif_portable.h` .
|
||||||
|
|
||||||
===More about EIF_OBJECT, EIF_REFERENCE, and basic expanded types===
|
===More about EIF_OBJECT, EIF_REFERENCE, and basic expanded types===
|
||||||
It is sometimes difficult to tell the difference between an ''EIF_OBJECT'' and an ''EIF_REFERENCE''.
|
It is sometimes difficult to tell the difference between an ''EIF_OBJECT'' and an ''EIF_REFERENCE''.
|
||||||
An ''EIF_REFERENCE'' is an Eiffel reference. It corresponds to an Eiffel object in the Eiffel side. <eiffel>eif_attribute</eiffel>, <eiffel>eif_reference_function</eiffel>, <eiffel>eif_string</eiffel>, <eiffel>eif_wean</eiffel> all return ''EIF_REFERENCEs''. An ''EIF_REFERENCE'' can be used "as is" by the Eiffel run-time. <eiffel>eif_attribute</eiffel>, <eiffel>eif_xx_function</eiffel> take ''EIF_REFERENCEs'' as arguments, never ''EIF_OBJECTs''. The return value of a C external is to be an ''EIF_REFERENCE'', if it is not a basic expanded type. To protect an ''EIF_REFERENCE'', use <eiffel>eif_protect</eiffel>.
|
An ''EIF_REFERENCE'' is an Eiffel reference. It corresponds to an Eiffel object in the Eiffel side. <eiffel>eif_attribute</eiffel>, <eiffel>eif_reference_function</eiffel>, <eiffel>eif_string</eiffel>, <eiffel>eif_wean</eiffel> all return ''EIF_REFERENCEs''. An ''EIF_REFERENCE'' can be used "as is" by the Eiffel run-time. <eiffel>eif_attribute</eiffel>, <eiffel>eif_xx_function</eiffel> take ''EIF_REFERENCEs'' as arguments, never ''EIF_OBJECTs''. The return value of a C external is to be an ''EIF_REFERENCE'', if it is not a basic expanded type. To protect an ''EIF_REFERENCE'', use <eiffel>eif_protect</eiffel>.
|
||||||
@@ -189,7 +191,7 @@ Called within a C external, the function ''eif_adopt'' creates a user protection
|
|||||||
'''Example:'''
|
'''Example:'''
|
||||||
|
|
||||||
In Eiffel:
|
In Eiffel:
|
||||||
<div>
|
|
||||||
<code>
|
<code>
|
||||||
c_foo (ptr: POINTER; obj: OBJECT): INTEGER
|
c_foo (ptr: POINTER; obj: OBJECT): INTEGER
|
||||||
external
|
external
|
||||||
@@ -205,9 +207,9 @@ In Eiffel:
|
|||||||
end
|
end
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
</div>
|
|
||||||
On the C side:
|
On the C side:
|
||||||
<div>
|
|
||||||
<code lang="c">
|
<code lang="c">
|
||||||
EIF_OBJECT my_obj; /* Protection of the object of type OBJECT. */
|
EIF_OBJECT my_obj; /* Protection of the object of type OBJECT. */
|
||||||
EIF_INTEGER foo (EIF_POINTER ptr, EIF_OBJECT obj)
|
EIF_INTEGER foo (EIF_POINTER ptr, EIF_OBJECT obj)
|
||||||
@@ -229,7 +231,7 @@ void display_and_release_obj (void)
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
</div>
|
|
||||||
Between the call of `c_foo` and `c_display_obj`, the global object `(eif_access (my_obj))` may not be referenced from Eiffel any longer. To prevent the GC from collecting it before the call to `c_display_and_release_obj`, you must protect it with `eif_adopt` in the C function `foo`.
|
Between the call of `c_foo` and `c_display_obj`, the global object `(eif_access (my_obj))` may not be referenced from Eiffel any longer. To prevent the GC from collecting it before the call to `c_display_and_release_obj`, you must protect it with `eif_adopt` in the C function `foo`.
|
||||||
|
|
||||||
==Other CECIL functions:==
|
==Other CECIL functions:==
|
||||||
@@ -423,11 +425,12 @@ EIF_REFERENCE foo () {
|
|||||||
</code>
|
</code>
|
||||||
|
|
||||||
===Getting the attribute from an Eiffel object: eif_attribute===
|
===Getting the attribute from an Eiffel object: eif_attribute===
|
||||||
''' # include "eif_cecil. h"'''
|
|
||||||
|
|
||||||
|
```
|
||||||
|
# include "eif_cecil. h"
|
||||||
|
|
||||||
EIFFEL_TYPE eif_attribute (EIF_REFERENCE object, char *name, EIFFEL_TYPE, int *status)
|
EIFFEL_TYPE eif_attribute (EIF_REFERENCE object, char *name, EIFFEL_TYPE, int *status)
|
||||||
|
```
|
||||||
|
|
||||||
Return the attribute of an Eiffel object.
|
Return the attribute of an Eiffel object.
|
||||||
|
|
||||||
@@ -435,34 +438,37 @@ The `eif_attribute` macro returns the attribute of object of name, which is of t
|
|||||||
|
|
||||||
EIFFEL_TYPE is the type of the Eiffel attribute. It can be: EIF_INTEGER, EIF_POINTER, EIF_CHARACTER, EIF_BOOLEAN, EIF_DOUBLE, EIF_REAL or EIF_REFERENCE.
|
EIFFEL_TYPE is the type of the Eiffel attribute. It can be: EIF_INTEGER, EIF_POINTER, EIF_CHARACTER, EIF_BOOLEAN, EIF_DOUBLE, EIF_REAL or EIF_REFERENCE.
|
||||||
|
|
||||||
If status is NULL then no status is set. Otherwise the status of the function is put in *status: <br/>
|
If status is NULL then no status is set. Otherwise the status of the function is put in *status:
|
||||||
*status = EIF_NO_ATTRIBUTE => no attribute found. <br/>
|
*status = EIF_NO_ATTRIBUTE => no attribute found.
|
||||||
*status = EIF_CECIL_OK => attribute found. <br/>
|
*status = EIF_CECIL_OK => attribute found.
|
||||||
*status = EIF_CECIL_ERROR => an undefined error occurred, object may be invalid.
|
*status = EIF_CECIL_ERROR => an undefined error occurred, object may be invalid.
|
||||||
|
|
||||||
If the visible exception is enabled, then a visible exception is raised upon failure (EIF_NO_ATTRIBUTE, EIF_CECIL_ERROR).
|
If the visible exception is enabled, then a visible exception is raised upon failure (EIF_NO_ATTRIBUTE, EIF_CECIL_ERROR).
|
||||||
|
|
||||||
RETURN VALUE:
|
RETURN VALUE:
|
||||||
<div>upon failure, it returns (EIFFEL_TYPE) 0, otherwise, the attribute is returned. If the return value is not a basic type, you must protect it with eif_protect</div>
|
Upon failure, it returns (EIFFEL_TYPE) 0, otherwise, the attribute is returned. If the return value is not a basic type, you must protect it with eif_protect.
|
||||||
|
|
||||||
COMPATIBILITY:
|
COMPATIBILITY:
|
||||||
<div>eif_attribute (object, name, type, NULL) is equivalent to eif_field (object, name, type)</div>
|
`eif_attribute (object, name, type, NULL)` is equivalent to `eif_field (object, name, type)`.
|
||||||
{{tip|You cannot access a constant attribute, or the result of a function (once or not) with eif_attribute. Use eif_procedure or eif_xx_function instead. }}<br/>
|
|
||||||
|
{{tip|You cannot access a constant attribute, or the result of a function (once or not) with eif_attribute. Use eif_procedure or eif_xx_function instead. }}
|
||||||
<br/>
|
<br/>
|
||||||
{{tip|EIF_BOOLEAN attribute_exists (EIF_REFERENCE object, char *name) returns EIF_TRUE or EIF_FALSE depending if the attribute exists or not, is visible or not. }}
|
{{tip|EIF_BOOLEAN attribute_exists (EIF_REFERENCE object, char *name) returns EIF_TRUE or EIF_FALSE depending if the attribute exists or not, is visible or not. }}
|
||||||
|
|
||||||
===Getting the address of an Eiffel routine===
|
===Getting the address of an Eiffel routine===
|
||||||
''' #include "eif_cecil. h"''' <br/>
|
```
|
||||||
<br/>
|
#include "eif_cecil. h"
|
||||||
''' EIF_PROCEDURE eif_procedure (char *rout_name, EIF_TYPE_ID type_id)''' <br/>
|
|
||||||
''' EIF_REFERENCE_FUNCTION eif_reference_function (char *rout_name, EIF_TYPE_ID type_id)''' <br/>
|
|
||||||
''' EIF_INTEGER_FUNCTION eif_integer_function (char *rout_name, EIF_TYPE_ID type_id)''' <br/>
|
|
||||||
''' EIF_CHARACTER_FUNCTION eif_character_function (char *rout_name, EIF_TYPE_ID type_id)''' <br/>
|
|
||||||
''' EIF_REAL_FUNCTION eif_real_function (char *rout_name, EIF_TYPE_ID type_id)''' <br/>
|
|
||||||
''' EIF_DOUBLE_FUNCTION eif_double_function (char *rput_name, EIF_TYPE_ID type_id)''' <br/>
|
|
||||||
''' EIF_BIT_FUNCTION eif_bit_function (char *rout_name, EIF_TYPE_ID type_id)''' <br/>
|
|
||||||
''' EIF_BOOLEAN_FUNCTION eif_boolean_function (char *rout_name, EIF_TYPE_ID type_id)''' <br/>
|
|
||||||
''' EIF_POINTER_FUNCTION eif_pointer_function (char *rout_name, EIF_TYPE_ID type_id)'''
|
|
||||||
|
|
||||||
|
EIF_PROCEDURE eif_procedure (char *rout_name, EIF_TYPE_ID type_id)
|
||||||
|
EIF_REFERENCE_FUNCTION eif_reference_function (char *rout_name, EIF_TYPE_ID type_id)
|
||||||
|
EIF_INTEGER_FUNCTION eif_integer_function (char *rout_name, EIF_TYPE_ID type_id)
|
||||||
|
EIF_CHARACTER_FUNCTION eif_character_function (char *rout_name, EIF_TYPE_ID type_id)
|
||||||
|
EIF_REAL_FUNCTION eif_real_function (char *rout_name, EIF_TYPE_ID type_id)
|
||||||
|
EIF_DOUBLE_FUNCTION eif_double_function (char *rput_name, EIF_TYPE_ID type_id)
|
||||||
|
EIF_BIT_FUNCTION eif_bit_function (char *rout_name, EIF_TYPE_ID type_id)
|
||||||
|
EIF_BOOLEAN_FUNCTION eif_boolean_function (char *rout_name, EIF_TYPE_ID type_id)
|
||||||
|
EIF_POINTER_FUNCTION eif_pointer_function (char *rout_name, EIF_TYPE_ID type_id)
|
||||||
|
```
|
||||||
|
|
||||||
Return the address of the Eiffel routine by giving its name rout_name and the type id type_id of the class, in which it is declared. Returns a NULL pointer or raises a visible exception (if enabled) when there is no corresponding routine with name rout_name or the routine is not visible. The first argument of an Eiffel routine has to be the target of the Eiffel routine.
|
Return the address of the Eiffel routine by giving its name rout_name and the type id type_id of the class, in which it is declared. Returns a NULL pointer or raises a visible exception (if enabled) when there is no corresponding routine with name rout_name or the routine is not visible. The first argument of an Eiffel routine has to be the target of the Eiffel routine.
|
||||||
|
|
||||||
@@ -473,48 +479,49 @@ The Eiffel object returned by an Eiffel function must be protected afterwards wi
|
|||||||
{{caution|Be sure that the Eiffel routine is not a C External. In this case, you should call directly the C external instead of its Eiffel wrapper. }}
|
{{caution|Be sure that the Eiffel routine is not a C External. In this case, you should call directly the C external instead of its Eiffel wrapper. }}
|
||||||
|
|
||||||
===Enabling/Disabling the visible exception===
|
===Enabling/Disabling the visible exception===
|
||||||
''' #include "eif_cecil. h"'''
|
```
|
||||||
|
#include "eif_cecil. h"
|
||||||
|
|
||||||
|
void eif_enable_visible_exception ()
|
||||||
|
void eif_disable_visible_exception ()
|
||||||
|
```
|
||||||
|
|
||||||
''' void eif_enable_visible_exception ()''' <br/>
|
Respectively, enable and disable the visible exception.
|
||||||
''' void eif_disable_visible_exception ()'''
|
|
||||||
|
|
||||||
Respectively, enable and disable the visible exception. <br/>
|
|
||||||
By default, the visible exception is disabled (since v4. 5).
|
By default, the visible exception is disabled (since v4. 5).
|
||||||
|
|
||||||
===Creating an Eiffel string: eif_string===
|
===Creating an Eiffel string: eif_string===
|
||||||
'''#include "eif_plug. h"'''
|
```
|
||||||
|
#include "eif_plug. h"
|
||||||
|
|
||||||
EIF_REFERENCE eif_string (char *string) /* Macro */
|
EIF_REFERENCE eif_string (char *string) /* Macro */
|
||||||
|
```
|
||||||
|
|
||||||
Return the direct reference to an Eiffel string by giving the corresponding C string . The result of eif_string does not reference the C string passed as argument: it copies it, before creating the Eiffel string.
|
Return the direct reference to an Eiffel string by giving the corresponding C string . The result of eif_string does not reference the C string passed as argument: it copies it, before creating the Eiffel string.
|
||||||
|
|
||||||
{{note|s''': The return value must be protected with eif_protect for later use. <br/>
|
{{note|The return value must be protected with eif_protect for later use. <br/>The C string must be manually freed by the user, if it has been dynamically allocated. }}
|
||||||
<br/>
|
|
||||||
The C string must be manually freed by the user, if it has been dynamically allocated. }}
|
|
||||||
|
|
||||||
COMPATIBILITY:
|
COMPATIBILITY:
|
||||||
<div>eif_string ("ABC") is equivalent to RTMS ("ABC") and eif_make_string ("ABC", strlen ("ABC")). </div>
|
|
||||||
===Getting the return-type of an attribute: eif_attribute_type===
|
|
||||||
''' #include "eif_cecil. h"'''
|
|
||||||
|
|
||||||
|
`eif_string ("ABC")` is equivalent to `RTMS ("ABC")` and `eif_make_string ("ABC", strlen ("ABC"))`.
|
||||||
|
|
||||||
|
===Getting the return-type of an attribute: eif_attribute_type===
|
||||||
|
```
|
||||||
|
#include "eif_cecil. h"
|
||||||
|
|
||||||
int eif_attribute_type (char *attr_name, EIF_TYPE_ID tid)
|
int eif_attribute_type (char *attr_name, EIF_TYPE_ID tid)
|
||||||
|
|
||||||
|
#define EIF_REFERENCE_TYPE 1
|
||||||
''' #define EIF_REFERENCE_TYPE 1''' <br/>
|
#define EIF_CHARACTER_TYPE 2
|
||||||
''' #define EIF_CHARACTER_TYPE 2''' <br/>
|
#define EIF_BOOLEAN_TYPE 3
|
||||||
''' #define EIF_BOOLEAN_TYPE 3''' <br/>
|
#define EIF_INTEGER_TYPE 4
|
||||||
''' #define EIF_INTEGER_TYPE 4''' <br/>
|
#define EIF_REAL_TYPE 5
|
||||||
''' #define EIF_REAL_TYPE 5''' <br/>
|
#define EIF_DOUBLE_TYPE 6
|
||||||
''' #define EIF_DOUBLE_TYPE 6''' <br/>
|
#define EIF_EXPANDED_TYPE 7
|
||||||
''' #define EIF_EXPANDED_TYPE 7''' <br/>
|
#define EIF_BIT_TYPE 8
|
||||||
''' #define EIF_BIT_TYPE 8''' <br/>
|
#define EIF_POINTER_TYPE 0
|
||||||
''' #define EIF_POINTER_TYPE 0''' <br/>
|
#define EIF_NO_TYPE (-1)
|
||||||
''' #define EIF_NO_TYPE (-1)''' <br/>
|
```
|
||||||
|
|
||||||
|
|
||||||
Return the type of the attribute described by its name attr_name and the type identifier tid of the class where it is defined. The return type is an int (see above for correspondences). In case of failure, EIF_NO_TYPE is returned - not such given attribute name, routine name instead of attribute name, or so on.
|
Return the type of the attribute described by its name attr_name and the type identifier tid of the class where it is defined. The return type is an int (see above for correspondences). In case of failure, EIF_NO_TYPE is returned - not such given attribute name, routine name instead of attribute name, or so on.
|
||||||
|
|
||||||
@@ -530,43 +537,45 @@ printf ("type is %d\n"); /* Should be EIF_INTEGER_TYPE since it returns an Ei
|
|||||||
{{tip|*(EIFFEL_TYPE *) eif_attribute_safe (EIF_REFERENCE object, char *name, int type_int, int *status) can be used for debugging or type checking. It returns the attribute reference of name from the object of type type_int. status contains the status of the function call: it can be EIF_CECIL_OK, EIF_CECIL_ERROR, EIF_NO_ATTRIBUTE or EIF_WRONG_TYPE (type_int does not match with real type of object). }}
|
{{tip|*(EIFFEL_TYPE *) eif_attribute_safe (EIF_REFERENCE object, char *name, int type_int, int *status) can be used for debugging or type checking. It returns the attribute reference of name from the object of type type_int. status contains the status of the function call: it can be EIF_CECIL_OK, EIF_CECIL_ERROR, EIF_NO_ATTRIBUTE or EIF_WRONG_TYPE (type_int does not match with real type of object). }}
|
||||||
|
|
||||||
===Getting the class name corresponding to a type id: eif_name===
|
===Getting the class name corresponding to a type id: eif_name===
|
||||||
''' #include "eif_cecil. h"'''
|
```
|
||||||
|
#include "eif_cecil. h"
|
||||||
|
|
||||||
char *eif_name (EIF_TYPE_ID tid)
|
char *eif_name (EIF_TYPE_ID tid)
|
||||||
|
```
|
||||||
|
|
||||||
Return the corresponding name (C string) of the Eiffel class, given a type identifier type_id. If the type identifier is a generic type identifier, no generic parameter type is given. Return NULL if an invalid type identifier is given.
|
Return the corresponding name (C string) of the Eiffel class, given a type identifier type_id. If the type identifier is a generic type identifier, no generic parameter type is given. Return NULL if an invalid type identifier is given.
|
||||||
|
|
||||||
'''Example:'''
|
'''Example:'''
|
||||||
|
|
||||||
printf ("the class name with type id 1 is %s\n", eif_name (1); /* Should print "ANY" on most compiler versions */
|
`printf ("the class name with type id 1 is %s\n", eif_name (1); /* Should print "ANY" on most compiler versions */`
|
||||||
|
|
||||||
COMPATIBILITY:
|
COMPATIBILITY:
|
||||||
<div>eif_name is equivalent to eif_name_by_tid</div>
|
|
||||||
|
`eif_name` is equivalent to `eif_name_by_tid`.
|
||||||
|
|
||||||
===Getting the type id of an Eiffel object: eif_type, eif_type_by_reference.===
|
===Getting the type id of an Eiffel object: eif_type, eif_type_by_reference.===
|
||||||
''' #include "eif_cecil. h"'''
|
```
|
||||||
|
#include "eif_cecil. h"
|
||||||
|
|
||||||
|
|
||||||
EIF_TYPE_ID eif_type (EIF_OBJECT object)
|
EIF_TYPE_ID eif_type (EIF_OBJECT object)
|
||||||
|
|
||||||
|
|
||||||
EIF_TYPE_ID eif_type_by_reference (EIF_REFERENCE reference)
|
EIF_TYPE_ID eif_type_by_reference (EIF_REFERENCE reference)
|
||||||
|
```
|
||||||
|
|
||||||
eif_type returns the type identifier, given an indirection pointer to an Eiffel object.
|
`eif_type` returns the type identifier, given an indirection pointer to an Eiffel object.
|
||||||
|
|
||||||
eif_type_by_reference returns the type identifier, given the direct reference to an Eiffel object reference.
|
`eif_type_by_reference` returns the type identifier, given the direct reference to an Eiffel object reference.
|
||||||
|
|
||||||
COMPATIBILITY:
|
COMPATIBILITY:
|
||||||
<div>eif_type is equivalent to eif_type_by_object.eif_type (object) is equivalent to eif_type_by_reference (eif_access (object)). </div>
|
`eif_type` is equivalent to `eif_type_by_object.eif_type (object)` is equivalent to `eif_type_by_reference (eif_access (object))`.
|
||||||
|
|
||||||
===Converting a C array into an Eiffel array: eif_make_from_c.===
|
===Converting a C array into an Eiffel array: eif_make_from_c.===
|
||||||
'''eif_make_from_c(eif_array, c_array, int nelts, int type) /* Macro */''' (since 4. 5)
|
```
|
||||||
|
eif_make_from_c(eif_array, c_array, int nelts, int type) /* Macro */
|
||||||
|
```
|
||||||
eif_array is an EIF_REFERENCE, c_array is a C array of type (type *), "nelts" is the number of elements in the array.
|
(since 4. 5)
|
||||||
<div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
`eif_array` is an `EIF_REFERENCE`, `c_array` is a C array of type `(type *)`, `nelts is the number of elements in the array.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[[Property:title|The Component Location]]
|
[[Property:title|The Component Location]]
|
||||||
[[Property:weight|4]]
|
[[Property:weight|4]]
|
||||||
[[Property:uuid|083c0120-2eda-9353-ceae-f63e7f407341]]
|
[[Property:uuid|083c0120-2eda-9353-ceae-f63e7f407341]]
|
||||||
<div>
|
|
||||||
==Types of Components==
|
==Types of Components==
|
||||||
Certainly you've heard of ActiveX, DirectX, OCX, COM+, ADO+, ASP, and other Microsoft technologies. These are all technologies that use the COM standard. This section focuses on categorizing COM components according to their properties as well as the context in which they are used. The categorization will define how the EiffelCOM wizard should be used to wrap or create a component. The first criterion that defines the type of component is its location at run time: will the component be loaded in the client process (in-process) or will the component be a remote server for a distributed application (out-of-process)? In the former case, the component is compiled as a Dynamic Link Libraries (DLL) while in the latter case it is a standard executable.
|
Certainly you've heard of ActiveX, DirectX, OCX, COM+, ADO+, ASP, and other Microsoft technologies. These are all technologies that use the COM standard. This section focuses on categorizing COM components according to their properties as well as the context in which they are used. The categorization will define how the EiffelCOM wizard should be used to wrap or create a component. The first criterion that defines the type of component is its location at run time: will the component be loaded in the client process (in-process) or will the component be a remote server for a distributed application (out-of-process)? In the former case, the component is compiled as a Dynamic Link Libraries (DLL) while in the latter case it is a standard executable.
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
[[Property:title|Calculator: winform]]
|
[[Property:title|Calculator: winform]]
|
||||||
[[Property:weight|-8]]
|
[[Property:weight|-8]]
|
||||||
[[Property:uuid|9d064b1c-e109-35e8-70d5-73feec59fca1]]
|
[[Property:uuid|9d064b1c-e109-35e8-70d5-73feec59fca1]]
|
||||||
<div>
|
|
||||||
[[Image:calculator|Calculator]]
|
[[Image:calculator|Calculator]]
|
||||||
</div>
|
|
||||||
<br/>
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user