annotate src/gpf2/misc/printtofile.c @ 662:8cd8fd15a095

SIM speed enhancement re-enabled and made configurable TI's original code supported SIM speed enhancement, but Openmoko had it disabled, and OM's disabling of speed enhancement somehow caused certain SIM cards to start working which didn't work before (OM's bug #666). Because our FC community is much smaller in year 2020 than OM's community was in their day, we are not able to find one of those #666-affected SIMs, thus the real issue they had encountered remains elusive. Thus our solution is to re-enable SIM speed enhancement and simply wait for if and when someone runs into a #666-affected SIM once again. We provide a SIM_allow_speed_enhancement global variable that allows SIM speed enhancement to be enabled or disabled per session, and an /etc/SIM_spenh file in FFS that allows it to enabled or disabled on a non-volatile basis. SIM speed enhancement is now enabled by default.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 24 May 2020 05:02:28 +0000
parents cd37d228dae0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
294
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 +------------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 | File: printToFile.c
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 +------------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 | Copyright 2002 Texas Instruments Berlin, AG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 | All rights reserved.
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 |
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 | This file is confidential and a trade secret of Texas
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 | Instruments Berlin, AG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 | The receipt of or possession of this file does not convey
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 | any rights to reproduce or disclose its contents or to
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 | manufacture, use, or sell anything it may describe, in
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 | whole, or in part, without the specific written consent of
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 | Texas Instruments Berlin, AG.
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 +-----------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 | Purpose: This module implements some stream output functions.
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 +-----------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 #ifndef __PRINTTOFILE_C__
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 #define __PRINTTOFILE_C__
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #ifndef _TARGET_
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /*==== INCLUDES ===================================================*/
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 #include "printtofile.h"
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #include "typedefs.h"
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #ifndef _LINUX_
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #include <string.h>
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 #include <ctype.h>
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #include <stdarg.h>
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 #include <stdio.h>
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 #include "windows.h"
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 #include "vsi.h"
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 #include "time.h"
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 #include <sys/types.h>
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 #include <sys/timeb.h>
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 #endif /* _LINUX_ */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 /*==== TYPES ======================================================*/
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 /*==== CONSTANTS ==================================================*/
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 /*==== EXTERNALS ==================================================*/
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 /*==== VARIABLES ==================================================*/
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 #ifndef _LINUX_
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 static HANDLE mutEx;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 #endif /* _LINUX_ */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 /*==== FUNCTIONS ==================================================*/
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 #ifndef RUN_INT_RAM
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 /*
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 +------------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 | Function : PrintToFile
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 +------------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 | Description : print to file xx and do a printf() with ident. arguments
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 |
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 | Parameters : const char *format, ... variable parameter list
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 |
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 | Return : printf retval
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 |
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 +------------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 void initPrintToFile()
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 #ifdef _LINUX_
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 return;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 #else /* _LINUX_ */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 #ifndef _TARGET_
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 FILE *fp;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 if ( (mutEx = OpenMutex (MUTEX_ALL_ACCESS, FALSE, "PrintToFile")) == NULL )
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 mutEx = CreateMutex( NULL, FALSE, "PrintToFile");
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 fp = fopen("\\gpf\\BIN\\debug\\tstlog.txt", "w");
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 PrintToFile("\n\nStart logging:\n");
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 if (mutEx == 0)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 printf("PrintToFile semaphore creation failed!\n");
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 #endif /* _LINUX_ */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 #ifndef RUN_INT_RAM
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 /*
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 +------------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 | Function : PrintToFile
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 +------------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 | Description : print to file xx and do a printf() with ident. arguments
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 |
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 | Parameters : const char *format, ... variable parameter list
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109 |
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 | Return : printf retval
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 |
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 +------------------------------------------------------------------------------
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 int PrintToFile(const char *format, ... )
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116 int retval = 0;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 #ifndef _LINUX_
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 #ifndef _TARGET_
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 va_list unamedArgumentList;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 char* nextChar;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 int ival;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122 char* sval;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 FILE *fp;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 struct _timeb timebuf;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 time_t seconds;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127 unsigned long int t;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 if ( WaitForSingleObject (mutEx, INFINITE) == WAIT_FAILED )
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132 printf("PrintToFile semaphore request failed! Is TST.exe up & running?\n");
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 return -1;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 va_start(unamedArgumentList, format);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 fp = fopen("\\gpf\\BIN\\debug\\tstlog.txt", "a");
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138 if ( fp != 0 )
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 time( &seconds ); // seconds after 1.1.70 GMT
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 _ftime( &timebuf );
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 t = (unsigned long int)(seconds * 1000) + timebuf.millitm;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 /*lint -e668 */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 /*lint -e559 */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 #ifdef _TOOLS_
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 fprintf(fp, "TST (%u): ", (unsigned int)t);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 #else
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 fprintf(fp, "Stack (%u): ", (unsigned int)t);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152 #endif /* _DEBUG */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 /*lint -e662 */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 for (nextChar = (char*) format; *nextChar; nextChar++)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157 if (*nextChar != '%')
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 putchar(*nextChar);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 if (fp != 0)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 fputc(*nextChar,fp);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 continue;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 switch (*++nextChar)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 case 'd':
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 ival = va_arg(unamedArgumentList, int);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 printf("%d", ival);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 if (fp != 0)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 fprintf(fp, "%d", ival);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 break;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 case 'x':
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182 ival = va_arg(unamedArgumentList, int);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 printf("%x", ival);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 if (fp != 0)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 fprintf(fp, "%x", ival);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 break;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 case 's':
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 for(sval = va_arg(unamedArgumentList, char*); *sval; sval++)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 putchar(*sval);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 if (fp != 0)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 fputc(*sval,fp);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 break;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 default:
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204 putchar(*nextChar);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 if (fp != 0)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208 fputc(*nextChar,fp);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 break;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 /*lint +e662 */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 va_end(unamedArgumentList);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 #ifdef _DEBUG
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 if (fp != 0)
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 {
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 fclose(fp);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 ReleaseMutex(mutEx);
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 #endif /* !_LINUX_ */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 #endif /* _TARGET_ */
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 return retval;
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
226 }
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
227 #endif
cd37d228dae0 src/gpf2/{misc,tst}: import from TCS211 semi-src
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
228 #endif