JWS C Library
C language utility library
|
00001 /* 00002 * This work is licensed under a Creative Commons 00003 * Attribution-Noncommercial-Share Alike 3.0 United States License. 00004 * 00005 * http://creativecommons.org/licenses/by-nc-sa/3.0/us/ 00006 * 00007 * You are free: 00008 * 00009 * to Share - to copy, distribute, display, and perform the work 00010 * to Remix - to make derivative works 00011 * 00012 * Under the following conditions: 00013 * 00014 * Attribution. You must attribute the work in the manner specified by the 00015 * author or licensor (but not in any way that suggests that they endorse you 00016 * or your use of the work). 00017 * 00018 * Noncommercial. You may not use this work for commercial purposes. 00019 * 00020 * Share Alike. If you alter, transform, or build upon this work, you may 00021 * distribute the resulting work only under the same or similar license to 00022 * this one. 00023 * 00024 * For any reuse or distribution, you must make clear to others the license 00025 * terms of this work. The best way to do this is by including this header. 00026 * 00027 * Any of the above conditions can be waived if you get permission from the 00028 * copyright holder. 00029 * 00030 * Apart from the remix rights granted under this license, nothing in this 00031 * license impairs or restricts the author's moral rights. 00032 */ 00033 00034 00046 #ifndef VECTOR_IO_H 00047 #define VECTOR_IO_H 00048 00049 00050 #include <jwsc/config.h> 00051 00052 #include <stdlib.h> 00053 #include <stdio.h> 00054 #include <inttypes.h> 00055 00056 #include "jwsc/base/error.h" 00057 #include "jwsc/math/complex.h" 00058 #include "jwsc/vector/vector.h" 00059 00060 00061 #ifdef __cplusplus 00062 namespace jwsc { 00063 extern "C" { 00064 #endif 00065 00066 00075 Error* read_vector_u32(Vector_u32** v_out, const char* fname); 00076 00078 Error* read_vector_i32(Vector_i32** v_out, const char* fname); 00079 00081 Error* read_vector_i64(Vector_i64** v_out, const char* fname); 00082 00084 Error* read_vector_f(Vector_f** v_out, const char* fname); 00085 00087 Error* read_vector_d(Vector_d** v_out, const char* fname); 00088 00090 Error* read_vector_cf(Vector_cf** v_out, const char* fname); 00091 00093 Error* read_vector_cd(Vector_cd** v_out, const char* fname); 00094 00108 Error* read_vector_fp_u32(Vector_u32** v_out, FILE* fp); 00109 00111 Error* read_vector_fp_i32(Vector_i32** v_out, FILE* fp); 00112 00114 Error* read_vector_fp_i64(Vector_i64** v_out, FILE* fp); 00115 00117 Error* read_vector_fp_f(Vector_f** v_out, FILE* fp); 00118 00120 Error* read_vector_fp_d(Vector_d** v_out, FILE* fp); 00121 00123 Error* read_vector_fp_cf(Vector_cf** v_out, FILE* fp); 00124 00126 Error* read_vector_fp_cd(Vector_cd** v_out, FILE* fp); 00127 00141 Error* write_vector_u32(const Vector_u32* v, const char* fname); 00142 00144 Error* write_vector_i32(const Vector_i32* v, const char* fname); 00145 00147 Error* write_vector_i64(const Vector_i64* v, const char* fname); 00148 00150 Error* write_vector_f(const Vector_f* v, const char* fname); 00151 00153 Error* write_vector_d(const Vector_d* v, const char* fname); 00154 00156 Error* write_vector_cf(const Vector_cf* v, const char* fname); 00157 00159 Error* write_vector_cd(const Vector_cd* v, const char* fname); 00160 00174 Error* write_formatted_vector_u32 00175 ( 00176 const Vector_u32* v, 00177 const char* fmt, 00178 const char* fname 00179 ); 00180 00182 Error* write_formatted_vector_i32 00183 ( 00184 const Vector_i32* v, 00185 const char* fmt, 00186 const char* fname 00187 ); 00188 00190 Error* write_formatted_vector_i64 00191 ( 00192 const Vector_i64* v, 00193 const char* fmt, 00194 const char* fname 00195 ); 00196 00198 Error* write_formatted_vector_f 00199 ( 00200 const Vector_f* v, 00201 const char* fmt, 00202 const char* fname 00203 ); 00204 00206 Error* write_formatted_vector_d 00207 ( 00208 const Vector_d* v, 00209 const char* fmt, 00210 const char* fname 00211 ); 00212 00214 Error* write_formatted_vector_cf 00215 ( 00216 const Vector_cf* v, 00217 const char* fmt, 00218 const char* fname 00219 ); 00220 00222 Error* write_formatted_vector_cd 00223 ( 00224 const Vector_cd* v, 00225 const char* fmt, 00226 const char* fname 00227 ); 00228 00242 Error* write_vector_fp_u32(const Vector_u32* v, FILE* fp); 00243 00245 Error* write_vector_fp_i32(const Vector_i32* v, FILE* fp); 00246 00248 Error* write_vector_fp_i64(const Vector_i64* v, FILE* fp); 00249 00251 Error* write_vector_fp_f(const Vector_f* v, FILE* fp); 00252 00254 Error* write_vector_fp_d(const Vector_d* v, FILE* fp); 00255 00257 Error* write_vector_fp_cf(const Vector_cf* v, FILE* fp); 00258 00260 Error* write_vector_fp_cd(const Vector_cd* v, FILE* fp); 00261 00275 Error* write_formatted_vector_fp_u32 00276 ( 00277 const Vector_u32* v, 00278 const char* fmt, 00279 FILE* fp 00280 ); 00281 00283 Error* write_formatted_vector_fp_i32 00284 ( 00285 const Vector_i32* v, 00286 const char* fmt, 00287 FILE* fp 00288 ); 00289 00291 Error* write_formatted_vector_fp_i64 00292 ( 00293 const Vector_i64* v, 00294 const char* fmt, 00295 FILE* fp 00296 ); 00297 00299 Error* write_formatted_vector_fp_f 00300 ( 00301 const Vector_f* v, 00302 const char* fmt, 00303 FILE* fp 00304 ); 00305 00307 Error* write_formatted_vector_fp_d 00308 ( 00309 const Vector_d* v, 00310 const char* fmt, 00311 FILE* fp 00312 ); 00313 00315 Error* write_formatted_vector_fp_cf 00316 ( 00317 const Vector_cf* v, 00318 const char* fmt, 00319 FILE* fp 00320 ); 00321 00323 Error* write_formatted_vector_fp_cd 00324 ( 00325 const Vector_cd* v, 00326 const char* fmt, 00327 FILE* fp 00328 ); 00329 00343 Error* read_vector_with_header_u32(Vector_u32** v_out, const char* fname); 00344 00346 Error* read_vector_with_header_i32(Vector_i32** v_out, const char* fname); 00347 00349 Error* read_vector_with_header_i64(Vector_i64** v_out, const char* fname); 00350 00352 Error* read_vector_with_header_f(Vector_f** v_out, const char* fname); 00353 00355 Error* read_vector_with_header_d(Vector_d** v_out, const char* fname); 00356 00358 Error* read_vector_with_header_cf(Vector_cf** v_out, const char* fname); 00359 00361 Error* read_vector_with_header_cd(Vector_cd** v_out, const char* fname); 00362 00376 Error* read_vector_with_header_fp_u32(Vector_u32** v_out, FILE* fp); 00377 00379 Error* read_vector_with_header_fp_i32(Vector_i32** v_out, FILE* fp); 00380 00382 Error* read_vector_with_header_fp_i64(Vector_i64** v_out, FILE* fp); 00383 00385 Error* read_vector_with_header_fp_f(Vector_f** v_out, FILE* fp); 00386 00388 Error* read_vector_with_header_fp_d(Vector_d** v_out, FILE* fp); 00389 00391 Error* read_vector_with_header_fp_cf(Vector_cf** v_out, FILE* fp); 00392 00394 Error* read_vector_with_header_fp_cd(Vector_cd** v_out, FILE* fp); 00395 00409 Error* write_vector_with_header_u32(const Vector_u32* v, const char* fname); 00410 00412 Error* write_vector_with_header_i32(const Vector_i32* v, const char* fname); 00413 00415 Error* write_vector_with_header_i64(const Vector_i64* v, const char* fname); 00416 00418 Error* write_vector_with_header_f(const Vector_f* v, const char* fname); 00419 00421 Error* write_vector_with_header_d(const Vector_d* v, const char* fname); 00422 00424 Error* write_vector_with_header_cf(const Vector_cf* v, const char* fname); 00425 00427 Error* write_vector_with_header_cd(const Vector_cd* v, const char* fname); 00428 00442 Error* write_formatted_vector_with_header_u32 00443 ( 00444 const Vector_u32* v, 00445 const char* fmt, 00446 const char* fname 00447 ); 00448 00450 Error* write_formatted_vector_with_header_i32 00451 ( 00452 const Vector_i32* v, 00453 const char* fmt, 00454 const char* fname 00455 ); 00456 00458 Error* write_formatted_vector_with_header_i64 00459 ( 00460 const Vector_i64* v, 00461 const char* fmt, 00462 const char* fname 00463 ); 00464 00466 Error* write_formatted_vector_with_header_f 00467 ( 00468 const Vector_f* v, 00469 const char* fmt, 00470 const char* fname 00471 ); 00472 00474 Error* write_formatted_vector_with_header_d 00475 ( 00476 const Vector_d* v, 00477 const char* fmt, 00478 const char* fname 00479 ); 00480 00482 Error* write_formatted_vector_with_header_cf 00483 ( 00484 const Vector_cf* v, 00485 const char* fmt, 00486 const char* fname 00487 ); 00488 00490 Error* write_formatted_vector_with_header_cd 00491 ( 00492 const Vector_cd* v, 00493 const char* fmt, 00494 const char* fname 00495 ); 00496 00510 Error* write_vector_with_header_fp_u32(const Vector_u32* v, FILE* fp); 00511 00513 Error* write_vector_with_header_fp_i32(const Vector_i32* v, FILE* fp); 00514 00516 Error* write_vector_with_header_fp_i64(const Vector_i64* v, FILE* fp); 00517 00519 Error* write_vector_with_header_fp_f(const Vector_f* v, FILE* fp); 00520 00522 Error* write_vector_with_header_fp_d(const Vector_d* v, FILE* fp); 00523 00525 Error* write_vector_with_header_fp_cf(const Vector_cf* v, FILE* fp); 00526 00528 Error* write_vector_with_header_fp_cd(const Vector_cd* v, FILE* fp); 00529 00543 Error* write_formatted_vector_with_header_fp_u32 00544 ( 00545 const Vector_u32* v, 00546 const char* fmt, 00547 FILE* fp 00548 ); 00549 00551 Error* write_formatted_vector_with_header_fp_i32 00552 ( 00553 const Vector_i32* v, 00554 const char* fmt, 00555 FILE* fp 00556 ); 00557 00559 Error* write_formatted_vector_with_header_fp_i64 00560 ( 00561 const Vector_i64* v, 00562 const char* fmt, 00563 FILE* fp 00564 ); 00565 00567 Error* write_formatted_vector_with_header_fp_f 00568 ( 00569 const Vector_f* v, 00570 const char* fmt, 00571 FILE* fp 00572 ); 00573 00575 Error* write_formatted_vector_with_header_fp_d 00576 ( 00577 const Vector_d* v, 00578 const char* fmt, 00579 FILE* fp 00580 ); 00581 00583 Error* write_formatted_vector_with_header_fp_cf 00584 ( 00585 const Vector_cf* v, 00586 const char* fmt, 00587 FILE* fp 00588 ); 00589 00591 Error* write_formatted_vector_with_header_fp_cd 00592 ( 00593 const Vector_cd* v, 00594 const char* fmt, 00595 FILE* fp 00596 ); 00597 00601 #ifdef __cplusplus 00602 } 00603 } 00604 #endif 00605 00606 00607 #endif