common.h 2.28 KB
Newer Older
1 2 3
/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

ellson's avatar
ellson committed
4
/*************************************************************************
5
 * Copyright (c) 2011 AT&T Intellectual Property
ellson's avatar
ellson committed
6 7 8 9 10 11 12
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors: See CVS logs. Details at http://www.graphviz.org/
 *************************************************************************/
13 14 15 16 17

#ifdef __cplusplus
extern "C" {
#endif

18
/* Lefteris Koutsofios - AT&T Labs Research */
19 20 21 22 23 24

#ifndef _COMMON_H
#define _COMMON_H

/* some config and conversion definitions from graphviz distribution */
#include "config.h"
erg's avatar
erg committed
25 26 27 28
/* we set some parameters which graphviz assumes.
 * At some point, we could consider allowing these to be set in configure
 * See Makefile.old for others.
 */
29
#define FEATURE_MINTSIZE 1
erg's avatar
erg committed
30
#define FEATURE_DOT 1
31
#if defined(_WIN32)
32 33 34 35 36 37 38
#ifndef FEATURE_WIN32
#define FEATURE_WIN32 1
#endif
#ifndef FEATURE_MS
#define FEATURE_MS 1
#endif
#else
erg's avatar
erg committed
39 40
#define FEATURE_X11 1
#endif
41 42 43 44 45 46 47

#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
48
#ifndef _WIN32
49
#include <sys/time.h>
50
#endif
51 52 53
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
54

55
#include <inttypes.h>
56 57 58 59 60 61 62 63 64
#include <math.h>
#include <stdio.h>
#include <setjmp.h>
#include <ctype.h>

#ifdef FEATURE_WIN32
#include <windows.h>
#include <commdlg.h>
#endif
65

66 67
#ifdef FEATURE_MS
#include <malloc.h>
68
#define printf gprintf
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
#endif

#define POS __FILE__, __LINE__

#ifndef TRUE
#define TRUE  1
#define FALSE 0
#endif

#ifndef L_SUCCESS
#define L_SUCCESS 1
#define L_FAILURE 0
#endif

#define CHARSRC 0
#define FILESRC 1

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

90 91 92 93 94
extern int warnflag;
extern char *leftypath, *leftyoptions, *shellpath;
extern jmp_buf exitljbuf;
extern int idlerunmode;
extern fd_set inputfds;
95

96 97 98 99 100
int init (char *);
void term (void);
char *buildpath (char *, int);
char *buildcommand (char *, char *, int, int, char *);
void warning (char *, int, char *, char *, ...);
101
void panic1 (char *, int, char *, char *, ...);
102 103
void panic2 (char *, int, char *, char *, ...);
#endif /* _COMMON_H */
104 105 106 107

#ifdef __cplusplus
}
#endif