
/*
 * magicStubs.c --
 *
 * Stubs for Magic routines.  We only use the database portion of the
 * Magic layout editor, so we need to dummy out some of the other stuff.
 *
 * Copyright (C) 1985 Regents of the University of California
 * All rights reserved.
 */

#ifndef lint
static char sccsid[] = "@(#)magicStubs.c	1.4 MAGIC (Berkeley) 3/4/85";
#endif  /* not lint */

#include <stdio.h>
#include <stdarg.h>
#include "misc/magic.h"
#include "utils/hash.h"
#include "utils/geometry.h"
#include "tiles/tile.h"
#include "database/database.h"
#include "textio/textio.h"
#include "undo/undo.h"

/* DBWIND */
int DBWclientID = 0;
int DBWFeedbackCount = 0;
TileTypeBitMask  DBWStyleToTypesTbl[256];
void DBWAreaChanged(){}
void DBWLabelChanged(){}
void DBWFeedbackAdd(){}
void DBWFeedbackShow(){}

/* MISC */
char AbortMessage[200];

void
niceabort(void)
{
    int i;
    i = 2;
    (void) fprintf(stderr, "Mpack has detected a major internal inconsistency:\n");
    (void) fprintf(stderr, "        %s\n\n", AbortMessage);
    (void) fprintf(stderr, "Bye!!!\n");
/***
	Fang -- must somehow guarantee that unused expression is not
	optimized out by compiler if this is truly how you want to core dump.
***/
    1/(2-i); /* core dump! */
}

char *PatchNames(){}

/* SIGNALS */
bool SigInterruptPending = FALSE;
void SigEnableInterrupts(){}
void SigDisableInterrupts(){}

 
/* TEXTIO */

#ifndef	NO_VARARGS
/*VARARGS1*/
void
TxError(char* format, ...)
{
    va_list args;
    va_start(args, format);
    (void) fflush(stdout);
    (void) fprintf(stderr, format, args);
    (void) fflush(stderr);
    va_end(args);
}

/*VARARGS1*/
void
TxPrintf(char* format, ...)
{
    va_list args;
    va_start(args, format);
    (void) fprintf(stdout, format, args);
    va_end(args);
}
#else	/* NO_VARARGS */
/*VARARGS1*/
void
TxError(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
char *format;
{
    (void) fflush(stdout);
    (void) fprintf(stderr, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
	a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
    (void) fflush(stderr);
}

/*VARARGS1*/
void
TxPrintf(format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
char *format;
{
    (void) fprintf(stdout, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
	a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
}
#endif

void
TxFlush()
{
    (void) fflush(stdout);
    (void) fflush(stderr);
}

char *
TxGetLine()
{
    TxError("Mpack, TxGetLine not implemented\n");
}

/* UNDO */
int UndoDisableCount = 1;
void UndoDisable(){}
void UndoEnable(){}
void UndoFlush(){}
UndoType UndoAddClient(){return 1;}
UndoEvent *UndoNewEvent(){return ((UndoEvent *) NULL);}

/* WINDOWS */
/* WindClient DBWclientID; */
void WindAreaChanged(){}
int WindSearch(){ printf("WindSearch called\n"); }
void WindSurfaceToScreen(){ printf("WindSurfaceToScreen called\n"); }

/* GRAPHICS */
void (*GrUnlockPtr)()   = NULL;
void (*GrFlushPtr)()    = NULL;
void (*GrLockPtr)()     = NULL;
void (*GrVfprintfPtr)() = NULL;
void GrClipBox() { printf("GrClipBox called\n"); }

/* CALMA */
void CalmaTechInit(void) { }
