Example #1
0
File: text.c Project: Thermi/pev
static void to_format(
	const format_t *format,
	const output_type_e type,
	const output_scope_t *scope,
	const char *key,
	const char *value)
{
	static int indent = 0;

	char * const escaped_key = format->escape_fn(format, key);
	char * const escaped_value = format->escape_fn(format, value);

	switch (type) {
		default:
			break;
		case OUTPUT_TYPE_SCOPE_OPEN:
			switch (scope->type) {
				default:
					break;
				case OUTPUT_SCOPE_TYPE_DOCUMENT:
					break;
				case OUTPUT_SCOPE_TYPE_OBJECT:
					if (key) {
						printf(INDENT(indent++, "%s\n"), escaped_key);
					} else {
						indent++;
					}
					break;
				case OUTPUT_SCOPE_TYPE_ARRAY:
					//putchar('\n');
					if (key) {
						printf(INDENT(indent++, "%s\n"), escaped_key);
					} else {
						indent++;
					}
					break;
			}
			break;
		case OUTPUT_TYPE_SCOPE_CLOSE:
			indent--;
			break;
		case OUTPUT_TYPE_ATTRIBUTE:
		{
			const size_t key_size = key ? strlen(key) : 0;
			if (key && value) {
				printf(INDENT(indent, "%s:%*c%s\n"), escaped_key, (int)(SPACES - key_size), ' ', escaped_value);
			} else if (key) {
				printf(INDENT(indent, "%s\n"), escaped_key);
			} else if (value) {
				printf(INDENT(indent, "%*c%s\n"), (int)(SPACES - key_size + 1), ' ', escaped_value);
			}
			break;
		}
	}

	if (escaped_key != NULL)
		free(escaped_key);
	if (escaped_value != NULL)
		free(escaped_value);
}
Example #2
0
static void PrintObject(JSObject* obj, int depth, ObjectPile* pile)
{
    PrintObjectBasics(obj);

    switch(pile->Visit(obj))
    {
    case ObjectPile::primary:
        puts("");
        break;
    case ObjectPile::seen:
        puts(" (SEE ABOVE)");
        return;
    case ObjectPile::overflow:
        puts(" (TOO MANY OBJECTS)");
        return;
    }

    if(!OBJ_IS_NATIVE(obj))
        return;

    JSObject* parent = (JSObject*)(obj->slots[JSSLOT_PARENT]);
    JSObject* proto  = (JSObject*)(obj->slots[JSSLOT_PROTO]);

    printf("%*sparent: ", INDENT(depth+1));
    if(parent)
        PrintObject(parent, depth+1, pile);
    else
        puts("null");
    printf("%*sproto: ", INDENT(depth+1));
    if(proto)
        PrintObject(proto, depth+1, pile);
    else
        puts("null");
}
Example #3
0
void showItem(CSEM_Item *item, int depth) {
    if(item) {
        int j = 0;
        CSEM_Url *itemidURL = CSEM_Item_GetId(item);
        CSEM_List *types = CSEM_Item_GetTypes(item);
        CSEM_List *refs = CSEM_Item_GetRefs(item);
        CSEM_List *properties = CSEM_Item_GetProperties(item);

        INDENT(depth);puts("ITEM {");
        if(itemidURL) {
            char *itemid = NULL;
            CSEM_URL_Serialize(itemidURL, &itemid);
            INDENT(depth);printf("@itemid=%s\n", itemid);
            free(itemid);
        }
        for(j = 0; types && j < CSEM_List_Size(types); j++) {
            INDENT(depth);printf("@itemtype=%s\n", (char *)CSEM_List_Get(types, j));
        }
        for(j = 0; refs && j < CSEM_List_Size(refs); j++) {
            INDENT(depth);printf("@itemref=%s\n", (char *)CSEM_List_Get(refs, j));
        }
        showProperties(properties, depth);
        INDENT(depth);puts("}");
    }
}
Example #4
0
void print(json_value *value, int indent = 0)
{
	INDENT(indent);
	if (value->name) printf("\"%s\" = ", value->name);
	switch(value->type)
	{
	case JSON_NULL:
		printf("null\n");
		break;
	case JSON_OBJECT:
	case JSON_ARRAY:
		printf(value->type == JSON_OBJECT ? "{\n" : "[\n");
		for (json_value *it = value->first_child; it; it = it->next_sibling)
		{
			print(it, indent + 1);
		}
		INDENT(indent);
		printf(value->type == JSON_OBJECT ? "}\n" : "]\n");
		break;
	case JSON_STRING:
		printf("\"%s\"\n", value->string_value);
		break;
	case JSON_INT:
		printf("%d\n", value->int_value);
		break;
	case JSON_FLOAT:
		printf("%f\n", value->float_value);
		break;
	case JSON_BOOL:
		printf(value->int_value ? "true\n" : "false\n");
		break;
	}
}
Example #5
0
static int
printAttribute(D4printer* out, NCD4node* attr, int depth)
{
    int ret = NC_NOERR;
    int i = 0;
    char* fqn = NULL;

    INDENT(depth); CAT("<Attribute");
    printXMLAttributeName(out,"name",attr->name);
    if(attr->basetype->subsort <=  NC_MAX_ATOMIC_TYPE)
	printXMLAttributeName(out,"type",attr->basetype->name);
    else {
	printXMLAttributeName(out,"type",(fqn = NCD4_makeFQN(attr->basetype)));
    }
    CAT(">\n");
    depth++;
    for(i=0;i<nclistlength(attr->attr.values);i++) {
	printValue(out,(const char*)nclistget(attr->attr.values,i),depth);
	CAT("\n");
    }
    depth--;
    INDENT(depth);
    CAT("</Attribute>");

    nullfree(fqn);
    return THROW(ret);
}
Example #6
0
static CSEM_Error showProperty(CSEM_Property *property, int depth) {
    CSEM_Error error = CSEM_ERROR_NONE;
    if(property) {
        int i = 0;
        CSEM_List *names = CSEM_Property_GetNames(property);
        CSEM_List *values = NULL, *types = NULL;
        if((error = CSEM_Property_GetValues(property, &values, &types))) {
            goto FINISH;
        }
        for(i = 0; names && i < CSEM_List_Size(names); i++) {
            INDENT(depth);printf("@property=%s\n", (char *)CSEM_List_Get(names, i));
        }
        for(i = 0; values && i < CSEM_List_Size(values); i++) {
            int *type = CSEM_List_Get(types, i);

            if(*type == CSEM_VALUE_TYPE_STR || *type == CSEM_VALUE_TYPE_URL) {
                INDENT(depth);printf("\"%s\"\n", (char *)CSEM_List_Get(values, i));
            } else if(*type == CSEM_VALUE_TYPE_ITEM) {
                CSEM_Item *item = CSEM_List_Get(values, i);
                showItem(item, depth + 1);
            } else if(*type == CSEM_VALUE_TYPE_PROPERTY) {
                CSEM_Property *property = CSEM_List_Get(values, i);
                showProperty(property, depth + 1);
            }
        }
    }
FINISH:
    return error;
}
Example #7
0
/*! \fn printStatus
 *
 *  \param [in]  [solverData]
 *  \param [in]  [nfunc_evals]
 *  \param [in]  [xerror]
 *  \param [in]  [xerror_scaled]
 *  \param [in]  [logLevel]
 *
 *  \author wbraun
 */
static void printStatus(DATA_HYBRD *solverData, const int *nfunc_evals, const double *xerror, const double *xerror_scaled, const int logLevel)
{
  int i;

  INFO(logLevel, "nls status");
  INDENT(logLevel);

  INFO(logLevel, "variables");
  INDENT(logLevel);
  for(i=0; i<solverData->n; i++)
    INFO3(logLevel, "x[%d] = %.20e [scaling factor = %16e]", i, solverData->x[i], solverData->diag[i]);
  RELEASE(logLevel);

  INFO(logLevel, "functions");
  INDENT(logLevel);
  for(i=0; i<solverData->n; i++)
    INFO3(logLevel, "res[%d] = %.20e [scaling factor = %16e]", i, solverData->fvec[i], solverData->resScaling[i]);
  RELEASE(logLevel);

  INFO(logLevel, "statistics");
  INDENT(logLevel);
  INFO3(logLevel, "nfunc = %d\nerror = %.20e\nerror_scaled = %.20e", *nfunc_evals, *xerror, *xerror_scaled);
  RELEASE(logLevel);

  RELEASE(logLevel);
}
Example #8
0
static void PrintObject(JSObject* obj, int depth, ObjectPile* pile)
{
    PrintObjectBasics(obj);

    switch(pile->Visit(obj))
    {
    case ObjectPile::primary:
        puts("");
        break;
    case ObjectPile::seen:
        puts(" (SEE ABOVE)");
        return;
    case ObjectPile::overflow:
        puts(" (TOO MANY OBJECTS)");
        return;
    }

    if(!JS_IsNative(obj))
        return;

    JSObject* parent = js::GetObjectParent(obj);
    JSObject* proto  = js::GetObjectProto(obj);

    printf("%*sparent: ", INDENT(depth+1));
    if(parent)
        PrintObject(parent, depth+1, pile);
    else
        puts("null");
    printf("%*sproto: ", INDENT(depth+1));
    if(proto)
        PrintObject(proto, depth+1, pile);
    else
        puts("null");
}
Example #9
0
static int
printVariable(D4printer* out, NCD4node* var, int depth)
{
    int ret = NC_NOERR;
    NCD4node* basetype = var->basetype;
    char* fqn = NULL;

    INDENT(depth); CAT("<");
    switch (var->subsort) {
    default:
	CAT(basetype->name);
	printXMLAttributeName(out, "name", var->name);
	break;
    case NC_ENUM:
	CAT("Enum");
	printXMLAttributeName(out, "name", var->name);
	printXMLAttributeName(out, "enum", (fqn=NCD4_makeFQN(basetype)));
	break;
    case NC_OPAQUE:
	CAT("Opaque");
	printXMLAttributeName(out, "name", var->name);
	printXMLAttributeName(out, "type", (fqn=NCD4_makeFQN(basetype)));
	break;
    case NC_SEQ:
	CAT("Seq");
	printXMLAttributeName(out, "name", var->name);
	printXMLAttributeName(out, "type", (fqn=NCD4_makeFQN(basetype)));
	break;
    case NC_STRUCT:
	CAT("Struct");
	printXMLAttributeName(out, "name", var->name);
	printXMLAttributeName(out, "type", (fqn=NCD4_makeFQN(basetype)));
	break;
    }
    if(hasMetaData(var)) {
	CAT(">\n");
	depth++;
	if((ret=printMetaData(out,var,depth))) goto done;
	depth--;
	INDENT(depth); CAT("</");
	if(basetype->subsort == NC_ENUM)
	    CAT("Enum");
	else if(basetype->subsort == NC_OPAQUE)
	    CAT("Opaque");
	else if(basetype->subsort == NC_STRUCT)
	    CAT("Struct");
	else if(basetype->subsort == NC_SEQ)
	    CAT("Sequence");
	else
	    CAT(basetype->name);
	CAT(">");
    } else
	CAT("/>");
done:
    nullfree(fqn);
    return THROW(ret);
}
Example #10
0
void
zt_opts_usage(char *argv[], struct zt_opt_args *opts, char *option_string, int max_opts, int show_defaults)
{
    int i = 0;

    fprintf(stderr, "usage: %s %s" NL, basename(argv[0]), option_string);

    if (max_opts > 0) {
        fprintf(stderr, NL "Options:" NL);
    }

    for (i = 0; i < max_opts; i++) {
        int offt = 0;
        if (opts[i].description != NULL) {
            if (isoptchar(opts[i].opt)) {
                offt = fprintf(stderr, BLANK "-%c", INDENT(1), opts[i].opt);
            }
#ifdef HAVE_GETOPT_LONG
            if (opts[i].long_opt) {
                if (isoptchar(opts[i].opt)) {
                    offt += fprintf(stderr, ", --%s", opts[i].long_opt);
                } else {
                    offt += fprintf(stderr, BLANK "    --%s", INDENT(1), opts[i].long_opt);
                }
            }
#endif /* ifdef HAVE_GETOPT_LONG */
            offt += fprintf(stderr, BLANK "%s", INDENT_TO(30, 5, offt), opts[i].description ? opts[i].description : "");

            if (show_defaults) {
                print_default(opts[i].type, opts[i].val);
            }

            if (opts[i].usage) {
                fprintf(stderr, BLANK ": %s" NL, INDENT(1), opts[i].usage);
            } else
            if (zt_opts_usage_t[opts[i].type].desc) {
                if (isoptchar(opts[i].opt)) {
                    fprintf(stderr,
                            BLANK ": eg. -%c %s" NL,
                            INDENT(1),
                            opts[i].opt,
                            zt_opts_usage_t[opts[i].type].desc ? zt_opts_usage_t[opts[i].type].desc : "");
                } else {
                    fprintf(stderr,
                            BLANK ": eg. --%s %s" NL,
                            INDENT(1),
                            opts[i].long_opt,
                            zt_opts_usage_t[opts[i].type].desc ? zt_opts_usage_t[opts[i].type].desc : "");
                }
            } else {
                fprintf(stderr, NL);
            }
        }
    }
} /* zt_opts_usage */
Example #11
0
void
DocumentLS_save(FILE *fd, const DOM_Node *node, int indent)
{
	NodeEntry *e;
	DOM_Node *c;

    if (fd == NULL || node == NULL) {
		return;
    }

    switch (node->nodeType) {
        case DOM_ELEMENT_NODE:
            fprintf(fd, "%s<%s", INDENT(indent), node->nodeName);
			for (e = node->attributes->first; e != NULL; e = e->next) {
				fprintf(fd, " %s=\"%s\"", e->node->nodeName, e->node->nodeValue);
			}
			if (DOM_Node_hasChildNodes(node)) {
				fprintf(fd, ">\n");
				for (c = node->firstChild; c != NULL; c = c->nextSibling) {
					DocumentLS_save(fd, c, indent + 1);
            	}
            	fprintf(fd, "%s</%s>\n", INDENT(indent), node->nodeName);
			} else {
				fprintf(fd, "/>\n");
			}
            break;
        case DOM_ATTRIBUTE_NODE:
            break;
        case DOM_TEXT_NODE:
            fprintf(fd, "%s\n", node->nodeValue);
            break;
        case DOM_CDATA_SECTION_NODE:
            break;
        case DOM_ENTITY_REFERENCE_NODE:
            break;
        case DOM_ENTITY_NODE:
            break;
        case DOM_PROCESSING_INSTRUCTION_NODE:
            break;
        case DOM_COMMENT_NODE:
			fprintf(fd, "%s<!--%s-->\n", INDENT(indent), node->nodeValue);
            break;
        case DOM_DOCUMENT_NODE:
            DocumentLS_save(fd, node->u.Document.documentElement, 0);
            break;
        case DOM_DOCUMENT_TYPE_NODE:
            break;
        case DOM_DOCUMENT_FRAGMENT_NODE:
            break;
        case DOM_NOTATION_NODE:
            break;
    }
}
Example #12
0
void showId(CSEM_Id *id, int depth) {
    if(id) {
        char *id_value = CSEM_Id_GetId(id);
        CSEM_List *properties = CSEM_Id_GetProperties(id);

        INDENT(depth);puts("ID {");
        if(id_value) {
            INDENT(depth);printf("@id=%s\n", id_value);
        }
        showProperties(properties, depth);
        INDENT(depth);puts("}");
    }
}
Example #13
0
static int
printGroup(D4printer* out, NCD4node* node, int depth)
{
    int ret = NC_NOERR;
    INDENT(depth);
    CAT("<Group");
    printXMLAttributeName(out,"name",node->name);
    CAT(">\n");
    depth++;
    ret = printGroupBody(out,node,depth);
    depth--;
    INDENT(depth);
    CAT("</Group>");
    return THROW(ret);	   
}	
Example #14
0
/* UDP port pair リスト各パケットを表示。*/
int
view_pair()
{ 
    struct udp_port_pair_t *pair;
    struct udp_stream_t *udp_streams;
    struct udp_stream_t *udp_streams_check;
    double udp_stream_init_time; /* UDP port pair 毎の開始時間*/
    double receive_time; /* 個々の packet の到着時間 */
    double previous_time = 0; /* 一つ前の packet の到着時間 */
    

        /* pair_head は空なので、次から・・*/
    pair = pair_head->pair_next ;
    if(pair == NULL )
        return(0);


    printf("\n====================================\n");
    printf("        Check each UDP port pair                \n");
    printf("====================================\n");
    for( ; pair != NULL ; pair = pair->pair_next) {
        printf("\n====================================\n");
        printf("Number of packets  : %d\n\n", pair->pair_count);
        printf("Addr 0: %s : Port: %d",inet_ntoa(pair->addr0), pair->port0);
        printf("\t\t\t\t\t");
        printf("Addr 1: %s : Port: %d",inet_ntoa(pair->addr1), pair->port1);        
        printf("---------------------------------------------------------------");
        printf("----------------------------------------------------------------\n");
        udp_stream_init_time = TIMEVAL_TO_SEC(pair->udp_stream->plist->php->pktime);
        previous_time = udp_stream_init_time;

            /* 以下 個々の packet の処理 */
        for(udp_streams = pair->udp_stream ; udp_streams != NULL ; udp_streams = udp_streams->udp_stream_next ){

            receive_time = TIMEVAL_TO_SEC(udp_streams->plist->php->pktime);

            INDENT(udp_streams);
            
                /* 以下 summary 表示部 */
            printf("%d: ",udp_streams->plist->packet_number);
            printf("%5.3f ",receive_time - previous_time);
            printf(" IPID: %u",ntohs(udp_streams->ip->ip_id));
            printf(" Len:%4d", UDPLEN(udp_streams));
            printf("  ");
            printf(" Flag: 0x%x",ntohs(udp_streams->ip->ip_off));
            printf(" Offset: %u",((ntohs(udp_streams->ip->ip_off)) & (8191))<<3);
            if (ntohs(udp_streams->ip->ip_off) & IP_MF)
                printf(" MF");
            if (ntohs(udp_streams->ip->ip_off) & IP_DF)
                printf(" DF");                                

            previous_time = receive_time ;
            printf("\n");
            
            if(!(optflag & DIAG))
                continue;
				
        } /* loop for udp_stream end */
    } /* loop for UDP port pair list end */
}
Example #15
0
SDB_API char *sdb_json_indent(const char *s) {
	int indent = 0;
	int i, instr = 0;
	char *o, *O = malloc (strlen (s)*2);
	for (o=O; *s; s++) {
		if (instr) {
			if (s[0] == '"') instr = 0;
			else if (s[0] == '\\' && s[1] == '"')
				*o++ = *s;
			*o++ = *s;
			continue;
		} else {
			if (s[0] == '"')
				instr = 1;
		}
		if (*s == '\n'|| *s == '\r' || *s == '\t' || *s == ' ')
			continue;
		#define INDENT(x) indent+=x; for (i=0;i<indent;i++) *o++ = '\t'
		switch (*s) {
                case ':':
                        *o++ = *s;
                        *o++ = ' ';
                        break;
                case ',':
                        *o++ = *s;
                        *o++ = '\n';
                        INDENT (0);
                        break;
                case '{':
                case '[':
			*o++ = *s;
			*o++ = (indent!=-1)?'\n':' ';
                        INDENT (1);
                        break;
                case '}':
                case ']':
                        *o++ = '\n';
                        INDENT (-1);
                        *o++ = *s;
                        break;
		default:
			*o++ = *s;
		}
	}
	*o = 0;
	return O;
}
Example #16
0
void bt_print (BTree* a, int indent)
{
  int i;
  if (isleaf(a)) {
    for (i = a->n - 1; i >= 0; --i) {
      INDENT(indent);
      printf( "%d \n" , a->k[i]);
    }
  }
  else {
    bt_print(a->p[a->n],indent+2);
    for (i = a->n - 1; i>=0; --i) {
      INDENT(indent);
      printf("%d \n" , a->k[i] ) ;
      bt_print(a->p[i],indent+2);
    }
  }
}
Example #17
0
static int
printValue(D4printer* out, const char* value, int depth)
{
    int ret = NC_NOERR;
    INDENT(depth);
    CAT("<Value");
    printXMLAttributeString(out,"value",value);
    CAT("/>");
    return THROW(ret);
}
Example #18
0
void
display_context( dcl_context* p, char* label, int oneline )
{
	int nt = ntok;
	if ( label && *label ) fprintf(stderr,"%s: ",label);
	fprintf(stderr,"dcl_context %d {\n",p);
	++indent; INDENT(indent);
	fprintf(stderr,"cot:"); display_type(p->cot);
	fprintf(stderr,"\n");
	display_expr(p->not,"not",oneline);
	INDENT(indent); putstring("tot:"); display_type(p->tot);
	fprintf(stderr,"\n");
	display_expr(p->nof,"nof",oneline);
	display_expr(p->c_this,"c_this",oneline);
	INDENT(indent); fprintf(stderr,"ftbl %d\n",p->ftbl);
	--indent;
	fprintf(stderr,"}\n");
	fflush(stderr);
}
Example #19
0
/*! \fn printVector
 *
 *  \param [in]  [vector]
 *  \param [in]  [size]
 *  \param [in]  [logLevel]
 *  \param [in]  [name]
 *
 *  \author wbraun
 */
static void printVector(const double *vector, integer *size, const int logLevel, const char *name)
{
  int i;

  INFO1(logLevel, "%s", name);
  INDENT(logLevel);
  for(i=0; i<*size; i++)
    INFO2(logLevel, "[%d] %10g", i, vector[i]);
  RELEASE(logLevel);
}
Example #20
0
_PUBLIC_ void ocpf_dump_named_property(uint32_t context_id)
{
	struct ocpf_context	*ctx;
	struct ocpf_nproperty	*element;

	ctx = ocpf_context_search_by_context_id(ocpf->context, context_id);
	if (!ctx) return;

	OCPF_DUMP_TITLE(indent, "NAMED PROPERTIES", OCPF_DUMP_TOPLEVEL);
	indent++;

	OCPF_DUMP_TITLE(indent, "OOM", OCPF_DUMP_SUBLEVEL);
	indent++;
	for (element = ctx->nprops; element->next; element = element->next) {
		if (element->kind == OCPF_OOM) {
			INDENT();
			printf("* %s\n", element->OOM);
		}
	}
	indent--;

	OCPF_DUMP_TITLE(indent, "MNID_ID", OCPF_DUMP_SUBLEVEL);
	indent++;
	for (element = ctx->nprops; element->next; element = element->next) {
		if (element->kind == OCPF_MNID_ID) {
			INDENT();
			printf("* 0x%.4x\n", element->mnid_id);
		}
	}
	indent--;

	OCPF_DUMP_TITLE(indent, "MNID_STRING", OCPF_DUMP_SUBLEVEL);
	indent++;
	for (element = ctx->nprops; element->next; element = element->next) {
		if (element->kind == OCPF_MNID_STRING) {
			INDENT();
			printf("* %s\n", element->mnid_string);
		}
	}
	indent--;

	indent--;
}
Example #21
0
static int
printMap(D4printer* out, NCD4node* mapref, int depth)
{
    char* fqn = NULL;
    INDENT(depth);
    CAT("<Map");
    printXMLAttributeName(out, "name", (fqn=NCD4_makeFQN(mapref)));
    CAT("/>");
    nullfree(fqn);
    return THROW(NC_NOERR);
}
Example #22
0
static void showItem(CSEM_Item *item, int depth) {
    if(item) {
        int j = 0;
        CSEM_Url *resourceURL = CSEM_Item_GetId(item);
        CSEM_List *types = CSEM_Item_GetTypes(item);
        CSEM_List *properties = CSEM_Item_GetProperties(item);

        INDENT(depth);puts("ITEM {");
        if(resourceURL) {
            char *resource = NULL;
            CSEM_URL_Serialize(resourceURL, &resource);
            INDENT(depth);printf("@resource=%s\n", resource);
            free(resource);
        }
        for(j = 0; types && j < CSEM_List_Size(types); j++) {
            INDENT(depth);printf("@typeof=%s\n", (char *)CSEM_List_Get(types, j));
        }
        showProperties(properties, depth);
        INDENT(depth);puts("}");
    }
}
Example #23
0
static int
printDataset(D4printer* out, NCD4node* node, int depth)
{
    int ret = NC_NOERR;
    CAT("<Dataset\n");
    depth++;
    INDENT(depth);
    printXMLAttributeName(out,"name",node->group.datasetname);
    CAT("\n");
    INDENT(depth);
    printXMLAttributeName(out,"dapVersion",node->group.dapversion);
    CAT("\n");
    INDENT(depth);
    printXMLAttributeName(out,"dmrVersion",node->group.dmrversion);
    CAT("\n");
    INDENT(depth);
    printXMLAttributeName(out,"xmlns","http://xml.opendap.org/ns/DAP/4.0#");
    CAT("\n");
    INDENT(depth);
    printXMLAttributeName(out,"xmlns:dap","http://xml.opendap.org/ns/DAP/4.0#");
    depth--;
    CAT(">\n");
    depth++;
    ret = printGroupBody(out,node,depth);
    depth--;
    INDENT(depth);
    CAT("</Dataset>");
    return THROW(ret);	   
}
Example #24
0
/* internal public functions ================================================ */
static void dom_print (GMarkupDomNode *root)
{
#define INDENT(niv) \
  do                                \
  {                                 \
    gint i;                         \
                                    \
    for (i = 0; i < (niv) - 1; i++) \
    {                               \
      g_print ("\t");               \
    }                               \
  } while (0)

  if (root != NULL)
  {
    INDENT (root->level);
    g_print ("<%s", root->name);
    {
      gint i = 0;

      while (root->attributs[i].name != NULL)
      {
        g_print (" %s=\"%s\"", root->attributs[i].name,
                               root->attributs[i].value);
        i++;
      }
    }
    g_print (">\n");
    if (root->content != NULL)
    {
      INDENT (root->level + 1);
      g_print ("%s\n", root->content);
    }
    dom_print (root->child);
    INDENT (root->level);
    g_print ("</%s>\n", root->name);
    dom_print (root->next);
  }
#undef INDENT
}
Example #25
0
/**
   \details Dump OCPF Type

   Dump OCPF Registered Type
*/
_PUBLIC_ void ocpf_dump_type(uint32_t context_id)
{
	struct ocpf_context	*ctx;

	ctx = ocpf_context_search_by_context_id(ocpf->context, context_id);
	if (!ctx) return;

	OCPF_DUMP_TITLE(indent, "TYPE", OCPF_DUMP_TOPLEVEL);
	indent++;
	
	INDENT();
	OCPF_DUMP(("* %s", ctx->type ? ctx->type : "Undefined"));
	indent--;
}
Example #26
0
/**
   \details Dump OCPF Destination Folder

   Dump OCPF Registered Destination Folder
 */
_PUBLIC_ void ocpf_dump_folder(uint32_t context_id)
{
	struct ocpf_context	*ctx;

	ctx = ocpf_context_search_by_context_id(ocpf->context, context_id);
	if (!ctx) return;

	OCPF_DUMP_TITLE(indent, "FOLDER", OCPF_DUMP_TOPLEVEL);
	indent++;

	INDENT();
	OCPF_DUMP(("* 0x%llx", ctx->folder ? ctx->folder : 0xFFFFFFFF));
	indent--;
}
Example #27
0
void VRML97_SceneClockWrite (VRMLData *dat, char *name, int loop, int enable, double duration, char *tag)
{
	fprintf(dat->vr->file,"%sDEF %s%s TimeSensor  {\n",dat->vr->indent,name,tag);
	INDENT(dat->vr);
	if(enable)
		fprintf(dat->vr->file,"%s startTime 0\n",dat->vr->indent);
	else // set with touch sensor's touchtime
		fprintf(dat->vr->file,"%s startTime -1 \n",dat->vr->indent);   
	if(loop)
		fprintf(dat->vr->file,"%s loop TRUE   stopTime 0\n",dat->vr->indent);
	else
		fprintf(dat->vr->file,"%s loop FALSE   stopTime 0\n",dat->vr->indent);// scn->startFrame/scn->fps);
	fprintf(dat->vr->file,"%s cycleInterval %.4f  \n",dat->vr->indent,duration);
	UNINDENT(dat->vr);
	fprintf(dat->vr->file,"%s}\n",dat->vr->indent);
}
Example #28
0
/**
   \details Dump OCPF OLEGUID

   Dump OCPF Registered OLEGUID
*/
_PUBLIC_ void ocpf_dump_oleguid(uint32_t context_id)
{
	struct ocpf_context	*ctx;
	struct ocpf_oleguid	*element;

	ctx = ocpf_context_search_by_context_id(ocpf->context, context_id);
	if (!ctx) return;

	OCPF_DUMP_TITLE(indent, "OLEGUID", OCPF_DUMP_TOPLEVEL);
	indent++;
	for (element = ctx->oleguid; element->next; element = element->next) {
		INDENT();
		printf("%-25s: %s\n", element->name, element->guid);
	}
	indent--;
}
Example #29
0
_PUBLIC_ void ocpf_dump_variable(uint32_t context_id)
{
	struct ocpf_context	*ctx;
	struct ocpf_var		*element;

	ctx = ocpf_context_search_by_context_id(ocpf->context, context_id);
	if (!ctx) return;

	OCPF_DUMP_TITLE(indent, "VARIABLE", OCPF_DUMP_TOPLEVEL);
	indent++;
	for (element = ctx->vars; element->next; element = element->next) {
		INDENT();
		printf("%s\n", element->name);
	}
	indent--;
}
Example #30
0
void
display_namelist( Plist nl, char* s, int verbose )
{
	error('d',"namelist:    %s",s?s:"");
	++indent;
	for ( Plist l = nl;  l;  l = l->l ) {
		Pname n = l->f;
		INDENT(indent);
		fprintf(stderr,"	%d",n);
		error('D'," %n %k n_key %d",n,n?n->tp->base:0,n?n->n_key:0);
		if ( verbose ) {
			++indent;
			display_expr(n);
			--indent;
		}
	}
	--indent;
}