News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

External lexer for Scintilla

Started by Nordwind64, February 19, 2010, 04:09:37 PM

Previous topic - Next topic

Nordwind64

Hi,

I want to write an external lexer for scintilla as dll.  As dll, because I only want to update the lexer in future, not the hole scintilla.dll, Here is my working startcode for the dll:

.386
.model flat, stdcall
option casemap:none

include windows.inc
include kernel32.inc
include debug.inc

includelib kernel32.lib
includelib debug.lib

.data

  lname  db  "ownlexer",0

.code

LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD

    mov eax,1
    ret

LibMain Endp


; ________________________________________________________________________________________________________________
   Lex proc c lexer:DWORD, startpos:DWORD, laenge:DWORD, initstyle:DWORD, thewords:DWORD, thewindow:DWORD, theprops:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

;DbgDump thewords,128

ret
Lex endp


; ________________________________________________________________________________________________________________
   Fold proc c lexer:DWORD, startpos:DWORD, laenge:DWORD, initstyle:DWORD, thewords:DWORD, thewindow:DWORD, theprops:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


ret
Fold endp


; ________________________________________________________________________________________________________________
   GetLexerCount proc c
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

  mov eax,1

ret
GetLexerCount endp


; ________________________________________________________________________________________________________________
   GetLexerName proc c para1:DWORD, para2:DWORD, para3:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

  mov edx,para2
  mov al,0
  mov [edx],al
  invoke lstrcat,para2,addr lname

ret
GetLexerName endp


End LibMain


Works fine, but I cannot understand the lexer and folding mechanism from the scintilla c++ demosource for external lexers. Is there anybody out there understanding it and is able to build the source in assembler?  I need some help... :8)

EDIT: Here is an external lexer written in Pascal: http://www.pnotepad.org/files/plexer.zip
I cannot understand Pascal and C++...  :(
Greetings, Nordwind.
Windows 7 (64Bit), JWASM/PoLink

Nordwind64

Ok, seems I'm on the right way. I've to use the Scrintilla-Messages...

; ________________________________________________________________________________________________________________
   Lex proc c lexer:DWORD, startpos:DWORD, laenge:DWORD, initstyle:DWORD, thewords:DWORD, thewindow:DWORD, theprops:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

invoke SendMessage,thewindow,2032,startpos,4    ;SCI_STARTSTYLING
invoke SendMessage,thewindow,2033,laenge,4      ;SCI_SETSTYLING


ret
Lex endp


; ________________________________________________________________________________________________________________
   Fold proc c lexer:DWORD, startpos:DWORD, laenge:DWORD, initstyle:DWORD, thewords:DWORD, thewindow:DWORD, theprops:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

invoke SendMessage,thewindow,2166,startpos,0    ;SCI_LINEFROMPOSITION
invoke SendMessage,thewindow,2222,eax,02000h    ;SCI_SETFOLDLEVEL

ret
Fold endp
Greetings, Nordwind.
Windows 7 (64Bit), JWASM/PoLink

Nordwind64

Ok, first made an includefile for scintilla.  :bg
Greetings, Nordwind.
Windows 7 (64Bit), JWASM/PoLink

Nordwind64

Ok,  I finished this project. Syntax Hightlight works fine, but is also very very slow in big sourcecodes. Seems, I haven't found the right technic. However, I will post it here for other peoples with the same problem.


.386
.model flat, stdcall
option casemap:none

include F:\Programmierung\_Masm32\include\scintilla.inc

include F:\Programmierung\_XProfan\xpia_dir\include\windows.inc
include F:\Programmierung\_XProfan\xpia_dir\include\kernel32.inc
include F:\Programmierung\_XProfan\xpia_dir\include\user32.inc
include F:\Programmierung\_XProfan\xpia_dir\include\masm32.inc
include F:\Programmierung\_XProfan\xpia_dir\include\comctl32.inc
include F:\Programmierung\_XProfan\xpia_dir\include\shell32.inc
include F:\Programmierung\_XProfan\xpia_dir\include\gdi32.inc
include F:\Programmierung\_XProfan\xpia_dir\include\ole32.inc
include F:\Programmierung\_XProfan\xpia_dir\include\comdlg32.inc
include F:\Programmierung\_XProfan\xpia_dir\include\shlwapi.inc
include F:\Programmierung\_XProfan\xpia_dir\include\debug.inc

includelib F:\Programmierung\_XProfan\xpia_dir\lib\kernel32.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\user32.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\masm32.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\comctl32.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\shell32.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\gdi32.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\ole32.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\comdlg32.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\shlwapi.lib
includelib F:\Programmierung\_XProfan\xpia_dir\lib\debug.lib

SMessage proto :DWORD,:DWORD,:DWORD,:DWORD

;=============
; Local macros
;=============
  szText MACRO Name, Text:VARARG
  LOCAL lbl
    jmp lbl
      Name db Text,0
    lbl:
  ENDM

  m2m MACRO M1, M2
    push M2
    pop  M1
  ENDM

  invokeplus MACRO funcname:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20
  local pos

      FOR arg,<p20,p19,p18,p17,p16,p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>

          IFNB <arg>
               pos=@InStr(1,arg,<ADDR>) OR @InStr(1,arg,<addr>) OR @InStr(1,arg,<Addr>)

               IF pos

                  IF (OPATTR(@SubStr(arg,%pos+5))) EQ 98
                          lea eax,@SubStr(<arg>,%pos+5)
                          push eax
                  ELSE
                          push OFFSET @SubStr(<arg>,%pos+5)
                  ENDIF

               ELSE
                          push arg
               ENDIF
          ENDIF
      ENDM
  call funcname
  ENDM

  Scall MACRO name:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22
    FOR arg,<p22,p21,p20,p19,p18,p17,p16,p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1>
    IFNB <arg>
      push arg
    ENDIF
    ENDM
    call name
  ENDM

  pushall macro
    push eax
    push ebx
    push ecx
    push edx
    push esi
    push edi
  endm

  popall macro
    pop edi
    pop esi
    pop edx
    pop ecx
    pop ebx
    pop eax
  endm

.data

  lname   db  "OTHER",0

  laststart     dd  0
  lastremstart  dd  0
  lastlength    dd  0
  endtext       dd  0

  lasttrenn     dd  0
  ebuffer       dd  1

  lastchar      db  0
  lasttext      dd  0

  istext        dd  0
  iscomment     dd  0

  startposorg   dd  0
  endtextorg    dd  0

  lines         dd  0
  whichkw       dd  0

  ausnahme      dd  0
  ausnahmeend   dd  0

  nurso         dd  0
  washex        dd  0

  direct        dd  0
  wnddata       dd  0
  iseax         dd  0

  keyword1      dd  0
  keyword2      dd  0
  keyword3      dd  0
  keyword4      dd  0
  keyword5      dd  0
  keyword6      dd  0
  keyword7      dd  0
  keyword8      dd  0
  wword1        dd  0
  wword2        dd  0
  wword3        dd  0
  wword4        dd  0
  wword5        dd  0
  wword6        dd  0
  wword7        dd  0
  wword8        dd  0

  ticks         dd  0

.data?

  buffer        dd 4096 dup(?)

.code

LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD

    mov eax,1
    ret

LibMain Endp


; ________________________________________________________________________________________________________________
   Lex proc c lexer:DWORD, startpos:DWORD, laenge:DWORD, initstyle:DWORD, thewords:DWORD, thewindow:DWORD, theprops:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

pushall

invoke SendMessage,thewindow,SCI_GETDIRECTFUNCTION,0,0
mov direct,eax
invoke SendMessage,thewindow,SCI_GETDIRECTPOINTER,0,0
mov wnddata,eax

mov edx,thewords
m2m keyword1,[edx]
m2m keyword2,[edx+4]
m2m keyword3,[edx+8]
m2m keyword4,[edx+12]
m2m keyword5,[edx+16]
m2m keyword6,[edx+20]
m2m keyword7,[edx+24]
m2m keyword8,[edx+28]
invoke lstrlen,keyword1
mov wword1,eax
invoke lstrlen,keyword2
mov wword2,eax
invoke lstrlen,keyword3
mov wword3,eax
invoke lstrlen,keyword4
mov wword4,eax
invoke lstrlen,keyword5
mov wword5,eax
invoke lstrlen,keyword6
mov wword6,eax
invoke lstrlen,keyword7
mov wword7,eax
invoke lstrlen,keyword8
mov wword8,eax

mov eax, startpos
add eax,laenge
mov endtext,eax
m2m startposorg,startpos
m2m endtextorg,endtext

.if ausnahme
  mov eax,startpos
  .if eax>ausnahme
    invoke SMessage,wnddata,SCI_LINEFROMPOSITION,ausnahme,0
    invoke SMessage,wnddata,SCI_POSITIONFROMLINE,eax,0
    mov ausnahme,eax
    m2m startpos,ausnahme
  .endif
  invoke SMessage,wnddata,SCI_GETLENGTH, 0, 0
  sub eax,startpos
  mov laenge,eax
.endif

invoke SMessage,wnddata,SCI_LINEFROMPOSITION,startpos,0
invoke SMessage,wnddata,SCI_POSITIONFROMLINE,eax,0
mov startpos,eax

invoke SMessage,wnddata,SCI_STARTSTYLING,startpos,31
invoke SMessage,wnddata,SCI_SETSTYLING,laenge,0

mov eax, startpos
add eax,laenge
mov endtext,eax

;
; Texte und Kommentare erkennen
;
m2m laststart,startpos
m2m lastremstart,startpos
m2m lasttrenn,startposorg
mov ebuffer,1
lea edx,buffer
mov al,32
mov [edx],al
mov istext,0
mov iscomment,0
mov lasttext,10
mov ebx,startpos
xor eax,eax

schleife1:
push ebx
mov lastchar,al
invoke SMessage,wnddata,SCI_GETCHARAT,ebx,0

.if ((al!=32) && (al!=9))
  mov ecx,lasttext
  shl ecx,8
  mov cl,al
  mov lasttext,ecx
  push eax
  invoke CharLowerBuff,addr lasttext,4
  pop eax
.endif
pop ebx

.if ((al==" ") && (istext==0) && (iscomment==0) && (lasttext==0a72656dh)) ; Rem
  sub ebx,4
  mov lastremstart,ebx
  add ebx,4
  mov iscomment,1
.endif

.if ((lastchar=="/") && (al=="/") && (istext==0) && (iscomment==0))       ; //
  dec ebx
  mov lastremstart,ebx
  inc ebx
  mov iscomment,1
.endif

.if ((al=="'") && (istext==0)  && (iscomment==0))                         ; '
  mov lastremstart,ebx
  mov iscomment,1
.endif

.if ((lastchar=="/") && (al=="*") && (istext==0) && (iscomment==0))       ;' /*
  dec ebx
  mov lastremstart,ebx
  mov iscomment,2
  .if ausnahme==0
    mov ausnahme,ebx
    dec ausnahme
  .endif
  inc ebx
  push ebx
  push eax
  invoke SMessage,wnddata,SCI_GETLENGTH, 0, 0
  sub eax,startpos
  mov laenge,eax
  mov eax, startpos
  add eax,laenge
  mov endtext,eax
  pop eax
  pop ebx

.endif

.if ((lastchar=="*") && (al=="/") && (istext==0) && (iscomment==2))       ;' */
  mov iscomment,0

  push eax
  push ebx
  invoke SMessage,wnddata,SCI_STARTSTYLING,lastremstart,31
  pop ebx
  push ebx
  sub ebx,lastremstart
  inc ebx
  invoke SMessage,wnddata,SCI_SETSTYLING,ebx,1
  pop ebx
  pop eax

.endif

.if ((al==13) && (iscomment==1))
  mov iscomment,0

  push eax
  push ebx
  invoke SMessage,wnddata,SCI_STARTSTYLING,lastremstart,31
  pop ebx
  push ebx
  sub ebx,lastremstart
  inc ebx
  invoke SMessage,wnddata,SCI_SETSTYLING,ebx,1
  pop ebx
  pop eax
.endif

.if ((al==13) && (istext==1))
  mov istext,0

  push eax
  push ebx
  invoke SMessage,wnddata,SCI_STARTSTYLING,laststart,31
  pop ebx
  push ebx
  sub ebx,laststart
  inc ebx
  invoke SMessage,wnddata,SCI_SETSTYLING,ebx,4
  pop ebx
  pop eax
.endif

.if iscomment==0
  .if al==34

    .if istext==0
      mov laststart,ebx
    .else
      push eax
      push ebx
      invoke SMessage,wnddata,SCI_STARTSTYLING,laststart,31
      pop ebx
      push ebx
      sub ebx,laststart
      inc ebx
      invoke SMessage,wnddata,SCI_SETSTYLING,ebx,4
      pop ebx
      pop eax
    .endif

    inc istext
    .if istext>=2
      mov istext,0
    .endif
  .endif

.endif


.if ((ebx>=startposorg) && (ebx<=endtextorg) && (istext==0) && (iscomment==0))

  ; Operatorenzeichen
  ;
  .if ((al=="+") || (al=="-") || (al=="*") || (al=="/") || (al=="\") || (al=="^") || (al=="=") || (al=="<") || (al==">") || (al=="&") || (al=="|"))
    push eax
    push ebx
    invoke SMessage,wnddata,SCI_STARTSTYLING,ebx,31
    invoke SMessage,wnddata,SCI_SETSTYLING,1,6
    pop ebx
    pop eax
  .endif

  ; Testen auf Wort-Trennzeichen
  ;
  .if ((al==" ") || (al==9) || (al==",") || (al==";") || (al==":") || (al=="(") || (al==")") || (al=="<") || (al==">") || (al=="[") || (al=="]"))
    jmp wardabei
  .endif
  .if ((al=="{") || (al=="}") || (al=="=") || (al=="/") || (al=="*") || (al=="+") || (al=="-") || (al==34) || (al==10) || (al==13))
    wardabei:
    lea ecx,buffer
    mov edx,ebuffer
    add ecx,edx
    mov dl,32
    mov [ecx],dl
    mov dl,0
    mov [ecx+1],dl
    .if ebuffer>=2
      mov whichkw,0
      push eax
      push ebx
      invoke CharLowerBuff,addr buffer,ebuffer
      inc ebuffer

      ; Jedes geparste Wort steht jetzt im Speicher "buffer". Vorne und hinten ein Leerzeichen, damit die Such-
      ; Routine schneller arbeitet. Anzahl Zeichen + 2 steht in ebuffer.

      ; Eigenes Parsing hier oder nach der Keywortsuche

      ; Geparstes Wort in Keyword-Strings suchen
      ; (eigene Routine FindBytes arbeitet schneller als Scintillas GETPROPERTY-Funktionen)
      ;
      lea ebx,buffer
      Scall FindBytes,keyword1,0,wword1,ebx,ebuffer
      .if eax!=-1
        mov whichkw,10
        jmp gefunden
      .endif
      lea ebx,buffer
      Scall FindBytes,keyword2,0,wword2,ebx,ebuffer
      .if eax!=-1
        mov whichkw,11
        jmp gefunden
      .endif
      lea ebx,buffer
      Scall FindBytes,keyword3,0,wword3,ebx,ebuffer
      .if eax!=-1
        mov whichkw,3
        jmp gefunden
      .endif
      lea ebx,buffer
      Scall FindBytes,keyword4,0,wword4,ebx,ebuffer
      .if eax!=-1
        mov whichkw,6
        jmp gefunden
      .endif
      lea ebx,buffer
      Scall FindBytes,keyword5,0,wword5,ebx,ebuffer
      .if eax!=-1
        mov whichkw,15
        jmp gefunden
      .endif
      lea ebx,buffer
      Scall FindBytes,keyword6,0,wword6,ebx,ebuffer
      .if eax!=-1
        mov whichkw,5
        jmp gefunden
      .endif
      lea ebx,buffer
      Scall FindBytes,keyword7,0,wword7,ebx,ebuffer
      .if eax!=-1
        mov whichkw,9
        jmp gefunden
      .endif
      lea ebx,buffer
      Scall FindBytes,keyword8,0,wword8,ebx,ebuffer
      .if eax!=-1
        mov whichkw,17
        jmp gefunden
      .endif

      ; Numerische Literale
      ;
      xor esi,esi
      lea ebx,buffer
      xor ecx,ecx
      schleife8:
      mov al,[ebx]
      xor edi,edi
      .if ecx==1
        .if ((al=="$") || (al=="%"))
          mov edi,1
          .if (al=="$")
            mov esi,1
          .endif
        .endif
      .endif
      .if esi==1
        .if ((al=="a") || (al=="b") || (al=="c") || (al=="d") || (al=="e") || (al=="f"))
          mov edi,1
        .endif
      .endif
      .if (((al>="0") && (al<="9")) || ((edi==1) || (al==0) || (al==" ") || (al==".")))
      .else
        jmp endesch8
      .endif
      inc ebx
      inc ecx
      cmp al,0
      jne schleife8
      mov whichkw,2
      jmp gefunden
      endesch8:

      ; Klassische Bezeichner
      ;
      lea ebx,buffer
      add ebx,ebuffer
      sub ebx,2
      mov al,[ebx]
      .if ((al=="#") || (al=="$") || (al=="!") || (al=="%") || (al=="&"))
        mov whichkw,8
        jmp gefunden
      .endif

      ; Geparstes Wort umfärben
      ;
      .if whichkw!=0
        gefunden:
        sub ebuffer,2
        invoke SMessage,wnddata,SCI_STARTSTYLING,lasttrenn,31
        invoke SMessage,wnddata,SCI_SETSTYLING,ebuffer,whichkw
      .endif
      ;--------------
      pop ebx
      pop eax
    .endif
    mov lasttrenn,ebx
    inc lasttrenn
    mov ebuffer,1

  .else
    lea ecx,buffer
    mov edx,ebuffer
    mov [ecx+edx],al
    inc ebuffer
  .endif
.else
  mov lasttrenn,ebx
  inc lasttrenn
  mov ebuffer,1
.endif

inc ebx
.if ebx<endtext
  jmp schleife1
.endif

.if ((istext==0) && (iscomment==2))
  mov iscomment,0
  invoke SMessage,wnddata,SCI_STARTSTYLING,lastremstart,31
  invoke SMessage,wnddata,SCI_GETLENGTH, 0, 0
  sub eax,lastremstart
  invoke SMessage,wnddata,SCI_SETSTYLING,eax,1
.endif

popall

ret 28
Lex endp


; ________________________________________________________________________________________________________________
   Fold proc c lexer:DWORD, startpos:DWORD, laenge:DWORD, initstyle:DWORD, thewords:DWORD, thewindow:DWORD, theprops:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

pushall

;invoke SendMessage,thewindow,SCI_LINEFROMPOSITION,startpos,0
;invoke SendMessage,thewindow,SCI_SETFOLDLEVEL,eax,startpos

popall

ret 28
Fold endp


FindBytes proc ;#################################################################################################
push ebp
mov  ebp,esp
push ebx

  mov   ebx,[ebp+8]       ;ebx = Pointer (plus Offset) auf Bereich#
  add   ebx,[ebp+12]

  mov   edi,[ebp+8]       ;edi = Pointer auf das Ende des Bereichs#
  add   edi,[ebp+12]
  add   edi,[ebp+16]


  mov   edx,[ebp+20]      ;edx = Pointer auf String$

  mov   esi,[ebp+24]      ;esi = Lônge des Strings

  mov   eax,0


  lllhastloop:
  mov   al,[ebx]
  cmp   al,[edx]
  je    lllhastig
  lllhastweiter:
  inc   ebx
  cmp   ebx,edi
  je    lllendehastig
  jmp   lllhastloop
  lllhastig:
  cmp   esi,1
  je    lllgollo
  mov   ecx,1
  lllhastig2:
  mov   al,[ebx+ecx]
  cmp   al,[edx+ecx]
  jne   lllhastweiter
  inc   ecx
  cmp   ecx,esi
  jne   lllhastig2
  lllgollo:
  sub   ebx,[ebp+8]
  mov   eax,ebx
  jmp   lllallehastig
  lllendehastig:
  mov   eax,-1

  lllallehastig:

pop ebx
pop ebp
ret 20
FindBytes endp


; ________________________________________________________________________________________________________________
   SMessage proc para1:DWORD, para2:DWORD, para3:DWORD, para4:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

push para4
push para3
push para2
push para1
Call direct

ret 16
SMessage endp


; ________________________________________________________________________________________________________________
   GetLexerCount proc c
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

  mov eax,1

ret
GetLexerCount endp


; ________________________________________________________________________________________________________________
   GetLexerName proc c para1:DWORD, para2:DWORD, para3:DWORD
; ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

  mov edx,para2
  mov al,0
  mov [edx],al
  invoke lstrcat,para2,addr lname

ret 12
GetLexerName endp


End LibMain


:'(
Greetings, Nordwind.
Windows 7 (64Bit), JWASM/PoLink

Nordwind64

Ok, I found a much more effectiver way for my coloring. Now I use SCI_GETSTYLEDTEXT and SCI_SETSTYLINGEX which works 10 times faster.  :U

Folding ist easy,too.

    push eax
    push ebx
    .if ((al==10) || (al==0))
      .if folder==1
        pop ebx
        push ebx
        sub ebx,speichertext
        invoke SendMessage,thewindow,SCI_LINEFROMPOSITION,ebx,0
        mov ebx,level
        or ebx,SC_FOLDLEVELHEADERFLAG
        invoke SendMessage,thewindow,SCI_SETFOLDLEVEL,eax,ebx
        inc level
      .elseif folder==2
        pop ebx
        push ebx
        sub ebx,speichertext
        invoke SendMessage,thewindow,SCI_LINEFROMPOSITION,ebx,0
        mov ebx,level
        invoke SendMessage,thewindow,SCI_SETFOLDLEVEL,eax,ebx
        dec level
        .if level<SC_FOLDLEVELBASE
          mov level,SC_FOLDLEVELBASE
        .endif
      .else
        pop ebx
        push ebx
        sub ebx,speichertext
        invoke SendMessage,thewindow,SCI_LINEFROMPOSITION,ebx,0
        mov ebx,level
        invoke SendMessage,thewindow,SCI_SETFOLDLEVEL,eax,ebx
      .endif
      mov folder,0
      mov wnummer,0
    .endif
    pop ebx
    pop eax
Greetings, Nordwind.
Windows 7 (64Bit), JWASM/PoLink

Mincho Georgiev