Subversion Repositories Kolibri OS

Rev

Rev 280 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 280 Rev 297
Line 7... Line 7...
7
	mov	[f_info.length],ecx
7
	mov	[f_info.length],ecx
8
	cld
8
	cld
9
	rep	movsb
9
	rep	movsb
10
	mov	byte[edi],0
10
	mov	byte[edi],0
Line 11... Line 11...
11
 
11
 
Line 12... Line 12...
12
	mov	esi,[cur_editor.Lines] ;! AREA_EDIT     ; 0x70000 = 448 Kbytes (maximum)
12
	mov	esi,[cur_editor.Lines]
13
 
13
 
14
	xor	ebx,ebx
14
	xor	ebx,ebx
15
	mov	ecx,[cur_editor.Lines.Count]
15
	mov	ecx,[cur_editor.Lines.Count]
Line 22... Line 22...
22
	shl	eax,1
22
	shl	eax,1
23
	lea	eax,[eax+ebx+1024]
23
	lea	eax,[eax+ebx+1024]
24
	call	mem.Alloc
24
	call	mem.Alloc
25
	push	eax
25
	push	eax
26
	mov	esi,[cur_editor.Lines]
26
	mov	esi,[cur_editor.Lines]
27
	mov	edi,eax ;!!! AREA_TEMP
27
	mov	edi,eax
28
 
-
 
29
;       pop     eax
-
 
30
;       ret     ; DISALLOW FOR NOW
-
 
Line 31... Line 28...
31
 
28
 
32
  .new_string:
29
  .new_string:
33
	call	save_string
30
	call	save_string
34
	cmp	dword[esi],0
31
	cmp	dword[esi],0
35
	jne	.new_string
32
	jne	.new_string
36
	pop	eax
-
 
37
	sub	edi,eax ;!!! AREA_TEMP+2   ; minus last CRLF
33
	pop	eax
38
	add	edi,-2
-
 
39
;!      mov     [filelen],edi
-
 
40
;       cmp     byte[f_info.path],'/'
-
 
41
;       je      .systree_save
-
 
42
;       mcall   33,f_info.path,0,edi,0 ;!!! AREA_TEMP,edi,0;[filelen],0
-
 
43
;       or      eax,eax
-
 
44
;       jz      .exit
34
	sub	edi,eax
45
;       call    file_not_found
-
 
Line 46... Line 35...
46
;       jmp     .exit.2
35
	add	edi,-2			; minus last CRLF
47
 
36
 
48
  .systree_save:
37
  .systree_save:
49
	mov	[f_info70+0],2
38
	mov	[f_info70+0],2
50
	mov	[f_info70+12],edi
39
	mov	[f_info70+12],edi
51
	mov	[f_info70+16],eax ;!!! AREA_TEMP
40
	mov	[f_info70+16],eax
52
	mov	byte[f_info70+20],0
41
	mov	byte[f_info70+20],0
Line 53... Line 42...
53
	mov	[f_info70+21],f_info.path
42
	mov	[f_info70+21],f_info.path
Line 54... Line 43...
54
	mcall	70,f_info70
43
	mcall	70,f_info70
55
 
44
 
Line 56... Line 45...
56
	call	set_status_fs_error
45
	call	set_status_fs_error
57
 
46
 
58
	or	eax,eax
47
	or	eax,eax
59
	jnz	.exit.2
48
	jnz	.exit.2
Line 60... Line 49...
60
 
49
 
61
  .exit:
50
  .exit:
Line 74... Line 63...
74
	movzx	ecx,word[esi]
63
	movzx	ecx,word[esi]
75
	test	dword[esi],0x00010000
64
	test	dword[esi],0x00010000
76
	jz	@f
65
	jz	@f
77
	or	dword[esi],0x00020000
66
	or	dword[esi],0x00020000
78
    @@: add	esi,4
67
    @@: add	esi,4
79
;       mov     ecx,eax
-
 
Line 80... Line 68...
80
 
68
 
81
    @@: cmp	byte[esi+ecx-1],' '
69
    @@: cmp	byte[esi+ecx-1],' '
82
	jne	@f
70
	jne	@f
83
	loop	@b
71
	loop	@b
Line 87... Line 75...
87
	mov	ah,dl
75
	mov	ah,dl
Line 88... Line 76...
88
 
76
 
89
  .next_char:
77
  .next_char:
90
	mov	al,[esi+ebx]
78
	mov	al,[esi+ebx]
91
	inc	ebx
-
 
92
;        cmp     [asm_mode],0
-
 
93
;        je      .put
79
	inc	ebx
94
	test	[options],OPTS_OPTIMSAVE
80
	test	[options],OPTS_OPTIMSAVE
95
	jz	.put
81
	jz	.put
96
	test	ah,00000001b
82
	test	ah,00000001b
97
	jnz	.char
83
	jnz	.char
Line 204... Line 190...
204
	stc
190
	stc
205
	ret
191
	ret
Line 206... Line 192...
206
 
192
 
207
  .file_found:
193
  .file_found:
-
 
194
	mov	ecx,eax
-
 
195
	cmp	[tab_bar.Items.Count],1
-
 
196
	jne	@f
-
 
197
	cmp	[cur_editor.FilePath],'/'
-
 
198
	je	@f
-
 
199
	cmp	[cur_editor.Modified],0
-
 
200
	jne	@f
-
 
201
	mov	ebp,cur_editor
208
	mov	ecx,eax
202
	jmp	.lp1
209
	call	create_tab
203
    @@: call	create_tab
210
	push	ecx esi edi
204
  .lp1: push	ecx esi edi
211
	mov	esi,tb_opensave.text
205
	mov	esi,tb_opensave.text
212
	lea	edi,[ebp+TABITEM.Editor.FilePath]
206
	lea	edi,[ebp+TABITEM.Editor.FilePath]
213
	movzx	ecx,[tb_opensave.length]
207
	movzx	ecx,[tb_opensave.length]
214
	rep	movsb
208
	rep	movsb
Line 223... Line 217...
223
	call	flush_cur_tab
217
	call	flush_cur_tab
224
	pop	edi esi ecx
218
	pop	edi esi ecx
225
	call	load_from_memory
219
	call	load_from_memory
226
	mov	eax,[f_info70+16]
220
	mov	eax,[f_info70+16]
227
	call	mem.Free
221
	call	mem.Free
-
 
222
 
-
 
223
	xor	eax,eax
-
 
224
	mov	[cur_editor.TopLeft.Y],eax
-
 
225
	mov	[cur_editor.TopLeft.X],eax
-
 
226
	mov	[cur_editor.Caret.X],eax
-
 
227
	mov	[cur_editor.Caret.Y],eax
-
 
228
	mov	[cur_editor.SelStart.X],eax
-
 
229
	mov	[cur_editor.SelStart.Y],eax
-
 
230
	mov	[cur_editor.Modified],al
-
 
231
	mov	[cur_editor.AsmMode],al
-
 
232
 
-
 
233
	lea	ebx,[cur_editor.FilePath]
-
 
234
	mov	eax,ebx
-
 
235
	call	strlen
-
 
236
	mov	ecx,dword[ebx+eax-3]
-
 
237
	or	ecx,0x202020
-
 
238
	cmp	ecx,'asm'
-
 
239
	jne	@f
-
 
240
	inc	[cur_editor.AsmMode]
-
 
241
	jmp	.nocol
-
 
242
    @@: cmp	ecx,'inc'
-
 
243
	jne	.nocol
-
 
244
	inc	[cur_editor.AsmMode]
-
 
245
    .nocol:
-
 
246
	call	update_caption
-
 
247
 
228
	clc
248
	clc
229
	ret
249
	ret
230
endf
250
endf
Line 231... Line 251...
231
 
251
 
Line 234... Line 254...
234
;-----------------------------------------------------------------------------
254
;-----------------------------------------------------------------------------
235
; ECX = data length
255
; ECX = data length
236
; ESI = data pointer
256
; ESI = data pointer
237
; EBP = EDITOR*
257
; EBP = EDITOR*
238
;-----------------------------------------------------------------------------
258
;-----------------------------------------------------------------------------
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
 
-
 
244
	call	get_lines_in_file
259
	call	get_lines_in_file
245
;       DEBUGF  1,"lines in file: %d\n",eax
-
 
246
	mov	[ebp+EDITOR.Lines.Count],eax
260
	mov	[ebp+EDITOR.Lines.Count],eax
247
	lea	edx,[ebx+ecx]
261
	lea	edx,[ebx+ecx]
248
	imul	ebx,eax,14
262
	imul	ebx,eax,14
249
	add	ebx,edx
263
	add	ebx,edx
250
;       DEBUGF  1,"36522: %d\n",ebx
-
 
251
	mov	eax,[ebp+EDITOR.Lines]
264
	mov	eax,[ebp+EDITOR.Lines]
252
	mov	[ebp+EDITOR.Lines.Size],ebx
265
	mov	[ebp+EDITOR.Lines.Size],ebx
253
	call	mem.ReAlloc
266
	call	mem.ReAlloc
254
;       DEBUGF  1,"mem.ReAlloc: 0x%x\n",eax
-
 
255
	mov	[ebp+EDITOR.Lines],eax
267
	mov	[ebp+EDITOR.Lines],eax
Line 256... Line 268...
256
 
268
 
257
	mov	[ebp+EDITOR.Columns.Count],0
269
	mov	[ebp+EDITOR.Columns.Count],0
258
	mov	edi,eax
270
	mov	edi,eax
Line 286... Line 298...
286
	mov	[ebx],eax
298
	mov	[ebx],eax
287
	mov	dword[ebx+eax+4],0
299
	mov	dword[ebx+eax+4],0
288
	sub	eax,10
300
	sub	eax,10
289
	jnz	@f
301
	jnz	@f
290
	inc	eax
302
	inc	eax
291
    @@: cmp	eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns]
303
    @@: cmp	eax,[ebp+EDITOR.Columns.Count]
292
	jbe	@f
304
	jbe	@f
293
	mov	[ebp+EDITOR.Columns.Count],eax ;! [columns],eax
305
	mov	[ebp+EDITOR.Columns.Count],eax
294
    @@: mov	[ebp+EDITOR.Modified],0 ;! [modified],0
306
    @@: mov	[ebp+EDITOR.Modified],0
295
	ret
307
	ret
Line 296... Line 308...
296
 
308
 
297
  .CR:	cmp	byte[esi],10
309
  .CR:	cmp	byte[esi],10
298
	jne	.LF
310
	jne	.LF
Line 302... Line 314...
302
	mov	al,' '
314
	mov	al,' '
303
	rep	stosb
315
	rep	stosb
304
	lea	eax,[edi-4]
316
	lea	eax,[edi-4]
305
	sub	eax,ebx
317
	sub	eax,ebx
306
	mov	[ebx],eax
318
	mov	[ebx],eax
307
;       inc     [cur_editor.Lines] ;! [lines]
-
 
308
	add	eax,-10
319
	add	eax,-10
309
	cmp	eax,[ebp+EDITOR.Columns.Count] ;! eax,[columns]
320
	cmp	eax,[ebp+EDITOR.Columns.Count]
310
	jbe	.next_line
321
	jbe	.next_line
311
	mov	[ebp+EDITOR.Columns.Count],eax ;! [columns],eax
322
	mov	[ebp+EDITOR.Columns.Count],eax
312
	jmp	.next_line
323
	jmp	.next_line
Line 313... Line 324...
313
 
324
 
314
  .TB:	lea	eax,[edi-4]
325
  .TB:	lea	eax,[edi-4]
315
	sub	eax,ebx
326
	sub	eax,ebx