summaryrefslogtreecommitdiff
path: root/command_line/CmdLine/Src/CLWriteObjectFile.c
blob: 22028dcdcf5ce79555a1e175d18fcc609c7a72f0 (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
#include "cmdline.h"

extern char STSbuf[256];

int WriteObjectFile(File *file, OSType maccreator, OSType mactype) {
    FSSpec srcfss;
    FSSpec outfss;

    OS_ASSERT(22, file->objectdata && file->compiler);

    OS_OSSpec_To_FSSpec(&file->outfss, &outfss);
    OS_OSSpec_To_FSSpec(&file->srcfss, &srcfss);

    if (optsCmdLine.verbose) {
        CLReport(16,
                 (file->tempOnDisk & CmdLineStageMask_Cg) ? "temporary " : "",
                 OS_SpecToStringRelative(&file->outfss, NULL, STSbuf, sizeof(STSbuf)));
    }

    if (!Plugin_CL_WriteObjectFile(file->compiler, &srcfss, &outfss, maccreator, mactype, file->objectdata))
        return 0;
    else
        return 1;
}

int WriteBrowseData(File *file, OSType maccreator, OSType mactype) {
    OSHandle browsehandle;
    OSSpec outfss;
    const CWObjectFlags *cof;

    cof = Plugin_CL_GetObjectFlags(file->compiler);
    outfss = file->outfss;

    OS_NameSpecSetExtension(&outfss.name, optsCompiler.brsFileExt[0] ? optsCompiler.brsFileExt : cof->brsFileExt);
    if (optsCmdLine.verbose) {
        CLReport(17, OS_SpecToStringRelative(&outfss, NULL, STSbuf, sizeof(STSbuf)));
    }

    if (!Browser_PackBrowseFile(file->browsedata, &clState.browseTableHandle, &browsehandle))
        return 0;

    return WriteBinaryHandleToFile(&outfss, maccreator, mactype, &browsehandle) != 0;
}