Ticket #20936: emacs-app-snow-leopard.patch

File emacs-app-snow-leopard.patch, 5.5 KB (added by eddieh (Eddie Hillenbrand), 15 years ago)

This patch should allow emacs.app to be built on Snow Leopard. Thanks goes to Erik Charlebois who posted instructions to the emacs-devel list. After the patch is applied there are still a few warnings...

  • src/dbusbind.c

    diff --git a/src/dbusbind.c b/src/dbusbind.c
    a b  
    12471247  CHECK_STRING (service);
    12481248  GCPRO3 (bus, serial, service);
    12491249
    1250   XD_DEBUG_MESSAGE ("%d %s ", XUINT (serial), SDATA (service));
     1250  XD_DEBUG_MESSAGE ("%ld %s ", XUINT (serial), SDATA (service));
    12511251
    12521252  /* Open a connection to the bus.  */
    12531253  connection = xd_initialize (bus);
     
    13411341  CHECK_STRING (service);
    13421342  GCPRO3 (bus, serial, service);
    13431343
    1344   XD_DEBUG_MESSAGE ("%d %s ", XUINT (serial), SDATA (service));
     1344  XD_DEBUG_MESSAGE ("%ld %s ", XUINT (serial), SDATA (service));
    13451345
    13461346  /* Open a connection to the bus.  */
    13471347  connection = xd_initialize (bus);
  • src/font.c

    diff --git a/src/font.c b/src/font.c
    a b  
    13571357    {
    13581358      f[XLFD_AVGWIDTH_INDEX] = alloca (11);
    13591359      len += sprintf (f[XLFD_AVGWIDTH_INDEX],
    1360                       "%d", XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1;
     1360                      "%ld", XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1;
    13611361    }
    13621362  else
    13631363    f[XLFD_AVGWIDTH_INDEX] = "*", len += 2;
     
    16731673    }
    16741674
    16751675  if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
    1676     len += sprintf (work, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX)));
     1676    len += sprintf (work, ":dpi=%ld", XINT (AREF (font, FONT_DPI_INDEX)));
    16771677  if (INTEGERP (AREF (font, FONT_SPACING_INDEX)))
    16781678    len += strlen (":spacing=100");
    16791679  if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
     
    16861686      if (STRINGP (val))
    16871687        len += SBYTES (val);
    16881688      else if (INTEGERP (val))
    1689         len += sprintf (work, "%d", XINT (val));
     1689        len += sprintf (work, "%ld", XINT (val));
    16901690      else if (SYMBOLP (val))
    16911691        len += (NILP (val) ? 5 : 4); /* for "false" or "true" */
    16921692    }
     
    17131713      p += sprintf (p, ":%s=%s", style_names[i],
    17141714                    SDATA (SYMBOL_NAME (styles[i])));
    17151715  if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
    1716     p += sprintf (p, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX)));
     1716    p += sprintf (p, ":dpi=%ld", XINT (AREF (font, FONT_DPI_INDEX)));
    17171717  if (INTEGERP (AREF (font, FONT_SPACING_INDEX)))
    1718     p += sprintf (p, ":spacing=%d", XINT (AREF (font, FONT_SPACING_INDEX)));
     1718    p += sprintf (p, ":spacing=%ld", XINT (AREF (font, FONT_SPACING_INDEX)));
    17191719  if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
    17201720    {
    17211721      if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0)
  • src/nsfns.m

    diff --git a/src/nsfns.m b/src/nsfns.m
    a b  
    17721772{
    17731773  check_ns ();
    17741774#ifdef NS_IMPL_COCOA
    1775   PSFlush ();
     1775  /*PSFlush ();*/
    17761776#endif
    17771777  /*ns_delete_terminal (dpyinfo->terminal); */
    17781778  [NSApp terminate: NSApp];
  • src/nsfont.m

    diff --git a/src/nsfont.m b/src/nsfont.m
    a b  
    245245            return w;
    246246      }
    247247#endif
    248     w = [sfont widthOfString: cstr];
     248    NSDictionary *attrsDictionary =
     249      [NSDictionary dictionaryWithObject:sfont
     250                    forKey:NSFontAttributeName];
     251    w = [cstr sizeWithAttributes:attrsDictionary].width;
    249252    return max (w, 2.0);
    250253}
    251254
  • src/nsgui.h

    diff --git a/src/nsgui.h b/src/nsgui.h
    a b  
    129129} XRectangle;
    130130
    131131#ifndef __OBJC__
    132 typedef struct _NSPoint { float x, y; } NSPoint;
    133 typedef struct _NSSize  { float width, height; } NSSize;
     132typedef double CGFloat;
     133typedef struct _NSPoint { CGFloat x, y; } NSPoint;
     134typedef struct _NSSize  { CGFloat width, height; } NSSize;
    134135typedef struct _NSRect  { NSPoint origin; NSSize size; } NSRect;
    135136#endif
    136137
    137 #define NativeRectangle struct _NSRect
     138#define NativeRectangle NSRect
    138139
    139140#define CONVERT_TO_XRECT(xr, nr)                \
    140141  ((xr).x     = (nr).origin.x,                  \
  • src/nsterm.m

    diff --git a/src/nsterm.m b/src/nsterm.m
    a b  
    14811481     Convert a color to a lisp string with the RGB equivalent
    14821482   -------------------------------------------------------------------------- */
    14831483{
    1484   float red, green, blue, alpha, gray;
     1484  CGFloat red, green, blue, alpha, gray;
    14851485  char buf[1024];
    14861486  const char *str;
    14871487  NSTRACE (ns_color_to_lisp);
     
    15231523         and set color_def pixel to the resulting index.
    15241524   -------------------------------------------------------------------------- */
    15251525{
    1526   float r, g, b, a;
     1526  CGFloat r, g, b, a;
    15271527
    15281528  [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a];
    15291529  color_def->red   = r * 65535;
     
    58335833  em_portion = portion;
    58345834  em_whole = whole;
    58355835
    5836   if (portion >= whole)
    5837     [self setFloatValue: 0.0 knobProportion: 1.0];
     5836  if (portion >= whole) {
     5837    [self setDoubleValue: 0.0];
     5838    [self setKnobProportion: 1.0];
     5839  }
    58385840  else
    58395841    {
    58405842      float pos, por;
    58415843      portion = max ((float)whole*min_portion/pixel_height, portion);
    58425844      pos = (float)position / (whole - portion);
    58435845      por = (float)portion/whole;
    5844       [self setFloatValue: pos knobProportion: por];
     5846      [self setDoubleValue: pos];
     5847      [self setKnobProportion: por];
    58455848    }
    58465849#ifdef NS_IMPL_GNUSTEP
    58475850  [self display];
     
    59465949    case NSScrollerKnobSlot:  /* GNUstep-only */
    59475950      last_hit_part = scroll_bar_move_ratio; break;
    59485951    default:  /* NSScrollerNoPart? */
    5949       fprintf (stderr, "EmacsScoller-mouseDown: unexpected part %d\n", part);
     5952      fprintf (stderr, "EmacsScoller-mouseDown: unexpected part %ld\n", part);
    59505953      return;
    59515954    }
    59525955
  • src/process.c

    diff --git a/src/process.c b/src/process.c
    a b  
    15221522            insert_string ("?");
    15231523          if (INTEGERP (speed))
    15241524            {
    1525               sprintf (tembuf, " at %d b/s", XINT (speed));
     1525              sprintf (tembuf, " at %ld b/s", XINT (speed));
    15261526              insert_string (tembuf);
    15271527            }
    15281528          insert_string (")\n");