Lines Matching refs:str

70 						   char **str,
76 char **str, struct param **extra_param,
81 char **str, struct param **extra_param,
85 char **str, struct arg_type_info **retp, int *ownp);
136 eat_spaces(char **str) { in eat_spaces() argument
137 while (**str == ' ') { in eat_spaces()
138 (*str)++; in eat_spaces()
143 xstrndup(char *str, size_t len) { in xstrndup() argument
149 strncpy(ret, str, len); in xstrndup()
155 parse_ident(struct locus *loc, char **str) in parse_ident() argument
157 char *ident = *str; in parse_ident()
159 if (!isalpha(CTYPE_CONV(**str)) && **str != '_') { in parse_ident()
164 while (**str && (isalnum(CTYPE_CONV(**str)) || **str == '_')) { in parse_ident()
165 ++(*str); in parse_ident()
168 return xstrndup(ident, *str - ident); in parse_ident()
176 start_of_arg_sig(char *str) { in start_of_arg_sig() argument
180 if (!strlen(str)) in start_of_arg_sig()
183 pos = &str[strlen(str)]; in start_of_arg_sig()
186 if (pos < str) in start_of_arg_sig()
188 while ((pos > str) && (*pos != ')') && (*pos != '(')) in start_of_arg_sig()
204 parse_int(struct locus *loc, char **str, long *ret) in parse_int() argument
207 long n = strtol(*str, &end, 0); in parse_int()
208 if (end == *str) { in parse_int()
213 *str = end; in parse_int()
243 parse_char(struct locus *loc, char **str, char expected) in parse_char() argument
245 if (**str != expected) { in parse_char()
247 "expected '%c', got '%c'", expected, **str); in parse_char()
251 ++*str; in parse_char()
256 char **str, int *ownp, int zero);
259 parse_zero(struct locus *loc, char **str, int *ownp) in parse_zero() argument
261 eat_spaces(str); in parse_zero()
262 if (**str == '(') { in parse_zero()
263 ++*str; in parse_zero()
265 struct expr_node *arg = parse_argnum(loc, str, &own, 0); in parse_zero()
268 if (parse_char(loc, str, ')') < 0) { in parse_zero()
305 parse_argnum(struct locus *loc, char **str, int *ownp, int zero) in parse_argnum() argument
311 if (isdigit(CTYPE_CONV(**str))) { in parse_argnum()
313 if (parse_int(loc, str, &l) < 0 in parse_argnum()
327 char *const name = parse_ident(loc, str); in parse_argnum()
368 = parse_zero(loc, str, ownp); in parse_argnum()
395 parse_typedef_name(struct protolib *plib, char **str) in parse_typedef_name() argument
397 char *end = *str; in parse_typedef_name()
400 if (end == *str) in parse_typedef_name()
403 size_t len = end - *str; in parse_typedef_name()
405 memcpy(buf, *str, len); in parse_typedef_name()
406 *str += len; in parse_typedef_name()
416 parse_typedef(struct protolib *plib, struct locus *loc, char **str) in parse_typedef() argument
418 (*str) += strlen("typedef"); in parse_typedef()
419 eat_spaces(str); in parse_typedef()
420 char *name = parse_ident(loc, str); in parse_typedef()
437 eat_spaces(str); in parse_typedef()
438 if (parse_char(loc, str, '=') < 0) in parse_typedef()
440 eat_spaces(str); in parse_typedef()
445 = parse_lens(plib, loc, str, NULL, 0, &own, &fwd); in parse_typedef()
486 char **str, struct arg_type_info *info, in parse_struct() argument
489 eat_spaces(str); in parse_struct()
491 if (**str == ';') { in parse_struct()
506 if (parse_char(loc, str, '(') < 0) in parse_struct()
509 eat_spaces(str); // Empty arg list with whitespace inside in parse_struct()
514 eat_spaces(str); in parse_struct()
515 if (**str == 0 || **str == ')') { in parse_struct()
516 parse_char(loc, str, ')'); in parse_struct()
522 parse_char(loc, str, ','); in parse_struct()
524 eat_spaces(str); in parse_struct()
527 = parse_lens(plib, loc, str, NULL, 0, &own, NULL); in parse_struct()
557 char **str, struct arg_type_info **retp, int *ownp) in parse_string() argument
563 if (isdigit(CTYPE_CONV(**str))) { in parse_string()
567 if (parse_int(loc, str, &l) < 0 in parse_string()
589 eat_spaces(str); in parse_string()
590 if (**str == '[') { in parse_string()
591 (*str)++; in parse_string()
592 eat_spaces(str); in parse_string()
594 length = parse_argnum(loc, str, &own_length, 1); in parse_string()
598 eat_spaces(str); in parse_string()
599 parse_char(loc, str, ']'); in parse_string()
601 } else if (**str == '(') { in parse_string()
603 ++*str; in parse_string()
605 eat_spaces(str); in parse_string()
606 info = parse_type(plib, loc, str, NULL, 0, ownp, NULL); in parse_string()
613 eat_spaces(str); in parse_string()
614 parse_char(loc, str, ')'); in parse_string()
695 try_parse_kwd(char **str, const char *kwd) in try_parse_kwd() argument
698 if (strncmp(*str, kwd, len) == 0 in try_parse_kwd()
699 && !isalnum(CTYPE_CONV((*str)[len])) in try_parse_kwd()
700 && (*str)[len] != '_') { in try_parse_kwd()
701 (*str) += len; in try_parse_kwd()
713 char **str, struct arg_type_info **retp, int *ownp, in parse_alias() argument
721 if (strncmp(*str, "string", 6) == 0) { in parse_alias()
722 (*str) += 6; in parse_alias()
723 return parse_string(plib, loc, str, retp, ownp); in parse_alias()
725 } else if (try_parse_kwd(str, "format") >= 0 in parse_alias()
731 if (parse_string(plib, loc, str, retp, ownp) < 0) in parse_alias()
736 } else if (try_parse_kwd(str, "enum") >=0) { in parse_alias()
738 return parse_enum(plib, loc, str, retp, ownp); in parse_alias()
749 char **str, struct arg_type_info *info) in parse_array() argument
751 eat_spaces(str); in parse_array()
752 if (parse_char(loc, str, '(') < 0) in parse_array()
755 eat_spaces(str); in parse_array()
758 = parse_lens(plib, loc, str, NULL, 0, &own, NULL); in parse_array()
762 eat_spaces(str); in parse_array()
763 parse_char(loc, str, ','); in parse_array()
765 eat_spaces(str); in parse_array()
767 struct expr_node *length = parse_argnum(loc, str, &own_length, 0); in parse_array()
778 eat_spaces(str); in parse_array()
779 parse_char(loc, str, ')'); in parse_array()
788 parse_enum(struct protolib *plib, struct locus *loc, char **str, in parse_enum() argument
792 eat_spaces(str); in parse_enum()
793 if (**str == '[') { in parse_enum()
794 parse_char(loc, str, '['); in parse_enum()
795 eat_spaces(str); in parse_enum()
796 *retp = parse_nonpointer_type(plib, loc, str, NULL, 0, ownp, 0); in parse_enum()
813 eat_spaces(str); in parse_enum()
814 if (parse_char(loc, str, ']') < 0) in parse_enum()
826 eat_spaces(str); in parse_enum()
827 if (parse_char(loc, str, '(') < 0) in parse_enum()
843 eat_spaces(str); in parse_enum()
844 if (**str == 0 || **str == ')') { in parse_enum()
845 parse_char(loc, str, ')'); in parse_enum()
853 parse_char(loc, str, ','); in parse_enum()
855 eat_spaces(str); in parse_enum()
856 char *key = parse_ident(loc, str); in parse_enum()
863 if (**str == '=') { in parse_enum()
864 ++*str; in parse_enum()
865 eat_spaces(str); in parse_enum()
866 if (parse_int(loc, str, &last_val) < 0) in parse_enum()
887 char **str, struct param **extra_param, size_t param_num, in parse_nonpointer_type() argument
890 const char *orig_str = *str; in parse_nonpointer_type()
892 if (parse_arg_type(str, &type) < 0) { in parse_nonpointer_type()
894 if (parse_alias(plib, loc, str, &type, in parse_nonpointer_type()
901 if ((type = parse_typedef_name(plib, str)) == NULL) in parse_nonpointer_type()
942 if (parse_array(plib, loc, str, info) < 0) { in parse_nonpointer_type()
949 if (parse_struct(plib, loc, str, info, forwardp) < 0) in parse_nonpointer_type()
970 name2lens(char **str, int *own_lensp) in name2lens() argument
974 if (try_parse_kwd(str, lenses[i].name) == 0) { in name2lens()
983 parse_type(struct protolib *plib, struct locus *loc, char **str, in parse_type() argument
988 = parse_nonpointer_type(plib, loc, str, extra_param, in parse_type()
994 eat_spaces(str); in parse_type()
995 if (**str == '*') { in parse_type()
1008 (*str)++; in parse_type()
1018 char **str, struct param **extra_param, in parse_lens() argument
1022 struct lens *lens = name2lens(str, &own_lens); in parse_lens()
1026 eat_spaces(str); in parse_lens()
1030 if (lens == &octal_lens && **str != '(') { in parse_lens()
1034 } else if (parse_char(loc, str, '(') < 0) { in parse_lens()
1042 eat_spaces(str); in parse_lens()
1043 info = parse_type(plib, loc, str, extra_param, param_num, in parse_lens()
1054 eat_spaces(str); in parse_lens()
1055 parse_char(loc, str, ')'); in parse_lens()
1112 char *str = buf; in process_line() local
1116 eat_spaces(&str); in process_line()
1119 if (*str == ';' || *str == 0 || *str == '\n' || *str == '#') in process_line()
1122 if (strncmp(str, "typedef", 7) == 0) { in process_line()
1123 parse_typedef(plib, loc, &str); in process_line()
1133 fun.return_info = parse_lens(plib, loc, &str, NULL, 0, &own, NULL); in process_line()
1150 eat_spaces(&str); in process_line()
1151 tmp = start_of_arg_sig(str); in process_line()
1158 proto_name = strdup(str); in process_line()
1166 str = tmp + 1; in process_line()
1172 eat_spaces(&str); in process_line()
1173 if (*str == ')') in process_line()
1176 if (str[0] == '+') { in process_line()
1184 str++; in process_line()
1190 = parse_lens(plib, loc, &str, &extra_param, in process_line()
1203 eat_spaces(&str); in process_line()
1204 if (*str == ',') { in process_line()
1205 str++; in process_line()
1207 } else if (*str == ')') { in process_line()
1210 if (str[strlen(str) - 1] == '\n') in process_line()
1211 str[strlen(str) - 1] = '\0'; in process_line()
1213 "syntax error around \"%s\"", str); in process_line()