| 1 | /* $Id: kRdr.h 3550 2007-08-26 01:13:35Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | * kRdr - The File Provider.
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | /*
|
|---|
| 7 | * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of kStuff.
|
|---|
| 10 | *
|
|---|
| 11 | * kStuff is free software; you can redistribute it and/or modify
|
|---|
| 12 | * it under the terms of the GNU Lesser General Public License as published
|
|---|
| 13 | * by the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | * (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * kStuff 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
|
|---|
| 19 | * GNU Lesser General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU Lesser General Public License
|
|---|
| 22 | * along with kStuff; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | #ifndef ___kRdr_h___
|
|---|
| 28 | #define ___kRdr_h___
|
|---|
| 29 |
|
|---|
| 30 | #include <k/kDefs.h>
|
|---|
| 31 | #include <k/kTypes.h>
|
|---|
| 32 |
|
|---|
| 33 | /** @defgroup grp_kRdr kRdr - The File Provider
|
|---|
| 34 | * @{ */
|
|---|
| 35 |
|
|---|
| 36 | /** @def KRDR_DECL
|
|---|
| 37 | * Declares a kRdr function according to build context.
|
|---|
| 38 | * @param type The return type.
|
|---|
| 39 | */
|
|---|
| 40 | #if defined(KRDR_BUILDING_DYNAMIC)
|
|---|
| 41 | # define KRDR_DECL(type) K_DECL_EXPORT(type)
|
|---|
| 42 | #elif defined(KRDR_BUILT_DYNAMIC)
|
|---|
| 43 | # define KRDR_DECL(type) K_DECL_IMPORT(type)
|
|---|
| 44 | #else
|
|---|
| 45 | # define KRDR_DECL(type) type
|
|---|
| 46 | #endif
|
|---|
| 47 |
|
|---|
| 48 | /** Pointer to a file provider instance. */
|
|---|
| 49 | typedef struct KRDR *PKRDR;
|
|---|
| 50 | /** Pointer to a file provider instance pointer. */
|
|---|
| 51 | typedef struct KRDR **PPKRDR;
|
|---|
| 52 |
|
|---|
| 53 | #ifdef __cplusplus
|
|---|
| 54 | extern "C" {
|
|---|
| 55 | #endif
|
|---|
| 56 |
|
|---|
| 57 | KRDR_DECL(int) kRdrOpen( PPKRDR ppRdr, const char *pszFilename);
|
|---|
| 58 | KRDR_DECL(int) kRdrClose( PKRDR pRdr);
|
|---|
| 59 | KRDR_DECL(int) kRdrRead( PKRDR pRdr, void *pvBuf, KSIZE cb, KFOFF off);
|
|---|
| 60 | KRDR_DECL(int) kRdrAllMap( PKRDR pRdr, const void **ppvBits);
|
|---|
| 61 | KRDR_DECL(int) kRdrAllUnmap( PKRDR pRdr, const void *pvBits);
|
|---|
| 62 | KRDR_DECL(KFOFF) kRdrSize( PKRDR pRdr);
|
|---|
| 63 | KRDR_DECL(KFOFF) kRdrTell( PKRDR pRdr);
|
|---|
| 64 | KRDR_DECL(const char *) kRdrName( PKRDR pRdr);
|
|---|
| 65 | KRDR_DECL(KIPTR) kRdrNativeFH( PKRDR pRdr);
|
|---|
| 66 | KRDR_DECL(KSIZE) kRdrPageSize( PKRDR pRdr);
|
|---|
| 67 | #ifdef ___k_kLdr___
|
|---|
| 68 | KRDR_DECL(int) kRdrMap( PKRDR pRdr, void **ppvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fFixed);
|
|---|
| 69 | KRDR_DECL(int) kRdrRefresh( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments);
|
|---|
| 70 | KRDR_DECL(int) kRdrProtect( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments, KBOOL fUnprotectOrProtect);
|
|---|
| 71 | KRDR_DECL(int) kRdrUnmap( PKRDR pRdr, void *pvBase, KU32 cSegments, PCKLDRSEG paSegments);
|
|---|
| 72 | #endif /* !___k_kLdr___ */
|
|---|
| 73 | KRDR_DECL(void) kRdrDone( PKRDR pRdr);
|
|---|
| 74 |
|
|---|
| 75 | KRDR_DECL(int) kRdrBufOpen(PPKRDR ppRdr, const char *pszFilename);
|
|---|
| 76 | KRDR_DECL(int) kRdrBufWrap(PPKRDR ppRdr, PKRDR pRdr, KBOOL fCloseIt);
|
|---|
| 77 | KRDR_DECL(KBOOL) kRdrBufIsBuffered(PKRDR pRdr);
|
|---|
| 78 | KRDR_DECL(int) kRdrBufLine(PKRDR pRdr, char *pszLine, KSIZE cbLine);
|
|---|
| 79 | KRDR_DECL(int) kRdrBufLineEx(PKRDR pRdr, char *pszLine, KSIZE *pcbLine);
|
|---|
| 80 | KRDR_DECL(const char *) kRdrBufLineQ(PKRDR pRdr);
|
|---|
| 81 |
|
|---|
| 82 | #ifdef __cplusplus
|
|---|
| 83 | }
|
|---|
| 84 | #endif
|
|---|
| 85 |
|
|---|
| 86 | /** @} */
|
|---|
| 87 |
|
|---|
| 88 | #endif
|
|---|
| 89 |
|
|---|