~ubuntu-branches/ubuntu/precise/ncbi-tools6/precise

« back to all changes in this revision

Viewing changes to api/prtutil.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
*   
30
30
* Version Creation Date: 4/1/93
31
31
*
32
 
* $Revision: 6.1 $
 
32
* $Revision: 6.3 $
33
33
*
34
34
* File Description:  Object Print Utilities
35
35
*
40
40
* 04-24-94 Kans        Template sought first in program, then DATA directory
41
41
*
42
42
* $Log: prtutil.c,v $
 
43
* Revision 6.3  2004/02/02 18:09:34  kans
 
44
* typo in PrintTemplateSetLoadEx
 
45
*
 
46
* Revision 6.2  2004/02/02 17:30:21  kans
 
47
* PrintTemplateSetLoadEx takes a local string, used to make internal copy of objprt.prt in Sequin
 
48
*
43
49
* Revision 6.1  1998/12/29 19:55:53  kans
44
50
* more informative error message if FindPath fails
45
51
*
113
119
*       If path== NULL, looks for "prt.prt" in the "data" directory
114
120
*
115
121
*****************************************************************************/
116
 
NLM_EXTERN Boolean PrintTemplateSetLoad ( CharPtr path )
 
122
static Boolean PrintTemplateSetLoadInt ( CharPtr path, Boolean verbose )
117
123
{
118
124
        AsnIoPtr aip;
119
125
        FILE *f;
127
133
        if (path != NULL && *path != '\0' && StringRChr (path, DIRDELIMCHR) != NULL) {
128
134
                StringNCpy (fullpath, path, sizeof (fullpath) - 1);
129
135
                if ((aip = AsnIoOpen (fullpath, "r")) == NULL) {
130
 
                        ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
 
136
                    if (verbose) {
 
137
                        ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
 
138
                    }
131
139
                        return FALSE;
132
140
                }
133
141
        } else {
150
158
                        if (FindPath ("NCBI", "NCBI", "DATA", fullpath, sizeof (fullpath) - 1)) {
151
159
                                FileBuildPath (fullpath, NULL, filename);
152
160
                                if ((aip = AsnIoOpen (fullpath, "r")) == NULL) {
153
 
                                        ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
 
161
                                    if (verbose) {
 
162
                                            ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
 
163
                                    }
154
164
                                        return FALSE;
155
165
                                }
156
166
                        } else {
157
 
                                ErrPost(CTX_NCBIOBJ, 1, "FindPath failed in PrintTemplateSetLoad - ncbi configuration file missing or incorrect");
 
167
                            if (verbose) {
 
168
                                ErrPost(CTX_NCBIOBJ, 1, "FindPath failed in PrintTemplateSetLoad - ncbi configuration file missing or incorrect");
 
169
                            }
158
170
                                return FALSE;
159
171
                        }
160
172
                } else {
161
173
                        ErrSetMessageLevel (lastLevel);
162
174
                        FileClose (f);
163
175
                        if ((aip = AsnIoOpen(fullpath, "r")) == NULL) {
164
 
                                ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
 
176
                            if (verbose) {
 
177
                                    ErrPost(CTX_NCBIOBJ, 1, "Couldn't open [%s]", fullpath);
 
178
                            }
165
179
                                return FALSE;
166
180
                        }
167
181
                }
173
187
    return retval;
174
188
}
175
189
 
 
190
static Boolean LoadObjPrtFromLocalString (CharPtr localStr)
 
191
 
 
192
{
 
193
  Boolean     retval = FALSE;
 
194
#ifndef WIN16
 
195
  AsnIoMemPtr aimp;
 
196
 
 
197
  aimp = AsnIoMemOpen ("r", (BytePtr) localStr, (Int4) StringLen (localStr));
 
198
  if (aimp == NULL || aimp->aip == NULL) return FALSE;
 
199
  retval = PrintTemplateSetAsnRead (aimp->aip);
 
200
  AsnIoMemClose (aimp);
 
201
#endif
 
202
  return retval;
 
203
}
 
204
 
 
205
NLM_EXTERN Boolean PrintTemplateSetLoadEx ( CharPtr path, CharPtr localStr )
 
206
 
 
207
{
 
208
  Boolean  verbose = TRUE;
 
209
 
 
210
  if (StringDoesHaveText (localStr)) {
 
211
    verbose = FALSE;
 
212
  }
 
213
  if (PrintTemplateSetLoadInt (path, verbose)) return TRUE;
 
214
  if (verbose) return FALSE;
 
215
  return LoadObjPrtFromLocalString (localStr);
 
216
}
 
217
 
 
218
NLM_EXTERN Boolean PrintTemplateSetLoad ( CharPtr path )
 
219
 
 
220
{
 
221
  return PrintTemplateSetLoadEx (path, NULL);
 
222
}
 
223
 
176
224
/*****************************************************************************
177
225
*
178
226
*   PrintStackItemNew(psp)