Lines Matching refs:function
68 The first field of the three is a function name. This will produce
69 a function or array of the same name in the C output, so it should
71 function named returns a string (a (char *) in C), but if the first
72 field is preceded by %, the function returns an unsigned long
75 The second field describes the arguments of the function. It consists
78 the function. Each character of the string represents one bit,
86 describing the parameters of the function, or the parameters after
94 The third field describes the value of the function. If a bitmask
96 1s), then the third field is the value of the function only in the
99 function but with different bitpatterns. The generated C code will
101 matches the actual first argument of the function when it is
105 It is only allowed for two different lines to name the same function
114 identical on every line referring to a given function, and the
127 - A $ followed by the name of a function and an argument list in
128 parentheses () is replaced by the value returned by the function
130 string without being converted by a function, nor can a string
156 function is assumed to be defined externally and only a function
164 disassembled by a generated function "inst" which looks like this:
174 The first field names the function, "inst". The second field
175 implies that that function has exactly one argument which is an
176 integer, and that this line specifies the value of the function
193 corresponding values of the inst function will be "daa", "cpl",
196 The description defines a helper function "reg8" like this:
207 that the function can be represented by an array rather than
208 compiling a C function.
210 The reg8 function is used in lines like this one:
224 The description also uses an external C function "hexprint" defined
233 The value of this function is a string containing the number n
235 file this function is declared like this:
242 The hexprint function is used in lines like this one:
277 string-value. In a void function, instead of returning a string (or
278 integer) it would be output via a user-supplied function.
296 #define MAXfunction 32 /* Max function name length. */
315 to concatenate together at some stage. A separate C function is compiled
331 struct function *findfunction(char *function);
332 int parseextern(struct function *fp, FILE *f);
333 struct function *makefunction(char *function);
334 int parsebits(struct function *fp, char *bitstring, int nbits);
337 int parseargs(struct function *fp, FILE *f, int *cp);
338 int parsestring(struct function *fp, char *str);
339 enum type makestring(struct function *fp, struct string **stringlink,
341 int parsedollar(struct function *fp, char **stringp, struct string *sp);
342 int parsebitsplice(struct function *fp, char *bitstring, int nbits,
344 int findvariable(struct function *fp, int name, struct string *sp);
345 int parsefunctioncall(struct function *fp, char *start, char **stringp,
347 int parsearray(struct function *fp, char **stringp, struct string *sp,
350 void dumpfunction(struct function *fp);
351 void showentry(FILE *f, struct function *fp, struct entry *ep, bits highlight);
366 int outputfunction(struct function *fp);
367 void functionarray(struct function *fp);
368 void functionheader(FILE *f, struct function *fp);
371 int functionswitch(struct function *fp, bits mask, bits value);
437 char function[MAXfunction], bitstring[MAXBITS];
440 struct function *fp;
462 /* Read function name, terminated by space. */
463 for (i = 0; i < sizeof function && !isspace(c); i++, c = getc(f)) {
466 function[i] = c;
468 if (i >= sizeof function) {
469 fprintf(stderr, "%s: %s(%d): function name is too long: %.*s\n",
470 progname, filename, lineno, i, function);
473 function[i] = '\0';
480 if (function[0] == ':')
483 fp = makefunction(function);
509 /* : indicates an external (C) function. */
549 if (function[0] == ':') {
550 if (parsecontrol(function + 1, string) != 0)
563 /* A function in the description file. nbits and nargs are -1 until the
565 struct function {
566 struct function *next;
577 struct function *functions;
580 /* Find the function with the given name. If not found, create a structure
582 struct function *findfunction(char *name) {
583 struct function *fp;
603 /* Parse an external (C) function declaration. This will look something like:
607 int parseextern(struct function *fp, FILE *f) {
628 /* A value supplied for a function (the third field in a description line).
638 struct string *string; /* Value of function when bitpattern matched. */
643 /* We've just seen a definition of function "name". Make a structure for it
646 struct function *makefunction(char *name) {
647 struct function *fp;
660 fprintf(stderr, "%s: %s(%d): function %s previously declared as %s, "
677 /* A named bitfield within the bitpattern of a function entry, or within a
688 /* Parse the bitstring supplied for the given function. nbits says how many
690 int parsebits(struct function *fp, char *bitstring, int nbits) {
696 fprintf(stderr, " function %s has bit strings of length %d\n",
704 /* Parse a bitstring that is the pattern for a function entry or that is in a
771 /* A parameter to a function, e.g., x in:
780 /* Parse the parameters (x,y,...) to a function and put the result in fp.
783 this is the first entry for the function, fp->nargs will be -1 and
787 int parseargs(struct function *fp, FILE *f, int *cp) {
882 fprintf(stderr, " function %s has argument lists of length %d\n",
892 function. Return 0 on success. */
893 int parsestring(struct function *fp, char *str) {
900 fprintf(stderr, "%s: %s(%d): function %s has inconsistent types\n",
909 function, or certain strings within that (e.g., array indices). This is a
926 /* The representation of a function call $func(...) in the description of a
927 function value. */
929 struct function *function;
934 of a function value. tempno is used when constructing a C variable name
943 /* A list of strings, being the list of arguments in a function call or the
953 of parsing of a function value. When parsing arrays or function calls,
958 /* Parse a function return-value string or substring and make a struct string
962 at *stringlink. `fp' is the function whose return value is being parsed.
965 enum type makestring(struct function *fp, struct string **stringlink,
1021 newt = sp->value.functioncall->function->type;
1070 `fp' is the function whose return value is being parsed. The parsed
1072 int parsedollar(struct function *fp, char **stringp, struct string *sp) {
1113 argument to the current function, in which case it will be shifted
1115 current function, in which case it will be shifted by the difference
1119 For instance, in a function like this:
1129 for a function will be treated like a parameter in that it will not be
1150 int parsebitsplice(struct function *fp, char *bitstring, int nbits,
1211 this function and therefore doesn't need to be masked. */
1226 int findvariable(struct function *fp, int name, struct string *sp) {
1250 int parsefunctioncall(struct function *fp, char *start, char **stringp,
1259 fprintf(stderr, "%s: %s(%d): missing ( after function %.*s\n", progname,
1266 fcp->function = findfunction(start);
1292 int parsearray(struct function *fp, char **stringp, struct string *sp,
1360 struct function *fp;
1367 void dumpfunction(struct function *fp) {
1380 void showentry(FILE *f, struct function *fp, struct entry *ep, bits highlight) {
1500 fprintf(f, "$%s(", fcp->function->name);
1581 struct function *fp;
1625 struct function *fp;
1701 struct function *fp;
1766 int outputfunction(struct function *fp) {
1784 void functionarray(struct function *fp) {
1793 void functionheader(FILE *f, struct function *fp) {
1846 /* Generate code for entries in function fp whose bitstring b satisfies
1853 generate a `switch' case and invoke the function recursively with
1862 int functionswitch(struct function *fp, bits mask, bits value) {
1893 "%s: function %s: unable to distinguish between:\n",
2134 struct function *fp;
2142 fp = sp->value.functioncall->function;