|
reSIProcate/stack
9694
|
#include <stdlib.h>#include <stdio.h>#include <sys/types.h>#include <unistd.h>#include <fcntl.h>#include <ctype.h>#include <string>
Go to the source code of this file.
Classes | |
| class | ArGen |
Functions | |
| static std::string | toString (int v) |
| void | dumpraw (const char *path, const char *basename, int arNo) |
| int | usage () |
| int | main (int argc, char *argv[]) |
Variables | |
| const size_t | indent = 4 |
| const char * | pName = 0 |
| void dumpraw | ( | const char * | path, |
| const char * | basename, | ||
| int | arNo | ||
| ) |
Definition at line 129 of file testConvertRaw.cxx.
References ArGen::add(), ArGen::end(), and ArGen::outputDef().
Referenced by main().
{
if (access(path,R_OK))
{
perror(path);
return;
}
int fd = open(path,O_RDONLY);
if (fd < 0)
{
perror(path);
return;
}
int hdr = 0;
int s;
char unsigned buf[16 * 1024];
const int bsz = sizeof(buf)/sizeof(*buf);
const int nCols = 8;
int col = 0;
ArGen cg(basename,arNo);
while((s=read(fd,buf,bsz)) > 0)
{
cg.add(buf,s);
}
cg.end();
if (s < 0)
{
perror(path);
return;
}
cg.outputDef(1);
return;
}

| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 173 of file testConvertRaw.cxx.
References dumpraw(), pName, and usage().
{
pName = *argv;
const char * basename = 0;
int basearg = 1;
if (argc < 2) return usage();
if (argv[1][0] == '-' &&
argv[1][1] == 'n')
{
if (argc < 4) return usage();
basename = argv[2];
basearg = 3;
}
for (int i = basearg ; i < argc ; ++i )
dumpraw(argv[i],basename,i-basearg);
return 0;
}

| static std::string toString | ( | int | v | ) | [static] |
Definition at line 31 of file testConvertRaw.cxx.
Referenced by ArGen::ArGen().
{
std::string s;
bool b = false;
for( int i = 1000000; i > 0 ; i/=10)
{
int p = v/i;
if (b = ( b || p || ( i == 1)))
s += '0' + p;
v = v % i;
}
return s;
}
| int usage | ( | ) |
Definition at line 168 of file testConvertRaw.cxx.
References pName.
{
printf("usage: %s [-n arraybasename] file ...\n",pName);
}
| const size_t indent = 4 |
Definition at line 9 of file testConvertRaw.cxx.
Referenced by indent(), and traverseMulti().
| const char* pName = 0 |
Definition at line 166 of file testConvertRaw.cxx.
Referenced by main(), testParameterHash(), and usage().
1.7.5.1