File: [local] / OpenXM / src / ox_toolkit / print.c (download)
Revision 1.1, Tue Oct 10 05:23:21 2000 UTC (23 years, 11 months ago) by ohara
Branch: MAIN
CVS Tags: maekawa-ipv6
ox_toolkit is up to date.
0. OXFILE is introduced.
1. we support new method of ox connection.
2. we support exchaging byte order.
(in possible, we choose a byte order of machine integer).
3. cmo_list is rewritten.
4. we support a mathcap database.
etc.
Sorry, I forgot many changes.
|
/* -*- mode: C; coding: euc-japan -*- */
/* $OpenXM: OpenXM/src/ox_toolkit/print.c,v 1.1 2000/10/10 05:23:21 ohara Exp $ */
/*
Functions in this module print a given CMO to console.
These functions are used for debugging.
*/
#include <stdio.h>
#include <stdlib.h>
#include "ox_toolkit.h"
#include "parse.h"
static void print_cmo_int32(cmo_int32* c);
static void print_cmo_list(cmo_list* li);
static void print_cmo_mathcap(cmo_mathcap* c);
static void print_cmo_string(cmo_string* c);
void print_cmo(cmo* c)
{
int tag = c->tag;
symbol_t symp = lookup_by_tag(tag);
if (symp != NULL) {
fprintf(stderr, "(%s", symp->key);
}else {
fprintf(stderr, "(%d", tag);
}
switch(tag) {
case CMO_LIST:
print_cmo_list((cmo_list *)c);
break;
case CMO_INT32:
print_cmo_int32((cmo_int32 *)c);
break;
case CMO_MATHCAP:
case CMO_INDETERMINATE:
case CMO_RING_BY_NAME:
case CMO_ERROR2:
print_cmo_mathcap((cmo_mathcap *)c);
break;
case CMO_STRING:
print_cmo_string((cmo_string *)c);
break;
case CMO_NULL:
case CMO_ZERO:
case CMO_DMS_GENERIC:
fprintf(stderr, ")");
break;
default:
fprintf(stderr, "print_cmo() does not know how to print.\n");
}
}
static void print_cmo_int32(cmo_int32* c)
{
fprintf(stderr, ", %d)", c->i);
}
static void print_cmo_list(cmo_list* this)
{
cell* cp = list_first(this);
while(!list_endof(this, cp)) {
fprintf(stderr, ", ");
print_cmo(cp->cmo);
cp=list_next(cp);
}
fprintf(stderr, ")");
}
static void print_cmo_mathcap(cmo_mathcap* c)
{
fprintf(stderr, ", ");
print_cmo(c->ob);
fprintf(stderr, ")");
}
static void print_cmo_string(cmo_string* c)
{
fprintf(stderr, ", \"%s\")", c->s);
}