/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#include <vclib.h>
/* Transpose a table of some given row length.
**
** Written by Binh Vo and Kiem-Phong Vo (04/24/2006)
*/
typedef struct _transflip_s
} Transflip_t;
typedef struct _transctxt_s
} Transctxt_t;
typedef struct _transpose_s
{ int type;
} Transpose_t;
/* arguments passable to vcopen() */
{
{ 0 , "Both transposed data and meta-data are coded.", (Void_t*)0 }
};
#if __STD_C
#else
int rsep;
#endif
{
int byte;
RETURN(-1);
/* count number of rows */
nrows += 1;
/* allocate space for row data */
RETURN(-1);
/* compute record starts and record sizes */
for(p = r = z = 0; z < dtsz; ++z)
p = z+1;
r += 1;
}
}
/* now flip records */
{ do
r = p;
}
else /* output one byte from this record */
r += 1;
}
} while(r < nrows);
}
return nrows;
}
#if __STD_C
#else
int rsep;
#endif
{
RETURN(-1);
/* count number of rows */
nrows += 1;
/* allocate space for row data */
RETURN(-1);
for(r = 0; r < nrows; ++r)
/* compute the size of each row */
for(r = z = 0; z < dtsz; )
r = p;
}
if(r < nrows)
z += 1;
}
r = 0;
}
/* allocate space for each record */
for(p = r = 0; r < nrows; ++r)
p += z; /* starting position for next record */
}
/* rebuild records */
for(r = z = 0; z < dtsz; )
r = p;
}
if(r < nrows)
z += 1;
}
if((r += 1) >= nrows)
r = 0;
}
return nrows;
}
#if __STD_C
#else
#endif
{
}
}
}
}
/* compute the # of columns from training data */
#if __STD_C
#else
#endif
{
return 1;
break;
}
#if 0 /* combining transpose and run-length-encoding - an optimization */
#if __STD_C
#else
#endif
{
RETURN(-1);
ch = -1; r = 0;
r += 1;
else
{ if(r > 0)
{ if(r < (1<<7) )
*run++ = r;
else if(r < (1<<14) )
*run++ = r&127;
}
else
}
}
else
if(r == 2)
}
}
}
}
if(r > 0)
}
else
if(r == 2)
}
}
RETURN(-1);
}
else
}
RETURN(-1);
if(out)
}
#endif
#if __STD_C
#else
#endif
{
return 0;
RETURN(-1);
RETURN(-1);
if(rsep >= 0)
ncols = 0;
nrows = 0;
if(rsep >= 0) /* var-length table */
break;
}
else
else
}
}
if(sz == 0)
return 0;
RETURN(-1);
if(rsep >= 0)
RETURN(-1);
}
RETURN(-1);
if(ncols <= 0)
z += 1;
if(ncols <= 0)
}
if(out)
return sz;
}
#if __STD_C
#else
#endif
{
if(size == 0)
return 0;
RETURN(-1);
RETURN(-1);
RETURN(-1);
if(ncols == 0)
}
else
if(rsep < 0)
}
RETURN(-1);
/* data to be untransposed */
RETURN(-1);
if(rsep < 0) /* fixed-length data */
RETURN(-1);
}
RETURN(-1);
if(rsep < 0)
RETURN(-1);
if(out)
return z;
}
#if __STD_C
#else
int type;
#endif
{
if(type == VC_OPENING)
RETURN(-1);
RETURN(-1);
}
goto vc_setarg;
}
else if(type == VC_CLOSING)
return 0;
}
else if(type == VC_SETMTARG)
{ vc_setarg:
RETURN(-1);
{ case TR_SEPARATOR: /* setting the record separator */
break;
case TR_COLUMNS: /* setting number of columns */
break;
case TR_PLAIN: /* setting transpose.0 */
default :
if(type == VC_OPENING)
break;
}
}
return 0;
}
else if(type == VC_INITCONTEXT)
{ if(!params)
return 0;
RETURN(-1);
return 1;
}
else if(type == VC_FREECONTEXT)
return 0;
}
else return 0;
}
{ transpose,
"transpose", "Transposing a table.",
"[-version?transpose (AT&T Research) 2003-01-01]" USAGE_LICENSE,
256*1024,
0
};