home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Python 1.1 / Mac / macguesstabsize.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-19  |  565 b   |  32 lines  |  [TEXT/KAHL]

  1. #include <Types.h>
  2. #include <Files.h>
  3. #include <OSUtils.h>
  4. #include <Resources.h>
  5.  
  6. #include <string.h>
  7.  
  8. /* Interface used by tokenizer.c */
  9.  
  10. guesstabsize(path)
  11.     char *path;
  12. {
  13.     Str255 s;
  14.     int refnum;
  15.     Handle h;
  16.     int tabsize = 0;
  17.     s[0] = strlen(path);
  18.     memcpy(s+1, path, s[0]);
  19.     refnum = OpenResFile(s);
  20. /* printf("%s --> refnum=%d\n", path, refnum); */
  21.     if (refnum == -1)
  22.         return 0;
  23.     UseResFile(refnum);
  24.     h = GetIndResource('ETAB', 1);
  25.     if (h != 0) {
  26.         tabsize = (*(short**)h)[1];
  27. /* printf("tabsize=%d\n", tabsize); */
  28.     }
  29.     CloseResFile(refnum);
  30.     return tabsize;
  31. }
  32.