AmiTimeKeeper/config.h

216 lines
5.6 KiB
C

/*-
* Copyright (c) 2017-2020 Carsten Sonne Larsen <cs@innolan.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef CONFIG_H_INCLUDED
#define CONFIG_H_INCLUDED
#include <exec/io.h>
#include <exec/types.h>
#include <exec/memory.h>
#include <exec/devices.h>
#include <exec/libraries.h>
#include <resources/battclock.h>
#include <libraries/asl.h>
#include <libraries/commodities.h>
#include <graphics/text.h>
#include <graphics/rastport.h>
#include <dos/dos.h>
#include <dos/dostags.h>
#include <proto/dos.h>
#include <proto/asl.h>
#include <proto/exec.h>
#include <proto/icon.h>
#include <proto/timer.h>
#include <proto/locale.h>
#include <proto/utility.h>
#include <proto/gadtools.h>
#include <proto/intuition.h>
#include <proto/battclock.h>
#include <proto/commodities.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "compiler.h"
#define DEBUG_BUILD 1
#if defined(AROS) || defined(__CLIB2__)
#include <stdint.h>
#endif
#if defined(__libnix__)
typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t;
typedef uint32_t uintptr_t;
#endif
#if defined(__CLIB2__)
#define __NO_NET_API
//define NO_INLINE_STDARG
//#define MISSING_ADDRINFO
#include <proto/graphics.h>
#include <proto/socket.h>
#endif
#if defined(AROS)
#include <proto/graphics.h>
#include <proto/socket.h>
#include <bsdsocket/socketbasetags.h>
#endif
#if defined(__libnix__)
#include <clib/graphics_protos.h>
#include <amitcp/socketbasetags.h>
#include "clib/amitcp_protos.h"
#endif
#if defined(__libnix__) || defined(__CLIB2__)
#include "netdb.h"
#include "sys/errno.h"
#include "sys/socket.h"
#include "netinet/in.h"
#else
#include <netdb.h>
#include <sys/errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif
#include "clib/screennotify.h"
#include "proto/screennotify.h"
#ifdef MAXPATHLEN
#undef MAXPATHLEN
#endif
#ifdef MAXFILELEN
#undef MAXFILELEN
#endif
#ifdef MAXFILEPATHLEN
#undef MAXFILEPATHLEN
#endif
#define MAXPATHLEN 1792
#define MAXFILELEN 256
#define MAXFILEPATHLEN MAXPATHLEN + MAXFILELEN
#define MAXDOSERRORLEN 256
#define LOGMESSAGELEN 128
#ifndef HAVE_POLL
#define POLLIN 0x0001
struct pollfd
{
int fd;
short events;
short revents;
};
typedef unsigned int nfds_t;
int poll(struct pollfd *, nfds_t, int);
#endif
#if AOS3
#define IPTR ULONG
#endif
#ifdef AROS
#define VSNPrintf(str, n, format, args) vsnprintf(str, n, format, args)
#define SNPrintf(str, n, format, ...) snprintf(str, n, format, __VA_ARGS__)
#endif
#define LIB_OK 0
#define COM_OK 0
#define LIB_ERROR -1
#define COM_ERROR -1
#ifdef AROS
#define APP_SHORT_NAME "TimeKeeper"
#define APP_LONG_NAME "AROS Time Keeper"
#else
#define APP_SHORT_NAME "TimeKeeper"
#define APP_LONG_NAME "Amiga Time Keeper"
#endif
#define APP_VERSION "1.10"
#define APP_DATE_VERSION "1.10 (20.03.2020)"
#define APP_ID APP_SHORT_NAME " " APP_DATE_VERSION
#define APP_TITLE APP_LONG_NAME " " APP_DATE_VERSION
#define APP_TITLE_VERSION APP_LONG_NAME " " APP_VERSION
#include "log.h"
#include "string.h"
#define KEYWORD_COUNT 10
#define KEYWORD_SERVER "SERVER"
#define KEYWORD_PORT "PORT"
#define KEYWORD_THRESHOLD "THRESHOLD"
#define KEYWORD_INTERVAL "INTERVAL"
#define KEYWORD_PRIORITY "CX_PRIORITY"
#define KEYWORD_POPKEY "CX_POPKEY"
#define KEYWORD_POPUP "CX_POPUP"
#define KEYWORD_READONLY "READONLY"
#define KEYWORD_EXPERT "EXPERT"
#define KEYWORD_TIMEOUT "TIMEOUT"
#define SERVER_DEF "pool.ntp.org"
#define PORT_DEF "123"
#define THRESHOLD_MIN 1000LL
#define THRESHOLD_DEF 1000000LL
#define INTERVAL_MIN 500
#define INTERVAL_DEF 17500
#define PRIORITY_MIN -128
#define PRIORITY_DEF 25
#define PRIORITY_MAX 127
#define READONLY_DEF 0
#define EXPERT_DEF 1
#define TIMEOUT_MIN 100
#define TIMEOUT_DEF 5000
#define TIMEOUT_MAX 30000
#define POPKEY_DEF "lshift control t"
#define POPUP_DEF 0
#define KEYWORD_TEMPLATE_1 KEYWORD_READONLY "/S," KEYWORD_EXPERT "/S," KEYWORD_SERVER "/K," KEYWORD_PORT "/K," KEYWORD_TIMEOUT "/N/K,"
#define KEYWORD_TEMPLATE_2 KEYWORD_THRESHOLD "/K," KEYWORD_INTERVAL "/N/K,"
#define KEYWORD_TEMPLATE_3 KEYWORD_PRIORITY "/N/K," KEYWORD_POPKEY "/K," KEYWORD_POPUP "/K,"
#define KEYWORD_TEMPLATE KEYWORD_TEMPLATE_1 KEYWORD_TEMPLATE_2 KEYWORD_TEMPLATE_3
/* broker.c */
void StartBroker(void);
bool IsBrokerRunning(void);
void SetBrokerPriority(int);
/* libraries.c */
int OpenLibraries(void);
void CloseLibraries(void);
void ReopenLocale(void);
/* val.c */
void SanitizeSettings(void);
#endif