Tesseract  3.02
tesseract-ocr/ccutil/scanutils.h
Go to the documentation of this file.
00001 // Copyright 2006 Google Inc.
00002 // All Rights Reserved.
00003 // Author: renn
00004 //
00005 // Contains file io functions (mainly for file parsing), that might not be 
00006 // available, on embedded devices, or that have an incomplete implementation 
00007 // there.
00008 //
00009 // Licensed under the Apache License, Version 2.0 (the "License");
00010 // you may not use this file except in compliance with the License.
00011 // You may obtain a copy of the License at
00012 // http://www.apache.org/licenses/LICENSE-2.0
00013 // Unless required by applicable law or agreed to in writing, software
00014 // distributed under the License is distributed on an "AS IS" BASIS,
00015 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016 // See the License for the specific language governing permissions and
00017 // limitations under the License.
00018 
00019 #ifndef TESSERACT_CCUTIL_SCANUTILS_H_
00020 #define TESSERACT_CCUTIL_SCANUTILS_H_
00021 
00022 #ifdef EMBEDDED
00023 
00024 #include <stdint.h>
00025 #include <stddef.h>
00026 #include <stdio.h>
00027 //#include <klibc/extern.h>
00028 #include <sys/stat.h>
00029 
00030 // Attempts to parse the given file stream s as an integer of the base
00031 // 'base'. Returns the first successfully parsed integer as a uintmax_t, or
00032 // 0, if none was found.
00033 uintmax_t streamtoumax(FILE* s, int base);
00034 
00035 // Parse a file stream according to the given format. See the fscanf manpage
00036 // for more information, as this function attempts to mimic its behavior.
00037 // Note that scientific loating-point notation is not supported.
00038 int fscanf(FILE* stream, const char *format, ...);
00039 
00040 // Parse a file stream according to the given format. See the fscanf manpage
00041 // for more information, as this function attempts to mimic its behavior.
00042 // Note that scientific loating-point notation is not supported.
00043 int vfscanf(FILE* stream, const char *format, va_list ap);
00044 
00045 // Create a file at the specified path. See the creat manpage for more 
00046 // information, as this function attempts to mimic its behavior.
00047 int creat(const char *pathname, mode_t mode);
00048 
00049 // Convert the specified C-String to a float. Returns the first parsed float,
00050 // or 0.0 if no floating point value could be found. Note that scientific
00051 // floating-point notation is not supported.
00052 double strtofloat(const char* s);
00053 
00054 #endif  // EMBEDDED
00055 
00056 #endif  // TESSERACT_CCUTIL_SCANUTILS_H_