AsmCode* AsmCodeNew(char *line) { AsmCode* code = ObjNew(AsmCode,1); char head[MAX_LEN]; strCut(line, "/", head, NULL); Array* tokens = split(head, " \t+[],", REMOVE_SPLITER); if (tokens->count == 0) { ArrayFree(tokens, strFree); ObjFree(code); return NULL; } code->line = strNew(head); strTrim(code->line, code->line, SPACE); code->tokens = tokens; int tokenIdx = 0; if (strTail(tokens->item[0], ":")) { code->label = ArrayGet(tokens, tokenIdx++); strTrim(code->label, code->label, ":"); } else code->label = NULL; code->op = ArrayGet(tokens, tokenIdx++); code->opCode = OP_NULL; code->argStart = tokenIdx; code->arg[0] = ArrayGet(tokens, tokenIdx++); code->arg[1] = ArrayGet(tokens, tokenIdx++); code->arg[2] = ArrayGet(tokens, tokenIdx++); // AsmCodePrintln(code); return code; }
PRBool test_null() { nsAutoString str(NS_LITERAL_STRING("string with a \0 char")); nsDependentString strCut(str.get()); if (str.Equals(strCut)) return PR_FALSE; nsCOMPtr<nsIAtom> atomCut = do_GetAtom(strCut); nsCOMPtr<nsIAtom> atom = do_GetAtom(str); return atom->GetLength() == str.Length() && atom->Equals(str) && atom->EqualsUTF8(NS_ConvertUTF16toUTF8(str)) && atom != atomCut && atomCut->Equals(strCut); }