Re: SE
Colnet Dominique <[email protected]> Fri, 17 Feb 2006 09:27:21 +0100
| Newsgroups | gmane.comp.lang.eiffel.smalleiffel |
|---|---|
| Message-ID | <[email protected]> |
Andy Suter wrote:
> Hello SE-Team
Hi Andy,
> I have some proposals for some SE libraries. I was not sure who should
> receive this mail, so I sent it to you. I hope you will find some
> constructive ideas.
Well, I finally found your mail in my Junk mail ;-)
>
> 1.
> SET does not (yet) inherit from TRAVERSABLE. It would make sense in my
> opinion. All features from TRAVERSABLE but 'first' and 'last' are
> already present in SET.
At first sight, I think you are right. I will discuss that with Frederic
which has added this traversable class.
Or may be, first/last should be separated in another ability class?
Don't know yet.
>
> 2.
> I found several occurences of the agent based features 'do_all',
> 'exists' and 'for_all'. They seem to be copy-pasted into the different
> classes. As they only use 'upper', 'lower' and 'item' it would be
> consequent – at least from my point of view - to have exactly one class
> that implements those features. TRAVERSABLE is the one that would make
> sense.
Or adding another ability?
> As a further extension of this idea, those features could be part of
> class ITERATOR as well.
Thank you for this idea too.
>
> 3.
> Faster implementation of intersection for SET. First the smaller set is
> choosen and thus this it is faster especially if 'other' is much bigger
> than 'Current'.
I will forward your mail to the team. They will probably take in account
your suggestions.
>
> infix "^" (other: like Current): like Current is
> -- Return the intersection of the `Current' set with `other'.
> require
> other /= Void
> do
> if Current.count < other.count then
> Result := twin
> Result.intersection(other)
> else
> Result := other.twin
> Result.intersection(Current)
> end
> ensure
> Result.count <= other.count.min(count)
> Result.is_subset_of(Current) and then Result.is_subset_of(other)
> end
>
> 4.
> As I was working with the very interesting sequencer implementation I
> found a “TODO” comments in class LOOP_STACK: 'current_loop' "TODO:
> change this function into an attribute to be more efficient". So here it
> is. For beeing "sure" that both implementations are equal, I added two
> invariants. (I just saw that I removed the copyrights from the
> attachement, sorry.)
>
> 5.
> OpenGL does not work on Windows XP. There are several C-syntax errors in
> the code of 'opengl.c'. I fixed them all, but several modifications were
> still needed. The compilation now is successful but it still does not
> work. I did not post this to SmartZilla as it seams to me that the
> implementation of Vision for Windows and the one for OpenGL on Windows
> are too different. E.g. OpenGL uses no semaphors etc... I do not know
> wheter there is a stable SmartGL implementation for Windows platforms.
> (I used your default Windows installation SE 2.2)
>
> Best regards,
> Andy
Thanks,
>
>
> ------------------------------------------------------------------------
>
> class LOOP_STACK
> -- Manage `LOOP_ITEM'. When new loop is pushed, all jobs in current
> -- running loop suspend until the new loop end (all jobs end or break).
> --
>
> creation {ANY}
> make
>
> feature {}
> loop_stack: FAST_ARRAY[LOOP_ITEM]
>
> make is
> do
> create loop_stack.make(0)
> create current_loop.make
> loop_stack.add_last(current_loop)
> ensure
> current_loop /= Void
> end
>
> feature {ANY}
> stop: BOOLEAN
>
> new_loop is
> -- create new empty loop (ie without job) and push it on the stack
> local
> loop_item: LOOP_ITEM
> do
> if current_loop /= Void then
> current_loop.pause_loop
> end
>
> create current_loop.make
> loop_stack.add_last(current_loop)
> end
>
> push_loop (l: like current_loop) is
> -- `l' is restarted and pushed on the stack
> require
> l /= Void
> do
> if current_loop /= Void then
> current_loop.pause_loop
> end
>
> current_loop := l
> loop_stack.add_last(current_loop)
> current_loop.restart
> ensure
> current_loop = l
> end
>
> run is
> -- run `current_loop' (ie execute it's jobs)
> require
> current_loop /= Void
> do
> from
> stop := False
> until
> current_loop = Void
> or else stop
> loop
> current_loop.run
>
> if current_loop /= Void and then not current_loop.pause then
> loop_stack.remove_last
>
> if loop_stack.is_empty then
> current_loop := Void
> else
> current_loop := loop_stack.last
> end
> end
> end
> ensure
> loop_stack.is_empty
> end
>
> add_job (j: JOB) is
> -- Add some job to the current loop
> require
> j /= Void
> do
> current_loop.add_job(j)
> end
>
> break is
> -- Exit current loop
> require
> current_loop /= Void
> do
> current_loop.break_loop
> loop_stack.remove_last
>
> if loop_stack.is_empty then
> current_loop := Void
> else
> current_loop := loop_stack.last
> end
> ensure
> current_loop /= old current_loop
> end
>
> exit_all is
> --TODO: Really needed feature ?
> require
> stop = False
> do
> stop := True
> current_loop.pause_loop
> ensure
> stop = True
> end
>
> current_loop: LOOP_ITEM
>
> invariant
> non_empty_definition: not loop_stack.is_empty implies current_loop = loop_stack.last
> empty_defintion: loop_stack.is_empty = (current_loop = Void)
>
> end -- class LOOP_STACK
--
--------------------------------------------------------------
[email protected] -- IUT (Nancy 2) -- INRIA Lorraine
http://SmartEiffel.loria.fr -- The GNU Eiffel Compiler
POST: Loria, B.P. 239,54506 Vandoeuvre les Nancy Cedex, FRANCE
Voice:+33 0383913140 Mobile: +33 0665362381 Fax:+33 0383581701