less dependencies: handle.h forward-defines Handle, so that not everything that uses res headers is dependent on h_mgr

This was SVN commit r1213.
This commit is contained in:
janwas 2004-10-06 14:00:43 +00:00
parent 53f8283cfc
commit 4f230f061d
18 changed files with 51 additions and 42 deletions

View File

@ -9,8 +9,8 @@
#include "lib/sysdep/win/win_internal.h"
#endif
#include "lib/res/res.h"
#include "lib/res/ogl_tex.h"
#include "res.h"
#include "ogl_tex.h"
#include "lib/ogl.h"
#include "CVFSFile.h"

View File

@ -20,9 +20,8 @@
#include "precompiled.h"
#include "lib.h"
#include "res.h"
#include "file.h"
#include "h_mgr.h"
#include "mem.h"
#include "detect.h"
#include "adts.h"
#include "sysdep/sysdep.h"

View File

@ -19,8 +19,7 @@
#include "precompiled.h"
#include "lib.h"
#include "h_mgr.h"
#include "mem.h"
#include "res.h"
#include <assert.h>
#include <limits.h> // CHAR_BIT

View File

@ -19,18 +19,18 @@
#ifndef H_MGR_H__
#define H_MGR_H__
// do not include from public header files!
// handle.h declares type Handle, and avoids making
// everything dependent on this (rather often updated) header.
#include <stdarg.h> // type init routines get va_list of args
#include "lib.h"
// 0 = invalid handle value; < 0 is an error code.
// 64 bits, because we want tags to remain unique: tag overflow may
// let handle use errors slip through, or worse, cause spurious errors.
// with 32 bits, we'd need >= 12 for the index, leaving < 512K tags -
// not a lot.
typedef i64 Handle;
#ifndef HANDLE_DEFINED
#include "handle.h"
#endif

9
source/lib/res/handle.h Executable file
View File

@ -0,0 +1,9 @@
// define type Handle. split out of h_mgr.h to reduce dependencies.
// 0 = invalid handle value; < 0 is an error code.
// 64 bits, because we want tags to remain unique: tag overflow may
// let handle use errors slip through, or worse, cause spurious errors.
// with 32 bits, we'd need >= 12 for the index, leaving < 512K tags -
// not a lot.
typedef i64 Handle;
#define HANDLE_DEFINED

13
source/lib/res/hotload.h Executable file
View File

@ -0,0 +1,13 @@
extern int res_reload(const char* fn);
// the following functions must be called from the same thread!
// (wdir_watch limitation)
extern int res_watch_dir(const char* const path, intptr_t* const watch);
extern int res_cancel_watch(const intptr_t watch);
extern int res_reload_changed_files();

View File

@ -4,7 +4,6 @@
#include "lib.h"
#include "res.h"
#include "h_mgr.h"
#include <stdlib.h>
#include <assert.h>

View File

@ -1,7 +1,7 @@
#ifndef MEM_H
#define MEM_H
#include "h_mgr.h"
#include "handle.h"
#ifdef __cplusplus

View File

@ -1,7 +1,7 @@
#include "precompiled.h"
#include "ogl.h"
#include "res.h"
#include "ogl.h"
#include "tex.h"
#include "ogl_tex.h"

View File

@ -1,7 +1,7 @@
#ifndef OGL_TEX_H__
#define OGL_TEX_H__
#include "lib/res/h_mgr.h"
#include "handle.h"
// load and return a handle to the texture given in <fn>.
// supports RAW, BMP, JP2, PNG, TGA, DDS

View File

@ -1,13 +1,15 @@
#include "precompiled.h"
#include "res.h"
#include "file.h"
#include "file.h" // file_make_native_path
#include "timer.h"
#include "hotload.h" // we implement that interface
#include "sysdep/dir_watch.h"
#include <string.h>
int res_reload(const char* const fn)
{
return h_reload(fn);

View File

@ -1,17 +1,5 @@
#include "res/h_mgr.h"
#include "res/vfs.h"
#include "res/mem.h"
// common headers needed by lib/res code
extern int res_reload(const char* fn);
// the following functions must be called from the same thread!
// (wfam limitation)
extern int res_watch_dir(const char* const path, intptr_t* const watch);
extern int res_cancel_watch(const intptr_t watch);
extern int res_reload_changed_files();
#include "h_mgr.h"
#include "vfs.h"
#include "mem.h"

View File

@ -1,4 +1,4 @@
#include "res/h_mgr.h"
#include "handle.h"
// prepare to enumerate all device names (this resets the list returned by

View File

@ -19,7 +19,7 @@
#ifndef __TEX_H__
#define __TEX_H__
#include "h_mgr.h"
#include "handle.h"

View File

@ -1,15 +1,14 @@
// $Id: unifont.h,v 1.6 2004/09/06 02:24:05 gee Exp $
// $Id: unifont.h,v 1.7 2004/10/06 14:00:43 janwas Exp $
#ifndef __UNIFONT_H__
#define __UNIFONT_H__
//#include "types.h"
#include "h_mgr.h"
#include "handle.h"
// Load and return a handle to the font defined
// in fn+".fnt" with texture fn+".tga"
Handle unifont_load(const char* fn, int scope = RES_STATIC);
Handle unifont_load(const char* fn, int scope = 0);
// Release a handle to a previously loaded font
int unifont_unload(Handle& h);

View File

@ -24,6 +24,7 @@
#include "zip.h"
#include "file.h"
#include "adts.h"
#include "hotload.h" // see NO_DIR_WATCH
#include <string.h>

View File

@ -20,7 +20,7 @@
#ifndef __VFS_H__
#define __VFS_H__
#include "h_mgr.h" // Handle
#include "handle.h" // Handle def
#include "posix.h" // struct stat
#include "file.h" // file open flags (renamed)

View File

@ -19,7 +19,7 @@
#ifndef ZIP_H__
#define ZIP_H__
#include "h_mgr.h"
#include "handle.h"
#include "file.h" // FileCB for zip_enum