• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*---------------------------------------------------------------------------*
2  *  pstdio.h  *
3  *                                                                           *
4  *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5  *                                                                           *
6  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7  *  you may not use this file except in compliance with the License.         *
8  *                                                                           *
9  *  You may obtain a copy of the License at                                  *
10  *      http://www.apache.org/licenses/LICENSE-2.0                           *
11  *                                                                           *
12  *  Unless required by applicable law or agreed to in writing, software      *
13  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15  *  See the License for the specific language governing permissions and      *
16  *  limitations under the License.                                           *
17  *                                                                           *
18  *---------------------------------------------------------------------------*/
19 
20 #ifndef PSTDIO_H
21 #define PSTDIO_H
22 
23 
24 
25 #include <stdio.h>
26 #include "PortPrefix.h"
27 #include "ptypes.h"
28 #include "PFile.h"
29 #include "ESR_ReturnCode.h"
30 
31 /**
32  * File table structure for memory FS
33  */
34 typedef struct FileRecord_t
35 {
36   /**
37    * file name
38       */
39   char name[80];
40   /**
41    * pointer to the file data
42    */
43   unsigned char *start;
44   /**
45       * real size of the file
46       */
47   int size;
48   /**
49       * total size in memory
50       */
51   int memsize;
52   /**
53    * mode: 0/1: text/binary
54    */
55   int mode;
56 }
57 FileRecord;
58 
59 #ifdef _WIN32
60 
61 #include "direct.h"
62 #include "stdlib.h"
63 
64 /**
65  * @addtogroup ESR_PortableModule ESR_Portable API functions
66  *
67  * @{
68  */
69 
70 /**
71  * Platform-independant maximum filename path length.
72  */
73 #define P_PATH_MAX _MAX_PATH
74 
75 /**
76  * Platform-independant maximum command-line length. In reality this value is shell-specific
77  * and is around 32k for WindowsNT however we can't spare that much stack-space and we assume
78  * such a large value will never actually occur so we settle for 4k instead.
79  */
80 #define P_CMDLINE_MAX 4000
81 /**
82  * @}
83  */
84 
85 #else
86 
87 #if defined(PATH_MAX)
88 #define P_PATH_MAX PATH_MAX
89 #elif defined(MAXPATHLEN)
90 #define P_PATH_MAX MAXPATHLEN
91 #else
92 #error "Cannot determine value for P_PATH_MAX."
93 #endif /* PATH_MAX */
94 
95 #endif /* _WIN32 */
96 
97 #endif
98