amiga-sha/platform.h

131 lines
3.8 KiB
C

/*
* Copyright (c) 2015 Carsten Larsen
* 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 _SHA_PLATFORM_H
#define _SHA_PLATFORM_H
/***************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "compiler.h"
/***************************************************************/
#include <exec/io.h>
#include <exec/types.h>
#include <exec/memory.h>
#include <clib/exec_protos.h>
#include <clib/utility_protos.h>
#include <clib/dos_protos.h>
#if defined(AOS3) || defined(AOS4)
# define ARGPTR STRPTR
# define ARGS_FORMAT ARGSFORMAT
#endif
#if defined(AROS) || defined(MORPHOS)
# define ARGPTR CONST_STRPTR
# define ARGS_FORMAT (CONST_STRPTR)ARGSFORMAT
#endif
#ifndef ARGPTR
# error Platform must be defined
#endif
/***************************************************************/
#ifndef VERSION_PROG
# define VERSION_PROG "sha"
#endif
#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_PATCHLEVEL 5
#define VERSION_STRING "1.05"
#define VERSION_DATE "08.06.2015"
/***************************************************************/
#ifdef mc68000
# define ACPU "MC68000+"
# define WORDS_BIGENDIAN 1
# define SHA_BUFFER_SIZE 65536
#endif
#ifdef mc68020
# undef ACPU
# define ACPU "MC68020"
#endif
#ifdef mc68030
# undef ACPU
# define ACPU "MC68030"
#endif
#ifdef mc68040
# undef ACPU
# define ACPU "MC68040"
#endif
#ifdef mc68060
# undef ACPU
# define ACPU "MC68060"
#endif
/***************************************************************/
#if defined(INTELCPU) || defined(i386) || defined(i486) || \
defined(intel) || defined(x86) || defined(i86pc) || \
defined(__i386__) || defined(_M_IX86)
# ifdef ACPU
# undef ACPU
# endif
# define ACPU "i386"
# define RUNTIME_ENDIAN 1
# define SHA_BUFFER_SIZE 65536
#endif
#ifdef __powerpc__
# define ACPU "PowerPC"
# define RUNTIME_ENDIAN 1
# define SHA_BUFFER_SIZE 65536
#endif
#if defined(__x86_64__)
# define ACPU "amd64"
# define RUNTIME_ENDIAN 1
# define SHA_BUFFER_SIZE 65536
#endif
#ifndef ACPU
# error what cpu is this ?!
#endif
/****************************************************************
* Assemble version string using format:
* sha 1.05 (08.06.2015)
*/
#define VERSION_STRING_AMIGA \
"\0$VER: " \
VERSION_PROG " " \
VERSION_STRING " (" \
VERSION_DATE ") " \
ACPU
/***************************************************************/
struct RDArgs *rdargs;
struct shaargs;
int shaFile (char *name, FILE *f, int which);
void alloc_buffer(void);
void clean_exit(void);
void args_error(char *program);
extern uint8_t *buffer;
extern void *alloced_buffer;
#endif