|
Post by bigbass on Jul 1, 2012 22:36:58 GMT 1
updated below
|
|
|
Post by bigbass on Oct 19, 2017 17:59:53 GMT 1
very simple but I still use it 'dnd-diff.bac 'Joe Arose "bigbass" 'July 2nd 2012 'Oct 2017 added CHOP$ to clean up an error with the mate desktop
' Include the files for making a GUI. INCLUDE hug.bac INIT
PRINT " bacon version " ,VERSION$
SUB entry_demo() ORIGINAL_FILE$ = CHOP$(GRAB$(My_entry),0) file_start$ = "file:///" 'get rid of drag n drop prefixed file:// IF REGEX(ORIGINAL_FILE$ , file_start$) THEN ORIGINAL_FILE$ = REPLACE$(ORIGINAL_FILE$ , file_start$, "/") ELSE ORIGINAL_FILE$ = CHOP$(GRAB$(My_entry),0) ENDIF
CHANGED_FILE$ = GRAB$(My_entry2) file_start$ = "file:///" 'get rid of drag n drop prefixed file:// IF REGEX(CHANGED_FILE$ , file_start$) THEN CHANGED_FILE$ = REPLACE$(CHANGED_FILE$ , file_start$, "/") ELSE CHANGED_FILE$ = GRAB$(My_entry2) ENDIF CHANGED_FILE$ = CHOP$(CHANGED_FILE$,0) ORIGINAL_FILE$ = CHOP$(ORIGINAL_FILE$,0) 'the filtered or unfiltered file gets passed here 'we let your system open the file for viewing based on your defaults SYSTEM CONCAT$("diff ", "-pruN " , ORIGINAL_FILE$ , " ", CHANGED_FILE$ , " > " ,ORIGINAL_FILE$,".diff" ) SYSTEM CONCAT$("xdg-open ", ORIGINAL_FILE$,".diff") END SUB
Mainwin = WINDOW( "BaCon DND diff", 350, 200 )
My_label = MARK( "Original file ", 300, 30 ) ATTACH( Mainwin, My_label, -80, 10) FONT(My_label, "sans 12")
My_entry = ENTRY("", 320, 30) ATTACH( Mainwin, My_entry, 10, 40 ) CALLBACK(My_entry, entry_demo)
My_label2 = MARK( "Modified file ", 300, 30 ) ATTACH( Mainwin, My_label2, -80, 80) FONT(My_label2, "sans 12")
My_entry2 = ENTRY("", 320, 30) ATTACH( Mainwin, My_entry2, 10, 110 ) CALLBACK(My_entry2, entry_demo)
' Create a button. My_button = BUTTON("Diff", 80, 30) ATTACH( Mainwin, My_button , 140, 165 ) CALLBACK(My_button, entry_demo)
' Create a button. My_button2 = BUTTON("QUIT", 80, 30) ATTACH( Mainwin, My_button2 , 240, 165 ) CALLBACK(My_button2, QUIT)
DISPLAY
|
|
|
Post by vovchik on Oct 19, 2017 19:53:15 GMT 1
Dear Joe,
Thanks. I am getting a runtime segfault on my Mint machine and will look into this. Can't at the moment see why... so have to look more closely.
With kind regards, vovchik
|
|
|
Post by bigbass on Oct 19, 2017 20:16:32 GMT 1
Thanks for the feedback vovchik
I am not at a computer until Tonight I hope I pasted the code Correctly (gulp)
It is a small snippet of code Only diff And xdg-open Run time
Could force geany...to open it
I noticed also could be a folder name with a space have to fix that
Can you source it in a terminal? Or it crashes before any info
Thanks I'll check it tonight You'll probally solve it before then
Joe
|
|
|
Post by vovchik on Oct 19, 2017 20:47:25 GMT 1
Dear Joe,
It is the latest HUG and it segfaults when starting...so no console messages except:
ERROR: signal for SEGMENTATION FAULT received - memory invalid or array out of bounds? Try to compile the program with TRAP LOCAL to find the cause.
I assume it is some kind of an array out of bounds error. Will check...
With kind regards, vovchik
|
|
|
Post by vovchik on Oct 19, 2017 20:51:30 GMT 1
Dear Joe, I found the culprit. It is the INIT statement. It needs to be commented out. That was simple. With kind regards, vovchik
|
|
|
Post by bigbass on Oct 19, 2017 23:38:58 GMT 1
Thanks old code I had the hug_import.bac before
I get lazy to type. The drag The file name and drop saves time When you have to diff different versions of code
Thanks for another one You solved first
Joe
|
|