Rev 267 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 267 | Rev 280 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;----------------------------------------------------------------------------- |
1 | ;----------------------------------------------------------------------------- |
2 | func save_file ;////////////////////////////////////////////////////////////// |
2 | func save_file ;////////////////////////////////////////////////////////////// |
3 | ;----------------------------------------------------------------------------- |
3 | ;----------------------------------------------------------------------------- |
4 | ret ; DISALLOW FOR NOW |
- | |
5 | - | ||
6 | mov esi,tb_opensave.text |
4 | mov esi,tb_opensave.text |
7 | mov edi,f_info.path |
5 | mov edi,f_info.path |
8 | movzx ecx,[tb_opensave.length] |
6 | movzx ecx,[tb_opensave.length] |
9 | mov [f_info.length],ecx |
7 | mov [f_info.length],ecx |
10 | cld |
8 | cld |
11 | rep movsb |
9 | rep movsb |
12 | mov byte[edi],0 |
10 | mov byte[edi],0 |
Line 13... | Line 11... | ||
13 | 11 | ||
- | 12 | mov esi,[cur_editor.Lines] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum) |
|
- | 13 | ||
- | 14 | xor ebx,ebx |
|
- | 15 | mov ecx,[cur_editor.Lines.Count] |
|
- | 16 | @@: call get_real_length |
|
- | 17 | add ebx,eax |
|
- | 18 | movzx eax,word[esi] |
|
- | 19 | lea esi,[esi+eax+4] |
|
- | 20 | loop @b |
|
- | 21 | mov eax,[cur_editor.Lines.Count] |
|
- | 22 | shl eax,1 |
|
- | 23 | lea eax,[eax+ebx+1024] |
|
- | 24 | call mem.Alloc |
|
- | 25 | push eax |
|
14 | mov esi,[cur_editor.Lines] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum) |
26 | mov esi,[cur_editor.Lines] |
- | 27 | mov edi,eax ;!!! AREA_TEMP |
|
- | 28 | ||
- | 29 | ; pop eax |
|
Line 15... | Line 30... | ||
15 | mov edi,0 ;!!! AREA_TEMP |
30 | ; ret ; DISALLOW FOR NOW |
16 | 31 | ||
17 | .new_string: |
32 | .new_string: |
18 | call save_string |
33 | call save_string |
- | 34 | cmp dword[esi],0 |
|
19 | cmp dword[esi],0 |
35 | jne .new_string |
- | 36 | pop eax |
|
20 | jne .new_string |
37 | sub edi,eax ;!!! AREA_TEMP+2 ; minus last CRLF |
21 | sub edi,0 ;!!! AREA_TEMP+2 ; minus last CRLF |
38 | add edi,-2 |
22 | ;! mov [filelen],edi |
39 | ;! mov [filelen],edi |
23 | cmp byte[f_info.path],'/' |
40 | ; cmp byte[f_info.path],'/' |
24 | je .systree_save |
41 | ; je .systree_save |
25 | mcall 33,f_info.path,0,edi,0 ;!!! AREA_TEMP,edi,0;[filelen],0 |
42 | ; mcall 33,f_info.path,0,edi,0 ;!!! AREA_TEMP,edi,0;[filelen],0 |
26 | or eax,eax |
43 | ; or eax,eax |
27 | jz .exit |
44 | ; jz .exit |
Line 28... | Line 45... | ||
28 | ; call file_not_found |
45 | ; call file_not_found |
29 | jmp .exit.2 |
46 | ; jmp .exit.2 |
30 | 47 | ||
31 | .systree_save: |
48 | .systree_save: |
32 | mov [f_info70+0],2 |
49 | mov [f_info70+0],2 |
33 | mov [f_info70+12],edi |
50 | mov [f_info70+12],edi |
34 | mov [f_info70+16],0 ;!!! AREA_TEMP |
51 | mov [f_info70+16],eax ;!!! AREA_TEMP |
Line 35... | Line 52... | ||
35 | mov byte[f_info70+20],0 |
52 | mov byte[f_info70+20],0 |
Line 141... | Line 158... | ||
141 | endf |
158 | endf |
Line 142... | Line 159... | ||
142 | 159 | ||
143 | ;----------------------------------------------------------------------------- |
160 | ;----------------------------------------------------------------------------- |
144 | func load_file ;////////////////////////////////////////////////////////////// |
161 | func load_file ;////////////////////////////////////////////////////////////// |
- | 162 | ;----------------------------------------------------------------------------- |
|
- | 163 | cmp [tb_opensave.text],0 |
|
- | 164 | jne @f |
|
- | 165 | stc |
|
- | 166 | ret |
|
145 | ;----------------------------------------------------------------------------- |
167 | |
146 | mov esi,tb_opensave.text |
168 | @@: mov esi,tb_opensave.text |
147 | mov edi,f_info.path |
169 | mov edi,f_info.path |
148 | movzx ecx,[tb_opensave.length] |
170 | movzx ecx,[tb_opensave.length] |
149 | mov [f_info.length],ecx |
171 | mov [f_info.length],ecx |
150 | cld |
172 | cld |
Line 212... | Line 234... | ||
212 | ;----------------------------------------------------------------------------- |
234 | ;----------------------------------------------------------------------------- |
213 | ; ECX = data length |
235 | ; ECX = data length |
214 | ; ESI = data pointer |
236 | ; ESI = data pointer |
215 | ; EBP = EDITOR* |
237 | ; EBP = EDITOR* |
216 | ;----------------------------------------------------------------------------- |
238 | ;----------------------------------------------------------------------------- |
- | 239 | ; DEBUGF 1,<">>> load_from_memory\n" # \ |
|
- | 240 | ; " data length = %d\n" # \ |
|
- | 241 | ; " data pointer = 0x%x\n" # \ |
|
- | 242 | ; " EDITOR* = 0x%x\n">,ecx,esi,ebp |
|
- | 243 | ||
217 | call get_lines_in_file |
244 | call get_lines_in_file |
218 | inc eax |
245 | ; DEBUGF 1,"lines in file: %d\n",eax |
219 | mov [ebp+EDITOR.Lines.Count],eax |
246 | mov [ebp+EDITOR.Lines.Count],eax |
- | 247 | lea edx,[ebx+ecx] |
|
220 | imul ebx,eax,14 |
248 | imul ebx,eax,14 |
221 | add ebx,ecx |
249 | add ebx,edx |
- | 250 | ; DEBUGF 1,"36522: %d\n",ebx |
|
222 | mov eax,[ebp+EDITOR.Lines] |
251 | mov eax,[ebp+EDITOR.Lines] |
- | 252 | mov [ebp+EDITOR.Lines.Size],ebx |
|
223 | call mem.ReAlloc |
253 | call mem.ReAlloc |
- | 254 | ; DEBUGF 1,"mem.ReAlloc: 0x%x\n",eax |
|
224 | mov [ebp+EDITOR.Lines],eax |
255 | mov [ebp+EDITOR.Lines],eax |
Line 225... | Line 256... | ||
225 | 256 | ||
226 | mov [ebp+EDITOR.Columns.Count],0 |
257 | mov [ebp+EDITOR.Columns.Count],0 |
227 | mov edi,eax |
258 | mov edi,eax |