/* MAKEBIGIO.C - create a small bigimage and fill it with values */
#include <stdio.h>
#include <errno.h>
#include "bigio.h"
int main ( int argc, char **argv )
{
char mapname[132]; /* name of directory to hold bigimage */
int bd; /* bigimage descriptor */
int status; /* status */
short values[20]; /* values written to the bigimage */
int lane; /* lane number */
int row; /* row number */
int j; /* loop counter */
char errmsg[80]; /* error message */
/* Invent a row of pixel values */
for ( j=0; j<20; j++ )
{
values[j] = (short)j;
}
/* Extract the mapname, which is the name of the directory to hold the
bigimage */
if ( argc == 2 )
{
strcpy ( mapname, argv[1] );
/* Create the bigimage */
status = 0;
bigio_create ( mapname, 3, 20, 30, "I2S", &status );
if ( status != 0 )
{
printf ( "failed to create map\n" );
bigio_errtran ( 80, errmsg, &status );
printf ( "%s\n", errmsg );
}
else
{
/* Open the bigimage and write the invented data to it. Each row of
pixels in each lane is the same */
bigio_open ( mapname, "update", &bd, &status );
if ( status != 0 )
{
printf ( "failed to open map\n" );
bigio_errtran ( 80, errmsg, &status );
printf ( "%s\n", errmsg );
}
else
{
for ( lane=1; lane<=3; lane++ )
{
for ( row=1; row<=30; row++ )
{
bigio_putrow ( bd, lane, row, (char *)values, &status );
}
}
if ( status != 0 )
{
printf ( "failed to write map\n" );
bigio_errtran ( 80, errmsg, &status );
perror ( errmsg );
}
bigio_close ( bd, &status );
}
}
}
else
{
printf ( "makebigio: usage:- makebigio mapname\n" );
}
return 0;
}