annotate src/gpf2/inc/pco_util.h @ 1:864b8cc0cf63

src/gpf2: preened GPF goo from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2016 23:38:58 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +-----------------------------------------------------------------------------
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | Project : PCO2
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 | Modul : PCO_UTIL
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 +-----------------------------------------------------------------------------
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | Copyright 2002 Texas Instruments Berlin, AG
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 | All rights reserved.
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | This file is confidential and a trade secret of Texas
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | Instruments Berlin, AG
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | The receipt of or possession of this file does not convey
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | any rights to reproduce or disclose its contents or to
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | manufacture, use, or sell anything it may describe, in
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | whole, or in part, without the specific written consent of
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 | Texas Instruments Berlin, AG.
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 +-----------------------------------------------------------------------------
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 | Purpose : This Modul provides utillity functions for pco
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 +-----------------------------------------------------------------------------
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #ifndef _PCO_UTIL_H_
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #define _PCO_UTIL_H_
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /*==== INCLUDES ===================================================*/
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #include <stdio.h>
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #include "ipcapi.h"
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 #undef EXPORT
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include "typedefs.h"
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 /*==== TYPES ======================================================*/
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 /*==== CONSTANTS ==================================================*/
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #define ZERO_COMPRESS_MIN 8
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 /*==== EXTERNALS ==================================================*/
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 /*==== VARIABLES ==================================================*/
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 /*==== PROTOTYPES =================================================*/
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 +--------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 | PROJECT : PCO2 MODULE : PCO_UTIL |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 | STATE : code ROUTINE : get_path |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 +--------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 PURPOSE : Retrieves the pathname from a path/filename(path\filenames)-string.
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 PARAMS: fname ... path/filename
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 path ... retrieved path string
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 slash ... 1 -> '/'s are used as separators.
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 0 -> '\'s are used as separators
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 void get_path(const char* fname, char* path, int slash=1);
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 +------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 | PROJECT : PCO2 MODULE : PCO_UTIL |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 | STATE : code ROUTINE : read_string |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 +------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 PURPOSE : Reads one line from a text file.
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 PARAMS: stream ... stream to read from
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 buf ... buffer to read into
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 max_len ... maximum length of line to read into buf
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 RETURNS: 0 ... no error
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 -1 ... buffer to small
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 int read_string (FILE * stream, char * buf, int max_len);
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 | PROJECT : PCO2 MODULE : PCO_UTIL |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 | STATE : code ROUTINE : send_ipcmsg |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 PURPOSE : tries to send a message with ipc header to a receiver
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 PARAMS: buf ... pointer to buffer
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 size .. size of buffer
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 id ... message id
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 sender .. queuename of sender
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 receiver .. queuename of receiver
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 RETURNS: 0 .. sucess
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 -1 .. receiver not found
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 -2 .. error while contacting receiver
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 int send_ipcmsg(void* buf, U16 size, U16 id, const char* sender,
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 const char* receiver);
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 | PROJECT : PCO2 MODULE : PCO_UTIL |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 | STATE : code ROUTINE : send_ipcmsg |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 PURPOSE : tries to send a message with ipc header to a receiver
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 PARAMS: buf ... pointer to buffer
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 size .. size of buffer
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 id ... message id
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 sender .. queuename of sender
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 receiver .. queuename of receiver
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 rqueue ... handle of receiver queue
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 RETURNS: 0 .. sucess
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 -1 .. error while contacting receiver
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 int send_ipcmsg(void* buf, U16 size, U16 id, const char* sender,
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 const char* receiver, CMS_HANDLE rqueue);
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 | PROJECT : PCO2 MODULE : PCO_VIEW_STD |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 | STATE : code ROUTINE : create_hexdump |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 PURPOSE : creates hexdump string of given data
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 PARAMS: data .. the data
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 dsize .. size of data
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 dump .. buffer to receive hexdump
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 size .. size of dump
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 reverse.. if !=0 the hexdump will represent the reverse data buffer
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 zero_compress_min .. count of zeros from which on compression will be applied
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 RETURNS: 0 .. success
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 -1 .. dump buffer to small
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 int create_hexdump(const void *data, unsigned dsize, char *dump, unsigned size,
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 int reverse=0, int zero_compress_min=ZERO_COMPRESS_MIN);
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 | PROJECT : PCO2 MODULE : PCO_UTIL |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 | STATE : code ROUTINE : interprete_hexdump |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 PURPOSE : tries to interprete a given string hexdump-like
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 Example: 00 44 (23*00) 47 11
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 PARAMS: dump .. string containing hexdump
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 buffer .. buffer to receive interpreted data
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 bsize .. size of buffer
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 count .. count of bytes writen to buffer
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 RETURNS: 0 .. success
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 -1 .. buffer to small
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 -2 .. invalid hexdump
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 int interprete_hexdump(const char *dump, void* buffer, unsigned bsize, unsigned& count);
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 | PROJECT : PCO2 MODULE : PCO_UTIL |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 | STATE : code ROUTINE : get_time_hmsm |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 PURPOSE : calculates the current time in ms
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 (hour, minute, second and ms are taken into account)
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 RETURNS: current time in milliseconds
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 ULONG get_time_hmsm();
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 /*
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 | PROJECT : PCO2 MODULE : PCO_UTIL |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 | STATE : code ROUTINE : get_dll_size |
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 +-------------------------------------------------------------------------------+
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 PURPOSE : calculates the actual count of bytes used in a given DLL-file
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 PARAMS: dll_fname .. name of dll-file
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 RETURNS: count of bytes used, 0 if file is no WIN32-DLL
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 */
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 ULONG get_dll_size(const char* dll_fname);
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194
864b8cc0cf63 src/gpf2: preened GPF goo from TCS211
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 #endif /* _PCO_UTIL_H_ */