Back to index

tetex-bin  3.0
Defines | Functions
gd_io.c File Reference
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "gd.h"

Go to the source code of this file.

Defines

#define IO_DBG(s)

Functions

void Putword (int w, gdIOCtx *ctx)
void Putchar (int c, gdIOCtx *ctx)
void gdPutC (const unsigned char c, gdIOCtx *ctx)
void gdPutWord (int w, gdIOCtx *ctx)
void gdPutInt (int w, gdIOCtx *ctx)
int gdGetC (gdIOCtx *ctx)
int gdGetByte (int *result, gdIOCtx *ctx)
int gdGetWord (int *result, gdIOCtx *ctx)
int gdGetInt (int *result, gdIOCtx *ctx)
int gdPutBuf (const void *buf, int size, gdIOCtx *ctx)
int gdGetBuf (void *buf, int size, gdIOCtx *ctx)
int gdSeek (gdIOCtx *ctx, const int pos)
long gdTell (gdIOCtx *ctx)

Define Documentation

#define IO_DBG (   s)

Definition at line 27 of file gd_io.c.


Function Documentation

int gdGetBuf ( void buf,
int  size,
gdIOCtx ctx 
)

Definition at line 159 of file gd_io.c.

{
  return (ctx->getBuf) (ctx, buf, size);
}
int gdGetByte ( int result,
gdIOCtx ctx 
)

Definition at line 83 of file gd_io.c.

{
  int r;
  r = (ctx->getC) (ctx);
  if (r == EOF)
    {
      return 0;
    }
  *result = r;
  return 1;
}

Here is the caller graph for this function:

int gdGetC ( gdIOCtx ctx)

Definition at line 75 of file gd_io.c.

{
  return ((ctx->getC) (ctx));
}

Here is the caller graph for this function:

int gdGetInt ( int result,
gdIOCtx ctx 
)

Definition at line 116 of file gd_io.c.

{
  int r;
  r = (ctx->getC) (ctx);
  if (r == EOF)
    {
      return 0;
    }
  *result = r << 24;

  r = (ctx->getC) (ctx);
  if (r == EOF)
    {
      return 0;
    }
  *result += r << 16;

  r = (ctx->getC) (ctx);
  if (r == EOF)
    {
      return 0;
    }
  *result += r << 8;

  r = (ctx->getC) (ctx);
  if (r == EOF)
    {
      return 0;
    }
  *result += r;

  return 1;
}

Here is the caller graph for this function:

int gdGetWord ( int result,
gdIOCtx ctx 
)

Definition at line 96 of file gd_io.c.

{
  int r;
  r = (ctx->getC) (ctx);
  if (r == EOF)
    {
      return 0;
    }
  *result = r << 8;
  r = (ctx->getC) (ctx);
  if (r == EOF)
    {
      return 0;
    }
  *result += r;
  return 1;
}

Here is the caller graph for this function:

int gdPutBuf ( const void buf,
int  size,
gdIOCtx ctx 
)

Definition at line 151 of file gd_io.c.

{
  IO_DBG (printf ("Putting buf...\n"));
  return (ctx->putBuf) (ctx, buf, size);
  IO_DBG (printf ("put.\n"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gdPutC ( const unsigned char  c,
gdIOCtx ctx 
)

Definition at line 49 of file gd_io.c.

{
  (ctx->putC) (ctx, c);
}

Here is the caller graph for this function:

void gdPutInt ( int  w,
gdIOCtx ctx 
)

Definition at line 64 of file gd_io.c.

{
  IO_DBG (printf ("Putting int...\n"));
  (ctx->putC) (ctx, (unsigned char) (w >> 24));
  (ctx->putC) (ctx, (unsigned char) ((w >> 16) & 0xFF));
  (ctx->putC) (ctx, (unsigned char) ((w >> 8) & 0xFF));
  (ctx->putC) (ctx, (unsigned char) (w & 0xFF));
  IO_DBG (printf ("put.\n"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gdPutWord ( int  w,
gdIOCtx ctx 
)

Definition at line 55 of file gd_io.c.

{
  IO_DBG (printf ("Putting word...\n"));
  (ctx->putC) (ctx, (unsigned char) (w >> 8));
  (ctx->putC) (ctx, (unsigned char) (w & 0xFF));
  IO_DBG (printf ("put.\n"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

int gdSeek ( gdIOCtx ctx,
const int  pos 
)

Definition at line 166 of file gd_io.c.

{
  IO_DBG (printf ("Seeking...\n"));
  return ((ctx->seek) (ctx, pos));
  IO_DBG (printf ("Done.\n"));
}

Here is the call graph for this function:

long gdTell ( gdIOCtx ctx)

Definition at line 174 of file gd_io.c.

{
  IO_DBG (printf ("Telling...\n"));
  return ((ctx->tell) (ctx));
  IO_DBG (printf ("told.\n"));
}

Here is the call graph for this function:

void Putchar ( int  c,
gdIOCtx ctx 
)

Definition at line 43 of file gd_io.c.

{
  (ctx->putC) (ctx, c & 0xff);
}
void Putword ( int  w,
gdIOCtx ctx 
)

Definition at line 34 of file gd_io.c.

{
  unsigned char buf[2];
  buf[0] = w & 0xff;
  buf[1] = (w / 256) & 0xff;
  (ctx->putBuf) (ctx, (char *) buf, 2);
}