webamp/modern/resources/maki_decompiler_1.1/tool/extract_objects.pl
Jordan Eldredge aedd8e4745
Modern integration (#833)
* Make modern part of the code base

`yarn modern` will now start a dev server with the modern app running.

The debugger is not yet setup

`yarn test` will run all the tests, both Webamp and "modern".

* Let debug work

* Prettier

* Ignore lint errors for now

* Point test at the now skin location
2019-08-05 19:17:12 -07:00

70 lines
1.6 KiB
Perl

#!/usr/bin/perl -w
# funktion to parse the winamps std.mi file
use strict;
my %objects;
my %objectIDs;
while( <> ) {
if( /\s*extern\s+(.*?)\s+(.*?)\s*\.(.*?)\s*\((.*)\);/ ) { # function definition
#print "f $1#$2#$3#$4\n";
my %function;
$function{'name'} = $3;
$function{'result'} = $1;
my $objectName = $2;
my @args = split( /\s*,\s*/, $4 );
my @parameters;
foreach( @args ) {
if( /^\s*(.*?)\s+(.*)\s*$/ ) {
push @parameters, [$1, $2];
}
}
$function{'parameters'} = \@parameters;
push @{$objects{$objectName}->{'functions'}}, \%function;
} elsif( /\s*extern\s+(.*?)\s*\.(.*?)\s*\((.*)\);/ ) { # function definition
#print "f $1#$2#$3#$4\n";
my %function;
$function{'name'} = $2;
$function{'result'} = "";
my $objectName = $1;
my @args = split( /\s*,\s*/, $3 );
my @parameters;
foreach( @args ) {
if( /^\s*(.*?)\s+(.*)\s*$/ ) {
push @parameters, [$1, $2];
}
}
$function{'parameters'} = \@parameters;
push @{$objects{$objectName}->{'functions'}}, \%function;
} elsif( /\s*extern\s+class\s*\@\{(........-....-....-....-............)\}\@\s*(.*?)\s+(.*?);/ ) { # object definition
#print "o $1#$2#$3\n";
my $id = $1;
my $parent = $2;
my $name = $3;
$id =~ s/-//g;
$name =~ s/^&//;
$name =~ s/^_predecl //;
my %object;
$object{'name'} = $name;
$object{'parent'} = $parent;
$object{'functions'} = [];
$objects{$name} = \%object;
$objectIDs{$id} = \%object;
}
}
use Data::Dumper;
print Dumper( \%objectIDs );