Converting EiffelVision 2 Systems to Void-Safety
Introduction
In order to convert systems that employ EiffelVision 2 (Vision2) to void-safety, some adjustments may be needed depending on its usage. This page describes the various usage scenarios of Vision2 that will need to be converted in order to adhere to void-safety.
If you have classes that inherit from a Vision2 interface class such as EV_DRAWING_AREA, the first change that has to be made is to alter
Example from EV_TIMEOUT
create_interface_objects
-- <Precursor>
do
create actions
end
create_implementation
-- Create implementation of timeout.
do
create {EV_TIMEOUT_IMP} implementation.make
end
Inheritance from an Implementation Interface Class with Associating Interface Class
If you have an existing, custom platform-dependent implementation, a few more changes will be needed above and beyond those required for the interface class.
For interface class changes, now the interface object is passed to the implementation after creation, via
An example from the conversion of the Windows implementation of EV_BUTTON_IMP:
make (an_interface: like interface)
-- Create `Current' with interface `an_interface'.
do
base_make (an_interface)
wel_make (default_parent, "", 0, 0, 0, 0, 0)
extra_width := 20
text_alignment := default_alignment
-- Retrieve the theme for the button.
open_theme := application_imp.theme_drawer.open_theme_data (wel_item, "Button")
end
initialize
-- Initialize `Current'.
do
Precursor {EV_PRIMITIVE_IMP}
set_default_font
end
interface: EV_BUTTON;
would become:
make
-- Initialize `Current'.
do
wel_make (default_parent, "", 0, 0, 0, 0, 0)
extra_width := 20
text_alignment := default_alignment
-- Retrieve the theme for the button.
open_theme := application_imp.theme_drawer.open_theme_data (wel_item, "Button")
Precursor {EV_PRIMITIVE_IMP}
set_default_font
end
interface: detachable EV_BUTTON note option: stable attribute end;
The following steps are needed during the conversion:
- The attribute
`interface' needs to be made a stable attribute. The converted`interface' attribute shows the syntax for doing so.
- Copy any initialization of the widget from
`make' to`initialize' excluding`base_make' setup. Any initialization code that relies on`interface' would have to be rewritten so that`interface' gets passed to the new creation routine, which in turn calls the original`make' . SeeEV_PRINT_PROJECTOR_IMP on Windows`make_with_context' for an example of this.
- Remove
`make' , rename`initialize' to`make' , and make sure that any calls to Precursor do not override any settings set in`initialize' . The ordering may need to be changed in order to make the code void-safe. SeeEV_POPUP_WINDOW_IMP.make (Windows implementation) where the setting of`user_can_resize' is performed after the Precursor call so that is doesn't get overriden.