Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

emcmotlog.c File Reference

#include "emcmotlog.h"

Include dependency graph for emcmotlog.c:

Include dependency graph

Go to the source code of this file.

Functions

char __attribute__ ((unused)) ident[]="$Id
int emcmotLogAdd (EMCMOT_LOG *log, EMCMOT_LOG_STRUCT val)
int emcmotLogGet (EMCMOT_LOG *log, EMCMOT_LOG_STRUCT *val)


Function Documentation

char __attribute__ (unused)    [static]
 

Definition at line 21 of file emcmotlog.c.

00021                                                    : emcmotlog.c,v 1.2 2000/10/27 20:34:42 terrylr Exp $";
00022 
00023 int emcmotLogInit(EMCMOT_LOG *log, int type, int size)
00024 {
00025   log->type = type;
00026   log->size = size;
00027   log->start = 0;
00028   log->end = 0;
00029   log->howmany = 0;
00030 
00031   return 0;
00032 }

int emcmotLogAdd EMCMOT_LOG   log,
EMCMOT_LOG_STRUCT    val
 

Definition at line 34 of file emcmotlog.c.

00035 {
00036   log->log[log->end] = val;
00037 
00038   log->end++;
00039   if (log->end >= log->size)
00040     {
00041       log->end = 0;
00042     }
00043 
00044   log->howmany++;
00045   if (log->howmany > log->size)
00046     {
00047       log->howmany = log->size;
00048       log->start++;
00049       if (log->start >= log->size)
00050         {
00051           log->start = 0;
00052         }
00053     }
00054 
00055   return 0;
00056 }

int emcmotLogGet EMCMOT_LOG   log,
EMCMOT_LOG_STRUCT   val
 

Definition at line 58 of file emcmotlog.c.

00059 {
00060   if (log->howmany == 0)
00061     {
00062       return -1;
00063     }
00064 
00065   *val = log->log[log->start];
00066   log->start++;
00067   if (log->start >= log->size)
00068     {
00069       log->start = 0;
00070     }
00071 
00072   log->howmany--;
00073 
00074   return 0;
00075 }


Generated on Sun Dec 2 15:27:56 2001 for EMC by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001