1 /*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
4 for INTEL64(R), AMD64(R)
6 Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
11 1. Redistributions of source code must retain the above copyright notice,
12 this list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright
14 notice, this list of conditions and the following disclaimer in the
15 documentation and/or other materials provided with the distribution.
17 THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 OF THE POSSIBILITY OF SUCH DAMAGE.
29 DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
31 /* File Info -----------------------------------------------------------
35 ----------------------------------------------------------------------*/
37 #define DRD64_SRC_LIBEDITTEXT_CURSORAPI_INFO
38 #include"drd64_libedittext.h"
40 #define LOCATION(n) DRD64_ERR_LOCATION( \
41 DRD64_ERROR_MODULE_LIBEDITTEXT, DRD64_ERROR_ARCH_NODEPEND, \
42 DRD64_SRC_LIBEDITTEXT_CURSORAPI_INFO_SRCID, (n))
45 /***********************************************************************
46 ***********************************************************************/
47 #define FUNCID_LibEditText_GetCursorPosition 0x01
48 LIBEDITTEXT_API_CURSORAPI_INFO
50 LibEditText_GetCursorPosition(
56 LibEditText_TextInfo *p_tinfo;
57 LibEditText_Cursor *p_cursor;
59 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
60 if( NULL == p_tinfo ) {
61 LibBrownie_Error_SetErrorInfo(
62 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
63 LOCATION( FUNCID_LibEditText_GetCursorPosition ),
64 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
69 p_cursor = LibEditText_CursorInfo_GetCursor( p_tinfo, i_curid );
70 if( NULL == p_cursor ) {
71 LibBrownie_Error_SetErrorInfo(
72 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x02 ),
73 LOCATION( FUNCID_LibEditText_GetCursorPosition ),
74 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
79 if( NULL != pdw_curline ) { *pdw_curline = p_cursor->dw_line; }
80 if( NULL != pdw_curpos ) { *pdw_curpos = p_cursor->dw_pos; }
86 /***********************************************************************
87 ***********************************************************************/
88 #define FUNCID_LibEditText_GetMaxLines 0x02
89 LIBEDITTEXT_API_CURSORAPI_INFO
91 LibEditText_GetMaxLines(
94 LibEditText_TextInfo *p_tinfo;
96 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
97 if( NULL == p_tinfo ) {
98 LibBrownie_Error_SetErrorInfo(
99 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
100 LOCATION( FUNCID_LibEditText_GetMaxLines ),
101 errno, (QWord)i_tinfoid, (QWord)0x00, __LINE__ );
106 return p_tinfo->dw_maxline;
110 /***********************************************************************
112 ***********************************************************************/
113 #define FUNCID_LibEditText_GetCursorRangeNextString 0x03
114 LIBEDITTEXT_API_CURSORAPI_INFO
116 LibEditText_GetCursorRangeNextString(
122 LibEditText_TextInfo *p_tinfo;
123 LibEditText_Cursor *p_cursor;
124 LibEditText_LineInfo *p_line;
126 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
127 if( NULL == p_tinfo ) {
128 LibBrownie_Error_SetErrorInfo(
129 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
130 LOCATION( FUNCID_LibEditText_GetCursorRangeNextString ),
131 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
136 p_cursor = LibEditText_CursorInfo_GetCursor( p_tinfo, i_curid );
137 if( NULL == p_cursor ) {
138 LibBrownie_Error_SetErrorInfo(
139 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x02 ),
140 LOCATION( FUNCID_LibEditText_GetCursorRangeNextString ),
141 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
146 if( p_cursor->dw_now_rngline == p_cursor->dw_rangelines ) { return NULL; }
148 p_line = LINFO(p_tinfo, p_cursor->dw_now_linfoid);
149 if( NULL == p_line ) {
150 LibBrownie_Error_SetErrorInfo(
151 DRD64_ERROR( DRD64_ERROR_PTN_NULLPTR, 0x01, 0x02 ),
152 LOCATION( FUNCID_LibEditText_GetCursorRangeNextString ), errno,
153 (QWord)p_cursor->dw_now_linfoid, (QWord)p_cursor->dw_now_rngline, __LINE__ );
158 if( NULL != pdw_len ) { *pdw_len = p_line->dw_strlen; }
159 pb_data = p_tinfo->pb_text + p_line->dw_start;
161 p_cursor->dw_now_linfoid = p_line->dw_next;
162 p_cursor->dw_now_rngline++;
164 return (const char *)pb_data;
168 /***********************************************************************
170 ***********************************************************************/
171 #define FUNCID_LibEditText_GetCursorRangeString 0x04
172 LIBEDITTEXT_API_CURSORAPI_INFO
174 LibEditText_GetCursorRangeString(
180 LibEditText_TextInfo *p_tinfo;
181 LibEditText_Cursor *p_cursor;
182 LibEditText_LineInfo *p_line;
184 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
185 if( NULL == p_tinfo ) {
186 LibBrownie_Error_SetErrorInfo(
187 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
188 LOCATION( FUNCID_LibEditText_GetCursorRangeString ),
189 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
194 p_cursor = LibEditText_CursorInfo_GetCursor( p_tinfo, i_curid );
195 if( NULL == p_cursor ) {
196 LibBrownie_Error_SetErrorInfo(
197 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x02 ),
198 LOCATION( FUNCID_LibEditText_GetCursorRangeString ),
199 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
204 if( 0 == p_cursor->dw_rangelines ) { return NULL; }
206 p_line = LINFO(p_tinfo, p_cursor->dw_start_lineid);
207 assert( NULL != p_line );
209 if( NULL != pdw_len ) { *pdw_len = p_line->dw_strlen; }
210 pb_data = p_tinfo->pb_text + p_line->dw_start;
212 p_cursor->dw_now_linfoid = p_line->dw_next;
213 p_cursor->dw_now_rngline = 1;
215 return (const char *)pb_data;
219 /***********************************************************************
221 ***********************************************************************/
222 #define FUNCID_LibEditText_GetCursorEndString 0x05
223 LIBEDITTEXT_API_CURSORAPI_INFO
225 LibEditText_GetCursorEndString(
231 LibEditText_TextInfo *p_tinfo;
232 LibEditText_Cursor *p_cursor;
233 LibEditText_LineInfo *p_line;
235 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
236 if( NULL == p_tinfo ) {
237 LibBrownie_Error_SetErrorInfo(
238 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
239 LOCATION( FUNCID_LibEditText_GetCursorEndString ),
240 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
245 p_cursor = LibEditText_CursorInfo_GetCursor( p_tinfo, i_curid );
246 if( NULL == p_cursor ) {
247 LibBrownie_Error_SetErrorInfo(
248 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x02 ),
249 LOCATION( FUNCID_LibEditText_GetCursorEndString ),
250 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
255 if( 0 == p_cursor->dw_rangelines ) { return NULL; }
257 p_line = LINFO(p_tinfo, p_cursor->dw_end_lineid);
259 if( NULL != pdw_len ) { *pdw_len = p_line->dw_strlen; }
261 pb_data = p_tinfo->pb_text + p_line->dw_start;
263 return (const char *)pb_data;
267 /***********************************************************************
269 ***********************************************************************/
270 #define FUNCID_LibEditText_GetCursorStartString 0x06
271 LIBEDITTEXT_API_CURSORAPI_INFO
273 LibEditText_GetCursorStartString(
279 LibEditText_TextInfo *p_tinfo;
280 LibEditText_Cursor *p_cursor;
281 LibEditText_LineInfo *p_line;
283 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
284 if( NULL == p_tinfo ) {
285 LibBrownie_Error_SetErrorInfo(
286 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
287 LOCATION( FUNCID_LibEditText_GetCursorStartString ),
288 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
293 p_cursor = LibEditText_CursorInfo_GetCursor( p_tinfo, i_curid );
294 if( NULL == p_cursor ) {
295 LibBrownie_Error_SetErrorInfo(
296 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x02 ),
297 LOCATION( FUNCID_LibEditText_GetCursorStartString ),
298 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
303 if( 0 == p_cursor->dw_rangelines ) { return NULL; }
305 p_line = LINFO(p_tinfo, p_cursor->dw_start_lineid);
307 if( NULL != pdw_len ) { *pdw_len = p_line->dw_strlen; }
309 pb_data = p_tinfo->pb_text + p_line->dw_start;
311 return (const char *)pb_data;
315 /***********************************************************************
317 ***********************************************************************/
318 #define FUNCID_LibEditText_GetCursorLineString 0x07
319 LIBEDITTEXT_API_CURSORAPI_INFO
321 LibEditText_GetCursorLineString(
327 LibEditText_TextInfo *p_tinfo;
328 LibEditText_Cursor *p_cursor;
329 LibEditText_LineInfo *p_line;
331 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
332 if( NULL == p_tinfo ) {
333 LibBrownie_Error_SetErrorInfo(
334 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
335 LOCATION( FUNCID_LibEditText_GetCursorLineString ),
336 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
341 p_cursor = LibEditText_CursorInfo_GetCursor( p_tinfo, i_curid );
342 if( NULL == p_cursor ) {
343 LibBrownie_Error_SetErrorInfo(
344 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x02 ),
345 LOCATION( FUNCID_LibEditText_GetCursorLineString ),
346 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
351 p_line = LINFO(p_tinfo, p_cursor->dw_lineid);
352 assert( NULL != p_line );
354 if( NULL != pdw_len ) { *pdw_len = p_line->dw_strlen; }
356 pb_str = p_tinfo->pb_text + p_line->dw_start;
358 return (const char *)pb_str;
362 /***********************************************************************
364 ***********************************************************************/
365 #define FUNCID_LibEditText_AllocCursor 0x08
366 LIBEDITTEXT_API_CURSORAPI_INFO
368 LibEditText_AllocCursor(
373 LibEditText_TextInfo *p_tinfo;
375 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
376 if( NULL == p_tinfo ) {
377 LibBrownie_Error_SetErrorInfo(
378 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
379 LOCATION( FUNCID_LibEditText_AllocCursor ),
380 errno, (QWord)i_tinfoid, (QWord)dw_ranges, __LINE__ );
385 i_curid = LibEditText_CursorInfo_AllocCursor( p_tinfo, dw_ranges );
391 /***********************************************************************
393 ***********************************************************************/
394 #define FUNCID_LibEditText_FreeCursor 0x09
395 LIBEDITTEXT_API_CURSORAPI_INFO
397 LibEditText_FreeCursor(
402 LibEditText_TextInfo *p_tinfo;
404 p_tinfo = LibEditText_System_GetTextInfo( i_tinfoid );
405 if( NULL == p_tinfo ) {
406 LibBrownie_Error_SetErrorInfo(
407 DRD64_ERROR( DRD64_ERROR_PTN_CALLFUNC, 0x01, 0x01 ),
408 LOCATION( FUNCID_LibEditText_FreeCursor ),
409 errno, (QWord)i_tinfoid, (QWord)i_curid, __LINE__ );
414 i_result = LibEditText_CursorInfo_FreeCursor( p_tinfo, i_curid );
421 /* EOF of drd64_.c ----------------------------------- */