Back to index

plt-scheme  4.2.1
Classes | Defines | Typedefs | Functions | Variables
gd_io_file.c File Reference
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "gd.h"
#include "gdhelpers.h"

Go to the source code of this file.

Classes

struct  fileIOCtx

Defines

#define SEEK_SET   0

Typedefs

typedef struct fileIOCtx fileIOCtx

Functions

gdIOCtxnewFileCtx (FILE *f)
static int fileGetbuf (gdIOCtx *, void *, int)
static int filePutbuf (gdIOCtx *, const void *, int)
static void filePutchar (gdIOCtx *, int)
static int fileGetchar (gdIOCtx *ctx)
static int fileSeek (struct gdIOCtx *, const int)
static long fileTell (struct gdIOCtx *)
static void gdFreeFileCtx (gdIOCtx *ctx)
gdIOCtxgdNewFileCtx (FILE *f)

Variables

struct fileIOCtxfileIOCtxPtr

Class Documentation

struct fileIOCtx

Definition at line 35 of file gd_io_file.c.

Collaboration diagram for fileIOCtx:
Class Members
gdIOCtx ctx
FILE * f

Define Documentation

#define SEEK_SET   0

Definition at line 24 of file gd_io_file.c.


Typedef Documentation


Function Documentation

static int fileGetbuf ( gdIOCtx ctx,
void buf,
int  size 
) [static]

Definition at line 101 of file gd_io_file.c.

{
  fileIOCtx *fctx;
  fctx = (fileIOCtx *) ctx;

  return (fread (buf, 1, size, fctx->f));

}

Here is the caller graph for this function:

static int fileGetchar ( gdIOCtx ctx) [static]

Definition at line 123 of file gd_io_file.c.

{
  fileIOCtx *fctx;
  fctx = (fileIOCtx *) ctx;

  return getc (fctx->f);
}

Here is the caller graph for this function:

static int filePutbuf ( gdIOCtx ctx,
const void buf,
int  size 
) [static]

Definition at line 91 of file gd_io_file.c.

{
  fileIOCtx *fctx;
  fctx = (fileIOCtx *) ctx;

  return fwrite (buf, 1, size, fctx->f);

}

Here is the caller graph for this function:

static void filePutchar ( gdIOCtx ctx,
int  a 
) [static]

Definition at line 111 of file gd_io_file.c.

{
  unsigned char b;
  fileIOCtx *fctx;
  fctx = (fileIOCtx *) ctx;

  b = a;

  putc (b, fctx->f);
}

Here is the caller graph for this function:

static int fileSeek ( struct gdIOCtx ctx,
const int  pos 
) [static]

Definition at line 133 of file gd_io_file.c.

{
  fileIOCtx *fctx;
  fctx = (fileIOCtx *) ctx;
  return (fseek (fctx->f, pos, SEEK_SET) == 0);
}

Here is the caller graph for this function:

static long fileTell ( struct gdIOCtx ctx) [static]

Definition at line 141 of file gd_io_file.c.

{
  fileIOCtx *fctx;
  fctx = (fileIOCtx *) ctx;

  return ftell (fctx->f);
}

Here is the caller graph for this function:

static void gdFreeFileCtx ( gdIOCtx ctx) [static]

Definition at line 84 of file gd_io_file.c.

{
  gdFree (ctx);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gdIOCtx* gdNewFileCtx ( FILE *  f)

Definition at line 57 of file gd_io_file.c.

{
  fileIOCtx *ctx;

  ctx = (fileIOCtx *) gdMalloc (sizeof (fileIOCtx));
  if (ctx == NULL)
    {
      return NULL;
    }

  ctx->f = f;

  ctx->ctx.getC = fileGetchar;
  ctx->ctx.putC = filePutchar;

  ctx->ctx.getBuf = fileGetbuf;
  ctx->ctx.putBuf = filePutbuf;

  ctx->ctx.tell = fileTell;
  ctx->ctx.seek = fileSeek;

  ctx->ctx.gd_free = gdFreeFileCtx;

  return (gdIOCtx *) ctx;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gdIOCtx* newFileCtx ( FILE *  f)

Variable Documentation

Definition at line 42 of file gd_io_file.c.