1 | /*-*-c++-*-*/
|
---|
2 | /* $Id: print.c,v 1.2 2001-09-05 14:30:39 bird Exp $ */
|
---|
3 | /*
|
---|
4 | ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
|
---|
5 | ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
|
---|
6 | ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
|
---|
7 | ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
|
---|
8 | ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
|
---|
9 | ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
---|
10 | ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
|
---|
11 | ** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
|
---|
12 | **
|
---|
13 | ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
|
---|
14 | ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
|
---|
15 | ** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
|
---|
16 | ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
|
---|
17 | ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
|
---|
18 | ** THE UNITED STATES.
|
---|
19 | **
|
---|
20 | ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
|
---|
21 | **
|
---|
22 | **
|
---|
23 | ** $Revision: 1.2 $
|
---|
24 | ** $Date: 2001-09-05 14:30:39 $
|
---|
25 | **
|
---|
26 | ** Print functions for SST-1 Initialization routines
|
---|
27 | */
|
---|
28 | #pragma optimize ("",off)
|
---|
29 | #include <stdio.h>
|
---|
30 | #include <stdlib.h>
|
---|
31 | #include <stdarg.h>
|
---|
32 | #ifdef BUILD_FOR_SST1
|
---|
33 | #include <sst.h>
|
---|
34 | #else
|
---|
35 | #include <3dfx.h>
|
---|
36 | #include <cvgregs.h>
|
---|
37 | #include <cvgdefs.h>
|
---|
38 | #endif
|
---|
39 | #include <sst1vid.h>
|
---|
40 | #define FX_DLL_DEFINITION
|
---|
41 | #include <fxdll.h>
|
---|
42 | #include <sst1init.h>
|
---|
43 | #include <gdebug.h>
|
---|
44 |
|
---|
45 | #ifdef INIT_OUTPUT
|
---|
46 |
|
---|
47 | FX_ENTRY void FX_CALL sst1InitVPrintf(const char *, va_list);
|
---|
48 |
|
---|
49 | FX_ENTRY void FX_CALL sst1InitPrintf(const char *format, ...)
|
---|
50 | {
|
---|
51 | va_list args;
|
---|
52 | static FxBool firstPass = FXTRUE;
|
---|
53 | static FxBool printIt = FXFALSE;
|
---|
54 |
|
---|
55 | if(firstPass == FXTRUE) {
|
---|
56 | firstPass = FXFALSE;
|
---|
57 | if (sst1InitMsgFile == NULL)
|
---|
58 | {
|
---|
59 | /* I couldn't initialize to stdout because stdout is not constant */
|
---|
60 | sst1InitMsgFile = stdout;
|
---|
61 | }
|
---|
62 | if(GETENV(("SSTV2_INITDEBUG")) || GDBG_GET_DEBUGLEVEL(5))
|
---|
63 | printIt = FXTRUE;
|
---|
64 | if(GETENV(("SSTV2_INITDEBUG_FILE"))) {
|
---|
65 | printIt = ((sst1InitMsgFile = fopen(GETENV(("SSTV2_INITDEBUG_FILE")), "w")) != NULL);
|
---|
66 | if (!printIt) {
|
---|
67 | fprintf(stderr, "sst1InitPrintf(): Could not open file '%s' for logging...\n",
|
---|
68 | GETENV(("SSTV2_INITDEBUG_FILE")));
|
---|
69 | }
|
---|
70 | }
|
---|
71 | }
|
---|
72 |
|
---|
73 | if(printIt == FXFALSE)
|
---|
74 | return;
|
---|
75 |
|
---|
76 | va_start(args, format);
|
---|
77 | sst1InitVPrintf(format, args);
|
---|
78 | va_end(args);
|
---|
79 | }
|
---|
80 |
|
---|
81 | FX_ENTRY void FX_CALL sst1InitVPrintf(const char *format, va_list args)
|
---|
82 | {
|
---|
83 | vfprintf(sst1InitMsgFile, format, args);
|
---|
84 | fflush(sst1InitMsgFile);
|
---|
85 | }
|
---|
86 |
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | #pragma optimize ("",on)
|
---|