1 /*****************************************************************************/
5 /* Object file options for the ca65 macroassembler */
9 /* (C) 1998-2008, Ullrich von Bassewitz */
10 /* Roemerstrasse 52 */
11 /* D-70794 Filderstadt */
12 /* EMail: uz@cc65.org */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
50 /*****************************************************************************/
52 /*****************************************************************************/
57 static Option* OptRoot = 0;
58 static Option* OptLast = 0;
59 static unsigned OptCount = 0;
63 /*****************************************************************************/
65 /*****************************************************************************/
69 static Option* NewOption (unsigned char Type, unsigned long Val)
70 /* Create a new option, insert it into the list and return it */
75 Opt = xmalloc (sizeof (*Opt));
77 /* Initialize fields */
82 /* Insert it into the list */
90 /* One more option now */
93 /* Return the new struct */
99 void OptStr (unsigned char Type, const StrBuf* Text)
100 /* Add a string option */
102 NewOption (Type, GetStrBufId (Text));
107 void OptComment (const StrBuf* Comment)
110 NewOption (OPT_COMMENT, GetStrBufId (Comment));
115 void OptAuthor (const StrBuf* Author)
116 /* Add an author statement */
118 NewOption (OPT_AUTHOR, GetStrBufId (Author));
123 void OptTranslator (const StrBuf* Translator)
124 /* Add a translator option */
126 NewOption (OPT_TRANSLATOR, GetStrBufId (Translator));
131 void OptCompiler (const StrBuf* Compiler)
132 /* Add a compiler option */
134 NewOption (OPT_COMPILER, GetStrBufId (Compiler));
139 void OptOS (const StrBuf* OS)
140 /* Add an operating system option */
142 NewOption (OPT_OS, GetStrBufId (OS));
147 void OptDateTime (unsigned long DateTime)
148 /* Add a date/time option */
150 NewOption (OPT_DATETIME, DateTime);
155 void WriteOptions (void)
156 /* Write the options to the object file */
160 /* Tell the object file module that we're about to start the options */
163 /* Write the option count */
164 ObjWriteVar (OptCount);
166 /* Walk through the list and write the options */
170 /* Write the type of the option, then the value */
172 ObjWriteVar (O->Val);
179 /* Done writing options */