view src/dmresw.c @ 1315:7687412f9aef

Fix jssmod sample conversion flags storing .. urgh.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 20 Aug 2017 01:54:54 +0300
parents 9f06f6661cdf
children 0cac3360a0aa
line wrap: on
line source

/*
 * DMLib
 * -- Resource management
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2011-2015 Tecnic Software productions (TNSP)
 */
#include "dmresw.h"


int dmf_write_str(DMResource *f, const void *s, const size_t l)
{
    return dmfwrite(s, 1, l, f) == l;
}


BOOL dmf_write_byte(DMResource *f, const Uint8 val)
{
    return dmfputc(val, f) == val;
}


#define DM_DEFINE_FFUNC(xname, xtype, xmacro)            \
BOOL dmf_write_ ## xname (DMResource *f, const xtype v) {     \
    xtype result = DM_NATIVE_TO_ ## xmacro (v);         \
    if (dmfwrite(&result, sizeof( xtype ), 1, f) != 1)  \
        return FALSE;                                   \
    return TRUE;                                        \
}

#include "dmfiletmpl.h"

#undef DM_DEFINE_FFUNC