31 #define GENRATE_CODE(x) Clear_##x(); 
   44 #define GENRATE_CODE(x)                                                     \ 
   45   void CNFData::Clear_##x() {                                               \ 
   46     vector<CNFDB_##x *>::iterator iter;                                     \ 
   47     for (iter = DB_##x.begin(); iter != DB_##x.end(); iter++) delete *iter; \ 
   70   int fg_block_continue;
 
   72   fp = fopen(fname, 
"r");
 
   76     sprintf(s, 
": %s", fname);
 
  105           fprintf(
log_fp, 
"line:%d reading block %d\n", (
int)
line,
 
  115               fg_block_continue = 
TRUE;
 
  118               fg_block_continue = 
FALSE;
 
  122             fprintf(
log_fp, 
"   ---- blank block\n");
 
  124             fg_block_continue = 
FALSE;
 
  130           sprintf(s, 
": %d", (
int)BlockID);
 
  134           fg_block_continue = 
FALSE;
 
  136       } 
while (fg_block_continue);
 
  145   fprintf(
log_fp, 
"Data reading completed!\n");
 
  154   fp = fopen(fname, 
"w");
 
  158     sprintf(s, 
": %s", fname);
 
  162 #define GENRATE_CODE(x)                  \ 
  163   if (!CNFData::WriteDataBlock(fp, x)) { \ 
  165     throw CNFError(NFE_WRITEDATA_ERROR); \ 
  185 #define GENRATE_CODE(x) \ 
  187     return new CNFDB_##x; 
  208 #define GENRATE_CODE(x)                   \ 
  210     DB_##x.push_back((CNFDB_##x *)block); \ 
  248   fprintf(stdout, 
"%s\n", msg);
 
  274     token = strtok(
NULL, 
",\n\r");
 
  277   if (!token) 
return FALSE;
 
  281       if (sscanf(token, 
"%d", (
int *)value) != 1) {
 
  288       if (sscanf(token, 
"%hhd", (
unsigned char *)value) != 1) {
 
  295       if (sscanf(token, 
"%lf", (
double *)value) != 1) {
 
  315   for (
int i = 0; i < n; i++) {
 
  316     val_ptr[i] = (
void *)va_arg(va, 
void *);
 
  323     char *c = (
char *)fmt;
 
  325     for (
int i = 0; i < n; i++, c++) {
 
  351       if (*p == 
'\r' || *p == 
'\n') {
 
  358   } 
while (buff[0] == 0);
 
  360   if (strcmp(buff, 
"   -1") == 0) {
 
  376   if (strcmp(buff, 
"<NULL>") == 0) {
 
  381   int n = strlen(buff);
 
  382   assert(!(n >= size));
 
  384   for (i = 0; i < n; i++) s[i] = buff[i];
 
  396   int i, j, n, id, end_id;
 
  397   char *p = (
char *)val;
 
  417   n  = val_n / n_in_rec;
 
  420   for (i = 0; i < n; i++) {
 
  424     end_id = 
id + n_in_rec;
 
  426     for (; 
id < end_id; 
id++, j++) {
 
  440     for (; 
id < val_n; 
id++, j++) {
 
  453   if (s == 0 || s[0] == 0) {
 
  454     fprintf(
fp, 
"<NULL>\n");
 
  457     fprintf(
fp, 
"%s\n", s);
 
  461 static void float_write(FILE *fp, 
double x) {
 
  462   fprintf(fp, 
"%lg,", x);
 
  494     char *c = (
char *)fmt;
 
  496     for (
int i = 0; i < n; i++, c++) {
 
  505           fprintf(
fp, 
"%d,", (
int)(va_arg(va, 
nf_int)));
 
  511           fprintf(
fp, 
"%d,", b);
 
  536 #define GENRATE_CODE(x)                                         \ 
  538     if (DB_##x.size() > 0) {                                    \ 
  539       WriteBlockSeparator(fp);                                  \ 
  540       fprintf(fp, "   %d\n", (x));                              \
 
  541       vector<CNFDB_##x *>::iterator iter;                       \
 
  542       for (iter = DB_##x.begin(); iter != DB_##x.end(); iter++) \
 
  543         (*iter)->WriteData(this, fp);                           \
 
  544       WriteBlockSeparator(fp);                                  \
 
  555       fprintf(
fp, 
"   100\n");
 
  582   if (!
fp) 
fp = stdout;
 
  584   fprintf(
fp, 
"%8s  %8s\n", 
"BlockID", 
"num");
 
  585   fprintf(
fp, 
"====================\n");
 
  586 #define GENRATE_CODE(x) \ 
  587   if ((DB_##x).size() > 0) fprintf(fp, "%8d  %8lu\n", (x), (DB_##x).size());
 
  597   fprintf(
fp, 
"====================\n\n");
 
  598   fprintf(
fp, 
"non supporting block (skipped)\n");
 
  600   set<int>::iterator iter;
 
  609     fprintf(
fp, 
"  %4d,", *iter);
 
const double DefaultCNFDataVersion
 
const int READLINE_SUCESS
 
const int READLINE_SEPARATOR
 
@ NFE_DATA_BLOCK_REQUIRED
 
@ NFW_NON_SUPPORTED_DATA_BLOCK
 
virtual void WriteData(class CNFData *nfd, FILE *fp)
 
virtual void Read(class CNFData *nfd)=0
 
int ReadRecNext(char type, void *value)
 
virtual CNFDataBlock * CreateDataBlock(int block_id)
 
void WriteStr(FILE *fp, const char *s)
 
void ReadStr(char *buff, char *s, int size)
 
bool WriteDataBlock(FILE *fp, int id)
 
virtual void Save(const char *fname)
 
std::set< int > non_supported_block_list
 
virtual void PrintMessage(const char *msg)
 
void ReadLineEx(char *buff, int size=255)
 
virtual void SkipDataBlock()
 
virtual void StoreDataBlock(CNFDataBlock *block)
 
void WriteBlockSeparator(FILE *fp)
 
void WriteData(FILE *fp, const char *fmt,...)
 
void PushBackLine(char *buff)
 
void ReadRecord(char *buff, const char *fmt,...)
 
void WriteSummary(FILE *fp=0)
 
void ReadRecStart(char *buff)
 
virtual void Load(const char *fname)
 
void ReadMultRec(char type, int n_in_rec, int val_n, void *val)
 
int ReadLine(char *buff, int size=255)
 
virtual const char * Msg()
 
void version(char *arg)
show version and revision of FrontISTR