/*
** mg_misc.h for  in 
** 
** Made by vianney rancurel
** Login   <vianney@epita.fr>
** 
** Started on  Wed Aug 25 12:05:19 1999 vianney rancurel
** Last update Thu Oct 28 20:17:34 1999 
*/
#ifndef MG_MISC_H
#define MG_MISC_H	1

#include "mg.h"

#define MY_ABS(X)	(((X) < 0)?-(X):(X))
#define MY_MIN(X,Y)	(((X) < (Y))?(X):(Y))
#define MY_MAX(X,Y)	(((X) > (Y))?(X):(Y))

#define PTR_XY(Ptr,Width,PosX,PosY)	((Ptr)[(PosY) * (Width) + (PosX)])

#define RAND(Num)	(rand() % (Num))

#define ARG_PENDING	(argc > 0)
#define ARG_WORD	(argv[0])
#define ARG_NEXT	{argc--;argv++;}

/* PROTO mg_misc.c */
/* mg_misc.c */
t_boolean atobooleanfalse P((char *str));
t_boolean atobooleantrue P((char *str));
t_status atobooleanstrict P((char *str, t_boolean *val));
void *pool_alloc P((t_vec *pool, t_alloc_proc alloc_proc, size_t size, char *comment, t_free_proc free_proc, t_status *status));
char *strdup_alloc P((char *str, t_alloc_proc alloc_proc, char *comment1, char *comment2, t_status *status));
char *str_skip P((char *str, char *chars));
char *str_find P((char *str, char *chars));
char *bindex P((char *buf, int len, int c));
int indexcount P((char *str, int c));
void str_lower P((char *str));
void a_debug_init P((void));
void bff P((char *buf, int len));
#endif
