/* This file is part of MacPaint Format, a File Format plugin for Adobe Photoshop Copyright (C) 2003-6 Toby Thain, toby@telegraphics.com.au This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "entry.h" // must come after Photoshop includes #include "bufio.h" #include "macpaint.h" MACPASCAL void ENTRYPOINT(short selector,FormatRecordPtr pb,long *data,short *result); DLLEXPORT MACPASCAL void ENTRYPOINT(short selector,FormatRecordPtr pb,long *data,short *result){ OSErr e = noErr; EnterCodeResource(); /* Perform the requested operation */ // if(!*data) // *data = (long)malloc(sizeof(struct globals)); switch (selector){ case formatSelectorAbout: DoAbout((AboutRecordPtr)pb); break; case formatSelectorEstimatePrepare: case formatSelectorWritePrepare: pb->maxData = 4L<<10; // nominal memory requirement break; case formatSelectorReadPrepare: pb->maxData = (long)PNTG_ROWS*PNTG_ROWBYTES /* size of uncompressed MacPaint image */ + (4L<<10); /* slop */ break; case formatSelectorReadStart: e = read_start(pb,data); break; case formatSelectorReadContinue: e = read_continue(pb,data); break; case formatSelectorReadFinish: e = read_finish(pb,data); break; case formatSelectorOptionsPrepare: pb->maxData = 0; // no buffers are allocated in Options break; case formatSelectorEstimateStart: pb->minDataBytes = PNTG_HEADERSIZE + PNTG_ROWS*2; pb->maxDataBytes = PNTG_HEADERSIZE + PNTG_ROWS*(PNTG_ROWBYTES+1); case formatSelectorOptionsStart: case formatSelectorEstimateContinue: case formatSelectorOptionsContinue: pb->data = 0; case formatSelectorEstimateFinish: case formatSelectorOptionsFinish: break; case formatSelectorWriteStart: e = write_start(pb,data); break; case formatSelectorWriteContinue: e = write_continue(pb,data); break; case formatSelectorWriteFinish: e = write_finish(pb,data); break; case formatSelectorFilterFile: break; default: e = formatBadParameters; } *result = e; ExitCodeResource(); }