void CS_AddVLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap) /* Add a line to the given code segment */ { const char* L; CodeEntry* E; char Token[IDENTSIZE+10]; /* Format the line */ StrBuf Buf = STATIC_STRBUF_INITIALIZER; SB_VPrintf (&Buf, Format, ap); /* Skip whitespace */ L = SkipSpace (SB_GetConstBuf (&Buf)); /* Check which type of instruction we have */ E = 0; /* Assume no insn created */ switch (*L) { case '\0': /* Empty line, just ignore it */ break; case ';': /* Comment or hint, ignore it for now */ break; case '.': /* Control instruction */ ReadToken (L, " \t", Token, sizeof (Token)); Error ("ASM code error: Pseudo instruction `%s' not supported", Token); break; default: E = ParseInsn (S, LI, L); break; } /* If we have a code entry, transfer the labels and insert it */ if (E) { CS_AddEntry (S, E); } /* Cleanup the string buffer */ SB_Done (&Buf); }
void AddCode (opc_t OPC, am_t AM, const char* Arg, struct CodeLabel* JumpTo) /* Add a code entry to the current code segment */ { CHECK (CS != 0); CS_AddEntry (CS->Code, NewCodeEntry (OPC, AM, Arg, JumpTo, CurTok.LI)); }