musicio.h
musicmud-2.1.6/include/musicio.h · 1.3 KB
From the archive musicmud2.1.6.tar.gz
Download the archive « Back to the archive contents
#ifndef MUSICIO_H
#define MUSICIO_H
#include <string>
#include <stdio.h>
#include <sys/types.h>
#include "base.h"
//! Core I/O and fd leak tracking code.
namespace musicio {
typedef FILE XFILE;
//! File descriptor tracking info
class FileInfo : public base {
public:
int toselect;
FileInfo() : base(), toselect(0) { }
};
//! Info for every file descriptor
extern FileInfo *fds[1024];
//! open and register file
XFILE *xopen(const char *, const char *, const char *, const char *, int);
//! close file and unregister it
void xclose(XFILE *);
#define xopen(a, b, c) xopen(a, b, c, __FILE__, __LINE__);
//! open and register temporary file
XFILE *xopen_tmp(const char *a, const char *b, const char *c, const char *d, int e);
#define xopen_tmp(a, b, c) xopen_tmp(a, b, c, __FILE__, __LINE__);
//! close and rename temporary file over real file
void xclose_confirm(XFILE *xf, const char *b, const char *c);
//! register a descriptor
void xreg(int, const char *, const char *, int);
//! unregister a descriptor
void xunreg(int);
#define xreg(a, b) xreg(a, b, __FILE__, __LINE__);
//! safely remove a file
void xunlink(const char *, const char *);
//! mark a fd for listening to
void xselect(int);
//! get list of all fds that should be listened to
int makefdset(fd_set *set);
}
using namespace musicio;
#endif