8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / common / ficl / word.c
blob3d4da1b25a3f69e66362aaa4503b9cdc553fba46
1 #include "ficl.h"
3 /*
4 * w o r d I s I m m e d i a t e
5 */
6 int
7 ficlWordIsImmediate(ficlWord *word)
9 return ((word != NULL) && (word->flags & FICL_WORD_IMMEDIATE));
13 * w o r d I s C o m p i l e O n l y
15 int
16 ficlWordIsCompileOnly(ficlWord *word)
18 return ((word != NULL) && (word->flags & FICL_WORD_COMPILE_ONLY));
22 * f i c l W o r d C l a s s i f y
23 * This public function helps to classify word types for SEE
24 * and the debugger in tools.c. Given an pointer to a word, it returns
25 * a member of WOR
27 ficlWordKind
28 ficlWordClassify(ficlWord *word)
30 ficlPrimitive code;
31 ficlInstruction i;
32 ficlWordKind iType;
34 if ((((ficlInstruction)word) > ficlInstructionInvalid) &&
35 (((ficlInstruction)word) < ficlInstructionLast)) {
36 i = (ficlInstruction)word;
37 iType = FICL_WORDKIND_INSTRUCTION;
38 goto IS_INSTRUCTION;
41 code = word->code;
43 if ((((ficlInstruction)code) > ficlInstructionInvalid) &&
44 (((ficlInstruction)code) < ficlInstructionLast)) {
45 i = (ficlInstruction)code;
46 iType = FICL_WORDKIND_INSTRUCTION_WORD;
47 goto IS_INSTRUCTION;
50 return (FICL_WORDKIND_PRIMITIVE);
52 IS_INSTRUCTION:
54 switch (i) {
55 case ficlInstructionConstantParen:
56 #if FICL_WANT_FLOAT
57 case ficlInstructionFConstantParen:
58 #endif /* FICL_WANT_FLOAT */
59 return (FICL_WORDKIND_CONSTANT);
61 case ficlInstruction2ConstantParen:
62 #if FICL_WANT_FLOAT
63 case ficlInstructionF2ConstantParen:
64 #endif /* FICL_WANT_FLOAT */
65 return (FICL_WORDKIND_2CONSTANT);
67 #if FICL_WANT_LOCALS
68 case ficlInstructionToLocalParen:
69 case ficlInstructionTo2LocalParen:
70 #if FICL_WANT_FLOAT
71 case ficlInstructionToFLocalParen:
72 case ficlInstructionToF2LocalParen:
73 #endif /* FICL_WANT_FLOAT */
74 return (FICL_WORDKIND_INSTRUCTION_WITH_ARGUMENT);
75 #endif /* FICL_WANT_LOCALS */
77 #if FICL_WANT_USER
78 case ficlInstructionUserParen:
79 return (FICL_WORDKIND_USER);
80 #endif
82 case ficlInstruction2LiteralParen:
83 return (FICL_WORDKIND_2LITERAL);
85 #if FICL_WANT_FLOAT
86 case ficlInstructionFLiteralParen:
87 return (FICL_WORDKIND_FLITERAL);
88 #endif
89 case ficlInstructionCreateParen:
90 return (FICL_WORDKIND_CREATE);
92 case ficlInstructionCStringLiteralParen:
93 return (FICL_WORDKIND_CSTRING_LITERAL);
95 case ficlInstructionStringLiteralParen:
96 return (FICL_WORDKIND_STRING_LITERAL);
98 case ficlInstructionColonParen:
99 return (FICL_WORDKIND_COLON);
101 case ficlInstructionDoDoes:
102 return (FICL_WORDKIND_DOES);
104 case ficlInstructionDoParen:
105 return (FICL_WORDKIND_DO);
107 case ficlInstructionQDoParen:
108 return (FICL_WORDKIND_QDO);
110 case ficlInstructionVariableParen:
111 return (FICL_WORDKIND_VARIABLE);
113 case ficlInstructionBranchParenWithCheck:
114 case ficlInstructionBranchParen:
115 return (FICL_WORDKIND_BRANCH);
117 case ficlInstructionBranch0ParenWithCheck:
118 case ficlInstructionBranch0Paren:
119 return (FICL_WORDKIND_BRANCH0);
121 case ficlInstructionLiteralParen:
122 return (FICL_WORDKIND_LITERAL);
124 case ficlInstructionLoopParen:
125 return (FICL_WORDKIND_LOOP);
127 case ficlInstructionOfParen:
128 return (FICL_WORDKIND_OF);
130 case ficlInstructionPlusLoopParen:
131 return (FICL_WORDKIND_PLOOP);
133 default:
134 return (iType);