Added the write routine.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5584 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* common */
|
||||
#include "fileid.h"
|
||||
|
||||
@@ -88,6 +90,24 @@ static const FileId FormatTable[] = {
|
||||
|
||||
|
||||
|
||||
int FindOutputFormat (const char* Name)
|
||||
/* Find an output format by name. The function returns a value less than zero
|
||||
* if Name is not a known output format.
|
||||
*/
|
||||
{
|
||||
/* Search for the entry in the table. */
|
||||
const FileId* F = bsearch (Name,
|
||||
FormatTable,
|
||||
sizeof (FormatTable) / sizeof (FormatTable[0]),
|
||||
sizeof (FormatTable[0]),
|
||||
CompareFileId);
|
||||
|
||||
/* Return the id or an error code */
|
||||
return (F == 0)? -1 : F->Id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WriteOutputFile (const char* Name, const StrBuf* Data, OutputFormat Format)
|
||||
/* Write the contents of Data to the given file in the format specified. If
|
||||
* the format is ofAuto, it is determined by the file extension.
|
||||
|
||||
Reference in New Issue
Block a user