github.com/256dpi/max-go@v0.7.0/lib/max/ext_packages.h (about)

     1  /* 
     2  	ext_packages.h
     3  	API for access to Max Packages.
     4  	Timothy Place
     5  	Copyright 2013 - Cycling '74
     6  */
     7  
     8  #ifndef _EXT_PACKAGES_H_
     9  #define _EXT_PACKAGES_H_
    10  
    11  #include "ext_prefix.h"
    12  #include "ext_mess.h"
    13  #include "ext_linklist.h"
    14  #include "ext_dictionary.h"
    15  
    16  /** A container for a path/filename pair,
    17  	together with additional meta fields for special cases
    18  	@ingroup	packages
    19  */
    20  typedef struct _package_file {
    21  	t_symbol	*filename;
    22  	t_symbol	*name;
    23  	short		path;
    24  } t_package_file;
    25  
    26  
    27  BEGIN_USING_C_LINKAGE
    28  
    29  
    30  /** return the max path for a named package's folder
    31  
    32  	@ingroup	packages
    33  	@param		packagename		the name of the package
    34  	@return						the max path id for the package's folder
    35   */
    36  short packages_getpackagepath(const char *packagename);
    37  
    38  
    39  /** return linklist of max path ids for a given subpath of a package
    40  
    41  	@ingroup	packages
    42  	@param		subfoldername		the name of the folder (e.g. templates, prototypes, extensions, etc)
    43  	@param		includesysfolder	1 if you want it to include the default max copy (e.g. stuff in the C74 folder), 
    44  									a negative number will use the specified folder as the system folder
    45  									0 will ignore the default location
    46  	@return							linklist of max path ids -- you are responsible for freeing this linklist.
    47  */
    48  t_linklist *packages_createsubpathlist(const char *subfoldername, short includesysfolder);
    49  
    50  
    51  /**	return a linklist of max path ids for a given subpath of a package
    52  	and optionally a dictionary with all of the files contained therein.
    53  	
    54  	@ingroup	packages
    55  	@param		subfoldername			the name of the folder (e.g. templates, prototypes, extensions, etc)
    56  	@param		suffix_selector			a file suffix used to filter only the specified files in the path (e.g., ".maxpat")
    57  	@param		includesysfolder		1 if you want it to include the default max copy (e.g. stuff in the C74 folder),
    58  										a negative number will use the specified folder as the system folder
    59  										0 will ignore the default location
    60  	@param		subpathlist				if not NULL, a linklist is alloc'd and returned here with all of the max path ids
    61  	@param		names_to_packagefiles	if not NULL, a dictionary is alloc'd and returned, keys are the names (suffix stripped) and the values are t_package_file instances
    62  										the linklist in the dictionary will have its keys sorted alphabetically
    63  	@return								the usual max error code
    64   */
    65  t_max_err packages_getsubpathcontents(const char *subfoldername, const char *suffix_selector, short includesysfolder, t_linklist **subpathlist, t_dictionary **names_to_packagefiles);
    66  
    67  
    68  END_USING_C_LINKAGE
    69  
    70  #endif // _EXT_PACKAGES_H_