1 /* @include ajfile ************************************************************
2 **
3 ** AJAX file routines
4 **
5 ** @author Copyright (C) 1999 Peter Rice
6 ** @version $Revision: 1.89 $
7 ** @modified May 14 Jon Ison Added ajFileExtnTrim & ajFileDirExtnTrim
8 ** @modified $Date: 2013/01/31 13:25:12 $ by $Author: rice $
9 ** @@
10 **
11 ** This library is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU Lesser General Public
13 ** License as published by the Free Software Foundation; either
14 ** version 2.1 of the License, or (at your option) any later version.
15 **
16 ** This library is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ** Lesser General Public License for more details.
20 **
21 ** You should have received a copy of the GNU Lesser General Public
22 ** License along with this library; if not, write to the Free Software
23 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 ** MA  02110-1301,  USA.
25 **
26 ******************************************************************************/
27 
28 #ifndef AJFILE_H
29 #define AJFILE_H
30 
31 /* ========================================================================= */
32 /* ============================= include files ============================= */
33 /* ========================================================================= */
34 
35 #include "ajdefine.h"
36 #include "ajstr.h"
37 #include "ajlist.h"
38 
39 #include <sys/stat.h>
40 
41 #ifdef WIN32
42 #include "win32.h"
43 #endif /* WIN32 */
44 
45 AJ_BEGIN_DECLS
46 
47 
48 
49 
50 /* ========================================================================= */
51 /* =============================== constants =============================== */
52 /* ========================================================================= */
53 
54 
55 
56 
57 #ifndef WIN32
58 #define AJ_FILE_R S_IRUSR
59 #define AJ_FILE_W S_IWUSR
60 #define AJ_FILE_X S_IXUSR
61 #define HANDLE void*
62 #else /* WIN32 */
63 #define AJ_FILE_R S_IREAD
64 #define AJ_FILE_W S_IWRITE
65 #define AJ_FILE_X S_IEXEC
66 #define pid_t void*
67 #endif /* !WIN32 */
68 
69 #define MAJFILETELL(file) (file->fp ? ftell(file->fp) : 0L)
70 
71 
72 
73 
74 /* @enum AjEOutfileType *******************************************************
75 **
76 ** AJAX Outfile Type enumeration
77 **
78 ** @value ajEOutfileTypeUnknown Unknown - none of these
79 ** @value ajEOutfileTypeAssembly Assembly
80 ** @value ajEOutfileTypeCodon Codon usage
81 ** @value ajEOutfileTypeCPDB Clean PDB
82 ** @value ajEOutfileTypeDiscrete Discrete data
83 ** @value ajEOutfileTypeDistance Distance matrix data
84 ** @value ajEOutfileTypeFrequency Frequency data
85 ** @value ajEOutfileTypeMatrix Integer matrix data
86 ** @value ajEOutfileTypeMatrixF Floating point matrix data
87 ** @value ajEOutfileTypeOBO OBO ontology data
88 ** @value ajEOutfileTypeProperties Phylogenetic properties
89 ** @value ajEOutfileTypeRefseq Reference sequence data
90 ** @value ajEOutfileTypeResource Data resource catalogue data
91 ** @value ajEOutfileTypeSCOP SCOP data
92 ** @value ajEOutfileTypeTaxon NCBI taxonomy data
93 ** @value ajEOutfileTypeText Text data
94 ** @value ajEOutfileTypeTree Phylogenetic tree data
95 ** @value ajEOutfileTypeURL URL data
96 ** @value ajEOutfileTypeVariation Variation data
97 ** @value ajEOutfileTypeXml XML data
98 ** @@
99 ******************************************************************************/
100 
101 typedef enum AjOOutfileType
102 {
103     ajEOutfileTypeUnknown,
104     ajEOutfileTypeAssembly,
105     ajEOutfileTypeCodon,
106     ajEOutfileTypeCPDB,
107     ajEOutfileTypeDiscrete,
108     ajEOutfileTypeDistance,
109     ajEOutfileTypeFrequency,
110     ajEOutfileTypeMatrix,
111     ajEOutfileTypeMatrixF,
112     ajEOutfileTypeOBO,
113     ajEOutfileTypeProperties,
114     ajEOutfileTypeRefseq,
115     ajEOutfileTypeResource,
116     ajEOutfileTypeSCOP,
117     ajEOutfileTypeTaxon,
118     ajEOutfileTypeText,
119     ajEOutfileTypeTree,
120     ajEOutfileTypeURL,
121     ajEOutfileTypeVariation,
122     ajEOutfileTypeXml
123 } AjEOutfileType;
124 
125 
126 
127 
128 /* ========================================================================= */
129 /* ============================== public data ============================== */
130 /* ========================================================================= */
131 
132 
133 
134 
135 /* @data AjPFile **************************************************************
136 **
137 ** Ajax file object. Holds information for an open (unbuffered)
138 ** input or output file.
139 **
140 ** On output, conversion code "%F" writes the filename.
141 **
142 ** @alias AjSFile
143 ** @alias AjOFile
144 **
145 ** @attr fp [FILE*] C file pointer
146 ** @attr Name [AjPStr] File name as used when opening
147 ** @attr Printname [AjPStr] File name in a clean form for reporting
148 ** @attr List [AjPList] List of file names (first is open)
149 ** @attr End [AjBool] True if EOF has been reached
150 ** @attr App [AjBool] True if file was opened for append.
151 ** @attr Buff [AjPStr] Buffer for latest line read
152 ** @attr Workbuffer [char*] Block as a buffer for fgets etc
153 ** @attr Readblock [char*] Block as a buffer for fread
154 ** @attr Filepos [ajlong] File offset for start of latest read
155 ** @attr Blocksize [ajuint] Read block maximum size
156 ** @attr Blockpos [ajuint] Read block position
157 ** @attr Blocklen [ajuint] Read block length used
158 ** @attr Buffsize [ajuint] Buffer size (zero for default size)
159 ** @attr Handle [ajint] AJAX file number 0 if unused
160 ** @attr Pid [pid_t] Process PID if any (non-WIN32 only)
161 ** @attr Process [HANDLE] Process handle (WIN32 only)
162 ** @attr Thread [HANDLE] Thread handle (WIN32 only)
163 ** @@
164 ******************************************************************************/
165 
166 typedef struct AjSFile
167 {
168     FILE *fp;
169     AjPStr Name;
170     AjPStr Printname;
171     AjPList List;
172     AjBool End;
173     AjBool App;
174     AjPStr Buff;
175     char *Workbuffer;
176     char *Readblock;
177     ajlong Filepos;
178     ajuint Blocksize;
179     ajuint Blockpos;
180     ajuint Blocklen;
181     ajuint Buffsize;
182     ajint Handle;
183     pid_t Pid;
184     HANDLE Process;
185     HANDLE Thread;
186 } AjOFile;
187 
188 #define AjPFile AjOFile*
189 
190 
191 
192 
193 /* @data AjPFilebufflist ******************************************************
194 **
195 ** Ajax file buffer, holding a simple linked list of buffered lines.
196 ** This does not use the AjPList objects.
197 **
198 ** This is a substructure of the AjPFilebuff object.
199 **
200 ** @alias AjSFilebufflist
201 ** @alias AjSOilebufflist
202 **
203 ** @attr Line [AjPStr] String : this line
204 ** @attr Next [struct AjSFilebufflist*] Next line in the list, NULL for last
205 ** @attr Fpos [ajlong] File offset for start of this line
206 ** @@
207 ******************************************************************************/
208 
209 typedef struct AjSFilebufflist
210 {
211     AjPStr Line;
212     struct AjSFilebufflist* Next;
213     ajlong Fpos;
214 } AjOFilebufflist;
215 
216 #define AjPFilebufflist AjOFilebufflist*
217 
218 
219 
220 
221 /* @data AjPFilebuff **********************************************************
222 **
223 ** Ajax buffered file object. Holds information for a buffered input file.
224 **
225 ** @alias AjSFilebuff
226 ** @alias AjOFilebuff
227 **
228 ** @attr File [AjPFile] The input file - data to be buffered
229 ** @attr Lines [AjPFilebufflist] All lines ... where the data really is
230 ** @attr Freelines [AjPFilebufflist] Free list of lines for reuse
231 ** @attr Curr [AjPFilebufflist] Current line in Lines list
232 ** @attr Prev [AjPFilebufflist] Previous line (points to Curr for delete)
233 ** @attr Last [AjPFilebufflist] Last line for quick appending
234 ** @attr Freelast [AjPFilebufflist] Last free line for quick append
235 ** @attr Nobuff [AjBool] if true, do not buffer the file
236 ** @attr Pos [ajint] Position in list
237 ** @attr Size [ajint] Size of list
238 ** @attr FreeSize [ajint] Size of free list
239 ** @attr Fpos [ajlong] File position in File
240 ** @@
241 ******************************************************************************/
242 
243 typedef struct AjSFilebuff
244 {
245     AjPFile File;
246     AjPFilebufflist Lines;
247     AjPFilebufflist Freelines;
248     AjPFilebufflist Curr;
249     AjPFilebufflist Prev;
250     AjPFilebufflist Last;
251     AjPFilebufflist Freelast;
252     AjBool Nobuff;
253     ajint Pos;
254     ajint Size;
255     ajint FreeSize;
256     ajlong Fpos;
257 } AjOFilebuff;
258 
259 #define AjPFilebuff AjOFilebuff*
260 
261 
262 
263 
264 /* @data AjPDir ***************************************************************
265 **
266 ** Ajax directory object. Holds information for an open
267 ** input directory.
268 **
269 ** @alias AjSDir
270 ** @alias AjODir
271 **
272 ** @attr Name [AjPStr] Path
273 ** @attr Printname [AjPStr] Directory path in a clean form for reporting
274 ** @attr Prefix [AjPStr] Default filename prefix
275 ** @attr Extension [AjPStr] Default file extension
276 ** @@
277 ******************************************************************************/
278 
279 typedef struct AjSDir
280 {
281     AjPStr Name;
282     AjPStr Printname;
283     AjPStr Prefix;
284     AjPStr Extension;
285 } AjODir;
286 
287 #define AjPDir AjODir*
288 
289 
290 
291 
292 /* @data AjPDirout ************************************************************
293 **
294 ** Ajax output directory object. Holds information for an open
295 ** output directory.
296 **
297 ** @alias AjSDirout
298 ** @alias AjODirout
299 **
300 ** @attr Name [AjPStr] Path
301 ** @attr Printname [AjPStr] Directory path in a clean form for reporting
302 ** @attr Extension [AjPStr] Default file extension
303 ** @attr Created   [AjBool] New directory created
304 ** @attr Padding [char[4]] Padding to alignment boundary
305 ** @@
306 ******************************************************************************/
307 
308 typedef struct AjSDirout
309 {
310     AjPStr Name;
311     AjPStr Printname;
312     AjPStr Extension;
313     AjBool Created;
314     char Padding[4];
315 } AjODirout;
316 
317 #define AjPDirout AjODirout*
318 
319 
320 
321 
322 /* @data AjPOutfile ***********************************************************
323 **
324 ** Ajax file object. Holds information for an open (unbuffered)
325 ** input or output file.
326 **
327 ** On output, conversion code "%F" writes the filename.
328 **
329 ** @alias AjSOutfile
330 ** @alias AjOOutfile
331 **
332 ** @attr File [AjPFile] File object
333 ** @attr Type [AjPStr] Named data file type
334 ** @attr Formatstr [AjPStr] Format specific for this data type
335 ** @attr Cleanup [void function] Function to write remaining lines on closing
336 ** @attr OutData [void*] Format data for reuse, e.g. multiple entry output
337 ** @attr Itype [ajuint] Index number for Type
338 ** @attr Format [ajint] Index for Formatstr for this data type
339 ** @attr Records [ajuint] Number of records written
340 ** @attr Padding [char[4]] Padding to alignment boundary
341 ** @@
342 ******************************************************************************/
343 
344 typedef struct AjSOutfile
345 {
346     AjPFile File;
347     AjPStr Type;
348     AjPStr Formatstr;
349     void (*Cleanup) (struct AjSOutfile *outf);
350     void *OutData;
351     ajuint Itype;
352     ajint Format;
353     ajuint Records;
354     char Padding[4];
355 } AjOOutfile;
356 
357 #define AjPOutfile AjOOutfile*
358 
359 
360 
361 
362 /* ========================================================================= */
363 /* =========================== public functions ============================ */
364 /* ========================================================================= */
365 
366 
367 
368 
369 /*
370 ** Prototype definitions
371 */
372 
373 void           ajDirDel(AjPDir* pthis);
374 void           ajDiroutDel(AjPDirout* pthis);
375 const AjPStr   ajDirGetExt(const AjPDir thys);
376 const AjPStr   ajDirGetPath(const AjPDir thys);
377 const AjPStr   ajDirGetPrintpath(const AjPDir thys);
378 const AjPStr   ajDirGetPrefix(const AjPDir thys);
379 const AjPStr   ajDiroutGetExt(const AjPDirout thys);
380 const AjPStr   ajDiroutGetPath(const AjPDirout thys);
381 const AjPStr   ajDiroutGetPrintpath(const AjPDirout thys);
382 AjPDir         ajDirNewPath(const AjPStr path);
383 AjPDir         ajDirNewPathExt(const AjPStr path, const AjPStr ext);
384 AjPDir         ajDirNewPathPreExt(const AjPStr path, const AjPStr prefix,
385                                   const AjPStr ext);
386 AjBool         ajDiroutCreated(AjPDirout thys);
387 AjBool         ajDiroutExists(AjPDirout thys);
388 AjPDirout      ajDiroutNewPath(const AjPStr name);
389 AjPDirout      ajDiroutNewPathExt(const AjPStr name, const AjPStr ext);
390 AjBool         ajDiroutOpen(AjPDirout thys);
391 ajint          ajFilelistAddDirectory(AjPList list,
392                                       const AjPDir dir);
393 ajint          ajFilelistAddPathWildRecursiveIgnore(AjPList list,
394                                                     const AjPStr path,
395                                                     const AjPStr wildname,
396                                                     AjPList ignorelist);
397 void           ajDirnamePrintRecursiveIgnore(const AjPStr path,
398                                              AjPList ignorelist,
399                                              AjPFile outfile);
400 ajint          ajFilelistAddPath(AjPList list,
401                                  const AjPStr path);
402 ajint          ajFilelistAddPathDir(AjPList list,
403                                     const AjPStr path);
404 ajint          ajFilelistAddPathWild(AjPList list,
405                                      const AjPStr path,
406                                      const AjPStr filename);
407 ajint          ajFilelistAddPathWildDir(AjPList list,
408                                         const AjPStr path,
409                                         const AjPStr filename);
410 
411 void           ajFilebuffDel(AjPFilebuff* pthis);
412 AjPFilebuff    ajFilebuffNewNofile(void);
413 AjPFilebuff    ajFilebuffNewNameS(const AjPStr name);
414 AjPFilebuff    ajFilebuffNewNamePathC(const char* filename, const AjPStr dir);
415 AjPFilebuff    ajFilebuffNewNamePathS(const AjPStr filename, const AjPStr dir);
416 AjPFilebuff    ajFilebuffNewPathWild(const AjPStr path,
417                                      const AjPStr wildname);
418 AjPFilebuff    ajFilebuffNewPathWildExclude(const AjPStr path,
419                                             const AjPStr wildname,
420                                             const AjPStr exclude);
421 AjPFilebuff    ajFilebuffNewFromCfile(FILE *fp);
422 AjPFilebuff    ajFilebuffNewFromFile(AjPFile file);
423 AjPFilebuff    ajFilebuffNewLine(const AjPStr line);
424 AjPFilebuff    ajFilebuffNewListinList(AjPList list);
425 AjBool         ajFilebuffSetBuffered(AjPFilebuff thys);
426 void           ajFilebuffClear(AjPFilebuff thys, ajint lines);
427 void           ajFilebuffClearStore(AjPFilebuff thys, ajint lines,
428                                     const AjPStr rdline, AjBool store,
429                                     AjPStr *astr);
430 AjBool         ajFilebuffIsEmpty(const AjPFilebuff thys);
431 AjBool         ajFilebuffIsEnded(const AjPFilebuff thys);
432 AjBool         ajFilebuffIsEof(const AjPFilebuff thys);
433 AjPFile        ajFilebuffGetFile(const AjPFilebuff thys);
434 void           ajFilebuffFix(AjPFilebuff thys);
435 FILE*          ajFilebuffGetFileptr(const AjPFilebuff thys);
436 const AjPStr   ajFilebuffGetFirst(const AjPFilebuff thys);
437 AjBool         ajFilebuffIsBuffered(const AjPFilebuff thys);
438 void           ajFilebuffLoadAll(AjPFilebuff buff);
439 AjBool         ajFilebuffLoadReadurl(AjPFilebuff buff, const AjPStr url);
440 void           ajFilebuffLoadC(AjPFilebuff thys, const char* str);
441 void           ajFilebuffLoadS(AjPFilebuff thys, const AjPStr str);
442 AjBool         ajFilebuffSetUnbuffered(AjPFilebuff thys);
443 void           ajFilebuffTraceTitle(const AjPFilebuff thys, const char* title);
444 void           ajFilebuffReset(AjPFilebuff thys);
445 void           ajFilebuffResetPos(AjPFilebuff thys);
446 void           ajFilebuffResetStore(AjPFilebuff thys,
447                                     AjBool store, AjPStr *astr);
448 AjBool         ajFilebuffReopenFile(AjPFilebuff* Pbuff, AjPFile file);
449 ajuint         ajFilebuffHtmlNoheader(AjPFilebuff buff);
450 void           ajFilebuffHtmlStrip(AjPFilebuff thys);
451 AjBool         ajFilebuffHtmlPre(AjPFilebuff thys);
452 void           ajFilebuffTrace(const AjPFilebuff thys);
453 void           ajFilebuffTraceFull(const AjPFilebuff thys, size_t nlines,
454                                    size_t nfree);
455 void           ajFileClose(AjPFile *pthis);
456 AjBool         ajDirnameFixExists(AjPStr* dir);
457 void           ajDirnameFix(AjPStr* dir);
458 AjBool         ajDirnameUp(AjPStr* dir);
459 AjBool         ajDirnameFillPath(AjPStr* dir);
460 AjBool         ajFileIsEof(const AjPFile thys);
461 void           ajFileExit(void);
462 ajint          ajFilelistAddListname(AjPList list, const AjPStr files);
463 FILE*          ajFileGetFileptr(const AjPFile thys);
464 const AjPStr   ajFileValueCwd(void);
465 AjBool         ajFileIsAppend(const AjPFile thys);
466 AjBool         ajFilenameHasPath(const AjPStr name);
467 ajlong         ajFilenameGetSize(const AjPStr fname);
468 AjBool         ajFilenameTrimAll(AjPStr *fname);
469 AjBool         ajFilenameTrimExt(AjPStr* Pfilename);
470 AjBool         ajFilenameTrimPath(AjPStr* Pfilename);
471 AjBool         ajFilenameTrimPathExt(AjPStr* Pfilename);
472 const char*    ajFileGetNameC(const AjPFile thys);
473 const AjPStr   ajFileGetNameS(const AjPFile thys);
474 const char*    ajFileGetPrintnameC(const AjPFile thys);
475 const AjPStr   ajFileGetPrintnameS(const AjPFile thys);
476 AjBool         ajFilenameReplacePathS(AjPStr* filename, const AjPStr dir);
477 AjBool         ajFilenameReplacePathC(AjPStr* filename, const char* dir);
478 AjBool         ajFilenameReplaceExtC(AjPStr* filename, const char* extension);
479 AjBool         ajFilenameReplaceExtS(AjPStr* filename,
480                                      const AjPStr extension);
481 AjBool         ajFilenameSetExtC(AjPStr* filename, const char* extension);
482 AjBool         ajFilenameSetExtS(AjPStr* filename,
483                                  const AjPStr extension);
484 AjPFile        ajFileNewOutappendNameS(const AjPStr name);
485 AjPFile        ajFileNewListinList(AjPList list);
486 AjPFile        ajFileNewListinDirPre(const AjPDir dir, const AjPStr prefix);
487 AjPFile        ajFileNewListinNameDirS(const AjPStr name, const AjPDir dir);
488 AjPFile        ajFileNewListinPathWild(const AjPStr path,
489                                        const AjPStr wildname);
490 AjPFile        ajFileNewListinPathWildExclude(const AjPStr path,
491                                               const AjPStr wildname,
492                                               const AjPStr exclude);
493 
494 AjPFile        ajFileNewFromCfile(FILE* file);
495 AjPFile        ajFileNewInNameC(const char *name);
496 AjPFile        ajFileNewInNameS(const AjPStr name);
497 AjPFile        ajFileNewInBlockS(const AjPStr name, ajuint blocksize);
498 AjPFile        ajFileNewInPipe(const AjPStr name);
499 AjPFile        ajFileNewInNamePathC(const char* name, const AjPStr path);
500 AjPFile        ajFileNewInNamePathS(const AjPStr name, const AjPStr path);
501 AjPFile        ajFileNewOutNameC(const char *name);
502 AjPFile        ajFileNewOutNameS(const AjPStr name);
503 AjPFile        ajFileNewOutNameDirS(const AjPStr name, const AjPDirout dir);
504 AjPFile        ajFileNewOutNamePathS(const AjPStr name, const AjPStr path);
505 AjBool         ajFileReopenName(AjPFile thys, const AjPStr name);
506 AjBool         ajFileReopenNext(AjPFile thys);
507 ajint          ajFileSeek(AjPFile thys, ajlong offset, ajint wherefrom);
508 AjBool         ajFilenameExists(const AjPStr filename);
509 AjBool         ajFilenameExistsDir(const AjPStr filename);
510 AjBool         ajFilenameExistsExec(const AjPStr filename);
511 AjBool         ajFilenameExistsRead(const AjPStr filename);
512 AjBool         ajFilenameExistsWrite(const AjPStr filename);
513 AjBool         ajFilewildnameExists(const AjPStr wildname);
514 AjBool         ajFilewildnameExistsDir(const AjPStr wildname,
515                                        const AjPStr path);
516 AjBool         ajFileValueRedirectStderr(void);
517 AjBool         ajFileValueRedirectStdin(void);
518 AjBool         ajFileValueRedirectStdout(void);
519 AjBool         ajFileIsFile(const AjPFile file);
520 AjBool         ajFileIsStderr(const AjPFile file);
521 AjBool         ajFileIsStdin(const AjPFile file);
522 AjBool         ajFileIsStdout(const AjPFile file);
523 AjBool         ajFileFix(AjPFile file);
524 AjBool         ajFileResetEof(AjPFile thys);
525 ajlong         ajFileResetPos(AjPFile thys);
526 AjBool         ajFileSetEof(AjPFile thys);
527 AjBool         ajFilenameSetTempname(AjPStr* Pfilename);
528 AjBool         ajFilenameSetTempnamePathC(AjPStr* Pfilename,const char* txt);
529 AjBool         ajFilenameSetTempnamePathS(AjPStr* Pfilename, const AjPStr str);
530 AjBool         ajFilenameTestExclude(const AjPStr filename,
531                                      const AjPStr exclude,
532                                      const AjPStr include);
533 AjBool         ajFilenameTestInclude(const AjPStr filename,
534                                      const AjPStr exclude,
535                                      const AjPStr include);
536 AjBool         ajFilenameTestExcludePath(const AjPStr filename,
537                                          const AjPStr exclude,
538                                          const AjPStr include);
539 AjBool         ajFilenameTestIncludePath(const AjPStr filename,
540                                          const AjPStr exclude,
541                                          const AjPStr include);
542 void           ajFileTrace(const AjPFile thys);
543 void           ajFileSetUnbuffer(AjPFile thys);
544 
545 ajuint         ajFileValueBuffsize(void);
546 
547 
548 AjPOutfile     ajOutfileNewNameS(const AjPStr name);
549 void           ajOutfileClose(AjPOutfile* pthis);
550 AjPFile        ajOutfileGetFile(const AjPOutfile thys);
551 FILE*          ajOutfileGetFileptr(const AjPOutfile thys);
552 const AjPStr   ajOutfileGetFormat(const AjPOutfile thys);
553 ajuint         ajOutfileGetFormatindex(const AjPOutfile file);
554 void           ajOutfileReset(AjPOutfile outf);
555 
556 /*
557 ** End of prototype definitions
558 */
559 
560 
561 
562 
563 #ifdef AJ_COMPILE_DEPRECATED_BOOK
564 #endif /* AJ_COMPILE_DEPRECATED_BOOK */
565 
566 #ifdef AJ_COMPILE_DEPRECATED
567 
568 __deprecated AjBool         ajFileDirTrim(AjPStr* name);
569 __deprecated ajint          ajFileBuffSize(void);
570 __deprecated void           ajFileBuffClearStore(AjPFilebuff buff, ajint lines,
571                                                  const AjPStr rdline,
572                                                  AjBool store, AjPStr *astr);
573 __deprecated AjBool         ajFileBuffBuff(AjPFilebuff thys);
574 __deprecated AjBool         ajFileBuffEmpty(const AjPFilebuff thys);
575 __deprecated AjBool         ajFileBuffEnd(const AjPFilebuff thys);
576 __deprecated AjBool         ajFileBuffEof(const AjPFilebuff thys);
577 __deprecated AjPFile        ajFileBuffFile(const AjPFilebuff thys);
578 __deprecated void           ajFileBuffFix(AjPFilebuff thys);
579 __deprecated AjBool         ajFileBuffIsBuffered(const AjPFilebuff thys);
580 __deprecated FILE*          ajFileBuffFp(const AjPFilebuff thys);
581 __deprecated void           ajFileBuffTrace(const AjPFilebuff thys);
582 __deprecated void           ajFileBuffLoadC(AjPFilebuff thys, const char* str);
583 __deprecated void           ajFileBuffLoadS(AjPFilebuff thys, const AjPStr str);
584 __deprecated AjBool         ajFileBuffNobuff(AjPFilebuff thys);
585 __deprecated void           ajFileBuffPrint(const AjPFilebuff thys,
586                                             const char* title);
587 __deprecated void           ajFileBuffReset(AjPFilebuff thys);
588 __deprecated void           ajFileBuffResetPos(AjPFilebuff thys);
589 __deprecated void           ajFileBuffResetStore(AjPFilebuff thys,
590                                                  AjBool store, AjPStr *astr);
591 __deprecated void           ajFileBuffTraceFull(const AjPFilebuff thys,
592                                                 size_t nlines,
593                                                 size_t nfree);
594 __deprecated const AjPStr   ajFileGetName(const AjPFile thys);
595 __deprecated AjBool         ajFileGetwd(AjPStr* dir);
596 __deprecated AjBool         ajFileHasDir(const AjPStr name);
597 __deprecated ajlong         ajFileLength(const AjPStr fname);
598 __deprecated AjBool         ajFileNameShorten(AjPStr *fname);
599 __deprecated AjBool         ajFileNameTrim(AjPStr *fname);
600 __deprecated const char*    ajFileTempName(const char *dir);
601 __deprecated AjBool         ajFileTestSkip(const AjPStr fullname,
602                                            const AjPStr exc, const AjPStr inc,
603                                            AjBool keep,
604                                            AjBool ignoredirectory);
605 __deprecated AjBool         ajFileDir(AjPStr* dir);
606 __deprecated AjBool         ajFileDirExtnTrim(AjPStr* name);
607 __deprecated void           ajFileOutHeader(AjPFile thys);
608 __deprecated ajint          ajFileScan(const AjPStr path, const AjPStr filename,
609                                        AjPList *result,
610                                        AjBool show, AjBool dolist,
611                                        AjPList *list,
612                                        AjPList rlist, AjBool recurs,
613                                        AjPFile outf);
614 
615 __deprecated void           ajFileDirFix(AjPStr* dir);
616 __deprecated AjBool         ajFileDirPath(AjPStr* dir);
617 __deprecated AjBool         ajFileDirUp(AjPStr* dir);
618 __deprecated AjBool         ajFileExtnTrim(AjPStr* name);
619 __deprecated ajint          ajDirScan(const AjPStr path,
620                                       const AjPStr filename,
621                                       AjPList *result);
622 
623 __deprecated AjBool         ajFileSetDir(AjPStr *pname, const AjPStr dir);
624 __deprecated FILE*          ajOutfileFp(const AjPOutfile thys);
625 __deprecated AjBool         ajFileNameValid(const AjPStr filename);
626 __deprecated AjBool         ajFileStat(const AjPStr filename, ajint mode);
627 __deprecated AjPFile        ajOutfileFile(const AjPOutfile thys);
628 __deprecated AjPStr         ajOutfileFormat(const AjPOutfile thys);
629 __deprecated void           ajOutfileDel(AjPOutfile* pthis);
630 __deprecated AjPOutfile     ajOutfileNew(const AjPStr name);
631 __deprecated void           ajFileBuffStripHtml(AjPFilebuff thys);
632 __deprecated AjBool         ajFileBuffStripHtmlPre(AjPFilebuff thys);
633 __deprecated const AjPStr   ajFileNameS(const AjPFile thys);
634 __deprecated const char*    ajFileName(const AjPFile thys);
635 __deprecated AjPFilebuff ajFileBuffNewS(const AjPStr data);
636 __deprecated AjPFilebuff ajFileBuffNewList(AjPList list);
637 __deprecated AjBool         ajFileEof(const AjPFile thys);
638 __deprecated FILE*          ajFileFp(const AjPFile thys);
639 __deprecated AjBool         ajFileStderr(const AjPFile file);
640 __deprecated AjBool         ajFileStdin(const AjPFile file);
641 __deprecated AjBool         ajFileStdout(const AjPFile file);
642 __deprecated void           ajFileBuffDel(AjPFilebuff* pthis);
643 __deprecated AjPFilebuff    ajFileBuffNew(void);
644 __deprecated AjPFilebuff    ajFileBuffNewF(FILE *fp);
645 __deprecated void           ajFileBuffClear(AjPFilebuff thys, ajint lines);
646 __deprecated AjBool ajFileBuffSetFile(AjPFilebuff* pthys, AjPFile file,
647                                       AjBool samefile);
648 __deprecated AjBool         ajFileGetApp(const AjPFile thys);
649 __deprecated ajlong         ajFileTell(AjPFile thys);
650 __deprecated AjBool         ajFileNext(AjPFile thys);
651 __deprecated FILE*          ajFileReopen(AjPFile thys, const AjPStr name);
652 __deprecated const AjPStr      ajDirExt(const AjPDir thys);
653 __deprecated const AjPStr      ajDirName(const AjPDir thys);
654 __deprecated AjPDir      ajDirNew(const AjPStr name);
655 __deprecated AjPDir      ajDirNewS(const AjPStr name, const AjPStr ext);
656 __deprecated AjPDir      ajDirNewSS(const AjPStr name, const AjPStr prefix,
657                                     const AjPStr ext);
658 __deprecated AjPFile     ajFileNew(void);
659 __deprecated AjPFilebuff ajFileBuffNewIn(const AjPStr name);
660 __deprecated AjPFile     ajFileNewIn(const AjPStr name);
661 __deprecated AjPFile     ajFileNewInList(AjPList list);
662 __deprecated AjPFile     ajFileNewDW(const AjPStr dir, const AjPStr wildfile);
663 __deprecated AjPFile     ajFileNewDWE(const AjPStr dir, const AjPStr wildfile,
664                                       const AjPStr exclude);
665 
666 
667 __deprecated AjPFilebuff ajFileBuffNewFile(AjPFile file);
668 __deprecated AjPFilebuff ajFileBuffNewDW(const AjPStr dir,
669                                          const AjPStr wildfile);
670 __deprecated AjPFilebuff ajFileBuffNewDWE(const AjPStr dir,
671                                           const AjPStr wildfile,
672                                           const AjPStr exclude);
673 
674 __deprecated AjPFile     ajFileNewApp(const AjPStr name);
675 
676 __deprecated AjPFile ajFileNewOut(const AjPStr name);
677 
678 __deprecated AjPFile     ajFileNewOutD(const AjPStr dir, const AjPStr name);
679 __deprecated AjPFile     ajFileNewOutDir(const AjPDirout dir,
680                                          const AjPStr name);
681 __deprecated AjPFile     ajFileNewF(FILE* file);
682 __deprecated AjPDir ajDirOutNew(const AjPStr name);
683 __deprecated AjPDir ajDirOutNewS(const AjPStr name, const AjPStr ext);
684 __deprecated AjPDir ajDirOutNewSS(const AjPStr name,
685                                   const AjPStr prefix, const AjPStr ext);
686 
687 __deprecated AjPFilebuff  ajFileBuffNewDC(const AjPStr dir,
688                                           const char* filename);
689 __deprecated AjPFilebuff  ajFileBuffNewDF(const AjPStr dir,
690                                           const AjPStr filename);
691 __deprecated AjPFile      ajFileNewDC(const AjPStr dir,
692                                       const char* filename);
693 __deprecated AjPFile      ajFileNewDF(const AjPStr dir,
694                                       const AjPStr filename);
695 
696 __deprecated AjBool       ajFileNameDirSet(AjPStr* filename,
697                                            const AjPStr dir);
698 __deprecated AjBool       ajFileNameDirSetC(AjPStr* filename,
699                                             const char* dir);
700 __deprecated AjBool       ajFileNameExt(AjPStr* filename,
701                                         const AjPStr extension);
702 __deprecated AjBool       ajFileNameExtC(AjPStr* filename,
703                                          const char* extension);
704 
705 __deprecated AjPFile      ajFileNewDirF(const AjPDir dir,
706                                         const AjPStr filename);
707 
708 __deprecated void         ajFileUnbuffer(AjPFile thys);
709 __deprecated AjPFile        ajFileNewInC(const char *name);
710 
711 #endif /* AJ_COMPILE_DEPRECATED */
712 
713 
714 
715 
716 AJ_END_DECLS
717 
718 #endif /* !AJFILE_H */
719