Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Generating Scintilla wrapper using Scintilla.iface
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Denis V. Shelomovskij  
View profile  
 More options Jun 15 2012, 4:31 am
From: "Denis V. Shelomovskij" <verylonglo...@gmail.com>
Date: Fri, 15 Jun 2012 01:31:35 -0700 (PDT)
Local: Fri, Jun 15 2012 4:31 am
Subject: Generating Scintilla wrapper using Scintilla.iface

I'm creating a Scintilla wrapper for D programming language. I want this wrapper to be auto-generated using Scintilla.iface but I faced some problems and have to change the file. My repo:
https://github.com/denis-sh/Scintilla.iface-improvements

I hope changes in `master` branch are obvious and needed for general wrapper generation and at least some of them can be merged in the main repo.

The main problem is that 3 functions are inconsistent (nothing is tested yet, it's just a result of reading Scintilla sources but all other functions looks consistent). You can see them in `strange-funcs` branch (e.g. click Branches->Compare in github to see diff with `master`). I'm temporary generating incorrect wrapper for them using descriptions in `simplified` branch.

So my questions:
1. Can (some of) my change be merged back?
2. Can you make `GetText` function consistent?
3. Can you fix `GetSelText` function? Patch:
diff -r 597445a1063c src/Editor.cxx
--- a/src/Editor.cxx    Mon Apr 30 12:48:10 2012 +1000
+++ b/src/Editor.cxx    Fri Jun 15 12:24:40 2012 +0400
@@ -7301,14 +7301,15 @@
                                return selectedText.len ? selectedText.len : 1;
                        } else {
                                char *ptr = CharPtrFromSPtr(lParam);
-                               int iChar = 0;
                                if (selectedText.len) {
+                                       int iChar = 0;
                                        for (; iChar < selectedText.len; iChar++)
                                                ptr[iChar] = selectedText.s[iChar];
+                                       return iChar;
                                } else {
                                        ptr[0] = '\0';
+                                       return 1;
                                }
-                               return iChar;
                        }
                }


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Hodgson  
View profile  
 More options Jun 15 2012, 9:07 pm
From: Neil Hodgson <nyamaton...@me.com>
Date: Sat, 16 Jun 2012 11:07:09 +1000
Local: Fri, Jun 15 2012 9:07 pm
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface
Denis V. Shelomovskij:

> I'm creating a Scintilla wrapper for D programming language. I want this wrapper to be auto-generated using Scintilla.iface but I faced some problems and have to change the file. My repo:
> https://github.com/denis-sh/Scintilla.iface-improvements

> I hope changes in `master` branch are obvious and needed for general wrapper generation and at least some of them can be merged in the main repo.

   Scintilla.iface is used by downstream projects to determine how they see the API of Scintilla. Changes to this file will have large impacts on existing code and will need strong justification. In particular, adding new types to Scintilla.iface and modifying existing APIs to use these types will break existing use.

   API stability is a very important asset of the project allowing users to invest in Scintilla. I will not accept changes that devalue that investment.

> The main problem is that 3 functions are inconsistent (nothing is tested yet, it's just a result of reading Scintilla sources but all other functions looks consistent). You can see them in `strange-funcs` branch (e.g. click Branches->Compare in github to see diff with `master`).

   The reasons for some of the older APIs being inconsistent are historical. Initially Scintilla partially emulated the windows text edit and rich edit controls and some of the EM_* messages supported by that control. The old messages are listed in SciMessageFromEM. The text edit control behaved inconsistently and IIRC changed between versions. Scintilla evolved behaviour that worked with various clients that were built with different assumptions about API behaviour. It was much work to get these APIs working as well as they do so don't break that for consistency.

   That is: leave all messages mentioned in SciMessageFromEM alone. If there is significant benefit then add a new improved API.

   Neil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Denis V. Shelomovskij  
View profile  
 More options Jun 16 2012, 2:47 am
From: "Denis V. Shelomovskij" <verylonglo...@gmail.com>
Date: Fri, 15 Jun 2012 23:47:49 -0700 (PDT)
Local: Sat, Jun 16 2012 2:47 am
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface

At least these changes are just fixes for current *.iface file:
https://github.com/denis-sh/Scintilla.iface-improvements/commits/fixe...
Can they be merged?

Really sorry, but I can't imagine how existing *.iface file can be used for
automated generation of anything. It just hasn't enough information about
function arguments/results forcing user to work with strings as pointers
and carefully read documentation. Not sure if I managed to find appropriate
description for every string function exact argument type. This situation
is too error-prone to leave it as is.

>  That is: leave all messages mentioned in SciMessageFromEM alone. If there
> is significant benefit then add a new improved API.

 Thanks for the explanation.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Hodgson  
View profile  
 More options Jun 17 2012, 9:07 pm
From: Neil Hodgson <nyamaton...@me.com>
Date: Mon, 18 Jun 2012 11:07:13 +1000
Local: Sun, Jun 17 2012 9:07 pm
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface

Denis V. Shelomovskij:

> At least these changes are just fixes for current *.iface file: https://github.com/denis-sh/Scintilla.iface-improvements/commits/fixe...
> Can they be merged?

   They would have to be reviewed.

   I had a quick look and there is a problem in c37025f with the use of set for APIs like SetSelFore. Properties may be in 2 forms: either simple values or indexed properties where there is one value per valid index. The "get" and "set" feature types should only be used for properties. SetSelFore has two parameters but the first is not an index, instead being a flag specifying whether to use the second parameter. Since it can't be implemented as a property, it shouldn't change to "set".

> Really sorry, but I can't imagine how existing *.iface file can be used for automated generation of anything.

   Its been in use in many projects for a long period, so seems to have some value.

   Neil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Philippe Lhoste  
View profile  
 More options Jun 18 2012, 4:52 am
From: Philippe Lhoste <Phi...@GMX.net>
Date: Mon, 18 Jun 2012 10:52:16 +0200
Local: Mon, Jun 18 2012 4:52 am
Subject: Re: Generating Scintilla wrapper using Scintilla.iface
On 16/06/2012 08:47, Denis V. Shelomovskij wrote:

> Really sorry, but I can't imagine how existing *.iface file can be used for automated
> generation of anything. It just hasn't enough information about function arguments/results
> forcing user to work with strings as pointers and carefully read documentation. Not sure
> if I managed to find appropriate description for every string function exact argument
> type. This situation is too error-prone to leave it as is.

It is designed for automated generation from the start, since it is easier to parse than a
full C file.

It usage starts by generating source files for Scintilla itself, and it is also used by
the Lua interface for SciTE.
I think it is also used by several scripting languages wanting to include Scintilla in a GUI.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Hodgson  
View profile  
 More options Jul 4 2012, 6:42 am
From: Neil Hodgson <nyamaton...@me.com>
Date: Wed, 04 Jul 2012 10:42:23 +0000 (GMT)
Local: Wed, Jul 4 2012 6:42 am
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface

   After examining the list of proposed API changes at https://github.com/denis-sh/Scintilla.iface-improvements/commits/fixe..., there are some that appear reasonable and others that don't. Attached are two patches: APIUp.patch contains changes that appear OK and NoSimpl.patch contains the changes I don't want to include.

   The main reason for not including changes is that they try to convert functions with two parameters to properties where the first parameter is not an index. Some other functions are unsuitable as they are irregular such as GetCurLine which returns the caret position, not the size of the string returned.

   Finally, indexed parameters are normally used for fixed sets of indices like a set of styles, not for a dynamic set of indices like the set of lines in a document. This is more of a judgement call but there isn't a great loss of function in requiring access to these as functions instead of properties. Not everything that "get"s data needs to be a property.

   Downstream projects should be aware that changing functions to properties will change bindings generated from Scintilla.iface and this may require code that uses those bindings to be changed,

   Neil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg  
View profile  
 More options Jul 5 2012, 5:28 am
From: Greg <g...@ced.co.uk>
Date: Thu, 5 Jul 2012 02:28:13 -0700 (PDT)
Local: Thurs, Jul 5 2012 5:28 am
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface

When I started to use Scintilla I wrote myself a script that translated the
.iface file into methods in a C++ class, and this worked well for a long
time. However, I found the need to have two classes of call: ones that can
throw (basically calls that allocate memory) and calls that do not. From
that point I worked by looking at a diff of the interface each time a new
version was released and handling the changes manually, which is not that
big a task as the changes are generally not large. It would be really nice
to be able to return to auto-generating the interface... I know that I
could make all the calls use the throw detection route, but it feels an
unnecessary overhead in many cases. Would you consider adding a "nothrow"
to the end of fun, get and set lines that do not throw (or "canthrow" to
those that can)? It coud be hidden in a comment before the function
definition...

This would likely break existing import scripts, so I quite understand a
resounding "No". Perhaps you could poll to see how many projects rely on
the .iface file?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Hodgson  
View profile  
 More options Jul 6 2012, 12:04 am
From: Neil Hodgson <nyamaton...@me.com>
Date: Fri, 06 Jul 2012 14:04:23 +1000
Local: Fri, Jul 6 2012 12:04 am
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface
Greg:

> However, I found the need to have two classes of call: ones that can throw (basically calls that allocate memory) and calls that do not.

   It can be quite difficult to work out which calls can throw. Anything that could produce an event, including a macro-record event such as moving the cursor could lead to reentrance and setting the error code. Gradually, std::string and std::vector are infiltrating the code and wherever they are used, there's a possibly of exhausting memory.

> I know that I could make all the calls use the throw detection route, but it feels an unnecessary overhead in many cases. Would you consider adding a "nothrow" to the end of fun, get and set lines that do not throw (or "canthrow" to those that can)? It coud be hidden in a comment before the function definition…

   There are multiple ways to add the attribute if it really is warranted. If a method is marked nothrow then changing this could be considered breaking compatibility if clients are relying on it.

   Is removing error detection from some methods a significant improvement?

   Neil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lex Trotman  
View profile   Translate to Translated (View Original)
 More options Jul 6 2012, 12:50 am
From: Lex Trotman <ele...@gmail.com>
Date: Fri, 6 Jul 2012 14:50:34 +1000
Local: Fri, Jul 6 2012 12:50 am
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface
On 6 July 2012 14:04, Neil Hodgson <nyamaton...@me.com> wrote:

> Greg:

>> However, I found the need to have two classes of call: ones that can throw (basically calls that allocate memory) and calls that do not.

>    It can be quite difficult to work out which calls can throw. Anything that could produce an event, including a macro-record event such as moving the cursor could lead to reentrance and setting the error code. Gradually, std::string and std::vector are infiltrating the code and wherever they are used, there's a possibly of exhausting memory.

>> I know that I could make all the calls use the throw detection route, but it feels an unnecessary overhead in many cases. Would you consider adding a "nothrow" to the end of fun, get and set lines that do not throw (or "canthrow" to those that can)? It coud be hidden in a comment before the function definition…

>    There are multiple ways to add the attribute if it really is warranted. If a method is marked nothrow then changing this could be considered breaking compatibility if clients are relying on it.

>    Is removing error detection from some methods a significant improvement?

Hi Neil,

Its unlikely to be significant.

Although not a disinterested evaluation :) see
http://www.open-std.org/jtc1/sc22/wg21/docs/TR18015.pdf especially the
exceptions part.

Basically it depends on your compiler so much that for a portable app
like Scintilla you can't tell what the effect might be.

Cheers
Lex


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Neil Hodgson  
View profile  
 More options Jul 8 2012, 7:07 pm
From: Neil Hodgson <nyamaton...@me.com>
Date: Mon, 09 Jul 2012 09:07:53 +1000
Local: Sun, Jul 8 2012 7:07 pm
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface
   The changes have now been committed.

   Neil


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Denis V. Shelomovskij  
View profile  
 More options Jul 9 2012, 3:41 am
From: "Denis V. Shelomovskij" <verylonglo...@gmail.com>
Date: Mon, 9 Jul 2012 00:41:09 -0700 (PDT)
Local: Mon, Jul 9 2012 3:41 am
Subject: Re: [scintilla] Generating Scintilla wrapper using Scintilla.iface

Thanks!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »