Subversion Repositories filter_foundry

Rev

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

  1. /*
  2.         This file is part of a common library for Adobe(R) plugins
  3.     Copyright (C) 2002-6 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. /* Build environment for cross-platform plugin */
  21.  
  22. #ifndef WORLD_H_
  23. #define WORLD_H_
  24.  
  25. #include <string.h>
  26. #include <stdlib.h>
  27. //#include <stddef.h>
  28. #include <stdio.h>
  29.  
  30. #if defined(__GNUC__)
  31.         // probably OS X or MinGW gcc
  32.         #include <stdint.h> // for intptr_t req'd by CS4 SDK
  33. #elif defined(powerc) || defined(__SC__)
  34.         // Mac PPC and 68K have 32 bit pointers
  35.         typedef long intptr_t;
  36. #endif
  37.  
  38. #include "dbg.h"
  39. #include "str.h"
  40.  
  41. #ifdef macintosh
  42.         #include "carbonstuff.h"
  43.  
  44.         #include <quickdraw.h>
  45.         #include <events.h>
  46.  
  47.         #define TICKCOUNT TickCount
  48.         #define TICKS_SEC 60
  49.  
  50.         #if defined(powerc) || defined(__GNUC__)
  51.                 #define EnterCodeResource()
  52.                 #define ExitCodeResource()
  53.                 #define ENTERCALLBACK()
  54.                 #define EXITCALLBACK()
  55.         #else
  56.                 #ifdef __SC__
  57.                         // Symantec C (MPW compiler) - does not support A4 globals
  58.  
  59.                         #define EnterCodeResource()
  60.                         #define ExitCodeResource()
  61.                         #define ENTERCALLBACK()
  62.                         #define EXITCALLBACK()
  63.  
  64.                         // avoid some standard library routines (can't have global data)
  65.                         #include "sprintf_tiny.h"
  66.                         #define sprintf sprintf_tiny
  67.  
  68.                         #define memset my_memset
  69.  
  70.                         #include <macmemory.h>
  71.                         #define malloc (void*)NewPtr
  72.                         #define free(p) DisposePtr((void*)(p))
  73.                 #else
  74.                         // CodeWarrior supports A4-based globals
  75.  
  76.                         #include <a4stuff.h>
  77.  
  78.                         #define ENTERCALLBACK() long old_a4 = SetCurrentA4()
  79.                         #define EXITCALLBACK() SetA4(old_a4)
  80.                 #endif
  81.         #endif
  82.  
  83.         #define DIRSEP ':'
  84.  
  85.         typedef Handle HMODULE;
  86. #else
  87.         // Win32 target
  88.         #include <windows.h>
  89.  
  90.         #include "compat_win.h"
  91.  
  92.         #define TICKCOUNT _GetTickCount64
  93.         #define TICKS_SEC 1000
  94.  
  95.         #define EnterCodeResource()
  96.         #define ExitCodeResource()
  97.  
  98.         #define DIRSEP '\\'
  99.  
  100.         extern HINSTANCE hDllInstance;
  101. #endif
  102.  
  103. #define SETRECT(rect,l,t,r,b) \
  104.         ((rect).left=(l),(rect).top=(t),(rect).right=(r),(rect).bottom=(b))
  105. #define OFFSETRECT(rect,h,v) \
  106.         ( (rect).left+=(h),(rect).right+=(h),(rect).top+=(v),(rect).bottom+=(v) )
  107.  
  108. #ifdef __GNUC__
  109.         #define ATTRIBUTE_PACKED __attribute__ (( packed ))
  110. #else
  111.         #define ATTRIBUTE_PACKED
  112. #endif
  113.  
  114. #endif
  115.