X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Fkstddef.h;fp=include%2Fkstddef.h;h=0000000000000000000000000000000000000000;hp=75cde29a102805d46bbbee338813959f16ebcb08;hb=0fe37e9c318904715493dc9c894f658c43e6178e;hpb=63ddd1048df804cc73f21c1cdaf70f32324d0197 diff --git a/include/kstddef.h b/include/kstddef.h deleted file mode 100644 index 75cde29..0000000 --- a/include/kstddef.h +++ /dev/null @@ -1,188 +0,0 @@ -/***************************************************************************** -** FILE IDENTIFICATION -** -** File Name: kstddef.h -** Author: Kevin Rosenberg -** Purpose: Header file containing KRL standard C definitions -** Date Started: Dec. 83 -** -** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg -** -** $Id: kstddef.h,v 1.18 2000/06/19 18:18:13 kevin Exp $ -** -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License (version 2) as -** published by the Free Software Foundation. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -******************************************************************************/ - -#ifndef STDDEF_H -#define STDDEF_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef _WIN32 -#define snprintf _snprintf -#endif - -#define STR_MAX_LEN 255 -#define STR_SIZE STR_MAX_LEN+1 - -#include -#include -#include -#include - -#define TRUE 1 -#define FALSE 0 -#define OK TRUE -#define ERROR FALSE -#define YES TRUE -#define NO FALSE - -/*----------------------------------------------------------------------*/ - -#define SHOW(var, fmt) { cerr << "var = " << var << endl; } - -/*----------------------------------------------------------------------*/ - -#define NEWLINE '\n' -#define TAB '\t' -#define EOS '\0' -#define BLANK ' ' - -/*----------------------------------------------------------------------*/ - -struct time_st { - int hour, minute, second, ms; -}; - -struct date_st { - int year, month, date, dow; -}; - -struct timedate_st { - struct time_st t; - struct date_st d; -}; - -typedef struct time_st TIME; -typedef struct date_st DATE; -typedef struct timedate_st TIMEDATE; - -/*----------------------------------------------------------------------*/ - -#define ERR_WARNING 0 -#define ERR_SEVERE 1 -#define ERR_FATAL 2 - -/*----------------------------------------------------------------------*/ - - -/* codes for open command */ -#if MICROSOFT -#define OPEN_RDONLY O_RDONLY /* other system use standard codes */ -#define OPEN_WRONLY O_WRONLY /* for binary */ -#define OPEN_RDWR O_RDWR -#else -#define OPEN_RDONLY 0 /* other system use standard codes */ -#define OPEN_WRONLY 1 /* for binary */ -#define OPEN_RDWR 2 -#endif - -/*----------------------------------------------------------------------*/ - -#ifndef O_BINARY -#define O_BINARY (0) -#endif - -#ifndef S_IWRITE -#define S_IWRITE S_IWUSR -#endif - -/*----------------------------------------------------------------------*/ - -#if defined(MICROSOFT) || ! defined(SIZEOF_INT) - #define SIZEOF_INT 4 - #define SIZEOF_LONG 4 - #define SIZEOF_SHORT 2 - #define SIZEOF_FLOAT 4 - #define SIZEOF_DOUBLE 8 -#endif - -typedef signed char kint8; -typedef unsigned char kuint8; - -#if SIZEOF_INT == 4 - typedef int kint32; - typedef unsigned int kuint32; -#elif SIZEOF_LONG == 4 - typedef long int kint32; - typedef unsigned int kuint32; -#endif - -#if SIZEOF_SHORT == 2 - typedef short int kint16; - typedef unsigned short int kuint16; -#elif SIZEOF_INT == 2 - typedef int kint16; - typedef unsigned int kuint16; -#endif - -#if SIZEOF_FLOAT == 4 - typedef float kfloat32; -#endif -#if SIZEOF_DOUBLE == 8 - typedef double kfloat64; -#endif - - -/* filefuncs.cpp */ -bool file_exists(const char* fname); -const char* fileBasename(const char* filename); -FILE *sys_fopen(const char *filename, const char *mode, const char *progname); - -/* strfuncs.cpp */ -char* str_skip_head(const char* str, const char* const charlist); -char* str_skip_head(const char* str, char* charlist); -char *str_lower(char *s); -char *str_wrm_tail(char *str); -char *str_rm_tail(char *str, const char* const charlist); -char *str_upper(char *str); - -/* syserror.cpp */ -void sys_error(int severity, const char *msg, ...); -void sys_verror(int severity, const char *msg, va_list arg); -void sys_error_level(int severity); - -/* timedate.cpp */ -DATE *td_get_date(DATE *d); -TIME *td_get_time(TIME *t); -double td_current_sec(void); -double td_time_to_sec(TIME *t); -TIME *td_time_sub(const TIME *t1, const TIME *t2, TIME *tdiff); -TIME *td_time_add(const TIME *t1, const TIME *t2, TIME *tsum); -TIME *td_time_copy(TIME *to, const TIME *from); -TIME *td_time_norm(TIME *t); -void td_get_tmdt(TIMEDATE *td); -const char *td_str_tmdt(const TIMEDATE *td); -const char *td_str_time(const TIME *t); -const char *td_str_stime(const TIME *t); -const char *td_str_date(const DATE *d); -char *td_str_cdate(DATE *d); -char *td_month_name(int n); -char *td_day_name(int n); - -#endif