#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include "elst.h"
#include "pageblk.h"
#include "varable.h"
#include "hpddef.h"
Go to the source code of this file.
DLLSYM PAGE_BLOCK_LIST* read_poly_blocks | ( | const char * | name | ) |
Read file
Definition at line 51 of file rwpoly.cpp.
References CANTOPENFILE, de_serialise_INT32(), ERRCODE::error(), LOG, NULL, page_block_it, and page_block_list.
Referenced by read_hpd_file().
00053 { 00054 FILE *infp; 00055 int c; 00056 INT16 number_of_pblocks; 00057 //output list 00058 PAGE_BLOCK_LIST *pb_list = NULL; 00059 PAGE_BLOCK *page_block; //new block for list 00060 INT32 len; /*length to retrive */ 00061 PAGE_BLOCK_IT it; 00062 00063 if ((infp = fopen (name, "r")) != NULL) { 00064 if (((c = fgetc (infp)) != EOF) && (ungetc (c, infp) != EOF)) { 00065 if (blocks_read_asc) { 00066 pb_list = new PAGE_BLOCK_LIST; 00067 00068 len = de_serialise_INT32 (infp); 00069 it.set_to_list (pb_list); 00070 for (; len > 0; len--) { 00071 page_block = PAGE_BLOCK::new_de_serialise_asc (infp); 00072 /*put on the list */ 00073 it.add_to_end (page_block); 00074 } 00075 } 00076 else 00077 pb_list = PAGE_BLOCK_LIST::de_serialise (infp); 00078 page_block_list = pb_list; //set global for now 00079 } 00080 fclose(infp); 00081 } 00082 else { 00083 //can't open file 00084 CANTOPENFILE.error ("read_poly_blocks", LOG, name); 00085 pb_list = new PAGE_BLOCK_LIST; 00086 page_block_list = pb_list; //set global for now 00087 } 00088 page_block_it.set_to_list (pb_list); 00089 number_of_pblocks = pb_list->length (); 00090 00091 printf ("%d page blocks read\n", number_of_pblocks); 00092 return pb_list; 00093 00094 }
DLLSYM void write_poly_blocks | ( | FILE * | blfile, | |
PAGE_BLOCK_LIST * | blocks | |||
) |
* (C) Copyright 1993, Hewlett-Packard Ltd. ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** http://www.apache.org/licenses/LICENSE-2.0 ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
Definition at line 38 of file rwpoly.cpp.
00038 { 00039 if (blocks_write_asc) 00040 blocks->serialise_asc (blfile); 00041 else 00042 blocks->serialise (blfile); 00043 00044 return; 00045 }
PAGE_BLOCK_IT page_block_it |
DLLSYM PAGE_BLOCK_LIST* page_block_list |