if (!streq(name, old)) { if (streq(old, "string")) { old = "char"; rel = REL_POINTER; } else if (streq(old, "opaque")) { old = "char"; } else if (streq(old, "bool")) { old = "bool_t"; } if (undefined2(old, name) && def->def.ty.old_prefix) { s_print(prefix, "%s ", def->def.ty.old_prefix); } else { prefix[0] = 0; } f_print(fout, "typedef "); switch (rel) { case REL_ARRAY: f_print(fout, "struct {\n"); f_print(fout, "\tu_int %s_len;\n", name); f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name); f_print(fout, "} %s", name); break; case REL_POINTER: f_print(fout, "%s%s *%s", prefix, old, name); break; case REL_VECTOR: f_print(fout, "%s%s %s[%s]", prefix, old, name, def->def.ty.array_max); break; case REL_ALIAS: f_print(fout, "%s%s %s", prefix, old, name); break; } f_print(fout, ";\n");
if (!streq (name, old)) { if (streq (old, "string")) { old = "char"; rel = REL_POINTER;
ptypedef(definition *def){	const char *name = def->def_name;	const char *old = def->def.ty.old_type;	char prefix[8];	/* enough to contain "struct ", including NUL */	relation rel = def->def.ty.rel;	if (!streq(name, old)) {		if (streq(old, "string")) {			old = "char";			rel = REL_POINTER;		} else if (streq(old, "opaque")) {			old = "char";		} else if (streq(old, "bool")) {			old = "bool_t";		}		if (undefined2(old, name) && def->def.ty.old_prefix) {			s_print(prefix, "%s ", def->def.ty.old_prefix);		} else {			prefix[0] = 0;		}		f_print(fout, "typedef ");		switch (rel) {		case REL_ARRAY:			f_print(fout, "struct {\n");			f_print(fout, "\tu_int %s_len;\n", name);			f_print(fout, "\t%s%s *%s_val;\n", prefix, old, name);			f_print(fout, "} %s", name);			break;		case REL_POINTER:			f_print(fout, "%s%s *%s", prefix, old, name);			break;		case REL_VECTOR:			f_print(fout, "%s%s %s[%s]", prefix, old, name,				def->def.ty.array_max);			break;		case REL_ALIAS:			f_print(fout, "%s%s %s", prefix, old, name);			break;		}		f_print(fout, ";\n");	}}