Subversion Repositories filter_foundry

Rev

Rev 8 | Rev 37 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.         This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop
  3.     Copyright (C) 2003-5 Toby Thain, toby@telegraphics.com.au
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by  
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License  
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #include "world.h"
  21.  
  22. #include "PIFilter.h"
  23.  
  24. #include "entry.h"
  25.  
  26. #include "choosefile.h"
  27. #include "ui.h"
  28. #include "file_compat.h"
  29. #include "symtab.h"
  30. #include "PARM.h"
  31.  
  32. enum{
  33.         TAB = 011,
  34.         LF  = 012,
  35.         CR  = 015,
  36.  
  37.         CHUNK_ROWS = 64,
  38.  
  39.         PARM_TYPE = 'PARM',
  40.         PARM_ID = 16000,
  41.         TEXT_FILETYPE = 'TEXT',
  42.         SIG_SIMPLETEXT = 'ttxt',
  43.         PS_FILTER_FILETYPE = '8BFM'
  44. };
  45.  
  46. typedef struct{
  47.         Boolean standalone,parmloaded;
  48.         PARM_T parm;
  49. } globals_t;
  50.  
  51. extern globals_t *gdata;
  52. extern FilterRecordPtr gpb;
  53.  
  54. extern struct node *tree[4];
  55. extern char *err[4];
  56. extern int errpos[4],errstart[4],nplanes;
  57. extern value_type slider[8],cell[0x100],map[4][0x100];
  58. extern char *expr[4];
  59.  
  60. extern int tokpos,tokstart,varused[];
  61. extern char *errstr;
  62.  
  63. #if 1
  64. #define PINEWHANDLE             gpb->handleProcs->newProc
  65. #define PIDISPOSEHANDLE gpb->handleProcs->disposeProc
  66. #define PIGETHANDLESIZE gpb->handleProcs->getSizeProc
  67. #define PISETHANDLESIZE gpb->handleProcs->setSizeProc
  68. #define PILOCKHANDLE    gpb->handleProcs->lockProc
  69. #define PIUNLOCKHANDLE  gpb->handleProcs->unlockProc
  70. #else
  71. // avoid host callbacks for AE
  72. #define PINEWHANDLE             NewHandle
  73. #define PIDISPOSEHANDLE DisposeHandle
  74. #define PIGETHANDLESIZE GetHandleSize
  75. #define PISETHANDLESIZE(h,s) ( SetHandleSize(h,s),MemError() )
  76. #define PILOCKHANDLE(h,f) ( HLock(h),*(h) )
  77. #define PIUNLOCKHANDLE  HUnlock
  78. #endif
  79.  
  80. #define MIN(a,b) ((a) < (b) ? (a) : (b))
  81. #define MAX(a,b) ((a) > (b) ? (a) : (b))
  82.  
  83. #define DBG(x)
  84. //#define DEBUG
  85.  
  86.  
  87. DLLEXPORT MACPASCAL
  88. void ENTRYPOINT(short selector,FilterRecordPtr epb,long *data,short *result);
  89.  
  90. void DoPrepare (FilterRecordPtr epb);
  91. void DoStart (FilterRecordPtr epb);
  92. OSErr DoContinue (FilterRecordPtr epb);
  93. void DoFinish (FilterRecordPtr epb);
  94. void RequestNext (FilterRecordPtr epb,long);
  95.  
  96. Boolean readparams(Handle h,Boolean alerts,char **reason);
  97. Handle readfileintohandle(FILEREF r);
  98. Boolean readfile(StandardFileReply *sfr,char **reason);
  99. Boolean readPARM(Ptr h,PARM_T *parm,char **reasonstr);
  100.  
  101. OSErr saveparams(Handle h);
  102. OSErr savehandleintofile(Handle h,FILEREF r);
  103. Boolean savefile(StandardFileReply *sfr);
  104.  
  105. OSErr make_standalone(StandardFileReply *sfr);
  106.  
  107. Boolean setup(FilterRecordPtr pb);
  108. void evalpixel(unsigned char *outp,unsigned char *inp);
  109. OSErr process(FilterRecordPtr pb,Boolean progress,
  110.                           Rect *inRect,Rect *filterRect,Rect *outRect,
  111.                           void *outData,long outRowBytes);
  112. OSErr process_scaled(FilterRecordPtr pb,Boolean progress,
  113.                           Rect *inRect,Rect *filterRect,Rect *outRect,
  114.                           void *outData,long outRowBytes,double zoom);
  115.  
  116. unsigned long printablehash(unsigned long hash);
  117. long fixpipl(PIPropertyList *pipl,long origsize,StringPtr title);
  118. long fixaete(unsigned char *p,long origsize,StringPtr title);
  119.  
  120. Boolean loadfile(StandardFileReply *sfr,char **reason);
  121. Boolean readPARMresource(HMODULE hm,char **reason);
  122.  
  123. void dbglasterror(char*);
  124.  
  125. // from parser.y
  126. struct node *parseexpr(char *s);
  127.