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


  • Member
  • *****
  • Posts: 1764
    • 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 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:
There is 26902 lines in
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
; ---------------------------

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

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