Editing User:Generalantilles/rm you

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 138: Line 138:
rm_you: and be put into libhildon
rm_you: and be put into libhildon
-
 
-
timeless: I might give you perl that would hack gtk_ for this...
 
-
 
-
timeless: it really shouldn't be that bad
 
-
 
-
rm_you: I tried rewriting GtkMenu / GtkMenuItem last week
 
-
 
-
rm_you: it turned into a nightmare
 
-
 
-
rm_you: I don't know nearly enough about the inner workings of GTK to mess with that stuff <_<
 
-
 
-
timeless: well... you'd want something like:
 
-
 
-
 
-
#!/usr/bin/perl
 
-
 
-
unless (/^gtk_.*_set_/) { print; next; }
 
-
 
-
if (/\((.*)\)/) {
 
-
 
-
# one line case - not implemented because afaict, gtk doesn't use it
 
-
 
-
} elseif (/\((.*)/) {
 
-
 
-
#multi line case
 
-
 
-
my @args = ();
 
-
 
-
some_looping_here:
 
-
 
-
/\((?:const\s+|)(\S+)\s+(\*|)(\S+)([.)])/;
 
-
 
-
my ($type, $pointer, $name, $more) = ($1, $2, $3, $4);
 
-
 
-
push @args, $name;
 
-
 
-
$types{$name} = $type;
 
-
 
-
$pointers{$name} = $pointer;
 
-
 
-
goto some_looping_here if ($more eq ',');
 
-
 
-
#oops, probably would have been a good idea to read another line from input before doing that goto :)
 
-
 
-
#some perl assembly required ;-)
 
-
 
-
#at this point we've reached a line that ends in )
 
-
 
-
#we probably should have been printing the lines somewhere too... oh well, more assembly required
 
-
 
-
#eat the next line
 
-
 
-
<>;
 
-
 
-
die "i was really hoping to see an open brace ..." unless /^[{]/;
 
-
 
-
foreach my $arg (@args) {
 
-
 
-
if ($pointers{$arg}) { print qq#fprintf(stderr, "$arg %p ", $arg);\n#; }
 
-
 
-
elseif ($types{$arg} =~ /int$/i) { print qq#fprintf(stderr, "$arg %d, ", $arg);\n#; }
 
-
 
-
else {
 
-
 
-
#hrm, better work could be used here, you'll have to figure out what other creatures there are... you probably wanted to special case char before pointer :)
 
-
 
-
print qq#fprintf(stderr, "$arg %p, ", & $arg);\n#; }
 
-
 
-
}
 
-
 
-
print qq#fprintf(stderr, "\n");\n#;
 
-
 
-
#ok... thats a draft for the head
 
-
 
-
#in theory you'd want to deal w/ gtk_new and anything else that creates a pointer, but in practice, you won't really need it
 
-
 
-
#the goal is basically perl myscript.pl < gtkmenu.c > gtkmenu-evil.c
 
===Emails from Timeless concerning GTK stuff with applets:===
===Emails from Timeless concerning GTK stuff with applets:===

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)