OSDN Git Service

* CreateFile: drd64_libedittext_cursorfind.[ch]
[drdeamon64/drdeamon64.git] / libedittext / drd64_libedittext_types.h
1 /*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
2
3                          D r . D e a m o n  6 4
4                         for INTEL64(R), AMD64(R)
5         
6    Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10
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.
16
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.
28
29 DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
30
31 /* File Info -----------------------------------------------------------
32 File: drd64_.h
33 Function: Header 
34 Comment: 
35 ----------------------------------------------------------------------*/
36
37 #ifndef DRD64_HEADER_LIBEDITTEXT_TYPES
38 #define DRD64_HEADER_LIBEDITTEXT_TYPES
39
40 #define INVALID_LINE    (DWord)0xffffffff
41 #define MAXLINES                (DWord)0x7fffffff
42
43 #define LINFO(m,n)      (INVALID_LINE==(n) ? NULL : (((m)->p_lineinfo)+(n)))
44         /* (m): (Drd64_DrCC_TextInfo *) TextInfo Strcut Pointer */
45         /* (n): (DWord) LineInfo ID */
46 #define LINFO_ID(m,n)   ((((m)->p_lineinfo)+(n))->dw_id)
47         /* (m): (Drd64_DrCC_TextInfo *) TextInfo Strcut Pointer */
48         /* (n): (DWord) LineInfo ID */
49 #define LINFO_SORTNEXT(m,n)     (((m)->p_lineinfo)+((((m)->p_lineinfo)+(n))->dw_sortnext))
50         /* (m): (Drd64_DrCC_TextInfo *) TextInfo Strcut Pointer */
51         /* (n): (DWord) LineInfo ID */
52
53
54 typedef struct  {
55         DWord   dw_id;
56         DWord   dw_start;               /* Start Bytes of This Line in Text-Buffer */
57         DWord   dw_strlen;              /* Length of This LineString */
58         DWord   dw_linelen;             /* Line Alloced Bytes */
59         DWord   dw_before;
60         DWord   dw_next;
61         DWord   dw_sortnext;
62 } LibEditText_LineInfo;
63
64 typedef struct  {
65         DWord                                   dw_line;
66         DWord                                   dw_linfoid;
67 } LibEditText_LineSection;
68
69 typedef struct  {
70         /* Cursor Line --- */
71         DWord   dw_lineid;
72         DWord   dw_line;
73         DWord   dw_pos;                 // Cursor Pos. in line
74
75         /* Start Line --- */
76         DWord   dw_start_lineid;
77         DWord   dw_start_line;
78
79         /* End Line --- */
80         DWord   dw_end_lineid;
81         DWord   dw_end_line;
82          
83         DWord   dw_rangelines;
84         DWord   dw_now_linfoid;
85         DWord   dw_now_rngline;
86
87         Byte    b_update;
88
89         /* Find Data --- */
90         char    str_regstr[DRD64_LIBEDITTEXT_DEFAULT_REGSTR_SIZE];
91         regex_t *pt_findreg;
92         DWord   dw_find_prevpos_start;
93         DWord   dw_find_prevpos_len;
94         DWord   dw_find_prevlineid;
95
96 } LibEditText_Cursor;
97
98 typedef struct  {
99         int                                             i_id;                   /* ID of TextInfo Struct */
100         int                                             i_fd;
101         int                                             i_cursor_now;
102         Word                                    w_subtype;              /* TextFile Sub-Type (.c/.h/Makefile/etc) */
103
104         /* --- Buffer Info. --- */
105         Byte                                    *pb_text;               /* Buffer of TextData */
106         Byte                                    *pb_attr;               /* Attribute Buffer of Text */
107         DWord                                   dw_bufsize;             /* TextData Buffer Size */
108         DWord                                   dw_attrsize;    /* Attribute Buffer Size */
109         DWord                                   dw_lastsize;    /* Available Buffer Position */
110
111         /* --- Lines Info. --- */
112         DWord                                   dw_maxline;             /* Max TextFile Lines */
113         DWord                                   dw_bufline;             /* Lines of Alloc LineInfo Strcut */
114         DWord                                   dw_line_start;
115         DWord                                   dw_line_end;
116         LibEditText_LineInfo    *p_lineinfo;    /* LineInfo structs TopPointer */
117
118         /* --- Sections Info. --- */
119         DWord                                   dw_bufsections;
120         DWord                                   dw_sections;
121         DWord                                   dw_sect_steps;  
122         LibEditText_LineSection *p_section;
123
124         /* --- Cursors Info. --- */
125         DWord                                   dw_maxcursors;
126         LibEditText_Cursor              t_cursor[DRD64_LIBEDITTEXT_DEFAULT_MAX_CURSORS];
127
128         /* --- Undo Info. --- */
129         Byte                                    *pb_undo;
130         Byte                                    b_undo_flagchain;
131         DWord                                   dw_undo_bufsize;
132         DWord                                   dw_undo_lastsize;
133         DWord                                   dw_undo_last;
134         DWord                                   dw_undo_end;
135         DWord                                   dw_undo_line;
136         DWord                                   dw_undo_pos;
137
138         DWord                                   dw_linesort[DRD64_LIBEDITTEXT_DEFAULT_LINESORT_ARRAYS];
139         DWord                                   dw_empty[DRD64_LIBEDITTEXT_DEFAULT_LINESORT_ARRAYS];
140         char                                    str_pathname[DRD64_MAX_PATH];
141         char                                    str_filename[DRD64_MAX_PATH];
142 } LibEditText_TextInfo;
143
144 #endif  /* DRD64_HEADER_LIBEDITTEXT */
145
146
147 /* EOF of drd64_.h ----------------------------------- */