Scintilla.h changes

47 views
Skip to first unread message

Neil Hodgson

unread,
Nov 14, 2016, 5:05:19 PM11/14/16
to Scintilla mailing list
With the recent discussion of the Scintilla namespace in Scintilla.h, there are a couple of other issues that could be improved.

#define X Sci_X:

When the structs received “Sci_” prefixes in 2009, the intention was to later remove the old names which are more likely to clash with application names. These currently have #defines:

#define CharacterRange Sci_CharacterRange
#define TextRange Sci_TextRange
#define TextToFind Sci_TextToFind
#define RangeToFormat Sci_RangeToFormat
#define NotifyHeader Sci_NotifyHeader

The original thread about “branding structs”:
https://groups.google.com/d/topic/scintilla-interest/sodUr-UU1W0/discussion

I’d like to remove these #define statements. They will first move into an #ifdef INCLUDE_DEPRECATED_FEATURES section like old APIs for a release or two before disappearing completely.

uptr_t and sptr_t:

These typedefs are very old with the current versions from 2001/2002. The C99 language standard has intptr_t and uintptr_t available from stdint.h. Unfortunately Microsoft put these definitions in stddef.h as there was no stdint.h in VS2008 or the original release of VS2010. The replacement code could look like:

/* Define uptr_t, an unsigned integer type large enough to hold a pointer and
* sptr_t, a signed integer large enough to hold a pointer. */
#if defined(_MSC_VER)
// Older releases of MSVC did not have stdint.h.
#include <stddef.h>
#else
#include <stdint.h>
#endif
typedef uintptr_t uptr_t;
typedef intptr_t sptr_t;

When support is dropped for older versions of Visual C++, the conditional includes could be changed to just #include <stdint.h>.

Neil


Neil Hodgson

unread,
Nov 16, 2016, 3:31:43 PM11/16/16
to scintilla...@googlegroups.com
These changes have been committed.

Three deprecated symbols were also removed from Scintilla.h: SC_CP_DBCS, SCI_SETUSEPALETTE. and SCI_GETUSEPALETTE. These have been deprecated and performed no action for over 5 years.

Moving unbranded struct names into #ifdef section:
https://sourceforge.net/p/scintilla/code/ci/fa6a886a942f6eae463e00861aa4e2d952dbf546/

Removing deprecated features:
https://sourceforge.net/p/scintilla/code/ci/a26e3b1b7055587d1668ed478a32c3bcae0ba487/

Using standardised types for uptr_t and sptr_t:
https://sourceforge.net/p/scintilla/code/ci/c050091192ef4a0430c5cc870f2e27e846a31f22/

Neil

johnsonj

unread,
Nov 16, 2016, 6:54:21 PM11/16/16
to scintilla-interest, nyama...@me.com

    <h3 id="RemovedMessages">Features that have been removed</h2>

1. it seems that <h3> be changed <h2>.
2. May RemovedMessages be intended for RemovedFeatures?
   There is already RemovedFeatures section.

    <h2 id="RemovedFeatures">Removed features</h2>


Thank you for your hard works!
---------------------------------------------------------------------------------------------------------------
diff -r 3030726762cc doc/ScintillaDoc.html
--- a/doc/ScintillaDoc.html    Wed Nov 16 11:46:39 2016 +1100
+++ b/doc/ScintillaDoc.html    Thu Nov 17 08:42:50 2016 +0900
@@ -7876,19 +7876,6 @@
      Any use of these symbols should be removed and replaced with <a href="#Indicators">standard indicators</a>.
     <code>SCI_GETSTYLEBITS</code> and <code>SCI_GETSTYLEBITSNEEDED</code> always return 8,
     indicating that 8 bits are used for styling and there are 256 styles.</p>
-   
-    <h3 id="RemovedMessages">Features that have been removed</h2>
-
-    <p>These features have now been removed completely.</p>
-
-    <p><b id="SC_CP_DBCS">SC_CP_DBCS</b> Removed<br />
-     This was used to set a DBCS (Double Byte Character Set) mode on GTK+.
-     An explicit DBCS code page should be used when calling <a class="seealso" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE</a></p>
-
-    <p><b id="SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool usePalette)</b> Removed<br />
-    <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE &rarr; bool</b> Removed<br />
-     Scintilla no longer supports palette mode. The last version to support palettes was 2.29.
-     Any calls to these methods must be removed.</p>
 
     <h2 id="EditMessagesNeverSupportedByScintilla">Edit messages never supported by Scintilla</h2>
 <pre>
@@ -7926,6 +7913,16 @@
     be sensibly handled. Unsupported messages have no effect.</p>
 
     <h2 id="RemovedFeatures">Removed features</h2>
+    <p>These features have now been removed completely.</p>
+
+    <p><b id="SC_CP_DBCS">SC_CP_DBCS</b> Removed<br />
+     This was used to set a DBCS (Double Byte Character Set) mode on GTK+.
+     An explicit DBCS code page should be used when calling <a class="seealso" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE</a></p>
+
+    <p><b id="SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool usePalette)</b> Removed<br />
+    <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE &rarr; bool</b> Removed<br />
+     Scintilla no longer supports palette mode. The last version to support palettes was 2.29.
+     Any calls to these methods must be removed.</p>
 
     <p>Previous versions of Scintilla allowed indicators to be stored in bits of each style byte.
     This was deprecated in 2007 and removed in 2014 with release 3.4.3.


Neil Hodgson

unread,
Nov 17, 2016, 2:17:21 AM11/17/16
to scintilla...@googlegroups.com
johnsonj:

> 1. it seems that <h3> be changed <h2>.
> 2. May RemovedMessages be intended for RemovedFeatures?
> There is already RemovedFeatures section.

OK, updated.

Neil

Reply all
Reply to author
Forward
0 new messages