Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scanutils.h
Go to the documentation of this file.
1 // Copyright 2006 Google Inc.
2 // All Rights Reserved.
3 // Author: renn
4 //
5 // Contains file io functions (mainly for file parsing), that might not be
6 // available, on embedded devices, or that have an incomplete implementation
7 // there.
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 
19 #ifndef TESSERACT_CCUTIL_SCANUTILS_H_
20 #define TESSERACT_CCUTIL_SCANUTILS_H_
21 
22 #ifdef EMBEDDED
23 
24 #include <stdint.h>
25 #include <stddef.h>
26 #include <stdio.h>
27 //#include <klibc/extern.h>
28 #include <sys/stat.h>
29 
30 // Attempts to parse the given file stream s as an integer of the base
31 // 'base'. Returns the first successfully parsed integer as a uintmax_t, or
32 // 0, if none was found.
33 uintmax_t streamtoumax(FILE* s, int base);
34 
35 // Parse a file stream according to the given format. See the fscanf manpage
36 // for more information, as this function attempts to mimic its behavior.
37 // Note that scientific loating-point notation is not supported.
38 int fscanf(FILE* stream, const char *format, ...);
39 
40 // Parse a file stream according to the given format. See the fscanf manpage
41 // for more information, as this function attempts to mimic its behavior.
42 // Note that scientific loating-point notation is not supported.
43 int vfscanf(FILE* stream, const char *format, va_list ap);
44 
45 // Create a file at the specified path. See the creat manpage for more
46 // information, as this function attempts to mimic its behavior.
47 int creat(const char *pathname, mode_t mode);
48 
49 // Convert the specified C-String to a float. Returns the first parsed float,
50 // or 0.0 if no floating point value could be found. Note that scientific
51 // floating-point notation is not supported.
52 double strtofloat(const char* s);
53 
54 #endif // EMBEDDED
55 
56 #endif // TESSERACT_CCUTIL_SCANUTILS_H_