summaryrefslogtreecommitdiff
path: root/sdk_hdrs/CWPlugins.h
blob: a42785382010b4bb38f39c230a854dc2ed08f1d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
/*
 *  CWPlugins.h - Common declarations for Metrowerks CodeWarrior� plugins
 *
 *  Copyright � 1995-1997 Metrowerks, Inc.  All rights reserved.
 *
 */

#include "common.h"

#ifndef __CWPlugins_H__
#define __CWPlugins_H__

#ifdef __MWERKS__
#	pragma once
#endif

#define CWPLUGIN_HOST_MACOS       1
#define CWPLUGIN_HOST_WIN32       2
#define CWPLUGIN_HOST_SOLARIS     3
#define CWPLUGIN_HOST_LINUX       4

// This seems to always be true for command-line tools
#define CWPLUGIN_HOST CWPLUGIN_HOST_MACOS

//#ifndef CWPLUGIN_HOST
//#  ifdef WIN32
//#  define CWPLUGIN_HOST CWPLUGIN_HOST_WIN32
//#  elif defined(macintosh)
//#  define CWPLUGIN_HOST CWPLUGIN_HOST_MACOS
//#  elif defined(__sun__)
//#  define CWPLUGIN_HOST CWPLUGIN_HOST_SOLARIS
//#  elif defined(__linux__)
//#  define CWPLUGIN_HOST CWPLUGIN_HOST_LINUX
//#  else
//#  error
//#  endif
//#endif

#define CWPLUGIN_API_MACOS 1
#define CWPLUGIN_API_WIN32 2
#define CWPLUGIN_API_UNIX  3

//#ifndef CWPLUGIN_API
//#  ifdef WIN32
//#  define CWPLUGIN_API CWPLUGIN_API_WIN32
//#  elif defined(macintosh)
//#  define CWPLUGIN_API CWPLUGIN_API_MACOS
//#  elif defined(__sun__) || defined(__linux__)
//#  define CWPLUGIN_API CWPLUGIN_API_UNIX
//#  else
//#  error
//#  endif
//#endif

// This seems to always be true for command-line tools
#define CWPLUGIN_API CWPLUGIN_API_MACOS

/*
**  Radix 256 notation where a 32-bit integer is created from four
**  ASCII characters. A four-character constant of this form, say
**  'ABCD', must always be represented with the same pattern, 0x41424344
**  in this case, regardless of big/little endian issues.
*/
typedef SInt32 CWFourCharType;
#define CWFOURCHAR(a, b, c, d)                            \
                 (((CWFourCharType) ((a) & 0xff) << 24)   \
                | ((CWFourCharType) ((b) & 0xff) << 16)   \
                | ((CWFourCharType) ((c) & 0xff) << 8)    \
                | ((CWFourCharType) ((d) & 0xff)))


#if CWPLUGIN_API == CWPLUGIN_API_UNIX
#include <sys/param.h>
#endif

#ifndef CW_USE_PRAGMA_EXPORT
#if CWPLUGIN_HOST == CWPLUGIN_HOST_MACOS
#define CW_USE_PRAGMA_EXPORT 1
#else
#define CW_USE_PRAGMA_EXPORT 0
#endif
#endif

#ifndef CW_USE_PRAGMA_IMPORT
#if CWPLUGIN_HOST == CWPLUGIN_HOST_MACOS
#define CW_USE_PRAGMA_IMPORT 1
#else
#define CW_USE_PRAGMA_IMPORT 0
#endif
#endif

#ifdef	__MWERKS__
	#pragma options align=mac68k
#endif

#ifdef	_MSC_VER
	#pragma	pack(push,2)
#endif


#ifdef __cplusplus
	extern "C" {
#endif

#if CW_USE_PRAGMA_IMPORT
#pragma import on
#endif

	/* These constants specify the action the IDE is asking the plugin to execute			*/
enum {
	reqInitialize  = -2,		/* called when the plugin is loaded							*/
	reqTerminate   = -1,		/* called when the plugin is unloaded						*/
	reqIdle		   = -100,		/* called periodically to allow for plugin tasks EP 6/24/98	*/
	reqAbout	   = -101,		/* called to ask plugin to display about dialog EP 6/24/98	*/
	reqPrefsChange = -102		/* called when an associated pref panel changes EP 6/24/98  */
};

	/* Used in CWFileInfo.dependencyType to indicate what type of make						*/
	/* dependency to establish between files												*/
typedef enum CWDependencyType {
	cwNoDependency,				/* do not establish a dependency							*/
	cwNormalDependency,			/* recompile dependent whenever prereq changes				*/
	cwInterfaceDependency		/* recompile only if interface to file changes				*/
} CWDependencyType;

	/* Used in CWFileInfo.filedatatype to indicate the type of data in a loaded file		*/
enum {
	cwFileTypeUnknown,			/* unknown binary data										*/
	cwFileTypeText,				/* normal text file											*/
	cwFileTypePrecompiledHeader	/* cached precompiled header								*/
};

	/* constant for CWFileInfo.isdependentoffile 											*/
#define kCurrentCompiledFile		-1L

	/* constant for CWStorePluginData/CWGetPluginData										*/
#define kTargetGlobalPluginData		-1L

	/* constant for CWNewProjectEntryInfo link order, segment, and overlay values				*/
#define kDefaultLinkPosition		-1L

	/* Selectors for CWFindLogicalDirectory */
enum {
	kIDEDirectorySelector = 1,				/* parent directory of IDE application; "bin" folder on Win32	*/
    kCodeWarriorDirectorySelector,			/* root CodeWarrior directory									*/
    kSystemDirectorySelector,				/* system directory												*/
    kProjectDirectorySelector,				/* parent directory of current project							*/
    kProjectDataDirectorySelector,			/* project data directory										*/
    kTargetDataDirectorySelector,			/* target data directory (within project data directory)		*/
    kTargetObjectCodeDirectorySelector,		/* object code directory (within target data directory)			*/
    kDebuggerCacheDirectorySelector,		/* "CW Debugging Cache" directory								*/
    kHelperAppsDirectorySelector,			/* "(Helper Apps)" directory									*/
    kPluginsDirectorySelector,				/* "CodeWarrior Plugins" (Mac) or "plugins" (Win32) directory	*/
    kPluginParentDirectorySelector,			/* parent directory of current plugin							*/
    kStationeryDirectorySelector,			/* "(Project Stationery)" directory								*/
    kRADStationeryDirectorySelector,		/* "RAD Stationery" directory									*/
    kLocalizedResourcesDirectorySelector	/* "resources" directory										*/
};


	/* CWPluginContext is a magic cookie passed to all plugins. It must						*/
	/* be passed back to all IDE callbacks													*/
	
typedef struct CWPluginPrivateContext* CWPluginContext;

	/* CWResult is the error/status result returned by all IDE API routine.					*/
	/* The most common errors are returned directly. For OS-specific errors, the 			*/
	/* CWResult is cwErrOSError, and the OS-specific error can be obtained by				*/
	/* calling CWGetOSError()																*/ 
typedef SInt32			CWResult;

	/* CWMemHandle is an abstraction for memory used in some parts						*/
	/* of the plugin API. API routines must be used to allocate							*/
	/* and free CWMemHandles, or to convert them to pointers.							*/
	 
typedef struct CWMemHandlePrivateStruct* CWMemHandle;

	/* Used to identify custom data associated by a plugin with							*/
	/* a project file or a target as a whole. Must be a four character					*/
	/* constant. All lower case constants are reserved by the IDE						*/
typedef UInt32 CWDataType;

	/* Some information used in the compiler/linker API is platform-dependent				*/
	/* We use some typedefs to isolate the differences										*/
	/* CWFileSpec contains the native platform file specifier.								*/
	/* CWFileName contains the string type for a native file name							*/
	/* CWFileTime contains the native platform file timestamp								*/
	/* CWOSResult contains the native platform error return value							*/
	/* CWResult contains an API routine error/status result									*/
	/* CW_CALLBACK is a macro defining the calling convention and return type for			*/
	/*  IDE callback routines.																*/
	/* CW_PLUGINENTRY is a macro defining the calling convention and return type for		*/
	/*  plugin entry points.																*/
	/* CWSUCCESS is a macro that evaluates to true when given a CWResult indicating an 		*/
	/*   routine succeeded																	*/

#if CWPLUGIN_API == CWPLUGIN_API_MACOS

typedef FSSpec			CWFileSpec;
typedef char			CWFileName[32];
typedef UInt32 	        CWFileTime;
typedef OSErr			CWOSResult;

#elif CWPLUGIN_API == CWPLUGIN_API_WIN32

typedef unsigned char 	Boolean;
typedef struct CWFileSpec { char path[MAX_PATH]; } CWFileSpec;
typedef char			CWFileName[65];
typedef FILETIME		CWFileTime;
typedef DWORD			CWOSResult;

#elif CWPLUGIN_API == CWPLUGIN_API_UNIX

#define MAX_PATH	MAXPATHLEN

#ifndef __MACTYPES__
typedef unsigned char 	Boolean;
#endif

#ifndef FALSE
#define FALSE 0
#endif

#ifndef TRUE
#define TRUE 1
#endif

typedef struct CWFileSpec { char path[MAX_PATH]; } CWFileSpec;
typedef char			CWFileName[65];
typedef time_t			CWFileTime;
typedef int				CWOSResult;

#else

#error Unknown plugin API!

#endif

#define CWSUCCESS(result)	((result) == 0)

#if CWPLUGIN_HOST == CWPLUGIN_HOST_MACOS

#define CW_CALLBACK							CW_PASCAL CWResult
#define	CW_CALLBACK_PTR(function_name)		CW_PASCAL CWResult (function_name)
#define CWPLUGIN_ENTRY(function_name)		CW_PASCAL short (function_name)

#elif CWPLUGIN_HOST == CWPLUGIN_HOST_WIN32

#define CW_CALLBACK							CWResult __stdcall
#define	CW_CALLBACK_PTR(function_name)		CWResult (__stdcall function_name)
#define CWPLUGIN_ENTRY(function_name)		short (__stdcall function_name)

#elif CWPLUGIN_HOST==CWPLUGIN_HOST_SOLARIS || CWPLUGIN_HOST==CWPLUGIN_HOST_LINUX

#define CW_CALLBACK							CWResult
#define	CW_CALLBACK_PTR(function_name)		CWResult (function_name)
#define CWPLUGIN_ENTRY(function_name)		short (function_name)

#else

#error Unknown plugin host!

#endif

/* information returned by CWFindAndLoadFile */
typedef struct CWFileInfo {
	Boolean 		fullsearch;			/* [<-] do we do a full search of paths for file	*/
	char	 		dependencyType;		/* [<-] type CWDependencyType						*/
	SInt32			isdependentoffile;	/* [<-] this file is a dependent of file id			*/
										/*		(zero based) or -1L if of current file		*/
	Boolean 		suppressload;		/* [<-] find but don't load the file				*/
	Boolean 		padding;			/* [**] structure padding							*/
	const char*		filedata;			/* [->] point to the file text/data, or NULL		*/
	SInt32			filedatalength;		/* [->] length of filedata							*/
	short			filedatatype;		/* [->] type of data pointed to by filedata			*/
	
	/* the remaining members are valid only when called by compilers						*/
	short			fileID;				/* [->] use in browse records and dependencies		*/
	CWFileSpec		filespec;			/* [->] specifies the file on disk					*/
	Boolean			alreadyincluded;	/* [->] TRUE if already included in current compile	*/
	Boolean 		recordbrowseinfo;	/* [->] record browse info for this file?			*/
} CWFileInfo;

/* information maintained by the IDE for each segment in the project */
typedef struct CWProjectSegmentInfo {
	char			name[32];			/* segment name			*/
	short			attributes;			/* segment attributes	*/
} CWProjectSegmentInfo;	

/* 64 bit address	*/
typedef struct CWAddr64 {
	SInt32	lo;							/* low order longword of address						*/
	SInt32	hi;							/* high order longword of address						*/
} CWAddr64;

/* describes an overlay group, Use CWGetOverlayGroup1Info to iterate over overlay groups 		*/
typedef struct CWOverlay1GroupInfo {
	char			name[256];			/* overlay group name									*/
	CWAddr64		address;			/* load address											*/
	SInt32			numoverlays;		/* number of overlays in this group						*/

} CWOverlay1GroupInfo;

/* describes an overlay, use CWGetOverlay1Info to iterate over overlays							*/ 
typedef struct CWOverlay1Info {
	char			name[256];			/* name of this overlay									*/
	SInt32			numfiles;			/* number of files in the overlay						*/
} CWOverlay1Info;

/* describes a file in an overlay, use CWGetOverlayFile1Info to iterate over files. Use		*/
/* whichfile in calls taking a file number, e.g. CWLoadObjectData or CWGetFileInfo			*/ 
typedef struct CWOverlay1FileInfo {
	SInt32			whichfile;			/* flat file number										*/
} CWOverlay1FileInfo;

/*
 *	All compiler errors or warnings which occur at some specific location in some
 *	source file are identified by a CWMessageRef structure. This structure
 *	provides sufficient information for the development environment to locate
 *	and display the exact position associated with a message. For each message,
 *  the compiler provides:
 *
 *		errorstring: contains a description of the error, e.g. "syntax error"
 * 		errorline:   contains a subset of the text containing the error
 *		errorlevel:  indicates if the "error" is an error, warning, or informational message
 *      CWMessageRef: further info so the IDE can perform two tasks:
 
 *			- Display a summary of each message, with the "error token"
 *			  underlined within the compiler-provided errorline. This 
 *			  information is provided by the tokenoffset and tokenlength
 *			  fields. If tokenLength is zero then no underlining is performed.
 *
 *			- Open the file containing the error and select the full
 *    		  text of the error. This information is provided by the
 *			  selectionoffset and selectionlength fields. 
 */

typedef struct CWMessageRef
{
	CWFileSpec	sourcefile;			/* file containing error							*/
	SInt32		linenumber;			/* error linenumber in file							*/
	short 		tokenoffset;        /* offset into errorline of token underline 		*/
	short 		tokenlength;        /* length of error token to be underlined			*/
	SInt32		selectionoffset;	/* start of error for text selection				*/
	SInt32		selectionlength;	/* length of error for text selection				*/
} CWMessageRef;

/* message types, used for errorlevel parameter to message routines */
enum {
	messagetypeInfo,					/* informational only								*/
	messagetypeWarning,					/* warning message									*/
	messagetypeError					/* error message									*/
};


/* information maintained by the IDE for each file in the project */
typedef struct CWProjectFileInfo 
{
	CWFileSpec		filespec;			/* CW_FileSpec of file in project			*/
	CWFileTime		moddate;			/* date source file was last modified		*/
	short			segment;			/* segment number of file					*/
	Boolean			hasobjectcode;		/* file has object code to be linked		*/
	Boolean			hasresources;		/* file has resources to be linked			*/
	Boolean			isresourcefile;		/* file -is- a resource file to be linked	*/
	Boolean			weakimport;			/* file has "Import Weak" flag set			*/
	Boolean			initbefore;			/* file has "Init Before" flag set			*/
	Boolean			gendebug;			/* file has generate debug info on			*/
	CWFileTime		objmoddate;			/* date object code was last modified		*/
	CWFileName		dropinname;			/* name of dropin used to process this file	*/
	short			fileID;				/* fileID to use in browse records			*/
	Boolean		 	recordbrowseinfo;	/* record browse info for this file?		*/
	Boolean			reserved;			/* reserved and used internally				*/
#if CWPLUGIN_HOST == CWPLUGIN_HOST_MACOS
	/* some Macintosh-specific information											*/
	OSType			filetype;			/* MacOS file type							*/
	OSType			filecreator;		/* MacOS file creator						*/
#endif
	Boolean			hasunitdata;		/* file has associated unit data (Pascal)	*/
	Boolean			mergeintooutput;	/* file has "Merge Into Output" flag set	*/
	UInt32	unitdatadependencytag;	/* dependency tag (i.e. checksum) of unit data (Pascal)	*/
} CWProjectFileInfo;

typedef struct CWNewTextDocumentInfo
{
	const char*		documentname;		/* name for new document, can be NULL		*/
	CWMemHandle		text;				/* initial text for document				*/
	Boolean			markDirty;			/* mark doc as needing to be saved?			*/
} CWNewTextDocumentInfo;

typedef struct CWNewProjectEntryInfo
{	/* use kDefaultLinkPosition to get default link order, overlay, or segment		*/
	SInt32			position;			/* optional link order position				*/
	SInt32			segment;			/* optional segment number					*/
	SInt32			overlayGroup;		/* optional overlay group number			*/
	SInt32			overlay;			/* optional overlay number					*/
	const char*		groupPath;			/* optional fully qualified path to file group */
	Boolean			mergeintooutput;	/* set merge into output flag?				*/
	Boolean			weakimport;			/* set weak import flag?					*/
	Boolean			initbefore;			/* set initbefore flag?						*/
} CWNewProjectEntryInfo;

typedef struct CWIDEInfo
{
	unsigned short		majorVersion;
	unsigned short		minorVersion;
	unsigned short		bugFixVersion;
	unsigned short		buildVersion;
	unsigned short		dropinAPIVersion;
} CWIDEInfo;

/* Structures for getting the list of access paths.								*/
/* The callback does the filtering on the host flags, so the list returned		*/
/* will only contain the paths that are enabled for the host platform.			*/
/* There are separate APIs to get the Mac OS X framework style access paths.	*/

typedef enum CWAccessPathType {
	cwSystemPath,
	cwUserPath
} CWAccessPathType;

typedef struct CWAccessPathInfo
{
	CWFileSpec			pathSpec;
	Boolean				recursive;
	SInt32				subdirectoryCount;
} CWAccessPathInfo;

typedef struct CWAccessPathListInfo
{
	SInt32		systemPathCount;
	SInt32		userPathCount;
	Boolean		alwaysSearchUserPaths;
	Boolean		convertPaths;
} CWAccessPathListInfo;

/* Structures for getting the list of Mac OS X framework access paths.			*/
/* The callback does the filtering on the host flags, so the list returned		*/
/* will only contain the Mac OS X framework style paths that are enabled for	*/
/* the host platform.															*/
/* There are separate APIs to get the traditional style access paths.			*/

typedef struct CWFrameworkAccessPathInfo
{
	CWFileSpec			pathSpec;
	Boolean				framework;
} CWFrameworkAccessPathInfo;

typedef struct CWFrameworkAccessPathListInfo
{
	SInt32		systemPathCount;
	SInt32		userPathCount;
	Boolean		alwaysSearchUserPaths;
	Boolean		convertPaths;
	Boolean		requireFrameworkIncludes;
} CWFrameworkAccessPathListInfo;

/* constants for different types of plugins											*/
/* Used in the dropintype in the DropInFlags, as well as for the MacOS file type	*/
enum
{
	CWDROPINLINKERTYPE	= CWFOURCHAR('L','i','n','k'),		/*	type for DropIn linkers			*/
	CWDROPINCOMPILERTYPE= CWFOURCHAR('C','o','m','p'),		/*	type for DropIn compilers		*/
	CWDROPINPREFSTYPE	= CWFOURCHAR('P','a','n','L'),		/*	type for DropIn panels			*/
	CWDROPINPREFSTYPE_1	= CWFOURCHAR('P','a','n','l'),		/*  type for 1.x IDE DropIn panels	*/
	CWDROPINVCSTYPE		= CWFOURCHAR('V','C','S',' '),		/*	type for DropIn version control	*/
	CWDROPINCOMTYPE		= CWFOURCHAR('C','O','M',' ')		/*  type for COM-only plugins 		*/
};
typedef SInt32 CWPluginType; // one of the above types

/* Format of 'Flag' resources, or data returned by dropin's GetDropinFlags entry    */
/* point.																			*/
/*																					*/
/* For the version 2 of these resource, we renamed the 'apiversion' field to		*/
/* 'earliestCompatibleAPIVersion' and added the 'newestAPIVersion' field.			*/
/* This allows plugins to support more than one API version and therefore run		*/
/* under more than one version of the IDE. The CWGetAPIVersion call should be used  */
/* to determine what API version the IDE is using to talk to a plugin.				*/

#define kCurrentDropInFlagsVersion 2

typedef struct DropInFlagsV1 {
    short			rsrcversion;		/*	version number of resource				*/
    CWDataType		dropintype;			/*	dropin type (compiler, panel, etc)		*/
    /*  earliest API support by this plugin		*/
    unsigned short	earliestCompatibleAPIVersion;
    UInt32	dropinflags;		/*	capability flags						*/
    CWDataType		edit_language;		/*	language								*/

} DropInFlagsV1, **DropInFlagsHandleV1;

typedef struct DropInFlags {
	short			rsrcversion;		/*	version number of resource				*/
	CWDataType		dropintype;			/*	dropin type (compiler, panel, etc)		*/
										/*  earliest API support by this plugin		*/
	unsigned short	earliestCompatibleAPIVersion;
	UInt32	dropinflags;		/*	capability flags						*/
	CWDataType		edit_language;		/*	language								*/
	unsigned short	newestAPIVersion;	/*	newest API version supported			*/
	
} DropInFlags, **DropInFlagsHandle;

#define kCurrentCWPanelListVersion 1

typedef struct CWPanelList {
	short			version;
	short			count;
	const char**	names;
} CWPanelList;

#define kCurrentCWFamilyListVersion	1
#define kCurrentCWFamilyResourceVersion 1

typedef struct CWFamily {
	CWDataType		type;
	const char*		name;
} CWFamily;

typedef struct CWFamilyList {
	short			version;
	short			count;
	CWFamily*		families;
} CWFamilyList;

typedef struct CWFamilyResource {
	short			version;
	CWDataType		type;
	unsigned char	name[64];
} CWFamilyResource;

#define kCurrentCWHelpInfoVersion 1

typedef struct CWHelpInfo {
	short			version;
	const char*		helpFileName;
} CWHelpInfo;


#define	kCurrentCWRelativePathVersion		1

typedef enum CWRelativePathFormat
{
	format_Generic	= 0,		// Simple name, not platform-specific
	format_Mac,					// Uses : as separator :: for parent directory
	format_Win,					// Uses \ as separator .. for parent directory
	format_Unix					// Uses / as separator .. for parent directory

} CWRelativePathFormat;

typedef enum CWRelativePathTypes
{
	type_Absolute	= 0,
	type_Project,
	type_Compiler,
	type_System,
	type_UserDefined
} CWRelativePathTypes;

typedef struct CWRelativePath
{
	short			version;				// version number
	unsigned char	pathType;				// use CWRelativePathTypes
	unsigned char	pathFormat;				// use CWRelativePathFormat
	char			userDefinedTree[256];	// user-defined tree name
	char			pathString[512];		// actual path string
} CWRelativePath;

/*
 *
 */
 
#define kCurrentCWPluginInfoVersion 1

typedef struct CWPluginInfo
{
	short			version;				// struct version number
	const char*		companyName;			// i.e. Metrowerks	
	const char*		pluginName;				// Defaults to Dropin->GetName()
	const char*		pluginDisplayName;
	const char* 	familyName;				// i.e. Java
	unsigned short	majorIDEVersion;		// Version of IDE Required
	unsigned short	minorIDEVersion;
		  
} CWPluginInfo;


/* Declaration of plugin entry points that must be implemented by non-MacOS plugins		*/
/* It can also be implemented for MacOS plugins instead of having a 'Flag' resource		*/

CWPLUGIN_ENTRY (CWPlugin_GetDropInFlags)(const DropInFlags**, SInt32* flagsSize);

/* Declaration of plugin entry points that may optionally be implemented by plugins		*/
/* These entry points override the corresponding resources on MacOS						*/

CWPLUGIN_ENTRY (CWPlugin_GetDropInName)(const char** dropInName);
CWPLUGIN_ENTRY (CWPlugin_GetDisplayName)(const char** displayName);
CWPLUGIN_ENTRY (CWPlugin_GetPanelList)(const CWPanelList** panelList);
CWPLUGIN_ENTRY (CWPlugin_GetFamilyList)(const CWFamilyList** familyList);
CWPLUGIN_ENTRY (CWPlugin_GetHelpInfo)(const CWHelpInfo** helpInfo);

/* Declaration of info plugin entry point that must be implemented by all COM plugins   */

CWPLUGIN_ENTRY (CWPlugin_GetPluginInfo)(const CWPluginInfo** pluginInfo);


/* Callback declarations: these callbacks are supported for all CodeWarrior plugins		*/
	
	/* Get the action the IDE is requesting of the plugin								*/
CW_CALLBACK CWGetPluginRequest(CWPluginContext context, SInt32* request);

	/* Call when finished handling a request, just before returning to the shell		*/
CW_CALLBACK CWDonePluginRequest(CWPluginContext, CWResult resultCode);

	/* Get the version number of API used by the IDE to talk to the plugin				*/
CW_CALLBACK	CWGetAPIVersion(CWPluginContext context, SInt32* version);

	/* Get information about the IDE being used											*/
CW_CALLBACK CWGetIDEInfo(CWPluginContext context, CWIDEInfo* info);

	/* Get the OS error associated with the last callback								*/
CW_CALLBACK CWGetCallbackOSError(CWPluginContext context, CWOSResult* error);

	/* Set the OS error associated with a failed plugin request							*/
CW_CALLBACK CWSetPluginOSError(CWPluginContext context, CWOSResult);
	
	/* Get the file specifier for the current project									*/
CW_CALLBACK	CWGetProjectFile(CWPluginContext context, CWFileSpec* projectSpec);

	/* Get the directory where the IDE stores target-specific generated data			*/
CW_CALLBACK CWGetTargetDataDirectory(CWPluginContext context, CWFileSpec* targetDataDirectorySpec);

	/* Get the name of the current target in the current project						*/
CW_CALLBACK CWGetTargetName(CWPluginContext context, char* name, short maxLength);

	/* Get the directory where output files should be stored						*/
CW_CALLBACK CWGetOutputFileDirectory(CWPluginContext context, CWFileSpec* outputFileDirectory);

	/* Get the number of files in the current project									*/
CW_CALLBACK CWGetProjectFileCount(CWPluginContext context, SInt32* count);

	/* Get information about a particular file in the project							*/
CW_CALLBACK	CWGetFileInfo(CWPluginContext context, SInt32 whichfile, Boolean checkFileLocation, CWProjectFileInfo* fileinfo);

	/* Search for a file by name on the current file's access paths. 					*/
CW_CALLBACK	CWFindAndLoadFile(CWPluginContext context, const char* filename, CWFileInfo *fileinfo);

	/* Get the access paths for the current target			 					*/
CW_CALLBACK	CWGetAccessPathListInfo(CWPluginContext context, CWAccessPathListInfo* pathListInfo);
CW_CALLBACK	CWGetAccessPathInfo(CWPluginContext context, CWAccessPathType pathType, SInt32 whichPath, CWAccessPathInfo* pathInfo);
CW_CALLBACK	CWGetAccessPathSubdirectory(CWPluginContext context, CWAccessPathType pathType, SInt32 whichPath, SInt32 whichSubdirectory, CWFileSpec* subdirectory);
CW_CALLBACK	CWGetFrameworkAccessPathListInfo(CWPluginContext context, CWFrameworkAccessPathListInfo* pathListInfo);
CW_CALLBACK	CWGetFrameworkAccessPathInfo(CWPluginContext context, CWAccessPathType pathType, SInt32 whichPath, CWFrameworkAccessPathInfo* pathInfo);

	/* Get file text, from the editor, include file cache, or by reading the file		*/
CW_CALLBACK CWGetFileText(CWPluginContext context, const CWFileSpec* filespec, const char** text, SInt32* textLength, short* filedatatype);

	/* Release file text returned by CWFindAndLoadFile and CWGetFileText				*/
CW_CALLBACK	CWReleaseFileText(CWPluginContext context, const char* text);

	/* Get information about a project segment											*/
CW_CALLBACK	CWGetSegmentInfo(CWPluginContext context, SInt32 whichsegment, CWProjectSegmentInfo* segmentinfo);

	/* Get the number of overlay groups in the target									*/
CW_CALLBACK	CWGetOverlay1GroupsCount(CWPluginContext context, SInt32* count);

	/* Get information about a project overlay group									*/
CW_CALLBACK CWGetOverlay1GroupInfo(CWPluginContext context, SInt32 whichgroup, CWOverlay1GroupInfo* groupinfo);

	/* Get information about an overlay	within a group									*/
CW_CALLBACK CWGetOverlay1Info(CWPluginContext context, SInt32 whichgroup, SInt32 whichoverlay, CWOverlay1Info* overlayinfo);

	/* Get information about a file in an overlay										*/
CW_CALLBACK CWGetOverlay1FileInfo(CWPluginContext context, SInt32 whichgroup, SInt32 whichoverlay, SInt32 whichoverlayfile, CWOverlay1FileInfo* fileinfo);

	/* Report a error, warning, or informational message								*/
CW_CALLBACK	CWReportMessage(CWPluginContext context, const CWMessageRef* msgRef, const char *line1, const char *line2, short errorlevel, SInt32 errorNumber);

	/* Display an alert. May actually be put in a message, depending on the plugin request */
CW_CALLBACK	CWAlert(CWPluginContext context, const char* msg1, const char* msg2, const char* msg3, const char* msg4);

	/* Display one or two status messages to the user									*/
CW_CALLBACK	CWShowStatus(CWPluginContext context, const char *line1, const char *line2);

	/* Give to the IDE to handle events and check if user has canceled this operation	*/
CW_CALLBACK	CWUserBreak(CWPluginContext context);

	/* Return stored preference data, referenced by name. Typically used for preference	*/
	/* panel settings.																	*/
CW_CALLBACK	CWGetNamedPreferences(CWPluginContext context, const char* prefsname, CWMemHandle* prefsdata);

	/* Store data referenced by a data type and file number								*/
CW_CALLBACK	CWStorePluginData(CWPluginContext context, SInt32 whichfile, CWDataType type, CWMemHandle prefsdata);

	/* Return stored data referenced by a data type and file number						*/
CW_CALLBACK	CWGetPluginData(CWPluginContext context, SInt32 whichfile, CWDataType type, CWMemHandle* prefsdata);

	/* Inform the IDE that a file modification date has changed. isGenerated is for use	*/
	/* by compiler and linker plugins only												*/
CW_CALLBACK	CWSetModDate(CWPluginContext context, const CWFileSpec* filespec, CWFileTime* moddate, Boolean isGenerated);

	/* Ask the IDE to add a file to the current target in the current project. isGenerated */
	/* is for use by compiler plugins only.												*/
CW_CALLBACK CWAddProjectEntry(CWPluginContext context, const CWFileSpec* fileSpec, Boolean isGenerated, const CWNewProjectEntryInfo* projectEntryInfo, SInt32* whichfile);

	/* Ask the IDE to remove a file from the current target (link-order/segment/overlay) in the current project. */
	/* If it's the last target that contains the file, it would be removed from the file list.								    	  									   */
CW_CALLBACK CWRemoveProjectEntry(CWPluginContext context, const CWFileSpec* fileSpec);

	/* Create a new editor window, supplying initial text and an optional document name */
CW_CALLBACK CWCreateNewTextDocument(CWPluginContext, const CWNewTextDocumentInfo* docinfo);

	/* Allocate memory. Permanent memory is not freed until the plugin is unloaded.		*/
	/* Temporary memory is freed after each plugin request completes.					*/
CW_CALLBACK	CWAllocateMemory(CWPluginContext context, SInt32 size, Boolean isPermanent, void** ptr);

	/* Free memory allocated via CWAllocateMemory										*/
CW_CALLBACK CWFreeMemory(CWPluginContext context, void* ptr, Boolean isPermanent);

	/* Allocate a memory handle of the requested size. All handles are automatically 	*/
	/* freed at the end of each compiler/linker request. useTempMemory is MacOS-specific*/
CW_CALLBACK	CWAllocMemHandle(CWPluginContext context, SInt32 size, Boolean useTempMemory, CWMemHandle* handle);

	/* Free a memory handle																*/
CW_CALLBACK	CWFreeMemHandle(CWPluginContext context, CWMemHandle handle);

	/* Return the current size of a memory handle										*/
CW_CALLBACK	CWGetMemHandleSize(CWPluginContext context, CWMemHandle handle, SInt32* size);

	/* Resize an existing memory handle													*/
CW_CALLBACK	CWResizeMemHandle(CWPluginContext context, CWMemHandle handle, SInt32 newSize);

	/* To obtain a pointer to the block, you must lock the handle						*/
	/* moveHi is MacOS-specific															*/
CW_CALLBACK	CWLockMemHandle(CWPluginContext context, CWMemHandle handle, Boolean moveHi, void** ptr);

	/* Unlock a memory handle, the pointer returned by locking the handle may no		*/
	/* longer be valid																	*/
CW_CALLBACK	CWUnlockMemHandle(CWPluginContext context, CWMemHandle handle);

#if CWPLUGIN_HOST == CWPLUGIN_HOST_MACOS
	/* Utility function to map MacOS error codes to a CWResult code. Plugins			*/
	/* may internally generate OSErrs, but need to return CWResult to the				*/
	/* CodeWarrior IDE																	*/
CW_CALLBACK CWMacOSErrToCWResult(CWPluginContext context, OSErr err);
#endif

	/* Turn off the built in PP window manager while the plugin displays a dialog		*/
CW_CALLBACK CWPreDialog(CWPluginContext context);

	/* Turn on the built in PP window manager after the plugin is through with its 		*/
	/* dialog																			*/
CW_CALLBACK CWPostDialog(CWPluginContext context);

	/* Notify the IDE that the plugin will be performing actions on a file 				*/
CW_CALLBACK CWPreFileAction(CWPluginContext context, const CWFileSpec *theFile);

	/* Notify the IDE that the plugin is finished performing actions on a file 			*/
CW_CALLBACK CWPostFileAction(CWPluginContext context, const CWFileSpec *theFile);

CW_CALLBACK CWResolveRelativePath(CWPluginContext context, const CWRelativePath* relativePath, CWFileSpec* fileSpec, Boolean create);

CW_CALLBACK CWFindLogicalDirectory(CWPluginContext context, SInt32 selector, CWFileSpec *dirSpec);

CW_CALLBACK CWOpenFileInEditor(CWPluginContext context, const CWFileSpec *fileSpec);


#if CWPLUGIN_HOST==CWPLUGIN_HOST_SOLARIS || CWPLUGIN_HOST==CWPLUGIN_HOST_LINUX
/* Forward declarations */
struct ICodeWarriorApp;
struct ICodeWarriorProject;
struct ICodeWarriorDesign;
struct ICodeWarriorTarget;
#endif /* CWPLUGIN_HOST==CWPLUGIN_HOST_SOLARIS || CWPLUGIN_HOST==CWPLUGIN_HOST_LINUX */


	/* Get the IDE application COM interface. Fails if called from any thread 			*/
	/* other than the main IDE thread, e.g. a build thread.								*/
CW_CALLBACK CWGetCOMApplicationInterface(CWPluginContext context, struct ICodeWarriorApp **app);

	/* Get the current project COM interface. Adds a reference upon return. 			*/
	/* Only succeeds if the plugin is being called in the context of a					*/
	/* particular project. Fails if called from any thread								*/
	/* other than the main IDE thread, e.g. a build thread.								*/
CW_CALLBACK CWGetCOMProjectInterface(CWPluginContext context, struct ICodeWarriorProject **project);

	/* Get the current design COM interface. Adds a reference upon return. 				*/
	/* Only succeeds if the plugin is being called in the context of a					*/
	/* particular target that is associated with a design.								*/
	/* Fails if called from any thread other than the main IDE thread, 					*/
	/* e.g. a build thread.																*/
CW_CALLBACK CWGetCOMDesignInterface(CWPluginContext context, struct ICodeWarriorDesign **design);

	/* Get the current target COM interface. Adds a reference upon return. 				*/
	/* Only succeeds if the plugin is being called in the context of a					*/
	/* particular target. Fails if called from any thread								*/
	/* other than the main IDE thread, e.g. a build thread.								*/
CW_CALLBACK CWGetCOMTargetInterface(CWPluginContext context, struct ICodeWarriorTarget **target);

#if CW_USE_PRAGMA_IMPORT
#pragma import reset
#endif

#ifdef __cplusplus
	}
#endif

#ifdef	_MSC_VER
#pragma	pack(pop)
#endif

#ifdef	__MWERKS__
#pragma options align=reset
#endif

#endif	/* __CWPlugins_H__ */