From 5c8ca303a38cc4b2a62020c920386f08d326bd98 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 29 Feb 2004 08:51:54 +0000 Subject: Patch from Bruce to return required allocation size when a NULL pointer is used as a stringresult argument. --- doc/ScintillaDoc.html | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'doc') diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 02aae7c9b..73fcaad4c 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -38,7 +38,7 @@

Scintilla Documentation

-

Last edited 16/May/2003 NH

+

Last edited 29/February/2004 NH

There is an overview of the internal design of Scintilla.
@@ -96,7 +96,7 @@ - const char* + const char * Arguments point at text that is being passed to Scintilla but not modified. The text may be zero terminated or another argument may specify the character count, the @@ -104,11 +104,12 @@ - char* + char * Arguments point at text buffers that Scintilla will fill with text. In some cases, another argument will tell Scintilla the buffer size. In others, you must make sure that - the buffer is big enough to hold the requested text. + the buffer is big enough to hold the requested text. If a NULL pointer (0) is passed + then, for SCI_* calls, the length that should be allocated is returned. @@ -293,10 +294,10 @@ SCI_GETTEXTRANGE(<unused>, TextRange *tr)
SCI_ALLOCATE(int bytes, <unused>)
- SCI_ADDTEXT(int length, char *s)
+ SCI_ADDTEXT(int length, const char *s)
SCI_ADDSTYLEDTEXT(int length, cell *s)
SCI_APPENDTEXT(int length, const char *s)
- SCI_INSERTTEXT(int pos, char *text)
+ SCI_INSERTTEXT(int pos, const char *text)
SCI_CLEARALL
SCI_CLEARDOCUMENTSTYLE
SCI_GETCHARAT(int position)
@@ -312,7 +313,9 @@ terminating 0 character. To collect all the text in a document, use SCI_GETLENGTH to get the number of characters in the document (nLen), allocate a character buffer of length nLen+1 bytes, then call SCI_GETTEXT(nLen+1, char - *text). If you then save the text, you should use SCI_SETSAVEPOINT to mark + *text). If the text argument is 0 then the length that should be allocated to store the + entire document is returned. + If you then save the text, you should use SCI_SETSAVEPOINT to mark the text as unmodified.

See also: SCI_GETSELTEXT, SCI_LINELENGTH(int line). The returned value is the number of characters copied to the buffer. The returned text includes any end of line characters. If you ask for a line number outside the range of lines in the document, 0 - characters are copied.

+ characters are copied. If the text argument is 0 then the length that should be allocated + to store the entire line is returned.

See also: SCI_GETCURLINE, SCI_GETSELTEXT,
SCI_POSITIONBEFORE(int position)
SCI_POSITIONAFTER(int position)
- SCI_TEXTWIDTH(int styleNumber, char *text)
+ SCI_TEXTWIDTH(int styleNumber, const char *text)
SCI_TEXTHEIGHT(int line)
SCI_CHOOSECARETX
@@ -1062,7 +1066,8 @@ struct TextToFind { This copies the currently selected text and a terminating 0 byte to the text buffer. The buffer must be at least SCI_GETSELECTIONEND()-SCI_GETSELECTIONSTART()+1 bytes long.
-
+ If the text argument is 0 then the length that should be allocated + to store the entire selection is returned.

See also: SCI_GETCURLINE, SCI_GETLINE, char* text pointing at a buffer large enough to hold the text you wish to retrieve and a terminating 0 character. Set textLen to the - length of the buffer.

+ length of the buffer. If the text argument is 0 then the length that should be allocated + to store the entire current line is returned.

See also: SCI_GETSELTEXT, SCI_GETLINE, -

SCI_TEXTWIDTH(int styleNumber, char *text)
+

SCI_TEXTWIDTH(int styleNumber, const char *text)
This returns the pixel width of a string drawn in the given styleNumber which can be used, for example, to decide how wide to make the line number margin in order to display a given number of numerals.

@@ -1927,7 +1933,7 @@ struct TextToFind { 2. Use SCI_STYLECLEARALL to copy this to all styles.
3. Set the style attributes that make your lexical styles different.

-

SCI_STYLESETFONT(int styleNumber, char *fontName)
+

SCI_STYLESETFONT(int styleNumber, const char *fontName)
SCI_STYLESETSIZE(int styleNumber, int sizeInPoints)
SCI_STYLESETBOLD(int styleNumber, bool bold)
SCI_STYLESETITALIC(int styleNumber, bool italic)
@@ -4080,8 +4086,8 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
SCI_LOADLEXERLIBRARY(<unused>, char *path)
SCI_COLOURISE(int start, int end)
- SCI_SETPROPERTY(char *key, char *value)
- SCI_SETKEYWORDS(int keyWordSet, char + SCI_SETPROPERTY(const char *key, const char *value)
+ SCI_SETKEYWORDS(int keyWordSet, const char *keyWordList)
@@ -4095,7 +4101,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ SCLEX_AUTOMATIC value; this identifies additional external lexers that Scintilla assigns unused lexer numbers to.

-

SCI_SETLEXERLANGUAGE(<unused>, char *name)
+

SCI_SETLEXERLANGUAGE(<unused>, const char *name)
This message lets you select a lexer by name, and is the only method if you are using an external lexer or if you have written a lexer module for a language of your own and do not wish to assign it an explicit lexer number. To select an existing lexer, set name to @@ -4108,7 +4114,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ href="#SCI_GETLEXER">SCI_GETLEXER before and after setting the new lexer to see if the lexer number changed.

-

SCI_LOADLEXERLIBRARY(<unused>, char *path)
+

SCI_LOADLEXERLIBRARY(<unused>, const char *path)
Load a lexer implemented in a shared library. This is a .so file on GTK+/Linux or a .DLL file on Windows.

@@ -4764,9 +4770,9 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next replace them with the Scintilla equivalent.

 WM_GETTEXT(int length, char *text)
-WM_SETTEXT(<unused>, char *text)
+WM_SETTEXT(<unused>, const char *text)
 EM_GETLINE(int line, char *text)
-EM_REPLACESEL(<unused>, char *text)
+EM_REPLACESEL(<unused>, const char *text)
 EM_SETREADONLY
 EM_GETTEXTRANGE(<unused>, TEXTRANGE *tr)
 WM_CUT
-- 
cgit v1.2.3