Hi, this is my fist post on this ML, i want to share some little extensions that i've made to C Language Bundle.
Hope these helps
Name : Run Activation : command-R
#!/usr/bin/python import os file = os.environ['TM_FILEPATH'] path = os.path.split(file) filename = path[1].split('.') os.system("gcc -Os " + path[1] + " -o " + filename[0]) os.system("./" + filename[0])
Name : Run Project Activation : command-shift-R
#!/usr/bin/python import os file = os.environ['TM_PROJECT_FILEPATH'] path = os.path.split(file) projectName = path[-1].split('.') projectName = projectName[0] os.system("make -k") os.system("./" + projectName)
Name : Compile Activation : command-B
#!/usr/bin/python import os file = os.environ['TM_FILEPATH'] os.system("gcc -c -Os " + file);
Name : Compile Project Activation : command-shift-B
make -k
On 15/09/2005, at 14.07, Wezzy wrote:
Hi, this is my fist post on this ML, i want to share some little extensions that i've made to C Language Bundle.
Hope these helps [...]
A problem is that most people who do projects, use Makefiles so just running make would likely be a better choice. Either that or, if they use XCode, they build with that, for which there already is a command.
-- Sune.
Sune Foldager cryo@cyanite.org wrote:
On 15/09/2005, at 14.07, Wezzy wrote:
Hi, this is my fist post on this ML, i want to share some little extensions that i've made to C Language Bundle.
Hope these helps [...]
A problem is that most people who do projects, use Makefiles so just running make would likely be a better choice. Either that or, if they use XCode, they build with that, for which there already is a command.
-- Sune.
I know, in fact the last bundle only call make -k (like emacs), but sometimes i have to write small C files so these bundles save my time.
Bye Wezzy
___________________________________ Yahoo! Messenger: chiamate gratuite in tutto il mondo http://it.messenger.yahoo.com
On Sep 15, 2005, at 8:54 AM, Allan Odgaard wrote:
On 15/09/2005, at 14.28, Fabio wezzy Trezzi wrote:
[...] sometimes i have to write small C files so these bundles save my time.
Actually I also do that a lot myself, and so far has just been to lazy to write a generic command to call gcc on the file (and pretty print errors).
Same here, although I frequently also need to add frameworks on the build line as well. The technique I usually use is to embed the commands in the source code:
/* cd "$TM_DIRECTORY" g++ "$TM_FILEPATH" -Os -framework CoreMIDI -framework CoreFoundation - o MIDIXXTest */
Select both lines and control-r.
Chris
Allan Odgaard allan@macromates.com wrote:
On 15/09/2005, at 14.28, Fabio wezzy Trezzi wrote:
[...] sometimes i have to write small C files so these bundles save my time.
Actually I also do that a lot myself, and so far has just been to lazy to write a generic command to call gcc on the file (and pretty print errors).
writing something that read gcc error like the python bundle could be useful.
On 15/09/2005, at 17.03, Wezzy wrote:
Actually I also do that a lot myself, and so far has just been to lazy to write a generic command to call gcc on the file (and pretty print errors).
writing something that read gcc error like the python bundle could be useful.
Here's a very simple version:
echo '<pre>' g++ "$TM_FILEPATH" \ 2> >(perl -pe 's|^.*?:(\d+):\s*(.*?)$|<a href="txmt://open?line= $1">$2</a>|')
Set output to Show as HTML.
It redirects stderr (2>) to a perl one-liner which convert lines of the form: «something»:«line»:«something» into an txmt://-link that points to «line» (in current buffer).
So this gives you clickable errors, as long as the format is as above.
On 15/09/2005, at 17.47, Allan Odgaard wrote:
Here's a very simple version: echo '<pre>' g++ "$TM_FILEPATH" \ 2> >(perl -pe 's|^.*?:(\d+):\s*(.*?)$|<a href="txmt://open? line=$1">$2</a>|')
Actually, make that $TM_FILENAME instead (for nicer output).
And if you btw want to use -o with the basename:
echo '<pre>' g++ "$TM_FILENAME" -o "$(perl -pe <<<"$TM_FILEPATH" 's|.[^.]+ $||')" \ 2> >(perl -pe 's|^.*?:(\d+):\s*(.*?)$|<a href="txmt://open?line= $1">$2</a>|')
On 15/09/2005, at 17.50, Allan Odgaard wrote:
And [...]
Well, when you pickup something simple, you just can't let it go… here's another iteration:
echo -n '<pre>' if g++ "$TM_FILENAME" -o "$(perl -pe <<<"$TM_FILEPATH" 's|.[^.]+ $||')" \ 2> >(perl -pe 's|^.*?:(\d+):\s*(.*?)$|<a href="txmt://open?line= $1">$2</a>|') then echo "</pre><h3>Build succeded</h3>" else echo "</pre><h3>Build failed</h3>" fi
Allan Odgaard allan@macromates.com wrote:
On 15/09/2005, at 17.50, Allan Odgaard wrote:
And [...]
Well, when you pickup something simple, you just can't let it go… here's another iteration:
echo -n '<pre>' if g++ "$TM_FILENAME" -o "$(perl -pe <<<"$TM_FILEPATH" 's|\.[^.]+
$||')" \ 2> >(perl -pe 's|^.*?:(\d+):\s*(.*?)$|<a href="txmt://open?line= $1">$2</a>|') then echo "</pre><h3>Build succeded</h3>" else echo "</pre><h3>Build failed</h3>" fi
Wow that's great! This remember to me that i have to learn RE :-) Thanks for the very quick response and the usful trick
Bye Wezzy
___________________________________ Yahoo! Messenger: chiamate gratuite in tutto il mondo http://it.messenger.yahoo.com