MkReaperAPITable.pl

From CockosWiki

Jump to: navigation, search
#
# mkReaperAPITable.pl
#
# Rev When     Who        What
# --- -------- ---------- -----------------------------------------------------
# 002 15/12/09 MikeLacey  Fix stupid find-function-name bug
# 001 15/12/09 MikeLacey  Case insensitve sort
# 000 14/12/09 MikeLacey  Original version
#

use strict;
use warnings;

# format of Wiki table
# {|class=\"wikitable\
# | [[RPR_GetUserInputs|GetUserInputs()]]
# | [[RPR_AddMediaItemToTrack|AddMediaItemToTrack]]
# | [[RPR_AddProjectMarker|AddProjectMarker]]
# | [[RPR_AddTakeToMediaItem|AddTakeToMediaItem]]
# |-
# |}

use constant NUMCOLS => 4;
my $col_num = 0;
my $function_name;
my @functions;

while(<DATA>){
    if(/^REAPERAPI_DECL/){              # find new declaration line
        /\(\*/;                         # find start of function name
        $_ = $';                        # set $_ to everything after that
        /\)/;                           # find end of function name
        $function_name = $`;            # set $_ to everything before that
        push @functions, $function_name;
    }
}

print "{|class=\"wikitable\"\n";    # start of table

foreach $function_name (sort {uc($a) cmp uc($b)} @functions){
    $col_num++;
    print "| [[RPR_$function_name|$function_name]]\n";
    if($col_num==4){
       print "|-\n";
       $col_num=0;
    }
}
print "|}\n";                       # end of table
exit;

# all the stuff below the __DATA__ line below is taken directly from the
# reaper_plugin_functions.h file generated by REAPER
__DATA__

// __mergesort is a stable sorting function with an API similar to qsort().
// HOWEVER, it requires some temporary space, equal to the size of the data being sorted, so you can pass it as the last parameter,
// or NULL and it will allocate and free space internally.
REAPERAPI_DECL void (*__mergesort)(void* base, size_t nmemb, size_t size, int (*cmpfunc)(const void*,const void*), void* tmpspace);

// menuidstr is some unique identifying string
// menuname is for main menus only (displayed in a menu bar somewhere), NULL otherwise
// kbdsecname is the name of the KbdSectionInfo registered by this plugin, or NULL for the main actions section
REAPERAPI_DECL bool (*AddCustomizableMenu)(const char* menuidstr, const char* menuname, const char* kbdsecname, bool addtomainmenu);

// Add an Extensions main menu, which the extension can populate/modify with plugin_register("hookcustommenu")
REAPERAPI_DECL bool (*AddExtensionsMainMenu)();

// creates a new media item.
REAPERAPI_DECL MediaItem* (*AddMediaItemToTrack)(MediaTrack* tr);

// Returns the index of the created marker/region, or -1 on failure. Supply wantidx>=0 if you want a particular index number, but you'll get a different index number a region and wantidx is already in use.
REAPERAPI_DECL int (*AddProjectMarker)(ReaProject* proj, bool isrgn, double pos, double rgnend, const char* name, int wantidx);

// creates a new take in an item
REAPERAPI_DECL MediaItem_Take* (*AddTakeToMediaItem)(MediaItem* item);

// forceset=0,doupd=true,centermode=-1 for default
REAPERAPI_DECL void (*adjustZoom)(double amt, int forceset, bool doupd, int centermode);

REAPERAPI_DECL void (*APITest)();

// is in pre-buffer? threadsafe
REAPERAPI_DECL int (*Audio_IsPreBuffer)();

(and many more...)