annotate src/dmfile.h @ 2298:b5abfff07ca9

Add new DMGrowBuf helper functions dmGrowBufCopyOffsSize() and dmGrowBufConstCopyOffsSize().
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Jul 2019 10:54:16 +0300
parents 6b1f41ca300a
children 9807ae37ad69
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * DMLib
414
c452a459e552 Clear up the file descriptions.
Matti Hamalainen <ccr@tnsp.org>
parents: 405
diff changeset
3 * -- Standard I/O (stdio) file write/read endianess helpers
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * Programmed and designed by Matti 'ccr' Hamalainen
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 * (C) Copyright 2011 Tecnic Software productions (TNSP)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 #ifndef DMFILE_H
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 #define DMFILE_H
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10 #include "dmlib.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
434
380c226c75af Add C++ guard.
Matti Hamalainen <ccr@tnsp.org>
parents: 414
diff changeset
12 #ifdef __cplusplus
380c226c75af Add C++ guard.
Matti Hamalainen <ccr@tnsp.org>
parents: 414
diff changeset
13 extern "C" {
380c226c75af Add C++ guard.
Matti Hamalainen <ccr@tnsp.org>
parents: 414
diff changeset
14 #endif
380c226c75af Add C++ guard.
Matti Hamalainen <ccr@tnsp.org>
parents: 414
diff changeset
15
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 /* Plain file endianess functions
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 #define DM_DEFINE_FFUNC(xname, xtype, z) \
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 BOOL dm_fread_ ## xname (FILE *f, xtype *v); \
405
d0257d0004f6 Implement dm_{read,write}_byte() and constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
21 BOOL dm_fwrite_ ## xname (FILE *f, const xtype v);
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 #include "dmfiletmpl.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 #undef DM_DEFINE_FFUNC
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26
405
d0257d0004f6 Implement dm_{read,write}_byte() and constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
27 BOOL dm_fread_str(FILE *f, void *, const size_t);
d0257d0004f6 Implement dm_{read,write}_byte() and constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
28 BOOL dm_fwrite_str(FILE *f, const void *, const size_t);
d0257d0004f6 Implement dm_{read,write}_byte() and constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
29
d0257d0004f6 Implement dm_{read,write}_byte() and constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
30 BOOL dm_fread_byte(FILE *f, Uint8 *);
d0257d0004f6 Implement dm_{read,write}_byte() and constify.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
31 BOOL dm_fwrite_byte(FILE *f, const Uint8);
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
1474
6b1f41ca300a Add dmWriteDataFile() helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 1473
diff changeset
34 int dmWriteDataFile(FILE *outFile, const char *filename, const Uint8 *buf, const size_t bufSize);
1473
c543f5ae92d5 Cleanup dmReadDataFile() helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 812
diff changeset
35 int dmReadDataFile(FILE *inFile, const char *filename, Uint8 **pbuf, size_t *pbufSize);
567
b2b461829c61 Move utility function dmReadDataFile() to dmfile module instead.
Matti Hamalainen <ccr@tnsp.org>
parents: 434
diff changeset
36
b2b461829c61 Move utility function dmReadDataFile() to dmfile module instead.
Matti Hamalainen <ccr@tnsp.org>
parents: 434
diff changeset
37
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 #ifdef __cplusplus
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 }
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 #endif
434
380c226c75af Add C++ guard.
Matti Hamalainen <ccr@tnsp.org>
parents: 414
diff changeset
41
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 #endif // DMFILE_H