Re: Re: Assertion name not printed when using rescue

[email protected]
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <OFEE5E8A52.A24BDABF-ONC1256FDA.0022919F-C1256FDA.002616B4@mpsa.com>
> I am sorry, but I don't know C/C++ at all. That's why I'm using
> Eiffel. :) It was not easy for me just to link ncurses.h to my
> SmartEiffel program. I can see in sf_newt.c that you can have some
> hooks to be executed when runtime error happens but I don't understand
> how I could use that in my program (which is written in Eiffel, just
> calling some basic ncurses routines).

How do you call those routines? Using c_inline_c? This method is really 
discouraged. It is useful for small prototyping but you quickly strike its 
limits, and your problem is one of them.

You should write an external plugin as I did. For example, look at 
http://www.cadrian.net/svn/SmartFactor/trunk/source/interfaces/dialog/newt/sf_newt_context.e 
which calls the C routine sf_newt_init (look for the `plugin_init' 
feature)

More explanations on how this works:

CAVEAT: the following only works with the upcoming 2.2 release, you should 
therefore download the latest snapshot. The plug_in external already 
exists in 2.1, but in a somewhat less powerful flavour.

An external plugin is a two-part component: it has an Eiffel part, and a C 
part. The Eiffel part is just glue code that calls the C part.

The Eiffel feature `plugin_init' is an external call. In that case, it is 
defined as an external "plug_in". This external specification requires an 
alias that describes:

  - its "location" i.e. the directory where the plugin should be found. I 
usually use "." but the standard SmartEiffel library for instance usually 
uses "${sys}plugins" (look at INPUT_STREAM for example)

  - its "module_name" i.e. the directory where the plugin is put. This 
directory must be a subdirectory of the location. It is separate from the 
location because it can describe something else (2.1 compatibility, out of 
scope of this mail). This directory should, in your case, contain a 
directory named "c" which contains C files (.c and .h) and a special 
"libs" file which describes the libraries to link into your executable, 
and maybe a "paths" file if some include paths have to be passed to the C 
compiler. For examples, look either at Vision (included in SmartEiffel) or 
SmartFactor.

  - its "feature_name" i.e. the name of the C symbol to use. It can be 
either a macro, a function or a global variable.

> I was programming some 20 years ago in assembler and now I am looking
> for some different higher level language. And C/C++ is not that
> language. :)

I understand that ;o) but knowing a bit of C cannot harm. To me C is just 
a multiplatform assembler.

PS- I'm sorry you cannot download the whole SmartFactor release anymore. I 
have technical problems, I'll put the feature back online some day. Stay 
tuned ;o)

Best regards,
--
Cyril Adrian -- ALPLOG
@ PSA Peugeot Citroën, Sochaux, France
tél. +33 (0)3 81 33 48 76
fax +33 (0)3 81 33 16 06
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.