16 #if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
22 void write_debug_stream(const char *format
, ...)
26 FILE *f
= fopen("/boot/home/transport.log", "aw+");
27 vfprintf(f
, format
, ap
);
33 void DUMP_BFILE(BFile
*in
, const char *path
)
36 if (B_NO_ERROR
== in
->GetSize(&size
)) {
37 uchar
*buffer
= new uchar
[size
];
38 in
->Read(buffer
, size
);
39 BFile
out(path
, B_WRITE_ONLY
| B_CREATE_FILE
);
40 out
.Write(buffer
, size
);
41 in
->Seek(0, SEEK_SET
);
47 void DUMP_BMESSAGE(BMessage
*msg
)
55 DBGMSG(("\t************ START - DUMP BMessage ***********\n"));
56 DBGMSG(("\taddress: 0x%x\n", (int)msg
));
61 DBGMSG(("\tmsg->what: %c%c%c%c\n",
62 *((char *)&msg
->what
+ 3),
63 *((char *)&msg
->what
+ 2),
64 *((char *)&msg
->what
+ 1),
65 *((char *)&msg
->what
+ 0)));
67 DBGMSG(("\tmsg->what: %c%c%c%c\n",
68 *((char *)&msg
->what
+ 0),
69 *((char *)&msg
->what
+ 1),
70 *((char *)&msg
->what
+ 2),
71 *((char *)&msg
->what
+ 3)));
74 for (i
= 0; msg
->GetInfo(B_ANY_TYPE
, i
, &name
, &type
, &count
) == B_OK
; i
++) {
77 for (j
= 0; j
< count
; j
++) {
79 aBool
= msg
->FindBool(name
, j
);
80 DBGMSG(("\t%s, B_BOOL_TYPE[%d]: %s\n",
81 name
, j
, aBool
? "true" : "false"));
86 for (j
= 0; j
< count
; j
++) {
88 msg
->FindInt8(name
, j
, &anInt8
);
89 DBGMSG(("\t%s, B_INT8_TYPE[%d]: %d\n", name
, j
, (int)anInt8
));
94 for (j
= 0; j
< count
; j
++) {
96 msg
->FindInt16(name
, j
, &anInt16
);
97 DBGMSG(("\t%s, B_INT16_TYPE[%d]: %d\n", name
, j
, (int)anInt16
));
102 for (j
= 0; j
< count
; j
++) {
104 msg
->FindInt32(name
, j
, &anInt32
);
105 DBGMSG(("\t%s, B_INT32_TYPE[%d]: %d\n", name
, j
, (int)anInt32
));
110 for (j
= 0; j
< count
; j
++) {
112 msg
->FindInt64(name
, j
, &anInt64
);
113 DBGMSG(("\t%s, B_INT64_TYPE[%d]: %d\n", name
, j
, (int)anInt64
));
118 for (j
= 0; j
< count
; j
++) {
120 msg
->FindFloat(name
, j
, &aFloat
);
121 DBGMSG(("\t%s, B_FLOAT_TYPE[%d]: %f\n", name
, j
, aFloat
));
126 for (j
= 0; j
< count
; j
++) {
128 msg
->FindDouble(name
, j
, &aDouble
);
129 DBGMSG(("\t%s, B_DOUBLE_TYPE[%d]: %f\n", name
, j
, (float)aDouble
));
134 for (j
= 0; j
< count
; j
++) {
136 msg
->FindString(name
, j
, &string
);
137 DBGMSG(("\t%s, B_STRING_TYPE[%d]: %s\n", name
, j
, string
));
142 for (j
= 0; j
< count
; j
++) {
144 msg
->FindPoint(name
, j
, &aPoint
);
145 DBGMSG(("\t%s, B_POINT_TYPE[%d]: %f, %f\n",
146 name
, j
, aPoint
.x
, aPoint
.y
));
151 for (j
= 0; j
< count
; j
++) {
153 msg
->FindRect(name
, j
, &aRect
);
154 DBGMSG(("\t%s, B_RECT_TYPE[%d]: %f, %f, %f, %f\n",
155 name
, j
, aRect
.left
, aRect
.top
, aRect
.right
, aRect
.bottom
));
161 case B_MESSENGER_TYPE
:
163 DBGMSG(("\t%s, 0x%x, count: %d\n",
164 name
? name
: "(null)", type
, count
));
167 DBGMSG(("\t%s, 0x%x, count: %d\n",
168 name
? name
: "(null)", type
, count
));
176 DBGMSG(("\t************ END - DUMP BMessage ***********\n"));
179 #define PD_DRIVER_NAME "Driver Name"
180 #define PD_PRINTER_NAME "Printer Name"
181 #define PD_COMMENTS "Comments"
183 void DUMP_BDIRECTORY(BDirectory
*dir
)
193 DBGMSG(("\t************ STRAT - DUMP BDirectory ***********\n"));
196 while (dir
->GetNextAttrName(buffer1
) == B_NO_ERROR
) {
197 dir
->GetAttrInfo(buffer1
, &info
);
200 dir
->ReadAttr(buffer1
, info
.type
, 0, buffer2
, sizeof(buffer2
));
201 DBGMSG(("\t%s, B_ASCII_TYPE: %s\n", buffer1
, buffer2
));
204 dir
->ReadAttr(buffer1
, info
.type
, 0, buffer2
, sizeof(buffer2
));
205 DBGMSG(("\t%s, B_STRING_TYPE: %s\n", buffer1
, buffer2
));
208 dir
->ReadAttr(buffer1
, info
.type
, 0, &i
, sizeof(i
));
209 DBGMSG(("\t%s, B_INT32_TYPE: %d\n", buffer1
, i
));
212 dir
->ReadAttr(buffer1
, info
.type
, 0, &f
, sizeof(f
));
213 DBGMSG(("\t%s, B_FLOAT_TYPE: %f\n", buffer1
, f
));
216 dir
->ReadAttr(buffer1
, info
.type
, 0, &rc
, sizeof(rc
));
217 DBGMSG(("\t%s, B_RECT_TYPE: %f, %f, %f, %f\n", buffer1
, rc
.left
, rc
.top
, rc
.right
, rc
.bottom
));
220 dir
->ReadAttr(buffer1
, info
.type
, 0, &b
, sizeof(b
));
221 DBGMSG(("\t%s, B_BOOL_TYPE: %d\n", buffer1
, (int)b
));
224 DBGMSG(("\t%s, %c%c%c%c\n",
226 *((char *)&info
.type
+ 3),
227 *((char *)&info
.type
+ 2),
228 *((char *)&info
.type
+ 1),
229 *((char *)&info
.type
+ 0)));
234 DBGMSG(("\t************ END - DUMP BDirectory ***********\n"));