Author Topic: Working with text and lines numbers  (Read 1399 times)

ToutEnMasm

  • Member
  • *****
  • Posts: 1189
    • EditMasm
Working with text and lines numbers
« on: October 25, 2014, 04:41:50 AM »
Here is the source code of routines working with text and lines numbers

A sample is provide,He try to read the windows.inc file,open it in the same disk as masm32.
text routines are build in a lib.
failed,eax == 0

The text routines use SSE2 instructions (faster) and have been tested in the translator since 2010

They works with an array of qword in memory :
         A pointer on each line
         The size of each line
This allow to get a line by his number,without any scrutation (save time).

***** details ******
The allocated mem for the file grant you at least 16 bytes of free memory and a null terminated file.
You can outpass the size of the file with a register without memory leak
Size of allocated memory:
   mov ecx,InfosFichiers.nFileSizeLow     ;size of file
   inc ecx         ;zero terminated
   add ecx,32      ;mmx use 16 bytes registers
   and ecx,0FFFFFFF0h   ;rounded 16 bytes upper
   invoke GlobalAlloc,GMEM_MOVEABLE or GMEM_ZEROINIT,ecx

output of the sample:
Quote
There is 26902 lines in windows.inc
The bigger line is the 6385,his size is 284 bytes
Reading lines from 100 to 116

pr23 ArgCount(23)
pr24 ArgCount(24)
pr25 ArgCount(25)

; ½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½½

;;;; end macro

;;;; dtype

; ---------------------------
; C and C++ type definitions
; ---------------------------
CALLBACK typedef PROTO STDCALL
WINAPI typedef PROTO STDCALL

------ The reading is terminated -----------


« Last Edit: November 17, 2014, 05:42:24 PM by ToutEnMasm »
Fa is a musical note to play with CL