News:

Function Finder  Find all the functions within source code files

Main Menu

Compare Sources Codes - Matching Code ?

Started by kevin, August 20, 2024, 10:06:56 AM

Previous topic - Next topic

kevin

Compare Sources Codes - Matching Code ?


  This code includes a function to compare a pair of source files to each other.  The function returns if the two functions are the same or not.

  Usage demo

PlayBASIC Code: [Select]
        //  Run in DEBUG (F7) and view the console window
// to see output

loadfont "arial narrow",1, 36

Path$ ="Examples/"
File1$ =Path$+"test-code1.pba"
File2$ =Path$+"test-code2.pba"
Message(File1$,File2$)

Sync
WaitKEY




Function Message(File1$,File2$)

c1=$334455
c2=$776633
th=getTextHeight("|")/2
ypos=getcursory()
ypos2=ypos+th

shadebox 0,ypos,getsurfacewidth(),ypos2,c1,c2,c1,c2
setcursor 0,ypos2
print "Comparing Source Files"
print "File [1] ="+file1$
print "File [2] ="+file2$
result=COMPARE_SOURCE_FILES(file1$,file2$)
print "Compare Result #"+str$(result)
print ""

EndFunction


; ---------------------------------------------------------------------------------------
; ---------------------------------------------------------------------------------------
; ---------------------------------------------------------------------------------------
Function LoadFileToString(file$)
if FIleexist(file$)
local size=filesize(file$)
local f=readnewfile(file$)
result$=readchr$(f,size)
closefile f
endif
EndFunction Result$









 Related Links:

   - Function Finder
   - PlayBASIC Home Page


Download Sources Code


    Attached bellow