/usr/include/ncarg/cgm_tools.h is in libncarg-dev 6.1.2-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | /*
* $Id: cgm_tools.h,v 1.13 2008-07-27 03:22:38 haley Exp $
*/
/************************************************************************
* *
* The use of this Software is governed by a License Agreement. *
* *
************************************************************************/
/***********************************************************************
* *
* Copyright (C) 1990 *
* University Corporation for Atmospheric Research *
* All Rights Reserved *
* *
* NCAR View V3.00alpha *
* *
***********************************************************************/
#ifndef _cgm_tools_
#define _cgm_tools_
#include <ncarg/c.h>
#include <ncarg/cgmdef.h>
typedef int Cgm_fd; /* a file descriptor for a metafile */
typedef enum {
CGM_OK,
CGM_ERROR
} CGM_Status;
/*
* elements of the directory
*/
typedef struct {
int record, /* offset of record in the file */
num_record, /* number of records in this frame */
type; /* type of record */
char *text; /* optional picture descriptor */
} Directory_entry;
/*
* the directory
*/
typedef struct {
int num_meta; /* number of metafiles in single file */
int *meta; /* begining record of each metafile */
int meta_size; /* amount of memory allocated to *meta */
int num_frames; /* number of frames in the file */
Directory_entry *d; /* pointer to elements of the directory */
int dir_size; /* amount of memory allocated to *d */
char **MFDescription;/* optional metafile description*/
int MFDes_size; /* mem allocated to MFDescription*/
CGM_Status status;
Cgm_fd cgm_fd; /* file descriptor associated with this file */
} Directory;
#define CGM_NUM_META(D) ((D)->num_meta)
#define CGM_META_START(D, M) ((D)->meta[(M)])
#define CGM_NUM_FRAMES(D) ((D)->num_frames)
#define CGM_RECORD(D, F) ((D)->d[(F)].record)
#define CGM_NUM_RECORD(D, F) ((D)->d[(F)].num_record)
#define CGM_RECORD_TYPE(D, F) ((D)->d[(F)].type)
#define CGM_PIC_DES(D, F) ((D)->d[(F)].text)
#define CGM_STATUS(D) ((D)->status)
#define CGM_FD(D) ((D)->cgm_fd)
/*
* structure for reading in a raw cgm instruction
*/
typedef struct {
unsigned int cgmclass; /* CGM class (0-7) */
unsigned int id; /* CGM element id */
unsigned char buf[32767 * 2]; /* CGM element data */
unsigned char *data; /* pointer to begining of data in
* buf. usually this is &buf[0]
*/
unsigned int data_length; /* num bytes data in buf*/
int more; /* boolean, 1 => more data to follow */
} Instr;
/*
* the valid frame types. See section on NCAR CGM in the NCAR
* Graphics installers guide
*/
#define HEADER 4
#define PRINTER 8
#define PRE_CGM 2
#define NCAR_CGM 3
/*
* maximum amount of CGM instruction data that can be processed
* by a single invocation of CGM_getInstr() or CGM_putInstr()
*/
#define MAX_CGM_INS_LEN 32760
/*
* maximum file descriptors for memory files. Also max number of files that
* can exist. Must be <= (sizeof (long) * BYTESIZE)
*/
#define MAX_MEM_FILE 20
/*
* Flag passed to CGM_open to indicate CGM resides in memory, not
* on disk
*/
#define MEM_FILE -1
#ifndef SEEK_SET
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif
/*
**
** C G M T O O L S
**
*/
/* This macro protects C function names from C++ name-mangling. */
NCARG_PROTO_BEGIN
extern Cgm_fd CGM_open(
#ifdef NeedFuncProto
const char *metafile,
int record_size,
const char *type
#endif
);
extern int CGM_close(
#ifdef NeedFuncProto
Cgm_fd cgm_fd
#endif
);
extern CGM_read(
#ifdef NeedFuncProto
Cgm_fd cgm_fd,
unsigned char *buf
#endif
);
extern CGM_write(
#ifdef NeedFuncProto
Cgm_fd cgm_fd,
const unsigned char *buf
#endif
);
extern CGM_lseek(
#ifdef NeedFuncProto
Cgm_fd cgm_fd,
int offset,
int whence
#endif
);
extern CGM_flush(
#ifdef NeedFuncProto
Cgm_fd cgm_fd
#endif
);
extern Directory *CGM_directory(
#ifdef NeedFuncProto
Cgm_fd cgm_fd,
FILE *fp
#endif
);
extern void CGM_printDirectory(
#ifdef NeedFuncProto
const Directory *dir
#endif
);
extern int CGM_getInstr(
#ifdef NeedFuncProto
Cgm_fd cgm_fd,
Instr *instr
#endif
);
extern void CGM_flushGetInstr(
#ifdef NeedFuncProto
Cgm_fd cgm_fd
#endif
);
extern int CGM_putInstr(
#ifdef NeedFuncProto
Cgm_fd cgm_fd,
Instr *instr
#endif
);
extern int CGM_flushOutputInstr(
#ifdef NeedFuncProto
Cgm_fd cgm_fd
#endif
);
extern void CGM_freeDirectory(
#ifdef NeedFuncProto
Directory *dir
#endif
);
Directory *CGM_copyCreateDir(
#ifdef NeedFuncProto
Directory *d1
#endif
);
extern Directory *ReallocDir(
#ifdef NeedFuncProto
Directory *dir,
unsigned num_frames
#endif
);
extern Directory *CGM_copyFrames(
#ifdef NeedFuncProto
unsigned int start_frame,
int num_frames,
unsigned int target
#endif
);
extern Directory *CGM_deleteFrames(
#ifdef NeedFuncProto
unsigned int start_frame,
unsigned int num_frames
#endif
);
extern Directory *CGM_readFrames(
#ifdef NeedFuncProto
char *ncar_cgm,
unsigned int start_frame,
int num_frames,
unsigned int target,
unsigned int record_size
#endif
);
extern Directory *CGM_moveFrames (
#ifdef NeedFuncProto
unsigned int start_frame,
unsigned int num_frames,
unsigned int target
#endif
);
extern Directory *CGM_initMetaEdit (
#ifdef NeedFuncProto
char *ncar_cgm,
int record_size,
char *local_tmp,
FILE *verbose_fp
#endif
);
extern int CGM_termMetaEdit(
#ifdef NeedFuncProto
#endif
);
extern int CGM_writeFile(
#ifdef NeedFuncProto
char *ncar_cgm
#endif
);
extern int CGM_writeFrames(
#ifdef NeedFuncProto
char *ncar_cgm,
unsigned start_frame,
unsigned num_frames
#endif
);
extern int CGM_appendFrames(
#ifdef NeedFuncProto
char *ncar_cgm,
unsigned start_frame,
unsigned num_frames
#endif
);
extern Directory *CGM_mergeFrames(
#ifdef NeedFuncProto
unsigned bottom,
unsigned top
#endif
);
extern Directory *CGM_editFrame(
#ifdef NeedFuncProto
unsigned frame,
Instr *edit_instr,
int num_occur
#endif
);
extern const char *CGM_ClassLookup(
#ifdef NeedFuncProto
unsigned int cgmclass
#endif
);
extern const char *CGM_ElementLookup(
#ifdef NeedFuncProto
unsigned int cgmclass,
unsigned int id
#endif
);
NCARG_PROTO_END
#endif /* _cgm_tools_ */
|