nuttx-apps/interpreters/ficl/src/nuttx.c
patacongo 704fd479f8 Ported Ficl to NuttX apps/
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3584 42af7a65-404d-4744-a932-0658087f49c3
2011-05-10 18:18:19 +00:00

66 lines
999 B
C

#include <sys/stat.h>
#include <sys/statfs.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "ficl.h"
void *ficlMalloc(size_t size)
{
return malloc(size);
}
void *ficlRealloc(void *p, size_t size)
{
return realloc(p, size);
}
void ficlFree(void *p)
{
free(p);
}
void ficlCallbackDefaultTextOut(ficlCallback *callback, char *message)
{
FICL_IGNORE(callback);
if (message != NULL)
fputs(message, stdout);
else
fflush(stdout);
return;
}
int ficlFileStatus(char *filename, int *status)
{
struct stat statbuf;
if (stat(filename, &statbuf) == 0)
{
*status = statbuf.st_mode;
return 0;
}
*status = ENOENT;
return -1;
}
long ficlFileSize(ficlFile *ff)
{
struct stat statbuf;
if (ff == NULL)
return -1;
statbuf.st_size = -1;
if (fstat(fileno(ff->f), &statbuf) != 0)
return -1;
return statbuf.st_size;
}
void ficlSystemCompilePlatform(ficlSystem *system)
{
return;
}