Code patching

BlitzMax Forums/BlitzMax Programming/Code patching

fredborg(Posted 2007) [#1]
Hi,

Does anyone know if there is a standard code patcher around? One that works with any language and just requires some tags to work, like:
[OPEN]myfile.bmx[/]
[FIND]"hello world[/]
[INSERT AFTER] and worldets[/]
[FIND]"Funky!"[/]
[REPLACE WITH]"Groovy!"[/]
Or something similar.

I want to make my max module tweaks, so that they can be easily applied after a sync mods... Otherwise I'll have to make a simple system myself.


TheSin(Posted 2007) [#2]
I don't know but there is a " missing after world and after worldets...


fredborg(Posted 2007) [#3]
Hi,

Well, I made my own really simple one since I couldn't find one. The syntax is ugly and it's not very versatile, but it does the job.

Here it is:


And here is a script to apply the SetMaxWindowSize for Windows:



And the Textfield Return tweak:


And a tweak to block hotkeys from being triggered in textfields and textareas:



Beaker(Posted 2007) [#4]
This would be an ideal AutoHotKey job I suspect.


Chris C(Posted 2007) [#5]
why not just use patch?

patch --help
Usage: patch [OPTION]... [ORIGFILE [PATCHFILE]]

(should be part of mingw if not *easily* installable)

There are even GUI's for it :o


tonyg(Posted 2007) [#6]
I did something similar to search for Function or Method and stuck debuglog messages in each BRL.mod module to say when a function/method was entered. Worked pretty well and helped find out how images/pixmaps worked.


Brucey(Posted 2007) [#7]
Yeah, patch uses the unified diff format (which is pretty much a standard) and is used by the likes of Subversion for its diff/merge/patching.

"diff" is also a nice tool for comparing differences between two files - also outputs unified diff format.