view minijss/jss.c @ 2576:812b16ee49db

I had been living under apparent false impression that "realfft.c" on which the FFT implementation in DMLIB was basically copied from was released in public domain at some point, but it could very well be that it never was. Correct license is (or seems to be) GNU GPL. Thus I removing the code from DMLIB, and profusely apologize to the author, Philip Van Baren. It was never my intention to distribute code based on his original work under a more liberal license than originally intended.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 Mar 2022 16:32:50 +0200
parents aa3738b121d1
children 9807ae37ad69
line wrap: on
line source

/*
 * miniJSS - General functions
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2006-2015 Tecnic Software productions (TNSP)
 */
#include "jss.h"
#include <stdarg.h>


/* Memory and error handling functions
 */

BOOL jssWarningIsFatal, jssErrorIsFatal;

#ifndef JSS_LIGHT

void (*jssError) (int code, const char *filename, int linen, const char *fmt, ...);
void (*jssWarning) (int code, const char *filename, int linen, const char *fmt, ...);


void jssDefaultPrint(int code, const char *filename, int linen, const char *fmt)
{
    fprintf(stderr, "JSS");
    if (filename)
        fprintf(stderr, "[%s:%i]", filename, linen);
    fprintf(stderr, "%s", fmt);
    if (code > 0)
        fprintf(stderr, "(%i)", code);
    fprintf(stderr, ": ");
}


void jssDefaultError(int code, const char *filename, int linen, const char *fmt, ...)
{
    va_list ap;
    jssDefaultPrint(code, filename, linen, "E");

    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
}


void jssDefaultWarning(int code, const char *filename, int linen, const char *fmt, ...)
{
    va_list ap;
    jssDefaultPrint(code, filename, linen, "W");

    va_start(ap, fmt);
    vfprintf(stderr, fmt, ap);
    va_end(ap);
}

#endif


/* System initialization
 */
int jssInit(void)
{
    // Error handling
#ifndef JSS_LIGHT
    jssWarningIsFatal = FALSE;
    jssErrorIsFatal = TRUE;

    jssError = jssDefaultError;
    jssWarning = jssDefaultWarning;
#endif

    // Allocate global tables

    return DMERR_OK;
}


/* System shutdown
 */
int jssClose(void)
{
    return DMERR_OK;
}