コード例 #1
0
ファイル: codeseg.c プロジェクト: gomachan46/otoge_burn
void CS_OutputPrologue (const CodeSeg* S)
/* If the given code segment is a code segment for a function, output the
 * assembler prologue into the file. That is: Output a comment header, switch
 * to the correct segment and enter the local function scope. If the code
 * segment is global, do nothing.
 */
{
    /* Get the function associated with the code segment */
    SymEntry* Func = S->Func;

    /* If the code segment is associated with a function, print a function
     * header and enter a local scope. Be sure to switch to the correct
     * segment before outputing the function label.
     */
    if (Func) {
        /* Get the function descriptor */
       	CS_PrintFunctionHeader (S);
        WriteOutput (".segment\t\"%s\"\n\n.proc\t_%s", S->SegName, Func->Name);
        if (IsQualNear (Func->Type)) {
            WriteOutput (": near");
        } else if (IsQualFar (Func->Type)) {
            WriteOutput (": far");
        }
        WriteOutput ("\n\n");
    }

}
コード例 #2
0
ファイル: datatype.c プロジェクト: josch1710/cc65
void PrintFuncSig (FILE* F, const char* Name, Type* T)
/* Print a function signature. */
{
    /* Get the function descriptor */
    const FuncDesc* D = GetFuncDesc (T);

    /* Print a comment with the function signature */
    PrintType (F, GetFuncReturn (T));
    if (IsQualNear (T)) {
        fprintf (F, " __near__");
    }
    if (IsQualFar (T)) {
        fprintf (F, " __far__");
    }
    if (IsQualFastcall (T)) {
        fprintf (F, " __fastcall__");
    }
    if (IsQualCDecl (T)) {
        fprintf (F, " __cdecl__");
    }
    fprintf (F, " %s (", Name);

    /* Parameters */
    if (D->Flags & FD_VOID_PARAM) {
        fprintf (F, "void");
    } else {
        unsigned I;
        SymEntry* E = D->SymTab->SymHead;
        for (I = 0; I < D->ParamCount; ++I) {
            if (I > 0) {
                fprintf (F, ", ");
            }
            if (SymIsRegVar (E)) {
                fprintf (F, "register ");
            }
            PrintType (F, E->Type);
            E = E->NextSym;
        }
    }

    /* End of parameter list */
    fprintf (F, ")");
}