mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2026-04-04 17:19:23 +02:00
Author:halw
Date:2009-01-28T16:53:41.000000Z git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@173 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -5,8 +5,10 @@ More often than wanted, Eiffel compilations are not successful. The good point i
|
||||
|
||||
When an error occurs during an Eiffel compilation in EiffelStudio, the '''Output''' tab of the context tool displays a description of the error and its location, which looks more or less like this:
|
||||
|
||||
|
||||
[[Image:error-message]]
|
||||
|
||||
|
||||
In this case, the compiler tries to explain that the identifier "sessionid" is not a known identifier in the context where it was typed. This is a common error that mainly occurs when making typos in the code. Assuming the message does not make sense to you (which may happen in more complex cases), you can query more information about the encountered error.
|
||||
|
||||
To do this:
|
||||
@@ -14,6 +16,7 @@ To do this:
|
||||
* [[Pick-and-drop mechanism|Drop]] it either in the editor or on the error help button [[Image:command-error-info-icon]] .
|
||||
* A dialog is then popped up that describes extended information concerning this error type:
|
||||
|
||||
|
||||
[[Image:error-description-dialog]]
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,10 @@ From EiffelStudio, you can define up to 10 external commands. Those commands wil
|
||||
|
||||
To define your own command, select "External commands..." in the Tools menu. Then the following dialog will appear:
|
||||
|
||||
|
||||
[[Image:external-commands-dialog]]
|
||||
|
||||
|
||||
With this dialog you can:
|
||||
* add new commands
|
||||
* edit existing commands
|
||||
@@ -14,9 +16,11 @@ With this dialog you can:
|
||||
|
||||
To add your first command, simply click on the "Add..." button and the following command editor will appear:
|
||||
|
||||
|
||||
[[Image:external-commands-dialog-editor]]
|
||||
|
||||
In this dialog you can give a name to the command, this name will be displayed in the Tools menu. The index is the position among the external commands of the command in the Tools menu. The command line is the command you want to execute. In order to execute correctly, the application you will execute needs to be in your PATH environment variable or if it is not you must provide an absolute path to the external command. And you can specify the workding directory for that command.
|
||||
|
||||
In this dialog you can give a name to the command, this name will be displayed in the Tools menu. The index is the position among the external commands of the command in the Tools menu. The command line is the command you want to execute. In order to execute correctly, the application you will execute needs to be in your PATH environment variable or if it is not you must provide an absolute path to the external command. And you can specify the working directory for that command.
|
||||
|
||||
In addition to the external command name, you can pass as many options as you want plus the following placeholders that will be translated before calling the external command:
|
||||
* $class_name: this will be replaced by the name in lower case of the targeted class in editor
|
||||
|
||||
@@ -14,28 +14,29 @@ When clicking '''Attribute''', the window changes to the attribute layout. It ha
|
||||
This dialog box:<br/>
|
||||
<div> [[Image:feature-wizard-attribute-example]] </div><br/>
|
||||
Produces this feature:<br/>
|
||||
<code>class
|
||||
PRODUCT
|
||||
<code>
|
||||
class
|
||||
PRODUCT
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
price: DOUBLE
|
||||
-- Cost in dollars.
|
||||
price: DOUBLE
|
||||
-- Cost in dollars.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_price (a_price: DOUBLE) is
|
||||
-- Assign `a_price' to `price'.
|
||||
require
|
||||
a_price_non_negative: a_price >= 0.0
|
||||
do
|
||||
price := a_price
|
||||
ensure
|
||||
price_assigned: price = a_price
|
||||
end
|
||||
set_price (a_price: DOUBLE)
|
||||
-- Assign `a_price' to `price'.
|
||||
require
|
||||
a_price_non_negative: a_price >= 0.0
|
||||
do
|
||||
price := a_price
|
||||
ensure
|
||||
price_assigned: price = a_price
|
||||
end
|
||||
|
||||
invariant
|
||||
price_non_negative: price >= 0.0
|
||||
price_non_negative: price >= 0.0
|
||||
|
||||
end -- class PRODUCT</code>
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@ For functions and procedures, you can build a formal argument list. You can do t
|
||||
For every attribute you selected, enter a name in the text box and a type using the [[Type selection|type selection]] .
|
||||
<div> [[Image:feature-wizard-1-argument]] </div><br/>
|
||||
The code that is generated:
|
||||
<code>set_name (s: STRING) is
|
||||
do
|
||||
end</code>
|
||||
<code>
|
||||
set_name (s: STRING)
|
||||
do
|
||||
end</code>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,30 +4,30 @@
|
||||
What goes into the feature body field is dependent on what kind of feature you wish to generate.
|
||||
* '''do''': this is the normal procedure type. Enter in the field below '''do''' a body for your feature.
|
||||
<code>
|
||||
do_something is
|
||||
do
|
||||
a := b
|
||||
end</code>
|
||||
do_something
|
||||
do
|
||||
a := b
|
||||
end</code>
|
||||
|
||||
* '''once''': this is the type for a routine that is executed once per execution. As a once routine cannot have arguments, it is disabled when you added one or more arguments.
|
||||
<code>
|
||||
init is
|
||||
once
|
||||
load
|
||||
end</code>
|
||||
init
|
||||
once
|
||||
load
|
||||
end</code>
|
||||
|
||||
* '''deferred''': this creates a routine of deferred type. The local and body fields gray out as they serve no use anymore.
|
||||
<code>
|
||||
do_something is
|
||||
deferred
|
||||
end</code>
|
||||
do_something
|
||||
deferred
|
||||
end</code>
|
||||
|
||||
* '''external''': this creates an Eiffel wrap routine around a routine written in another language. Use the body field to enter a string containing the necessary information about the routine using the external syntax.
|
||||
<code>
|
||||
do_something is
|
||||
external
|
||||
"C | %"location.h%""
|
||||
end</code>
|
||||
do_something
|
||||
external
|
||||
"C | %"location.h%""
|
||||
end</code>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,27 +3,36 @@
|
||||
[[Property:uuid|019ea318-e0e0-dae9-a818-e12232aa8431]]
|
||||
The feature you create will be inserted in the feature clause you specified. If the feature clause was not already in your class, or not in the right place, EiffelStudio adds the feature clause to the class text based on the feature clause order specified in the [[Preferences Reference|preferences]] . By default, this is the order used by the Eiffel Software libraries, such as EiffelBase.
|
||||
==Export status==
|
||||
The export status is the class the feature is accessible for. Usually, this is <eiffel>ANY</eiffel> for public features, or <eiffel>NONE</eiffel> for implementation features, but you can specify any class here. <br/>
|
||||
The export status is the class the feature is accessible for. Usually, this is <eiffel>ANY</eiffel> for public features, or <eiffel>NONE</eiffel> for implementation features, but you can specify any class here.
|
||||
|
||||
|
||||
[[Image:feature-wizard-export]]
|
||||
|
||||
|
||||
|
||||
{{note|In the class text, you can export a feature to more than one class but (for simplicity) not with this dialog. }}
|
||||
|
||||
|
||||
|
||||
==Feature clause names==
|
||||
For feature clause names it is recommended that you pick one from the standard ones, but it is also possible to create a new one. If you have introduced a special feature clause name in your project, add it to the feature clause order list in the [[Preferences Reference|preferences]] and it will also appear in this dialog. <br/>
|
||||
For feature clause names it is recommended that you pick one from the standard ones, but it is also possible to create a new one. If you have introduced a special feature clause name in your project, add it to the feature clause order list in the [[Preferences Reference|preferences]] and it will also appear in this dialog.
|
||||
|
||||
|
||||
[[Image:feature-wizard-clausenames]]
|
||||
|
||||
|
||||
==Generated code==
|
||||
The code that is inserted in your class as a result of the selections made for the feature clause, is of the form: <br/>
|
||||
<code>
|
||||
feature {EXPORT} -- Clause name</code><br/>
|
||||
feature {EXPORT} -- Clause name</code><br/>
|
||||
except if you specified <eiffel>ANY</eiffel> as export status, which has the same meaning as not specifying class names in the export status: <br/>
|
||||
<code>
|
||||
feature --Clause name</code>
|
||||
feature --Clause name</code>
|
||||
<br/>
|
||||
|
||||
For example, if you specified a the "Initialization" feature clause name, and specified <eiffel>NONE</eiffel> as export status, you get: <br/>
|
||||
<code>
|
||||
feature {NONE} -- Initialization</code>
|
||||
feature {NONE} -- Initialization</code>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,9 @@ In the header comment field you can type a description of the feature. For style
|
||||
For example, suppose you have an attribute <eiffel>count</eiffel>. You can enter the following header comment:
|
||||
<div> [[Image:feature-wizard-comment]] </div><br/>
|
||||
When clicking '''OK''' this code is generated: <br/>
|
||||
<code>count: INTEGER
|
||||
-- Number of students in course</code>
|
||||
<code>
|
||||
count: INTEGER
|
||||
-- Number of students in course</code>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,13 +2,21 @@
|
||||
[[Property:weight|9]]
|
||||
[[Property:uuid|9f7ec967-0a45-4ad6-4393-521097467192]]
|
||||
When creating an attribute, you can optionally enter or select an invariant for that feature. That invariant will be added to the end of the existing invariant clause. If the invariant clause did not exist before, it is now created.
|
||||
<div> [[Image:feature-wizard-invariant]] </div>
|
||||
|
||||
|
||||
[[Image:feature-wizard-invariant]]
|
||||
|
||||
|
||||
If the attribute is of a reference type, you may select the invariant that the attribute may never be void. If it is of a basic expanded type, some other standard options may be chosen. For example, for <eiffel>INTEGER</eiffel> you may select that it should always be positive.
|
||||
<div> [[Image:feature-wizard-invariant-selected]] </div>
|
||||
|
||||
|
||||
[[Image:feature-wizard-invariant-selected]]
|
||||
|
||||
|
||||
The example above will generate the code:
|
||||
<code>
|
||||
invariant
|
||||
count_positive: count > 0
|
||||
invariant
|
||||
count_positive: count > 0
|
||||
</code>
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[[Property:title|Local variable]]
|
||||
[[Property:weight|5]]
|
||||
[[Property:uuid|423aa67d-99f4-0f81-3709-161a6be43af9]]
|
||||
Enter a local variable in the <code> local </code> field. A local variable clause will be added to the feature:
|
||||
Enter a local variable in the <code>local</code> field. A local variable clause will be added to the feature:
|
||||
<code>
|
||||
...
|
||||
local
|
||||
n: INTEGER
|
||||
...</code>
|
||||
...
|
||||
local
|
||||
n: INTEGER
|
||||
...</code>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
[[Property:uuid|850bd867-5cbf-34d0-f94c-97a75bfa244b]]
|
||||
The feature name field is a text box that lets you enter a name for the feature. For help on how to choose the right name for a feature, see: [http://www.eiffel.com/doc/oosc/ Object-Oriented Software Construction, Second Edition] , paragraph 26.2.
|
||||
|
||||
|
||||
{{warning|EiffelStudio performs no validation on the name you choose. For example if you type a space in it, it will generate the code, and detect a syntax error only when compiling. }}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[[Property:title|Postcondition]]
|
||||
[[Property:weight|7]]
|
||||
[[Property:uuid|b8196d6c-2a0f-c06e-855f-d9fe23cbe950]]
|
||||
Enter a postcondition in the <code> ensure </code> field. A postcondition clause will be added to the feature:
|
||||
<code>...
|
||||
ensure
|
||||
n = count</code>
|
||||
Enter a postcondition in the <code>ensure</code> field. A postcondition clause will be added to the feature:
|
||||
<code>
|
||||
...
|
||||
ensure
|
||||
n = count</code>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
[[Property:title|Precondition]]
|
||||
[[Property:weight|4]]
|
||||
[[Property:uuid|29b32f9e-799d-de91-d62d-79bdb509144b]]
|
||||
Enter a precondition in the <code> require </code> field. A precondition clause will be added to the feature:
|
||||
Enter a precondition in the <code>require</code> field. A precondition clause will be added to the feature:
|
||||
<code>
|
||||
...
|
||||
require
|
||||
n >= 0
|
||||
...</code>
|
||||
...
|
||||
require
|
||||
n >= 0
|
||||
...</code>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,21 +2,29 @@
|
||||
[[Property:weight|10]]
|
||||
[[Property:uuid|46b84038-099b-070c-15d7-2b7884a50e01]]
|
||||
When creating an attribute, it is common that you will also need a set-procedure for it. For example, for attribute <eiffel>property</eiffel> you need a procedure <eiffel>set_property</eiffel> to set it. This feature takes one argument of the same type as <eiffel>property</eiffel> or is anchored to it. The only thing you have to do with the feature wizard is check the button '''Generate set procedure'''.
|
||||
<div> [[Image:feature-wizard-setprocedure]] </div>
|
||||
The feature that is generated in addition to the attribute itself is placed in feature clause <code> Element change </code> and is exported to all classes. If you have selected or entered an invariant, the precondition will protect this invariant. Example of a generated set-procedure:
|
||||
<div> [[Image:feature-wizard-setprocedure-example]] </div>
|
||||
<code>
|
||||
feature -- Element change
|
||||
|
||||
set_button (a_button: EV_BUTTON) is
|
||||
-- Assign `a_button' to `button'
|
||||
require
|
||||
a_button_not_void: a_button /= Void
|
||||
do
|
||||
button := a_button
|
||||
ensure
|
||||
button_assigned: button = a_button
|
||||
end
|
||||
|
||||
[[Image:feature-wizard-setprocedure]]
|
||||
|
||||
|
||||
The feature that is generated in addition to the attribute itself is placed in feature clause <code>Element change</code> and is exported to all classes. If you have selected or entered an invariant, the precondition will protect this invariant. Example of a generated set-procedure:
|
||||
|
||||
|
||||
[[Image:feature-wizard-setprocedure-example]]
|
||||
|
||||
|
||||
<code>
|
||||
feature -- Element change
|
||||
|
||||
set_button (a_button: EV_BUTTON)
|
||||
-- Assign `a_button' to `button'
|
||||
require
|
||||
a_button_not_void: a_button /= Void
|
||||
do
|
||||
button := a_button
|
||||
ensure
|
||||
button_assigned: button = a_button
|
||||
end
|
||||
</code>
|
||||
|
||||
|
||||
|
||||
@@ -2,23 +2,42 @@
|
||||
[[Property:weight|8]]
|
||||
[[Property:uuid|b2bd8280-a738-dae4-73aa-c1e232245022]]
|
||||
Whenever you need to give a type of something in the dialog, the type selection component is used. The type selection lets you type any class name or you can pick one from the list.
|
||||
<div> [[Image:feature-wizard-typeselection]] </div>
|
||||
|
||||
|
||||
[[Image:feature-wizard-typeselection]]
|
||||
|
||||
|
||||
When you select a class that is in the system and has formal generic parameters, the type selection component lets you specify an actual generic parameter in another type selection.
|
||||
<div> [[Image:feature-wizard-generictype]] </div>
|
||||
{{note|the window might grow in size because of the added component. }}
|
||||
|
||||
|
||||
[[Image:feature-wizard-generictype]]
|
||||
|
||||
|
||||
{{note|The window might grow in size because of the added component. }}
|
||||
|
||||
|
||||
Since the actual generic type selection is also a type selection, you can select another class with generic parameters and nest them as deep as you need.
|
||||
<div> [[Image:feature-wizard-generictyperec]] </div>
|
||||
|
||||
|
||||
[[Image:feature-wizard-generictyperec]]
|
||||
|
||||
|
||||
You can also select the type <eiffel>TUPLE</eiffel>, which is a special class that can have zero or more generic parameters. When you select it, it has no parameters, but you can add one by clicking on the '''Add parameter''' button. Click it as often as the number of generic parameters that you need.
|
||||
<div> [[Image:feature-wizard-tupletype2]] <br/>
|
||||
</div>
|
||||
{{warning|if you need a very complex type, it is better not to use the dialog, as the window might grow bigger than your screen. After you completed the feature, edit it manually in the class text. }}
|
||||
|
||||
|
||||
[[Image:feature-wizard-tupletype2]]
|
||||
|
||||
|
||||
{{warning|If you need a very complex type, it is better not to use the dialog, as the window might grow bigger than your screen. After you completed the feature, edit it manually in the class text. }}
|
||||
|
||||
|
||||
The code generated for the selected type is quite straightforward, an example:
|
||||
<div> [[Image:feature-wizard-complextype]] <br/>
|
||||
</div>
|
||||
|
||||
|
||||
[[Image:feature-wizard-complextype]]
|
||||
|
||||
<code>
|
||||
new_feature: FUNCTION [ANY, TUPLE [INTEGER], BOOLEAN]
|
||||
new_feature: FUNCTION [ANY, TUPLE [INTEGER], BOOLEAN]
|
||||
</code>
|
||||
|
||||
|
||||
|
||||
@@ -17,20 +17,21 @@ When clicking '''Function''', the dialog changes to the function layout. It has
|
||||
This dialog box:<br/>
|
||||
<div> [[Image:feature-wizard-function-example]] </div><br/>
|
||||
Produces this feature:<br/>
|
||||
<code>class
|
||||
PRODUCT
|
||||
<code>
|
||||
class
|
||||
PRODUCT
|
||||
|
||||
feature -- Status report
|
||||
|
||||
order_price (quantity: INTEGER): DOUBLE is
|
||||
-- Total price when ordering `quantity'.
|
||||
require
|
||||
quantity_non_negative: quantity >= 0
|
||||
do
|
||||
Result := quantity * price
|
||||
ensure
|
||||
correct: Result = quantity * price
|
||||
end
|
||||
order_price (quantity: INTEGER): DOUBLE
|
||||
-- Total price when ordering `quantity'.
|
||||
require
|
||||
quantity_non_negative: quantity >= 0
|
||||
do
|
||||
Result := quantity * price
|
||||
ensure
|
||||
correct: Result = quantity * price
|
||||
end
|
||||
|
||||
end -- class PRODUCT</code>
|
||||
|
||||
|
||||
@@ -20,19 +20,19 @@ This dialog box:<br/>
|
||||
Produces this feature:<br/>
|
||||
<code>
|
||||
class
|
||||
PRODUCT
|
||||
PRODUCT
|
||||
|
||||
feature {PERSON} -- Element change
|
||||
|
||||
place_order (person: PERSON; quantity: INTEGER) is
|
||||
-- Mail `quantity' to `person'.
|
||||
require
|
||||
person /= Void and quantity > 0
|
||||
do
|
||||
person.mail_order (Current, quantity)
|
||||
ensure
|
||||
person.has_ordered (Current)
|
||||
end
|
||||
place_order (person: PERSON; quantity: INTEGER)
|
||||
-- Mail `quantity' to `person'.
|
||||
require
|
||||
person /= Void and quantity > 0
|
||||
do
|
||||
person.mail_order (Current, quantity)
|
||||
ensure
|
||||
person.has_ordered (Current)
|
||||
end
|
||||
|
||||
end -- class PRODUCT</code>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ The second screen of the wizard lets you reuse a previously generated ''Executio
|
||||
|
||||
The profiler wizard has detected that one or more ''Execution Profiles'' have already been generated for this system in this compilation mode. If you have executed your system after the generation of the existing profile, select '''Generate a profile from Run-time information record''' to create a new ''Execution Profile'' for the newly produced ''Run-time information record''.
|
||||
|
||||
{{note|If you choose '''Generate a profile from Run-time information record''' the generated ''Execution Profile'' will be written into ''<project_directory>/EIFGENa/target_name/W_CODE/profinfo.pfi'' if you have selected '''Workbench mode''' in the first step, or ''<project_directory>/EIFGENs/target_name/F_CODE/profinfo.pfi'' if you have selected '''Finalized mode'''. If a file with the same name already exists its content will be destroyed and replaced. }}
|
||||
{{note|If you choose '''Generate a profile from Run-time information record''' the generated ''Execution Profile'' will be written into: <br/><br/>''<project_directory>/EIFGENa/target_name/W_CODE/profinfo.pfi'' <br/><br/>if you have selected '''Workbench mode''' in the first step, or into: <br/><br/>''<project_directory>/EIFGENs/target_name/F_CODE/profinfo.pfi'' <br/><br/>if you have selected '''Finalized mode'''. If a file with the same name already exists its content will be destroyed and replaced. }}
|
||||
<br/>
|
||||
|
||||
However, if you have not executed your system since the generation of the last ''Execution Profile'', there is no need to generate a new ''Execution Profile''. If you are in the latter case, select '''Use existing profile''' and choose the last ''Execution Profile'' you have generated.
|
||||
|
||||
@@ -5,6 +5,7 @@ The third screen of the wizard lets you generate an ''Execution Profile'' from a
|
||||
|
||||
Then, in the combo box labeled '''Profiler used to produce the above record''', select the profiler that has been used to produce the ''Run-time information record'' you have entered. If the profiler used to execute the system does not appear in the combo box, you have to add it. See [[How to set up a Profiler Configuration File|How to set up a Profiler Configuration File]] for more details on how to do so.
|
||||
|
||||
|
||||
{{note|The Run-time information record must be located in the ''EIFGENs/target_name/W_code'' directory of your project. }}
|
||||
|
||||
<br/>
|
||||
@@ -13,7 +14,8 @@ Then, in the combo box labeled '''Profiler used to produce the above record''',
|
||||
|
||||
|
||||
Clicking '''Next''' will lead you to the [[Select the information you need and formulate your query|Final state]] if the provided ''Run-time information record'' is valid. If the ''Run-time information record'' is not valid or is not located in the ''EIFGENs/target_name/W_code'' directory of the project, you will go to the '''Run-time Information Record Error state''' as shown below.
|
||||
<br/>
|
||||
|
||||
|
||||
[[Image:profiler-wizard-rtir-error-state]] <br/>
|
||||
<br/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user