AmiTimeKeeper/amiga.h

158 lines
4.2 KiB
C

/*
** This file is in the public domain.
*/
#ifndef AMIGA_H
#define AMIGA_H
/* Used by localtime.c but not by amiga */
#define O_CLOEXEC 0
#define _DIAGASSERT(x)
#define __aconst
/* Used by amiga.c */
#define SECONDSPERDAY 86400
/*
* The following macro is used to remove const cast-away warnings
* from gcc -Wcast-qual; it should be used with caution because it
* can hide valid errors; in particular most valid uses are in
* situations where the API requires it, not to cast away string
* constants. We don't use *intptr_t on purpose here and we are
* explicit about unsigned long so that we don't have additional
* dependencies.
*/
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
#define NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU 1
#define HAVE_STRFTIME_L 0
/* Thread safety */
#define rwlock_wrlock(x)
#define rwlock_unlock(x)
#define TIME_MAX ULONG_MAX
#include <stdarg.h>
#include <stddef.h>
#include "mem.h"
#define TZLIB_NAME "tz.library"
#define VERSION_NO 7
#define VERSION_TEXT "7"
#define REVISION_NO 00
#define REVISION_TEXT "00"
#define DATE_TEXT "10.01.2018"
#define VERS TZLIB_NAME " " VERSION_TEXT "." REVISION_TEXT
#define VSTRING TZLIB_NAME " " VERSION_TEXT "." REVISION_TEXT \
"(" DATE_TEXT ")\r\n"
#define VERSTAG "\0$VER: " TZLIB_NAME " " VERSION_TEXT "." REVISION_TEXT \
"(" DATE_TEXT ")"
#define TZVARIABLE1 "TZ"
#define TZVARIABLE2 "Timezone.prefs"
#define TZVARIABLE TZVARIABLE1
#define ENVSIZE 128
#include <exec/io.h>
#include <proto/exec.h>
#include <inline/exec.h>
#include <proto/dos.h>
#include <inline/dos.h>
#include <proto/locale.h>
#include <inline/locale.h>
#include <proto/timer.h>
#include <inline/timer.h>
#include <proto/intuition.h>
#include <inline/intuition.h>
#ifndef REG
#define REG(reg, arg) arg __asm(#reg)
#endif
#ifndef UNUSED
#define UNUSED __attribute__((unused))
#endif
typedef struct Locale *locale_t;
struct lc_time_T
{
const char *mon[12];
const char *month[12];
const char *wday[7];
const char *weekday[7];
const char *X_fmt;
const char *x_fmt;
const char *c_fmt;
const char *t_fmt_ampm; // TODO
const char *am;
const char *pm;
const char *am_pm[2]; // TODO
const char *date_fmt;
locale_t locale;
};
#undef ctime_rz
#define ctime_rz tz_ctime_rz
#undef tzgetgmtoff
#define tzgetgmtoff tz_tzgetgmtoff
#undef timelocal_z
#define timelocal_z tz_timelocal_z
#undef tzgetname
#define tzgetname tz_tzgetname
#undef offtime_r
#define offtime_r tz_offtime_r
#undef tzgetlocation
#define tzgetlocation tz_tzgetlocation
#undef snprintf
#define snprintf SNPrintf
/* amiga.c tz functions */
int daylight_c(void);
long Timezone_c(void);
long altzone_c(void);
char **tzname_c(void);
int getsystime(struct timeval *tv);
int setsystime(struct timeval *tv);
int gettimeofday(struct timeval *tv, void *tz);
int settimeofday(const struct timeval *tv, void *tz);
/* amiga.c internals */
struct lc_time_T *openlc(locale_t locale);
void closelc(struct lc_time_T *lc);
extern const struct lc_time_T C_time_locale;
extern long Timezone;
extern long altzone;
extern int daylight;
extern struct SignalSemaphore *TimerSemaphore;
/* string.c */
void bcopy(const void *src, void *dest, size_t len); // <string.h>
void *memmove(void *dest, const void *src, size_t len); // <string.h>
size_t strlen(const char *string); // <string.h>
char *strcpy(char *dest, const char *src); // <string.h>
char *strcat(char *dest, const char *src); // <string.h>
int strcmp(const char *s1, const char *s2); // <string.h>
char *strchr(const char *s, int c); // <string.h>
int strncmp(const char *s1, const char *s2, size_t n); // <string.h>
char *getenv(const char *name); // <stdlib.h>
int isdigit(char c);
int isspace(char c);
int isalpha(char c);
int toupper(char c);
int strncasecmp(const char *_s1, const char *_s2, size_t n);
int SNPrintf(char *str, size_t size, const char *format, ...);
#if defined(__GNUC__) && (__GNUC__ < 3)
void *memcpy(void *dst, const void *src, unsigned long len);
#else
void *memcpy(void *dst, const void *src, size_t len);
#endif
void *memset(void *str, int c, size_t n);
extern struct ExecBase *SysBase;
extern int errno;
#endif