Author Topic: Iczelion tutorial 35 Highlighting  (Read 21554 times)

Antariy

  • Member
  • ****
  • Posts: 564
Re: Iczelion tutorial 35 Highlighting
« Reply #30 on: September 20, 2013, 03:40:40 PM »
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

  • Guest
Re: Iczelion tutorial 35 Highlighting
« Reply #31 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. 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

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Iczelion tutorial 35 Highlighting
« Reply #32 on: September 24, 2013, 10:28:11 AM »
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

  • Member
  • *****
  • Posts: 12933
  • Assembler is fun ;-)
    • MasmBasic
Re: Iczelion tutorial 35 Highlighting
« Reply #33 on: September 24, 2013, 03:29:19 PM »
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

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Iczelion tutorial 35 Highlighting
« Reply #34 on: September 24, 2013, 07:10:27 PM »
maybe a good design would implement file-mapping
but - it's better left to the guys that are familiar with rich text operations

Fumio

  • Guest
Re: Iczelion tutorial 35 Highlighting
« Reply #35 on: September 26, 2013, 02:48:43 AM »
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

  • Member
  • *****
  • Posts: 2185
  • AMD 7-32 / i3 10-64
Re: Iczelion tutorial 35 Highlighting
« Reply #36 on: May 30, 2021, 05:02:51 AM »
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

Mikl__

  • Member
  • *****
  • Posts: 1263
Re: Iczelion tutorial 35 Highlighting
« Reply #37 on: May 31, 2021, 07:55:46 AM »

HSE

  • Member
  • *****
  • Posts: 2185
  • AMD 7-32 / i3 10-64
Re: Iczelion tutorial 35 Highlighting
« Reply #38 on: May 31, 2021, 07:59:37 AM »
Hi Mikl__!

Win x64 Tutorial #35: IczEdit version 3.0

Yes, you have translated correctly... the error  :biggrin: :biggrin: :biggrin:
Equations in Assembly: SmplMath

Mikl__

  • Member
  • *****
  • Posts: 1263
Re: Iczelion tutorial 35 Highlighting
« Reply #39 on: May 31, 2021, 08:35:18 AM »
HSE
Thanks for the bug you found. Perhaps did Iczelion inserted this error for educational purposes?

HSE

  • Member
  • *****
  • Posts: 2185
  • AMD 7-32 / i3 10-64
Re: Iczelion tutorial 35 Highlighting
« Reply #40 on: May 31, 2021, 08:53:02 AM »
Perhaps 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