1 /* All ip headers. 2 */ 3 4 /* 5 6 Copyright (C) 1991-2003 The National Gallery 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License as published by 10 the Free Software Foundation; either version 2 of the License, or 11 (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License along 19 with this program; if not, write to the Free Software Foundation, Inc., 20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 22 */ 23 24 /* 25 26 These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk 27 28 */ 29 30 /* We can get multiple includes sometimes, gah, thank you bison. 31 */ 32 #ifndef IP_H 33 #define IP_H 34 35 /* DEBUG everywhere. 36 #define DEBUG 37 */ 38 39 /* Turn off VIPS's old and broken defines, we don't need them. 40 */ 41 #define IM_NO_VIPS7_COMPAT 42 43 /* Enable heap sanity checks on every alloc ... very slow ... also see heap.c 44 #define DEBUG_HEAP 45 */ 46 47 #ifdef HAVE_CONFIG_H 48 #include <config.h> 49 #endif /*HAVE_CONFIG_H*/ 50 51 #ifdef ENABLE_NLS 52 #include <libintl.h> 53 #define _(String) gettext(String) 54 #ifdef gettext_noop 55 #define N_(String) gettext_noop(String) 56 #else 57 #define N_(String) (String) 58 #endif 59 #else /* NLS is disabled */ 60 #define _(String) (String) 61 #define N_(String) (String) 62 #define textdomain(String) (String) 63 #define gettext(String) (String) 64 #define dgettext(Domain,String) (String) 65 #define dcgettext(Domain,String,Type) (String) 66 #define bindtextdomain(Domain,Directory) (Domain) 67 #define bind_textdomain_codeset(Domain,Codeset) (Codeset) 68 #define ngettext(S, P, N) ((N) == 1 ? (S) : (P)) 69 #endif /* ENABLE_NLS */ 70 71 #include <time.h> 72 #include <ctype.h> 73 #include <errno.h> 74 #include <limits.h> 75 #include <math.h> 76 #include <memory.h> 77 #include <locale.h> 78 #include <setjmp.h> 79 #include <stdarg.h> 80 #include <stdio.h> 81 #include <stdlib.h> 82 #include <string.h> 83 #ifdef HAVE_PWD_H 84 #include <pwd.h> 85 #endif /*HAVE_PWD_H*/ 86 #ifdef HAVE_FNMATCH_H 87 #include <fnmatch.h> 88 #endif /*HAVE_FNMATCH_H*/ 89 #ifdef HAVE_SYS_PARAM_H 90 #include <sys/param.h> 91 #endif /*HAVE_SYS_PARAM_H*/ 92 #include <sys/stat.h> 93 #ifdef HAVE_SYS_TIME_H 94 #include <sys/time.h> 95 #endif /*HAVE_SYS_TIME_H*/ 96 #include <sys/types.h> 97 #ifdef HAVE_SYS_RESOURCE_H 98 #include <sys/resource.h> 99 #endif /*HAVE_SYS_RESOURCE_H*/ 100 #ifdef HAVE_SYS_WAIT_H 101 #include <sys/wait.h> 102 #endif /*HAVE_SYS_WAIT_H*/ 103 #ifdef HAVE_UNISTD_H 104 #include <unistd.h> 105 #endif /*HAVE_UNISTD_H*/ 106 #ifdef HAVE_SYS_STATVFS_H 107 #include <sys/statvfs.h> 108 #endif /*HAVE_SYS_STATVFS_H*/ 109 #ifdef HAVE_SYS_VFS_H 110 #include <sys/vfs.h> 111 extern int statfs(); 112 #endif /*HAVE_SYS_VFS_H*/ 113 #ifdef HAVE_SYS_MOUNT_H 114 #include <sys/mount.h> 115 #endif /*HAVE_SYS_MOUNT_H*/ 116 #ifdef OS_WIN32 117 #include <windows.h> 118 #endif /*OS_WIN32*/ 119 #ifdef HAVE_FFTW 120 #include <fftw.h> 121 #endif /*HAVE_FFTW*/ 122 #ifdef HAVE_FFTW3 123 #include <fftw3.h> 124 #endif /*HAVE_FFTW3*/ 125 #include <fcntl.h> 126 127 /* Have to include glib before dmalloc ... dmalloc may be included by vips.h 128 */ 129 #include <gtk/gtk.h> 130 #include <gdk/gdkkeysyms.h> 131 132 #ifdef HAVE_LIBGOFFICE 133 #include <goffice/goffice.h> 134 135 #include <goffice/app/go-plugin.h> 136 #include <goffice/app/go-plugin-loader-module.h> 137 138 #include <goffice/data/go-data-simple.h> 139 140 #include <goffice/graph/gog-data-set.h> 141 #include <goffice/graph/gog-label.h> 142 #include <goffice/graph/gog-object.h> 143 #include <goffice/graph/gog-plot.h> 144 #include <goffice/graph/gog-series.h> 145 #include <goffice/graph/gog-grid.h> 146 #include <goffice/graph/gog-grid-line.h> 147 #include <goffice/graph/gog-legend.h> 148 #include <goffice/graph/gog-chart-map.h> 149 150 151 #include <goffice/utils/go-color.h> 152 #include <goffice/utils/go-marker.h> 153 #endif /*HAVE_LIBGOFFICE*/ 154 155 #ifdef HAVE_LIBGVC 156 #include <gvc.h> 157 #endif /*HAVE_LIBGVC*/ 158 159 #include <vips/vips.h> 160 #include <vips/vips7compat.h> 161 #include <vips/debug.h> 162 163 #include <libxml/tree.h> 164 #include <libxml/parser.h> 165 166 /* If we're not using GNU C, elide __attribute__ 167 */ 168 #ifndef __GNUC__ 169 # ifndef __attribute__ 170 # define __attribute__(x) /*NOTHING*/ 171 # endif 172 #endif 173 174 /* Our general widgets. 175 */ 176 #include "formula.h" 177 #include "doubleclick.h" 178 179 /* Generated marshallers. 180 */ 181 #include "nipmarshal.h" 182 183 /* XML namespace ... note, not nip2! We can't change this. 184 */ 185 #define NAMESPACE "http://www.vips.ecs.soton.ac.uk/nip" 186 187 #define MAXFILES (4000) /* Max. no of files in path */ 188 #define STACK_SIZE (1000) /* Depth of eval stack */ 189 #define LEN_LABEL (512) /* Label on windows */ 190 #define MAX_SYSTEM (50) /* Max number of args we allow */ 191 #define MAX_BANDS (64) /* Max number of bands in image */ 192 #define MAX_CSTACK (10) /* Max number of cursors we stack */ 193 #define MAX_STRSIZE (100000) /* Size of text for user defs */ 194 #define MAX_TRACE (1024) /* Biggest thing we print in trace */ 195 #define MAX_SSTACK (40) /* Scope stack for parser */ 196 #define VIPS_HOMEPAGE "https://github.com/jcupitt/nip2" 197 #define IP_NAME PACKAGE "-" VERSION 198 #define NIP_DOCPATH "$VIPSHOME" G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S \ 199 "doc" G_DIR_SEPARATOR_S PACKAGE G_DIR_SEPARATOR_S "html" 200 #define VIPS_DOCPATH "$VIPSHOME" G_DIR_SEPARATOR_S "share" G_DIR_SEPARATOR_S \ 201 "doc" G_DIR_SEPARATOR_S "vips" G_DIR_SEPARATOR_S "html" 202 #define IP_NAME PACKAGE "-" VERSION 203 #define MAX_LINELENGTH (120) /* Max chars we display of value */ 204 #define MAX_RECENT (10) /* Number of recent items in file menu */ 205 #define NIP_COPYRIGHT "%s: ©2018 Imperial College, London" 206 207 /* Our stock_ids. 208 */ 209 #define STOCK_NEXT_ERROR "nip-next-error" 210 #define STOCK_DROPPER "nip-dropper" 211 #define STOCK_DUPLICATE "nip-duplicate" 212 #define STOCK_PAINTBRUSH "nip-paintbrush" 213 #define STOCK_LINE "nip-linedraw" 214 #define STOCK_TEXT "nip-text" 215 #define STOCK_SMUDGE "nip-smudge" 216 #define STOCK_FLOOD "nip-flood" 217 #define STOCK_FLOOD_BLOB "nip-floodblob" 218 #define STOCK_RECT "nip-rect" 219 #define STOCK_MOVE "nip-move" 220 #define STOCK_LOCK "nip-lock" 221 #define STOCK_ALERT "nip-alert" 222 #define STOCK_SELECT "nip-select" 223 #define STOCK_LED_RED "nip-led-red" 224 #define STOCK_LED_GREEN "nip-led-green" 225 #define STOCK_LED_BLUE "nip-led-blue" 226 #define STOCK_LED_YELLOW "nip-led-yellow" 227 #define STOCK_LED_CYAN "nip-led-cyan" 228 #define STOCK_LED_OFF "nip-led-off" 229 230 /* How much we decompile for error messages. 231 */ 232 #define MAX_ERROR_FRAG (100) 233 234 /* win32 adds '_', sometimes. 235 */ 236 #ifdef OS_WIN32 237 #ifndef popen 238 #define popen(b,m) _popen(b,m) 239 #endif /*popen*/ 240 #ifndef pclose 241 #define pclose(f) _pclose(f) 242 #endif /*pclose*/ 243 #define mktemp(f) _mktemp(f) 244 #endif /*OS_WIN32*/ 245 246 /* Fwd ref these. 247 */ 248 typedef struct _Watch Watch; 249 typedef struct _Toolitem Toolitem; 250 typedef struct _BuiltinInfo BuiltinInfo; 251 typedef struct _Classmodel Classmodel; 252 typedef struct _Colour Colour; 253 typedef struct _Column Column; 254 typedef struct _Columnview Columnview; 255 typedef struct _Compile Compile; 256 typedef struct _Conversion Conversion; 257 typedef struct _Conversionview Conversionview; 258 typedef struct _Expr Expr; 259 typedef struct _Filemodel Filemodel; 260 typedef struct _Heap Heap; 261 typedef struct _HeapBlock HeapBlock; 262 typedef struct _Heapmodel Heapmodel; 263 typedef struct _iArrow iArrow; 264 typedef struct _iImage iImage; 265 typedef struct _Imagedisplay Imagedisplay; 266 typedef struct _Managed Managed; 267 typedef struct _Managedfile Managedfile; 268 typedef struct _Managedgvalue Managedgvalue; 269 typedef struct _Managedgobject Managedgobject; 270 typedef struct _Managedstring Managedstring; 271 typedef struct _Imageinfo Imageinfo; 272 typedef struct _Imagepresent Imagepresent; 273 typedef struct _Imagemodel Imagemodel; 274 typedef struct _iRegion iRegion; 275 typedef struct _iRegiongroup iRegiongroup; 276 typedef struct _Link Link; 277 typedef struct _LinkExpr LinkExpr; 278 typedef struct _Model Model; 279 typedef struct _iObject iObject; 280 typedef struct _iContainer iContainer; 281 typedef struct _Paintboxview Paintboxview; 282 typedef struct _ParseConst ParseConst; 283 typedef struct _ParseNode ParseNode; 284 typedef struct _Program Program; 285 typedef struct _String String; 286 typedef struct _Number Number; 287 typedef struct _Reduce Reduce; 288 typedef struct _Regionview Regionview; 289 typedef struct _Rhs Rhs; 290 typedef struct _Rhsview Rhsview; 291 typedef struct _Row Row; 292 typedef struct _Rowview Rowview; 293 typedef struct _Statusview Statusview; 294 typedef struct _Plotstatus Plotstatus; 295 typedef struct _Plot Plot; 296 typedef struct _Plotwindow Plotwindow; 297 typedef struct _Plotpresent Plotpresent; 298 typedef struct _Plotmodel Plotmodel; 299 typedef struct _Graphwindow Graphwindow; 300 typedef struct _Subcolumn Subcolumn; 301 typedef struct _Subcolumnview Subcolumnview; 302 typedef struct _Symbol Symbol; 303 typedef struct _Tool Tool; 304 typedef struct _Toolkit Toolkit; 305 typedef struct _Toolkitgroup Toolkitgroup; 306 typedef struct _Toolkitgroupview Toolkitgroupview; 307 typedef struct _Toolkitview Toolkitview; 308 typedef struct _Toolview Toolview; 309 typedef struct _Trace Trace; 310 typedef struct _Preview Preview; 311 typedef struct _Infobar Infobar; 312 typedef struct _iError iError; 313 typedef struct _Log Log; 314 typedef struct _vObject vObject; 315 typedef struct _View View; 316 typedef struct _Workspace Workspace; 317 typedef struct _Workspaceview Workspaceview; 318 typedef struct _Workspaceroot Workspaceroot; 319 typedef struct _Workspacegroup Workspacegroup; 320 typedef struct _Workspacegroupview Workspacegroupview; 321 typedef struct _Prefworkspaceview Prefworkspaceview; 322 typedef struct _Prefcolumnview Prefcolumnview; 323 typedef struct _iText iText; 324 typedef struct _Expression Expression; 325 typedef struct _Mainw Mainw; 326 typedef struct _Toolviewitemgroup Toolviewitemgroup; 327 typedef struct _Panechild Panechild; 328 typedef struct _Toolkitbrowser Toolkitbrowser; 329 typedef struct _Workspacedefs Workspacedefs; 330 331 /* container map function typedefs. 332 */ 333 typedef void *(*row_map_fn)( Row *, void *, void *, void * ); 334 typedef void *(*symbol_map_fn)( Symbol *, void *, void *, void * ); 335 typedef void *(*column_map_fn)( Column *, void * ); 336 typedef void *(*view_map_fn)( View *, void *, void * ); 337 typedef void *(*rowview_map_fn)( Rowview *, void * ); 338 typedef void *(*workspace_map_fn)( Workspace *, void * ); 339 typedef void *(*toolkit_map_fn)( Toolkit *, void *, void * ); 340 typedef void *(*tool_map_fn)( Tool *, void *, void * ); 341 342 /* Util stuff. 343 */ 344 #include "util.h" 345 #include "gtkutil.h" 346 #include "path.h" 347 #include "iobject.h" 348 #include "icontainer.h" 349 #include "iwindow.h" 350 #include "idialog.h" 351 #include "boxes.h" 352 #include "popupbutton.h" 353 #include "imageheader.h" 354 #include "filesel.h" 355 #include "managed.h" 356 #include "managedfile.h" 357 #include "managedgvalue.h" 358 #include "managedgobject.h" 359 #include "imageinfo.h" 360 #include "imagedisplay.h" 361 #include "colourdisplay.h" 362 #include "imagemodel.h" 363 #include "imagepresent.h" 364 #include "floatwindow.h" 365 #include "imageview.h" 366 #include "tslider.h" 367 #include "pane.h" 368 #include "progress.h" 369 370 /* Basic ip includes (order important). 371 */ 372 #include "tree.h" 373 #include "heap.h" 374 #include "managedstring.h" 375 #include "class.h" 376 #include "link.h" 377 #include "expr.h" 378 #include "model.h" 379 #include "paintboxview.h" 380 #include "conversion.h" 381 #include "heapmodel.h" 382 #include "classmodel.h" 383 #include "filemodel.h" 384 #include "symbol.h" 385 #include "workspace.h" 386 #include "workspaceroot.h" 387 #include "workspacegroup.h" 388 #include "toolkitgroup.h" 389 #include "secret.h" 390 #include "action.h" 391 #include "reduce.h" 392 #include "vobject.h" 393 #include "vipsobject.h" 394 #include "view.h" 395 #include "graphicview.h" 396 #include "spin.h" 397 #include "row.h" 398 #include "rowview.h" 399 #include "subcolumn.h" 400 #include "subcolumnview.h" 401 #include "rhs.h" 402 #include "rhsview.h" 403 #include "workspaceview.h" 404 #include "workspacegroupview.h" 405 #include "toolkitgroupview.h" 406 #include "column.h" 407 #include "columnview.h" 408 #include "toolkit.h" 409 #include "tool.h" 410 #include "toolkitview.h" 411 #include "toolview.h" 412 #include "watch.h" 413 #include "value.h" 414 #include "panechild.h" 415 416 /* Per module includes, any order 417 */ 418 #include "workspacedefs.h" 419 #include "toolkitbrowser.h" 420 #include "defbrowser.h" 421 #include "log.h" 422 #include "error.h" 423 #include "trace.h" 424 #include "program.h" 425 #include "conversionview.h" 426 #include "statusview.h" 427 #include "plotstatus.h" 428 #include "mainw.h" 429 #include "preview.h" 430 #include "builtin.h" 431 #include "compile.h" 432 #include "dump.h" 433 #include "main.h" 434 #include "predicate.h" 435 #include "slider.h" 436 #include "clock.h" 437 #include "pathname.h" 438 #include "fontname.h" 439 #include "group.h" 440 #include "real.h" 441 #include "vector.h" 442 #include "colour.h" 443 #include "number.h" 444 #include "istring.h" 445 #include "editview.h" 446 #include "expression.h" 447 #include "expressionview.h" 448 #include "stringview.h" 449 #include "numberview.h" 450 #include "matrix.h" 451 #include "matrixview.h" 452 #include "plot.h" 453 #ifdef HAVE_LIBGOFFICE 454 #include "plotview.h" 455 #endif /*HAVE_LIBGOFFICE*/ 456 #include "plotmodel.h" 457 #include "plotpresent.h" 458 #include "plotwindow.h" 459 #include "graphwindow.h" 460 #include "option.h" 461 #include "optionview.h" 462 #include "iimage.h" 463 #include "iregion.h" 464 #include "iregiongroup.h" 465 #include "iarrow.h" 466 #include "valueview.h" 467 #include "sliderview.h" 468 #include "pathnameview.h" 469 #include "fontnameview.h" 470 #include "colourview.h" 471 #include "iimageview.h" 472 #include "iregionview.h" 473 #include "iregiongroupview.h" 474 #include "prefs.h" 475 #include "prefworkspaceview.h" 476 #include "prefcolumnview.h" 477 #include "regionview.h" 478 #include "itext.h" 479 #include "itextview.h" 480 #include "toggle.h" 481 #include "toggleview.h" 482 #include "call.h" 483 #include "cache.h" 484 #include "parser.h" 485 486 #ifdef WITH_DMALLOC 487 #include <dmalloc.h> 488 #endif /*WITH_DMALLOC*/ 489 490 #endif /*IP_H*/ 491