spif_str_t spif_url_show(spif_url_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { spif_char_t tmp[4096]; if (SPIF_URL_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(url, name, buff, indent, tmp); return buff; } memset(tmp, ' ', indent); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_url_t) %s: %10p {\n", name, (spif_ptr_t) self); if (SPIF_STR_ISNULL(buff)) { buff = spif_str_new_from_ptr(tmp); } else { spif_str_append_from_ptr(buff, tmp); } buff = spif_str_show(self->proto, SPIF_CHARPTR("proto"), buff, indent + 2); buff = spif_str_show(self->user, SPIF_CHARPTR("user"), buff, indent + 2); buff = spif_str_show(self->passwd, SPIF_CHARPTR("passwd"), buff, indent + 2); buff = spif_str_show(self->host, SPIF_CHARPTR("host"), buff, indent + 2); buff = spif_str_show(self->port, SPIF_CHARPTR("port"), buff, indent + 2); buff = spif_str_show(self->path, SPIF_CHARPTR("path"), buff, indent + 2); buff = spif_str_show(self->query, SPIF_CHARPTR("query"), buff, indent + 2); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "}\n"); spif_str_append_from_ptr(buff, tmp); return buff; }
spif_str_t spif_str_show(spif_str_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { spif_char_t tmp[4096]; if (SPIF_STR_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(str, name, buff, indent, tmp); return buff; } memset(tmp, ' ', indent); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_str_t) %s: %10p { \"", name, (spif_ptr_t) self); if (SPIF_STR_ISNULL(buff)) { buff = spif_str_new_from_ptr(tmp); } else { spif_str_append_from_ptr(buff, tmp); } spif_str_append(buff, self); snprintf((char *) tmp, sizeof(tmp), "\", len %lu, size %lu }\n", (unsigned long) self->len, (unsigned long) self->size); spif_str_append_from_ptr(buff, tmp); return buff; }
spif_str_t spif_socket_show(spif_socket_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { spif_char_t tmp[4096]; if (SPIF_SOCKET_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(socket, name, buff, indent, tmp); return buff; } memset(tmp, ' ', indent); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_socket_t) %s: %10p {\n", name, (spif_ptr_t) self); if (SPIF_STR_ISNULL(buff)) { buff = spif_str_new_from_ptr(tmp); } else { spif_str_append_from_ptr(buff, tmp); } indent += 2; memset(tmp, ' ', indent); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_sockfd_t) fd: %d\n", self->fd); spif_str_append_from_ptr(buff, tmp); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_sockfamily_t) fam: %d\n", (int) self->fam); spif_str_append_from_ptr(buff, tmp); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_socktype_t) type: %d\n", (int) self->type); spif_str_append_from_ptr(buff, tmp); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_sockproto_t) proto: %d\n", (int) self->proto); spif_str_append_from_ptr(buff, tmp); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_sockaddr_t) addr: %10p\n", (spif_ptr_t) self->addr); spif_str_append_from_ptr(buff, tmp); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_sockaddr_len_t) len: %lu\n", (unsigned long) self->len); spif_str_append_from_ptr(buff, tmp); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_uint32_t) flags: 0x%08x\n", (unsigned) self->flags); spif_str_append_from_ptr(buff, tmp); spif_url_show(self->local_url, SPIF_CHARPTR("local_url"), buff, indent); spif_url_show(self->remote_url, SPIF_CHARPTR("remote_url"), buff, indent); indent -= 2; snprintf((char *) tmp + indent, sizeof(tmp) - indent, "}\n"); spif_str_append_from_ptr(buff, tmp); return buff; }
spif_str_t spif_tok_show(spif_tok_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { spif_char_t tmp[4096]; if (SPIF_TOK_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(tok, name, buff, indent, tmp); return buff; } memset(tmp, ' ', indent); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_tok_t) %s: %10p {\n", name, (spif_ptr_t) self); if (SPIF_STR_ISNULL(buff)) { buff = spif_str_new_from_ptr(tmp); } else { spif_str_append_from_ptr(buff, tmp); } buff = spif_str_show(SPIF_STR(self->src), SPIF_CHARPTR("src"), buff, indent + 2); buff = spif_str_show(SPIF_STR(self->sep), SPIF_CHARPTR("sep"), buff, indent + 2); indent += 2; memset(tmp, ' ', indent); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_char_t) quote: '%c' (0x%02x)\n", (char) self->quote, (unsigned int) self->quote); spif_str_append_from_ptr(buff, tmp); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_char_t) dquote: '%c' (0x%02x)\n", (char) self->dquote, (unsigned int) self->dquote); spif_str_append_from_ptr(buff, tmp); snprintf((char *) tmp + indent, sizeof(tmp) - indent, "(spif_char_t) escape: '%c' (0x%02x)\n", (char) self->escape, (unsigned int) self->escape); spif_str_append_from_ptr(buff, tmp); SPIF_LIST_SHOW(self->tokens, buff, indent); indent -= 2; snprintf((char *) tmp + indent, sizeof(tmp) - indent, "}\n"); spif_str_append_from_ptr(buff, tmp); return buff; }
spif_str_t spif_eterm_action_show(spif_eterm_action_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { char tmp[4096]; if (SPIF_ETERM_ACTION_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(eterm_action, name, buff, indent, tmp); return buff; } memset(tmp, ' ', indent); snprintf(tmp + indent, sizeof(tmp) - indent, "(spif_eterm_action_t) %s: {\n", name); if (SPIF_STR_ISNULL(buff)) { buff = spif_str_new_from_ptr(tmp); } else { spif_str_append_from_ptr(buff, tmp); } snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_eterm_action_type_t) type: %d\n", self->type); spif_str_append_from_ptr(buff, tmp); snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_ushort_t) modifiers: %c%c%c%c\n", SHOW_MODS(self->modifiers)); spif_str_append_from_ptr(buff, tmp); snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_uchar_t) button: %d\n", self->button); spif_str_append_from_ptr(buff, tmp); snprintf(tmp + indent, sizeof(tmp) - indent, " (KeySym) keysym: %04x\n", (unsigned) self->keysym); spif_str_append_from_ptr(buff, tmp); snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_eterm_action_handler_t) handler: %10p\n", self->handler); spif_str_append_from_ptr(buff, tmp); snprintf(tmp + indent, sizeof(tmp) - indent, " (spif_eterm_action_parameter_t) parameter: %10p\n", self->parameter); spif_str_append_from_ptr(buff, tmp); snprintf(tmp + indent, sizeof(tmp) - indent, "}\n"); spif_str_append_from_ptr(buff, tmp); return buff; }