6 ** Copyright (C) 1993,94,95,96,97 Bernardo Innocenti
8 ** Use 4 chars wide TABs to read this source
10 ** Private definitions for internal XModule use
14 #include <exec/nodes.h>
15 #endif /* !EXEC_NODES_H */
17 #ifndef EXEC_LIBRARIES_H
18 #include <exec/libraries.h>
19 #endif /* !EXEC_LIBRARIES_H */
23 #endif /* !DOS_DOS_H */
27 #endif /* !DOS_DOS_H */
29 #ifndef LIBRARIES_IFFPARSE_H
30 #include "libraries/iffparse.h"
31 #endif /* LIBRARIES_IFFPARSE_H */
33 #ifndef LIBRARIES_XMODULE_H
34 #include <libraries/xmodule.h>
35 #endif /* !LIBRARIES_XMODULE_H */
37 #ifndef LIBRARIES_SONGCLASS_H
38 #include <libraries/songclass.h>
39 #endif /* !LIBRARIES_SONGCLASS_H */
41 #include "XModule_rev.h"
42 #include "LocaleStrings.h"
43 #include "ListMacros.h"
44 #include "CompilerSpecific.h"
45 #include "Debug.h" /* Debug support */
47 /* Single object compilation requires different attributes for global symbols */
54 #define GLOBALCALL static
56 // #pragma msg 72 ignore
57 #pragma msg 181 ignore
62 /* Version information: updated auto-magically on every compilation ;-) */
64 #define XMODULEVER VERS
65 #define XMODULEDATE "(" DATE ")"
66 #define XMODULECOPY "Copyright © 1993,94,95,96,97 by Bernardo Innocenti"
70 #define BUILDMODE "[M68020 OS3.0]"
72 #define BUILDMODE "[M68000 OS3.0]"
76 #define BUILDMODE "[M68020 OS2.0]"
78 #define BUILDMODE "[M68000 OS2.0]"
84 /*************************/
85 /* Constants Definitions */
86 /*************************/
89 #define MAXTABLEEFFECTS 20 /* Number of entries in effect conversion table */
90 #define PATHNAME_MAX 108 /* Maximum length of an AmigaDOS path name */
93 /* Specific error codes */
94 #define ERROR_NOTMODULE ERROR_OBJECT_WRONG_TYPE /* File format not recognized */
95 #define ERROR_IOERR RETURN_FAIL /* A DOS call (e.g.: Read()) failed.
96 * check IoErr() for specific error.
99 /* Default directory for external hooks */
100 #define DEF_HOOKSDIR "PROGDIR:Hooks/"
103 /***********************/
104 /* Function Prototypes */
105 /***********************/
108 GLOBALCALL void HandleAudio (void);
109 GLOBALCALL void PlaySample (BYTE *samp, ULONG len, UWORD vol, UWORD per);
110 GLOBALCALL ULONG SetupAudio (void);
111 GLOBALCALL void CleanupAudio (void);
114 GLOBALCALL struct Library *MyOpenLibrary (CONST_STRPTR name, ULONG ver);
115 GLOBALCALL void CantOpenLib (CONST_STRPTR name, LONG vers);
116 GLOBALCALL void KillMsgPort (struct MsgPort *mp);
117 GLOBALCALL struct TextAttr *CopyTextAttrPooled (void *pool, const struct TextAttr *source, struct TextAttr *dest);
118 GLOBALCALL UWORD CmpTextAttr (const struct TextAttr *ta1, const struct TextAttr *ta2);
119 GLOBALCALL STRPTR DupStringPooled (void *pool, CONST_STRPTR source, STRPTR *dest);
120 GLOBALCALL void FilterName (STRPTR name);
121 GLOBALCALL struct DiskObject *GetProgramIcon (void);
122 GLOBALCALL LONG PutIcon (CONST_STRPTR source, CONST_STRPTR dest);
123 GLOBALCALL LONG BackupFile (CONST_STRPTR src, CONST_STRPTR template, ULONG versions);
125 /* From "Gui.c" (More functions prototyped in "Gui.h") */
126 GLOBALCALL LONG HandleGui (void);
129 GLOBALCALL void HandleRexxMsg (void);
130 GLOBALCALL LONG CreateRexxPort (void);
131 GLOBALCALL void DeleteRexxPort (void);
133 /* From "ToolBoxWin.c" */
134 GLOBALCALL void ToolBoxOpenModule (CONST_STRPTR file, ULONG num, ULONG count);
137 GLOBALCALL void HandleHelp (struct IntuiMessage *msg);
138 GLOBALCALL void HandleAmigaGuide (void);
139 GLOBALCALL void CleanupHelp (void);
142 GLOBALCALL LONG SetupCx (void);
143 GLOBALCALL void HandleCx (void);
144 GLOBALCALL void CleanupCx (void);
146 /* From "ProgressWin.c" */
147 GLOBALCALL void DisplayAction (ULONG msg);
148 GLOBALCALL void DisplayActionStr (CONST_STRPTR str);
149 GLOBALCALL LONG DisplayProgress (LONG Num, LONG Max);
150 GLOBALCALL void ShowMessage (ULONG msg, ...);
151 GLOBALCALL void ShowString (CONST_STRPTR s, LONG *args);
153 /* From "PlayWin.c" */
154 GLOBALCALL LONG SetupPlayer (void);
155 GLOBALCALL void CleanupPlayer (void);
157 /* From "Compress.c" */
158 GLOBALCALL BPTR DecompressFile (CONST_STRPTR name, UWORD type);
159 GLOBALCALL void DecompressFileDone (void);
160 GLOBALCALL LONG CruncherType (BPTR file);
163 GLOBALCALL Class * InitSongClass (void);
164 GLOBALCALL void FreeSongClass (Class *cl);
165 GLOBALCALL void FixSong (struct SongInfo *si);
166 GLOBALCALL ULONG CalcInstSize (struct SongInfo *si);
167 GLOBALCALL ULONG CalcSongSize (struct SongInfo *si);
168 GLOBALCALL ULONG CalcSongTime (struct SongInfo *si);
171 GLOBALCALL LONG LoadInstrument (struct SongInfo *si, ULONG num, CONST_STRPTR filename);
172 GLOBALCALL LONG SaveInstrument (struct Instrument *inst, CONST_STRPTR filename);
173 GLOBALCALL LONG Load8SVXInstrument (struct SongInfo *si, ULONG num, struct IFFHandle *iff, CONST_STRPTR filename);
174 GLOBALCALL LONG Save8SVXInstrument (struct Instrument *inst, ULONG num, struct IFFHandle *iff);
175 GLOBALCALL void OptimizeInstruments (struct SongInfo *si);
176 GLOBALCALL void RemDupInstruments (struct SongInfo *si);
177 GLOBALCALL void RemUnusedInstruments (struct SongInfo *si);
178 GLOBALCALL void RemapInstruments (struct SongInfo *si);
179 GLOBALCALL void SampChangeSign8 (UBYTE *samp, ULONG len);
181 /* From "Operators.c" */
182 GLOBALCALL ULONG InsertPattern (struct SongInfo *si, struct Pattern *patt, UWORD patnum);
183 GLOBALCALL struct SongInfo *MergeSongs (struct SongInfo *songa, struct SongInfo *songb);
184 GLOBALCALL struct SongInfo *JoinSongs (struct SongInfo *songa, struct SongInfo *songb);
185 GLOBALCALL void RemDupPatterns (struct SongInfo *si);
186 GLOBALCALL void DiscardPatterns (struct SongInfo *si);
187 GLOBALCALL void CutPatterns (struct SongInfo *si);
188 GLOBALCALL LONG ResizePatterns (struct SongInfo *si, ULONG min, ULONG max);
189 GLOBALCALL struct Pattern *CopyPattern (struct SongInfo *si, struct Pattern *src, ULONG destNum);
192 GLOBALCALL LONG LoadPrefs (CONST_STRPTR filename);
193 GLOBALCALL LONG SavePrefs (CONST_STRPTR filename);
195 /* From "Library.c" */
196 GLOBALCALL ULONG MakeXModuleLibrary (void);
197 GLOBALCALL void DisposeXModuleLibrary (void);
199 /* From "Locale.c" */
200 GLOBALCALL void SetupLocale (void);
201 GLOBALCALL void CleanupLocale (void);
203 /* From "XModuleHook.c" */
204 GLOBALCALL void AddXModuleHooks (void);
205 GLOBALCALL LONG LoadSong (struct IFFHandle *iff, struct SongInfo *si);
206 GLOBALCALL struct Pattern *LoadPattern (struct SongInfo *si, ULONG num, struct IFFHandle *iff);
207 GLOBALCALL LONG SaveSong (struct IFFHandle *iff, struct SongInfo *si);
208 GLOBALCALL LONG SaveSequence (struct IFFHandle *iff, struct SongInfo *si);
209 GLOBALCALL LONG SavePatterns (struct IFFHandle *iff, struct SongInfo *si);
210 GLOBALCALL LONG SaveInstruments (struct IFFHandle *iff, struct SongInfo *si);
211 GLOBALCALL LONG SavePattern (struct IFFHandle *iff, struct Pattern *patt);
212 GLOBALCALL LONG WriteStringChunk (struct IFFHandle *iff, CONST_STRPTR name, ULONG id);
214 /* From "TrackerHook.c" */
215 GLOBALCALL void AddTrackerHooks (void);
217 /* From "Startup.asm" */
218 extern void _XCEXIT (LONG err);
219 extern void SPrintf (UBYTE *buf, CONST_STRPTR formatstr, ...);
220 extern void STDARGS VSPrintf (UBYTE *buf, CONST_STRPTR formatstr, void *argv);
221 extern struct WBStartup *WBenchMsg;
222 extern struct Process *ThisTask;
227 /* Memory pools support for pre-V39 OS */
229 #define CreatePool(f,p,t) LibCreatePool((f),(p),(t))
230 #define DeletePool(p) LibDeletePool(p)
231 #define AllocPooled(p,s) AsmAllocPooled((p), (s), SysBase)
232 #define FreePooled(p,m,s) AsmFreePooled((p), (m), (s), SysBase)
234 extern ASMCALL void *AsmAllocPooled (REG(a0, void *pool), REG(d0, ULONG size), REG(a6, struct ExecBase *SysBase));
235 extern ASMCALL void *AsmFreePooled (REG(a0, void *pool), REG(a1, void *drop), REG(d0, ULONG size), REG(a6, struct ExecBase *SysBase));
237 #endif /* !OS30_ONLY */
240 /* More memory pools support */
243 GLOBALCALL void *CAllocPooled (void *pool, ULONG size);
244 GLOBALCALL void *AllocVecPooled (void *pool, ULONG size);
245 GLOBALCALL void FreeVecPooled (void *pool, void *drop);
247 #define AllocVecPooled(p,s) AsmAllocVecPooled((p), (s), SysBase)
248 #define FreeVecPooled(p,m) AsmFreeVecPooled((p), (m), SysBase)
249 #define CAllocPooled(p,s) AsmCAllocPooled((p), (s), SysBase)
251 extern ASMCALL void *AsmCAllocPooled (REG(a0, void *pool), REG(d0, ULONG size), REG(a6, struct ExecBase *SysBase));
252 extern ASMCALL void *AsmAllocVecPooled (REG(a0, void *pool), REG(d0, ULONG size), REG(a6, struct ExecBase *SysBase));
253 extern ASMCALL void AsmFreeVecPooled (REG(a0, void *pool), REG(a1, void *drop), REG(a6, struct ExecBase *SysBase));
257 /* Use these macros when the corresponding functions are not available.
258 * GLOBALCALL void InstallGfxFunctions (void);
259 * GLOBALCALL ULONG (*ReadAPen)(struct RastPort *RPort);
260 * GLOBALCALL ULONG (*ReadBPen)(struct RastPort *RPort);
261 * GLOBALCALL ULONG (*ReadDrMd)(struct RastPort *RPort);
266 /********************/
267 /* Global variables */
268 /********************/
270 XREF struct Catalog *Catalog;
272 XREF STRPTR AppStrings[];
276 XREF UBYTE PubPortName[];
279 XREF UBYTE CxPopKey[32];
284 XREF UBYTE IconName[16];
286 XREF const UBYTE Version[];
287 XREF const UBYTE BaseName[]; /* All caps */
288 XREF const UBYTE PrgName[]; /* Mixed case */
290 #endif /* !XMODULE_PRIV_H */