CMake/Source/cmCPluginAPI.h

203 lines
10 KiB
C
Raw Normal View History

2002-08-21 19:54:06 +04:00
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Insight Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
/* This header file defines the API that loadable commands can use. In many
of these commands C++ instances of cmMakefile of cmSourceFile are passed
in as arguments or returned. In these cases they are passed as a void *
argument. In the function prototypes mf is used to represent a makefile
and sf is used to represent a source file. The functions are grouped
loosely into four groups 1) Utility 2) cmMakefile 3) cmSourceFile 4)
cmSystemTools. Within each grouping functions are listed alphabetically */
/*=========================================================================*/
/*=========================================================================*/
/* CM_PLUGIN_EXPORT should be used by plugins */
/*=========================================================================*/
#ifdef _WIN32
#define CM_PLUGIN_EXPORT __declspec( dllexport )
#else
#define CM_PLUGIN_EXPORT
#endif
/*=========================================================================*/
/* define the different types of cache entries, see cmCacheManager.h for more
information */
/*=========================================================================*/#define CM_CACHE_BOOL 0
#define CM_CACHE_PATH 1
#define CM_CACHE_FILEPATH 2
#define CM_CACHE_STRING 3
#define CM_CACHE_INTERNAL 4
#define CM_CACHE_STATIC 5
/*=========================================================================*/
/* define the different types of compiles a library may be */
/*=========================================================================*/
#define CM_LIBRARY_GENERAL 0
#define CM_LIBRARY_DEBUG 1
#define CM_LIBRARY_OPTIMIZED 2
#ifdef __cplusplus
extern "C" {
#endif
/*=========================================================================*/
/* first we define the key data structures and function prototypes */
/*=========================================================================*/
typedef const char* (*CM_DOC_FUNCTION)();
typedef const char* (*CM_NAME_FUNCTION)();
typedef int (*CM_INITIAL_PASS_FUNCTION)(void *info, void *mf,
int argc, char *[]);
typedef void (*CM_FINAL_PASS_FUNCTION)(void *info, void *mf);
typedef struct {
int m_Inherited;
CM_INITIAL_PASS_FUNCTION InitialPass;
CM_FINAL_PASS_FUNCTION FinalPass;
CM_DOC_FUNCTION GetTerseDocumentation;
CM_DOC_FUNCTION GetFullDocumentation;
void *ClientData;
} cmLoadedCommandInfo;
typedef void (*CM_INIT_FUNCTION)(cmLoadedCommandInfo *);
/*=========================================================================*/
/* Finally we define the set of functions that a plugin may call. The first
goup of functions are utility functions that are specific to the plugin
API */
/*=========================================================================*/
/* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how
information is passed from the InitialPass to FInalPass for commands
that need a FinalPass and need information from the InitialPass */
2002-08-24 00:13:34 +04:00
extern void *cmGetClientData(void *info);
2002-08-21 19:54:06 +04:00
/* return the summed size in characters of all the arguments */
2002-08-24 00:13:34 +04:00
extern int cmGetTotalArgumentSize(int argc, char **argv);
2002-08-21 19:54:06 +04:00
/* free all the memory associated with an argc, argv pair */
2002-08-24 00:13:34 +04:00
extern void cmFreeArguments(int argc, char **argv);
2002-08-21 19:54:06 +04:00
/* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how
information is passed from the InitialPass to FInalPass for commands
that need a FinalPass and need information from the InitialPass */
2002-08-24 00:13:34 +04:00
extern void cmSetClientData(void *info, void *cd);
2002-08-21 19:54:06 +04:00
/*=========================================================================*/
/* The following functions all directly map to methods in the cmMakefile
class. See cmMakefile.h for descriptions of what each method does. All
of these methods take the void * makefile pointer as their first
argument. */
/*=========================================================================*/
2002-08-24 00:13:34 +04:00
extern void cmAddCacheDefinition(void *mf, const char* name,
2002-08-21 19:54:06 +04:00
const char* value,
const char* doc,
int cachetype);
2002-08-24 00:13:34 +04:00
extern void cmAddCustomCommand(void *mf, const char* source,
2002-08-21 19:54:06 +04:00
const char* command,
int numArgs,
const char **args,
int numDepends,
const char **depends,
int numOutputs,
const char **outputs,
const char *target);
2002-08-24 00:13:34 +04:00
extern void cmAddDefineFlag(void *mf, const char* definition);
extern void cmAddDefinition(void *mf, const char* name,
2002-08-21 19:54:06 +04:00
const char* value);
2002-08-24 00:13:34 +04:00
extern void cmAddExecutable(void *mf, const char *exename,
2002-08-21 19:54:06 +04:00
int numSrcs, const char **srcs,
int win32);
2002-08-24 00:13:34 +04:00
extern void cmAddLibrary(void *mf, const char *libname,
2002-08-21 19:54:06 +04:00
int shared, int numSrcs,
const char **srcs);
2002-08-24 00:13:34 +04:00
extern void cmAddLinkDirectoryForTarget(void *mf,
2002-08-21 19:54:06 +04:00
const char *tgt,
const char* d);
2002-08-24 00:13:34 +04:00
extern void cmAddLinkLibraryForTarget(void *mf,
2002-08-21 19:54:06 +04:00
const char *tgt,
const char *libname,
int libtype);
2002-08-24 00:13:34 +04:00
extern void cmAddUtilityCommand(void *mf, const char* utilityName,
2002-08-21 19:54:06 +04:00
const char *command,
const char *arguments,
int all, int numDepends,
const char **depends,
int numOutputs,
const char **outputs);
2002-08-24 00:13:34 +04:00
extern int cmCommandExists(void *mf, const char* name);
extern void cmExecuteCommand(void *mf, const char *name,
2002-08-21 19:54:06 +04:00
int numArgs, const char **args);
2002-08-24 00:13:34 +04:00
extern
2002-08-21 19:54:06 +04:00
void cmExpandSourceListArguments(void *mf,int argc, const char **argv,
int *resArgc, char ***resArgv,
unsigned int startArgumentIndex);
2002-08-24 00:13:34 +04:00
extern char *cmExpandVariablesInString(void *mf,
2002-08-21 19:54:06 +04:00
const char *source,
int escapeQuotes,
int atOnly);
2002-08-24 00:13:34 +04:00
extern unsigned int cmGetCacheMajorVersion(void *mf);
extern unsigned int cmGetCacheMinorVersion(void *mf);
extern const char* cmGetCurrentDirectory(void *mf);
extern const char* cmGetCurrentOutputDirectory(void *mf);
extern const char* cmGetDefinition(void *mf, const char *def);
extern const char* cmGetHomeDirectory(void *mf);
extern const char* cmGetHomeOutputDirectory(void *mf);
extern unsigned int cmGetMajorVersion(void *mf);
extern unsigned int cmGetMinorVersion(void *mf);
extern const char* cmGetProjectName(void *mf);
extern const char* cmGetStartDirectory(void *mf);
extern const char* cmGetStartOutputDirectory(void *mf);
extern int cmIsOn(void *mf, const char* name);
2002-08-21 19:54:06 +04:00
/*=========================================================================*/
/* The following functions are designed to operate or manipulate
cmSourceFiles. Please see cmSourceFile.h for additional information on many
2002-08-22 17:10:24 +04:00
of these methods. Some of these methods are in cmMakefile.h. */
2002-08-21 19:54:06 +04:00
/*=========================================================================*/
2002-08-24 00:13:34 +04:00
extern void *cmAddSource(void *mf, void *sf);
extern void *cmCreateSourceFile();
extern void *cmGetSource(void *mf, const char* sourceName);
extern void cmSourceFileAddDepend(void *sf, const char *depend);
extern const char *cmSourceFileGetProperty(void *sf,
2002-08-21 19:54:06 +04:00
const char *prop);
2002-08-24 00:13:34 +04:00
extern int cmSourceFileGetPropertyAsBool(void *sf,
2002-08-21 19:54:06 +04:00
const char *prop);
2002-08-24 00:13:34 +04:00
extern const char *cmSourceFileGetSourceName(void *sf);
extern
2002-08-21 19:54:06 +04:00
void cmSourceFileSetName(void *sf, const char* name, const char* dir,
int numSourceExtensions,
const char **sourceExtensions,
int numHeaderExtensions,
const char **headerExtensions);
2002-08-24 00:13:34 +04:00
extern
2002-08-21 19:54:06 +04:00
void cmSourceFileSetName2(void *sf, const char* name, const char* dir,
const char *ext, int headerFileOnly);
2002-08-24 00:13:34 +04:00
extern void cmSourceFileSetProperty(void *sf, const char *prop,
2002-08-21 19:54:06 +04:00
const char *value);
/*=========================================================================*/
/* the following methods are from cmSystemTools.h see that file for
specific documentaiton on each method. */
/*=========================================================================*/
2002-08-24 00:13:34 +04:00
extern char *cmCapitalized(const char *);
extern void cmCopyFileIfDifferent(const char *f1, const char *f2);
extern char *cmGetFilenameWithoutExtension(const char *);
extern void cmRemoveFile(const char *f1);
2002-08-21 19:54:06 +04:00
#ifdef __cplusplus
}
#endif