Re: Going Loopy
Posted: Wed Feb 26, 2020 6:05 pm
				
				Yes I noticed thatMarc56us wrote:Hum, bug
Otherwise the program will always look for the same term (the one given at the opening).
Yes I noticed thatMarc56us wrote:Hum, bug
Otherwise the program will always look for the same term (the one given at the opening).
You can't change gadget properties from threads... This crashedI don't have mac and rarely code PB on Linux. What part is not compatible ?mk-soft wrote:Don't forget...
That not work with Linux or maOS
Hi,You can't change gadget properties from threads... This crashed
Show signature ThreadToGUI
While Not Eof(hFile)
ReadString(hFile)
Lines + 1
Wend
CloseFile(hFile)
Code: Select all
Procedure CountFileByte(filename.s, byte)
  Protected result, bytes_read
  Protected buffer_size = 65536
  Protected f = ReadFile(#PB_Any, filename)
  Protected *mem = AllocateMemory(buffer_size + 48)
  Protected *pos = (*mem + 15) & -16
  While Not Eof(f)
    bytes_read = ReadData(f, *pos, buffer_size)
    If bytes_read <> buffer_size
      FillMemory(*pos + bytes_read, 32, ~byte)
      bytes_read = (bytes_read + 31) & -32
    EndIf
    !pxor xmm5, xmm5
    !movzx edx, byte [p.v_byte]
    !imul edx, 0x01010101
    !movd xmm4, edx
    !pshufd xmm4, xmm4, 0
    !mov edx, 0x01010101
    !movd xmm3, edx
    !pshufd xmm3, xmm3, 0
    !movd xmm0, [p.v_result]
    CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
      !mov edx, [p.p_pos]
      !mov ecx, [p.v_bytes_read]
      !cfb_loop32b:
      !movdqa xmm1, [edx]
      !movdqa xmm2, [edx + 16]
    CompilerElse
      !mov rdx, [p.p_pos]
      !mov rcx, [p.v_bytes_read]
      !cfb_loop32b:
      !movdqa xmm1, [rdx]
      !movdqa xmm2, [rdx + 16]
    CompilerEndIf
    !pcmpeqb xmm1, xmm4
    !pcmpeqb xmm2, xmm4
    !pand xmm1, xmm3
    !psubb xmm1, xmm2
    !psadbw xmm1, xmm5
    !paddq xmm0, xmm1
    CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
      !add edx, 32
      !sub ecx, 32
    CompilerElse
      !add rdx, 32
      !sub rcx, 32
    CompilerEndIf
    !jnz cfb_loop32b
    !pshufd xmm1, xmm0, 00001110b
    !paddq xmm0, xmm1
    !movd [p.v_result], xmm0
  Wend
  CloseFile(f)
  FreeMemory(*mem)
  ProcedureReturn result
EndProcedureCode: Select all
lines = CountFileByte(file$, 13)Code: Select all
If FindString(text$,"ERROR") = 21 And FindString(text$,":\")
        st=FindString(text$,"(0x")
        err$=Mid(text$,27,st-1)
        AddGadgetItem(Editor,-1,text$):err+1
      Endif
Code: Select all
C:\>"C:\Program Files\Git\usr\bin\wc.exe" -l Txt_1_GB.txt
6008007 Txt_1_GB.txt    Code: Select all
C:\>findstr "20:06:46" Txt_1_GB.txtCode: Select all
If Mid(Txt$, 21, 5) = "ERROR"
    Debug "Error: " + Mid(Txt$, 32, 8)
EndIf
Code: Select all
Counting lines, Please Wait...
EOF
8.60 secs
ASM
0.22 secsCode: Select all
If ElapsedMilliseconds()-starttime >=20:starttime.q=ElapsedMilliseconds():SetGadgetState(ProgressBar_0,pg):EndIf
          If ElapsedMilliseconds()-starttime >=20:starttime.q=ElapsedMilliseconds():SetGadgetText(tim,Str(ElapsedMilliseconds()/1000-ltim/1000)+" Second(s)"):EndIfCode: Select all
s$="-------------------------------------------------------------------------------"+#CRLF$+
    "ROBOCOPY     ::     Robust File Copy For Windows                              "+#CRLF$+
    "-------------------------------------------------------------------------------"+#CRLF$+#CRLF$+
    
    "  Started : 22 January 2020 08:00:07"+#CRLF$+
    "   Source : C:\test\test"+#CRLF$+
    "     Dest : \\testfiler\testfiler\test\"+#CRLF$+#CRLF$+
    
    "   Files : *.*"+#CRLF$+#CRLF$+
    	    
    "Exc Files : autorun.inf"+#CRLF$+
                              " "+#CRLF$+	    
                              "Options : *.* /V /TEE /S /E /COPYALL /PURGE /MIR /ZB /XO /MT:4 /R:1 /W:1 "+#CRLF$+
                              " "+#CRLF$+
                              "------------------------------------------------------------------------------"+#CRLF$
    
  e$="------------------------------------------------------------------------------"+#CRLF$+#CRLF$+
  "              Total     Copied    Skipped  Mismatch    FAILED    Extras"+#CRLF$+
  "    Dirs :    161280    161273    161272          0        21         0"+#CRLF$+
  "    Files :   1240450   1240290        17         0       143         0"+#CRLF$+
   "   Bytes :   4.414 t   4.399 t       850         0  15.803 g         0"+#CRLF$+
   "   Times : 377:26:21  60:49:51                       0:00:00  15:28:13"+#CRLF$+
   "   Ended : 25 January 2020 12:18:12"+#CRLF$+#CRLF$
  
err$+"2020/01/21 08:32:46 ERROR 31 (0x0000001F) Copying NTFS Security To Destination File c:\test\test\test.doc"+#CRLF$+
"2020/01/21 08:32:46 ERROR 1 (0x0000001F) Copying NTFS Security To Destination File c:\test\test\test.doc"+#CRLF$+
"2020/01/21 08:32:46 ERROR 1920 (0x0000001F) Copying NTFS Security To Destination File c:\test\test\test.doc"+#CRLF$
r$="random line"+#CRLF$
CreateFile(0,"C:\data\Robocopytest.log")
WriteString(0,s$)
While FileSize("C:\data\Robocopytest.log")<1073741821
  x=Random(500,1)
    For a = 1 To x
      WriteString(0,r$)
    Next a
    x=Random(1500,0)
   If x=20
    For a = 1 To x
      WriteString(0,err$)
    Next a
   EndIf
Wend
WriteString(0,e$)
CloseFile(0)
Code: Select all
lines = CountFileByte(file$, 13) ;All Wilbert
     Protected Factor = Lines / 20
                
      If ReadFile(hfile,file$)
          s1=0:length2 = FileSize(File$)
                              
          While Not Eof(hfile)
             
          x+1 : x2+1
          If x / factor = x % Factor
          StatusBarProgress(0,0,x,#PB_StatusBar_Raised, 0, lines)
          EndIf
          Text$ = ReadString(hfile)
                                    
         ps=FindString(text$,"Started : "):If ps<>0:s1+1:started(s1)=Mid(text$,ps+10,Len(text$)):spos(s1)=(x):Debug "started : "+started(s1):ps=0:EndIf
         ps=FindString(text$,"Ended : ")  :If ps<>0:s2+1:ended(s2)=Mid(text$,ps+8,Len(text$)):epos(s2)=(x):Debug "ended : "+ended(s2):ps=0:EndIf
         ps=FindString(Text$,"Dest : ")   :If ps<>0:s3+1:Destination(s3)=Mid(text$,ps+7,Len(text$)):Debug "Dest : "+ Destination(s3):ps=0:EndIf
         ps=FindString(text$,"Options : "):If ps<>0:s4+1:Options(s4)=Mid(text$,ps+10,Len(text$)):Debug "Options : "+Options(s4):ps=0:EndIf
             
      If x>=spos(curon) And s1=curon
       If epos(curon)=0 Or x<=epos(curon)
                         
    If FindString(text$,"ERROR") = 21 And FindString(text$,":\")
      st=FindString(text$,"(0x")
      err$=Mid(text$,27,st-1)
      
        If run=0:errcount(Val(err$))+1
           AddGadgetItem(Editor,-1,text$):err+1
        EndIf
        
        If run=1
          If checked(Val(err$))=0
            AddGadgetItem(Editor,-1,text$):err+1
          EndIf
        EndIf
      EndIf
    EndIf
  EndIf
 Wend