News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Iczelion tutorial 35 Highlighting

Started by Fumio, September 17, 2013, 02:58:20 PM

Previous topic - Next topic

Antariy

Don't worry about that, Jochen :t

I see that you have found the need in probing, too, also the wrong ESI counter - what is close to the missed SendMessage call. The source from the previous page was changed from its original state.

Probably this is the place where those prologue and epilogue macroses may be used just nicely :biggrin:

Fumio

Hello: I'd like to add my thanks to Antariy for his interest in my issue. I implemented his suggestion of a stack probe but the program still crashes. On my vista machine using the original code from Izcelion Tutorial #35 the app will build and crash while using Radasm. If I add the following option to the link line in project options exactly as it is here /STACK:2000000|2000000 everything works fine.
So My Question would be does any one know how you determine before the crash that you would need to expand the stack?

Regards Fumio

dedndave

the first number is the stack "reserve" - there is no way to increase it dynamically
the second one is the "commit" - probing the stack can take care of this one

what i would do is try to re-design the program so that the limit is known and not exceeded
rather than using an increased stack size, use "normal" dynamic allocation, such as HeapAlloc or VirtualAlloc
that way, the stack limitation is not an issue

the heap is managed by the operating system
and - memory that isn't reserved for stack space is available for other types of allocation
the OS balances stack requirement with other memory requirements

you should be able to calculate the requirement before reading the data into memory

jj2007

Quote from: Fumio on September 24, 2013, 10:17:22 AM
Hello: I'd like to add my thanks to Antariy for his interest in my issue. I implemented his suggestion of a stack probe but the program still crashes.

Hi Fumio,
You seem to be the only one in this thread whose version is still crashing, all others work. Can you post the crashing source?

dedndave

maybe a good design would implement file-mapping
but - it's better left to the guys that are familiar with rich text operations

Fumio

Hello jj2007: Unfortunately I had deleted the crashing project. Clearly I must have done something to the code as it would not run without crashing when implementing the stack Probe. Now I have just added the probe code to a new tut 35 project and yes it does work as it should.
Again thanks to all who participated in this thread. It has been informative.
Regards Fumio :icon_cool:

HSE

Hi All!!

I found a mistake, only you can see clearly the effect with files bigger than 64 kb (I think).

Say:
Code (NewRichEditProc proc) Select
;===================================================================
; Do syntax hiliting here!
;===================================================================
invoke SendMessage,hWnd,EM_GETRECT,0,addr rect
invoke SendMessage,hWnd,EM_CHARFROMPOS,0,addr rect
;========================================================
; obtain the line number
;========================================================
invoke SendMessage,hWnd,EM_LINEFROMCHAR,eax,0
invoke SendMessage,hWnd,EM_LINEINDEX,eax,0
mov txtrange.chrg.cpMin,eax
mov FirstChar,eax
invoke SendMessage,hWnd,EM_CHARFROMPOS,0,addr rect.right
mov txtrange.chrg.cpMax,eax


But must say:
Code (NewRichEditProc proc) Select
;===================================================================
; Do syntax hiliting here!
;===================================================================
invoke SendMessage,hWnd,EM_GETRECT,0,addr rect
invoke SendMessage,hWnd,EM_CHARFROMPOS,0,addr rect
mov txtrange.chrg.cpMin,eax
mov FirstChar,eax
invoke SendMessage,hWnd,EM_CHARFROMPOS,0,addr rect.right
mov txtrange.chrg.cpMax,eax

Line number is never used anyway :biggrin: Perhaps Iczelion try to erase those lines and accidentally pasted here.

With this modification now work well a 1.5 mb file.

Regards, HSE.
Equations in Assembly: SmplMath


HSE

Equations in Assembly: SmplMath

Mikl__

HSE
Thanks for the bug you found. Perhaps did Iczelion inserted this error for educational purposes?

HSE

Quote from: Mikl__ on May 31, 2021, 08:35:18 AMPerhaps did Iczelion inserted this error for educational purposes?
Yes. He was learning

Look like he tried something with line numbers that never was.
Equations in Assembly: SmplMath