1 |
//$Header$
|
2 |
//-------------------------------------------------------------------------------------------------
|
3 |
//This file is part of "David T. Ashley's Shared Source Code", a set of shared components
|
4 |
//integrated into many of David T. Ashley's projects.
|
5 |
//-------------------------------------------------------------------------------------------------
|
6 |
//This source code and any program in which it is compiled/used is provided under the MIT License,
|
7 |
//reproduced below.
|
8 |
//-------------------------------------------------------------------------------------------------
|
9 |
//Permission is hereby granted, free of charge, to any person obtaining a copy of
|
10 |
//this software and associated documentation files(the "Software"), to deal in the
|
11 |
//Software without restriction, including without limitation the rights to use,
|
12 |
//copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the
|
13 |
//Software, and to permit persons to whom the Software is furnished to do so,
|
14 |
//subject to the following conditions :
|
15 |
//
|
16 |
//The above copyright notice and this permission notice shall be included in all
|
17 |
//copies or substantial portions of the Software.
|
18 |
//
|
19 |
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
20 |
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21 |
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
22 |
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23 |
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
24 |
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
25 |
//SOFTWARE.
|
26 |
//-------------------------------------------------------------------------------------------------
|
27 |
#define MODULE_MSGSTRS
|
28 |
|
29 |
#include "tcl.h"
|
30 |
#include "tcldecls.h"
|
31 |
|
32 |
#include "msgstrs.h"
|
33 |
|
34 |
#include <string.h>
|
35 |
|
36 |
#include "vcinfo.h"
|
37 |
|
38 |
|
39 |
//PP constant defining reference baseline with = signs.
|
40 |
#define MSGSTRS_REFHLINEEQ \
|
41 |
"============================================================================"
|
42 |
|
43 |
//Reference baseline with = signs.
|
44 |
static const char * MsgstrsRefHlineEq = MSGSTRS_REFHLINEEQ;
|
45 |
|
46 |
#define MSGSTRS_REFLINEHYPHEN \
|
47 |
"----------------------------------------------------------------------------"
|
48 |
|
49 |
//Reference baseline populated with hyphens.
|
50 |
static const char * MsgstrsRefHlineHyphen = MSGSTRS_REFLINEHYPHEN;
|
51 |
|
52 |
#define MSGSTRS_CORPCOPYRIGHTSTRING \
|
53 |
"Copyright David T. Ashley, Detroit, Michigan, USA."
|
54 |
|
55 |
//Copyright string.
|
56 |
static const char *MsgstrsCopyrightString = MSGSTRS_CORPCOPYRIGHTSTRING;
|
57 |
|
58 |
//Credits string, giving credit to who produced it.
|
59 |
#define MSGSTRS_CREDITSSTRING_A \
|
60 |
"Powered by static embedded Ajuba/Scriptics Tcl 8.3.1"
|
61 |
|
62 |
//Instruction strings.
|
63 |
#define MSGSTRS_INSTRUCTSTRING_A \
|
64 |
"Type \"credits\" for credit and contact information; or \"exit\" to end session."
|
65 |
|
66 |
|
67 |
//Returns the length of the standard separator line. This is taken
|
68 |
//to be the right length for all horizontal lines.
|
69 |
|
70 |
DECMOD_MSGSTRS int MsgstrsGetStdSepLen(void)
|
71 |
{
|
72 |
return(strlen(MsgstrsRefHlineEq));
|
73 |
}
|
74 |
|
75 |
//Returns the standard horizontal line populated with "=".
|
76 |
|
77 |
DECMOD_MSGSTRS const char *MsgstrsGetRefHlineEq(void)
|
78 |
{
|
79 |
return(MsgstrsRefHlineEq);
|
80 |
}
|
81 |
|
82 |
//Returns the standard horizontal line populated with "-".
|
83 |
|
84 |
DECMOD_MSGSTRS const char *MsgstrsGetRefHlineHyphen(void)
|
85 |
{
|
86 |
return(MsgstrsRefHlineHyphen);
|
87 |
}
|
88 |
|
89 |
|
90 |
//Initializes this software module. The only function to perform is to
|
91 |
//calculate the CRC-32 of all available version control information and
|
92 |
//stuff it in the string which will be used for the opening message.
|
93 |
DECMOD_MSGSTRS void MsgstrsInit(void)
|
94 |
{
|
95 |
#if 0
|
96 |
Tcl_Obj *objptr;
|
97 |
char *srcptr;
|
98 |
char *dstptr;
|
99 |
int i;
|
100 |
int errflag;
|
101 |
#endif
|
102 |
|
103 |
#if 0
|
104 |
//First, form the CRC-32 of all available version control information.
|
105 |
//Get a Tcl object with this information.
|
106 |
objptr = VcinfoRetrieveVcData(0,NULL,&errflag);
|
107 |
|
108 |
//If there was an error generating the CRC, don't want to go any
|
109 |
//further. Free the returned object.
|
110 |
if (errflag)
|
111 |
goto free_obj_exit;
|
112 |
|
113 |
//Get a pointer to the string represented by the object.
|
114 |
srcptr = Tcl_GetString(objptr);
|
115 |
|
116 |
//Go two forward in the string to bypass the "0x".
|
117 |
if (srcptr)
|
118 |
{
|
119 |
if (strlen(srcptr) >= 2)
|
120 |
{
|
121 |
srcptr += 2;
|
122 |
}
|
123 |
}
|
124 |
|
125 |
//Loop through the list of opening message strings and substitute
|
126 |
//in the correct information wherever the string 00000000 is found.
|
127 |
//It is assumed that there will be only one such occurance in the
|
128 |
//set of opening strings. If the strstr() function indicates a match,
|
129 |
//it is known that there is enough room in the destination to copy
|
130 |
//in the string, otherwise there would not have been a match.
|
131 |
if (srcptr)
|
132 |
{
|
133 |
for (i=0; i<(sizeof(MsgstrsStartupMsg)/sizeof(MsgstrsStartupMsg[0])); i++)
|
134 |
{
|
135 |
if (MsgstrsStartupMsg[i])
|
136 |
{
|
137 |
dstptr = strstr(MsgstrsStartupMsg[i], "00000000");
|
138 |
/*
|
139 |
if (dstptr)
|
140 |
{
|
141 |
while (*srcptr && *dstptr)
|
142 |
{
|
143 |
*dstptr++ = *srcptr++;
|
144 |
}
|
145 |
|
146 |
break;
|
147 |
}
|
148 |
*/
|
149 |
}
|
150 |
}
|
151 |
}
|
152 |
|
153 |
free_obj_exit:
|
154 |
|
155 |
//We are done with the Tcl object. We can free it.
|
156 |
Tcl_DecrRefCount(objptr);
|
157 |
#endif
|
158 |
}
|
159 |
|
160 |
/* End of msgstrs.c */
|