/[dtapublic]/projs/dtats/trunk/shared_source/c_tclxtens_7_5/msgstrs.c
ViewVC logotype

Diff of /projs/dtats/trunk/shared_source/c_tclxtens_7_5/msgstrs.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.68  
changed lines
  Added in v.98

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25