ftp.nice.ch/pub/emacs-for-ns/emacs-4.2beta7.tar.gz#/emacs-4.2beta7/src/nsterm.h

This is nsterm.h in view mode; [Download] [Up]

/* Definitions and headers for communication with NeXTstep
   Copyright (C) 1989, 1993 Free Software Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs 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, or (at your option)
any later version.

GNU Emacs 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 GNU Emacs; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */

#include "config.h"

#ifdef HAVE_NS

#ifdef __OBJC__
#import <appkit/appkit.h>
#import <remote/NXProxy.h>

@interface Menu (UndocumentedMenu)
- (void)_restoreInitialMenuPos;
- (void)_saveInitialMenuPos;
@end

@interface SavePanel (UndocumentedSavePanel)
- (BOOL)_validateNames:(char *)name checkBrowser:(BOOL)check;
@end

/* These two interfaces were ruthlessly stolen from John C. Randolph */
@interface View (windowButtons)
- _setMask:(unsigned int) mask;
@end

@interface Window (windowButtons)
- toggleClose:sender;
- toggleMiniaturize:sender;
- setCloseButton:sender to:(BOOL)bool;
- setMiniaturizeButton:sender to:(BOOL)bool;
- showCloseButton:sender;
- showMiniaturizeButton:sender;
- hideCloseButton:sender;
- hideMiniaturizeButton:sender;
- updateBorder;
@end

@protocol Interrupt
-(oneway void)interrupt;
@end

@protocol BaseValueGetting
-(int)numSubValues;
-(id <BaseValueGetting>)subValueAt:(int)nValue;
-(id <BaseValueGetting>)subValueAt:(int)nValue withFlags:(out unsigned *)pFlags andName:(out char **)pName;
-(id <BaseValueGetting>)subValueNamed:(in char *)valueName index:(out int *)index;
-(id <BaseValueGetting>)subValueFor:(id <BaseValueGetting>)value from:(int *)from index:(int *)index;
@end

@protocol Value <BaseValueGetting>
-(char *)valueName;
-(unsigned)size;
-(unsigned)scalerValueFrom:(unsigned)from;
-(float)floatValueFrom:(unsigned)from;
-(char *)enumValueFrom:(unsigned)from;
-(char *)stringValueFrom:(unsigned)from;
-(char *)functionValueFrom:(unsigned)from;
-(unsigned)addressFrom:(unsigned)from;
-(unsigned)addressFrom:(unsigned)from isValid:(out int *)isValid;
-(unsigned)flags;
-(char *)typeName;
-(int)castToTypeNamed:(in char *)typeName from:(unsigned)from;
@end

@protocol Frame <BaseValueGetting>
-(int)hasSymbols;
-(char *)functionName;
-(char *)functionNameAndHasSymbols:(int *)hasSymbols;
-(unsigned)frame;
-(unsigned)pc;
-(char *)fileNameAndLine:(unsigned *)line;
-(int)frameNumber;
@end

@protocol Breakpoint
-(char *)fileName;
-(int)line;
-(BOOL)enabled;
-(char *)commands;
-(char *)condition;
-(char *)expression;
-(char *)function;
@end

@protocol GdbController
-(oneway void)breakInFile:(in char *)filename atLine:(int)line;
-(oneway void)untilInFile:(in char *)filename atLine:(int)line;
-(oneway void)step;
-(oneway void)next;
-(oneway void)continue;
-(oneway void)up;
-(oneway void)frame;
-(oneway void)down;
-(oneway void)finish;
-(oneway void)run;
-(oneway void)quit;
-(oneway void)printExpression:(in char *)selection;
-(oneway void)printExpressionIndirect:(in char *)selection;
-(oneway void)selectFrame:(int)frame;
-(oneway void)interrupt;
-(int)getFramesUpTo:(int)maxFrames selectedFrame:(out int *)sel symbolsOnly:(BOOL)sOnly;
-(id <Frame>)frameAt:(int)frameIndex functionName:(out char **)pFunctionName from:(out unsigned int *)pFrom;
-(id <Frame>)frameAt:(int)frameIndex from:(out unsigned int *)pFrom;
-(id <Frame>)frameAt:(int)frameIndex;
-(char *)functionNameAt:(int)frameIndex;
-(char *)functionNameAt:(int)frameIndex hasSymbols:(int *)hasSymbols;
-(oneway void)errorOpeningFile:(char *)filename fromLine:(int)start to:(int)end;
-(oneway void)executeCommand:(char *)command;
-(oneway void)setClient:anObject;
-(oneway void)addSourceDirectory:(const char *)directory;
-(int)numBreakpoints;
-(id <Breakpoint>)breakpointAt:(int)index;
-(NXData *)completionsForPrefix:(const char *)prefix;
@end

@protocol GdbUser
-(oneway void)openFile:(char *)fileName onHost:(char *)hostName atTrueLine:(int)line;
-(oneway void)openFile:(char *)fileName onHost:(char *)hostName fromTrueLine:(int)startLine to:(int)endLine;
-(oneway void)setInterruptHandler:handler;
-(oneway void)disconnect;
-(oneway void)frameChanged;
-(oneway void)programIsRunning;
-(oneway void)programStopped;
-(oneway void)programIsDead;
-(oneway void)setController:(id <GdbController>)anObject;
-(int)isNewUser;
-(oneway void)setGdbName:(const char *)theName;
@end

@protocol GdbNewUser
-(oneway void)openFile:(char *)fileName onHost:(char *)hostName atTrueLine:(int)line;
-(oneway void)openFile:(char *)fileName onHost:(char *)hostName fromTrueLine:(int)startLine to:(int)endLine;
-(oneway void)setInterruptHandler:handler;
-(oneway void)disconnect;
-(oneway void)frameChanged:(int)selectedFrame;
-(oneway void)programIsRunning;
-(oneway void)programStopped;
-(oneway void)programIsDead;
-(oneway void)setController:(id <GdbController>)anObject;
-(oneway void)programIsLoaded;
-(BOOL)isNewUser;
//-(oneway void)breakpointAdded:(id <Breakpoint>)breakpoint;
//-(oneway void)breakpointDeleted:(id <Breakpoint>)breakpoint;
//-(oneway void)breakpointChanged:(id <Breakpoint>)breakpoint;
@end

#define ISPOINTER   (1 << 0)
#define ISENUM      (1 << 1)
#define ISSCALER    (1 << 2)
#define ISFLOAT     (1 << 3)
#define ISDOUBLE    (1 << 4)
#define ISAGGREGATE (1 << 5)
#define ISCHAR	    (1 << 6)
#define ISARRAY     (1 << 7)
#define ISSIGNED    (1 << 8)
#define ISOBJECT    (1 << 9)
#define ISSTRING    (1 << 10)
#define ISFUNC      (1 << 11)

@protocol PBUser
-(oneway void)openFile:(char *)fileName onHost:(char *)hostName atTrueLine:(int)line;
-(oneway void)openFile:(char *)fileName onHost:(char *)hostName fromTrueLine:(int)startLine to:(int)endLine;
@end

@interface EmacsListener:Listener <PBUser, GdbNewUser>
   {
   }
@end

@interface EmacsApp :Application
   {
   id emacsListener;
   }

-(int)openFile:(char *)fileName onHost:(char *)hostName atTrueLine:(int)line;
-(int)openFile:(char *)fileName onHost:(char *)hostName fromTrueLine:(int)startLine to:(int)endLine;
-(int)app:sender openFile:(const char *) filename type:(const char *) aType;
-(int)app:sender openTempFile:(const char *) filename type:(const char *) aType;
-(BOOL)appAcceptsAnotherFile:sender;

-appWillInit:sender;
-appDidInit:sender;
-applicationDefined:(NXEvent *) e;

-menuDown:sender;

#if 0
-pasteboardChangedOwner:sender;
-pasteboard:sender provideData:(NXAtom)type;
#endif
@end

@interface EmacsView :View
   {
   struct frame *emacsframe;
   char *old_title;
   }

- changeFont:sender;
- (BOOL) acceptsFirstResponder;
- becomeFirstResponder;
- resignFirstResponder;

- keyDown:(NXEvent *)theEvent;
- mouseDown:(NXEvent *)theEvent;
- mouseUp:(NXEvent *)theEvent;
- rightMouseDown:(NXEvent *)theEvent;
- rightMouseUp:(NXEvent *)theEvent;
- mouseEntered:(NXEvent *)theEvent;
- mouseExited:(NXEvent *)theEvent;
- menuDown:sender;

- windowDidResize:sender;
- windowWillResize:sender toSize:(NXSize *)frameSize;
- windowWillClose:sender;
- windowWillMiniaturize:sender toMiniwindow:miniwindow;

- windowDidMove:sender;
- windowDidDeminiaturize:sender;
- windowDidExpose:sender;
- windowDidMiniaturize:sender;
- windowDidBecomeKey:sender;
- windowDidResignKey:sender;

- drawSelf:(const NXRect *)rects :(int)rectCount;
- initFrameFromEmacs:(struct frame *)f;

- validRequestorForSendType:(NXAtom)typeSent andReturnType:(NXAtom)typeReturned;

/* Implemented NXDraggingDestination protocol methods.  */
-(NXDragOperation) draggingEntered:(id <NXDraggingInfo>) sender;
-(BOOL)performDragOperation:(id <NXDraggingInfo>) sender;

- setMiniwindowImage;
@end

@interface EmacsMenu :Menu
   {
   int minmarked;
   id supercell;
   BOOL wasVisible;
   }

- initTitle:(const char *)aTitle;
- addItem:(Lisp_Object)val string:(Lisp_Object)aString bind:(Lisp_Object)bind;

- adjustMap:(Lisp_Object)keymap;
- adjustKey:(Lisp_Object)key binding:(Lisp_Object)bind;
- adjustKey:(Lisp_Object)key binding:(Lisp_Object)bind string:(Lisp_Object)string;
- findCell:(Lisp_Object)value;
- (int)findCellNumber:(Lisp_Object)value;
- transferCell:(int) row to:newmenu;

- addCell:cell;
- removeCell:cell;

- supercell;
- setSupercell:(id) nsupercell;

- mark;
- freeMarked;

- swapin;
- swapout;
@end

@interface EmacsMenuCell:MenuCell
   {
   Lisp_Object value;
   id supercell;
   }

- initTextCell:(const char *)aString;
- free;

- (Lisp_Object)value;
- setValue:(Lisp_Object)nvalue;
- supercell;
- setSupercell:(id) nsupercell;
@end

#if 1
// this is from 4.1
@interface EmacsMenuCard : Button
   {
   PopUpList *popup;
   }
-init;
-addTitle: (char *)name;
-addItem:  (char *)name value:(Lisp_Object)val enabled:(BOOL)enabled;
@end

@interface EmacsMenuPanel: Panel
   {
   id list;
   int maxwidth;
   }
- initFromMenu:(Lisp_Object)menu;
- addItem:(char *)str value:(Lisp_Object)val enabled:(BOOL)enabled at:(int)pane;
- addTitle:(char *)str to:(int)pane;
- (int)cards;
- (Lisp_Object)runMenuAt:(NXCoord)x:(NXCoord)y;
@end
#else
// this is from 4.1.2
@interface EmacsPopupMenu:EmacsMenu
   {
   }
- windowWillClose:sender;
- menuFromKeymap:sender;
- menuFromList:sender;
- addItem:(Lisp_Object)val string:(Lisp_Object)aString bind:(Lisp_Object)bind;
- initFromMenu:(Lisp_Object)def;
- (Lisp_Object)runMenuAt:(NXCoord)x:(NXCoord)y;
@end
#endif

@interface EmacsDialogPanel:Panel
   {
   id command;
   id title;
   id matrix;
   int rows,cols;
   }
- initFromContents:(Lisp_Object)menu;
- addButton:(char *)str value:(Lisp_Object)val row:(int)row;
- addString:(char *)str row:(int)row;
- addSplit;
- (Lisp_Object)runDialogAt:(NXCoord)x:(NXCoord)y;
@end

@interface EmacsImage : NXImage
{
  id imageListNext;
  int refCount;
  id stippleRep;
}
+ allocInitFromFile:(Lisp_Object)file;
- reference;
- imageListSetNext:(id)arg;
- imageListNext;
- free;
- initFromXBM:(unsigned char *)bits width:(int)w height:(int)h;
- initFromSkipXBM:(unsigned char *)bits width:(int)w height:(int)h
           length:(int)length;
- prepareForStippling;
- stippleRep;
@end

@interface EmacsFilePanel:SavePanel
  {
  BOOL allowCreate,allowOld,allowDir;
  }
- setAllowCreate:(BOOL)ifAllowCreate;
- setAllowOld:(BOOL)ifAllowOld;
- setAllowDir:(BOOL)ifAllowDir;
@end

@interface EmacsScroller:Scroller
   {
   Lisp_Object win;

   /* The offset to the bottom of the knob of the last mouse
      down normalized to the knob height.  */
   float last_mouse_offset;

   BOOL condemned;
   }
- initFrame:(const NXRect *)r window:(Lisp_Object)win;
- setFrame:(const NXRect *)r;
- free;

- scrollerMoved:sender;
- setPosition:(int) position portion:(int) portion whole:(int) whole;

- condemn;
- reprieve;
- judge;
@end

extern id ns_current_display;
extern id ns_emacscolors;
extern id <Interrupt> ns_gdb_interrupt_controller;
extern id <GdbController> ns_gdb_controller;
extern int ns_use_open_panel;
extern int ns_use_yes_no_panel;
extern int ns_gdb_frame;
extern Lisp_Object ns_alternate_is_meta,ns_iso_latin,ns_cursor_blink_rate;
extern Lisp_Object ns_shrink_space;
extern Lisp_Object ns_gdb_status;
extern Lisp_Object ns_menu_path;
extern unsigned char *ns2isomap;
extern unsigned char *iso2nsmap;
extern NXAtom *ns_send_types,*ns_return_types;
extern struct frame *ns_highlight_frame;
extern struct frame *ns_focus_frame;
extern struct frame *ns_focus_event_frame;
#endif

enum ns_highlight_kinds
   {
   no_highlight=0,
   filled_box,
   hollow_box,
   bar,
   line
   };

struct ns_display_info
{
  /* Chain of all ns_display_info structures.  */
  struct ns_display_info *next;

  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
     The same cons cell also appears in ns_display_name_list.  */
  Lisp_Object name_list_element;

#if 0
  /* Number of frames that are on this display.  */
  int reference_count;

  /* Number of panes on this screen.  */
  int n_planes;
  /* Dimensions of this screen.  */
  int height, width;
  /* Mask of things that cause the mouse to be grabbed.  */
  int grabbed;
  /* Emacs bitmap-id of the default icon bitmap for this frame.
     Or -1 if none has been allocated yet.  */
  int icon_bitmap_id;

  /* These variables describe the range of text currently shown
     in its mouse-face, together with the window they apply to.
     As long as the mouse stays within this range, we need not
     redraw anything on its account.  */
  int mouse_face_beg_row, mouse_face_beg_col;
  int mouse_face_end_row, mouse_face_end_col;
  int mouse_face_past_end;
  Lisp_Object mouse_face_window;
  int mouse_face_face_id;

  /* 1 if a mouse motion event came and we didn't handle it right away because
     gc was in progress.  */
  int mouse_face_deferred_gc;

  /* FRAME and X, Y position of mouse when last checked for
     highlighting.  X and Y can be negative or out of range for the frame.  */
  struct frame *mouse_face_mouse_frame;
  int mouse_face_mouse_x, mouse_face_mouse_y;

  /* Nonzero means defer mouse-motion highlighting.  */
  int mouse_face_defer;
#endif
  
#ifdef MULTI_KBOARD
  struct kboard *kboard;
#endif

#if 0
  /* The frame (if any) which has the NS window that has keyboard focus.
     Zero if none.  This is examined by Ffocus_frame in xfns.c.  Note
     that a mere EnterNotify event can set this; if you need to know the
     last frame specified in a FocusIn or FocusOut event, use
     ns_focus_event_frame.  */
  struct frame *ns_focus_frame;

  /* The last frame mentioned in a FocusIn or FocusOut event.  This is
     separate from ns_focus_frame, because whether or not LeaveNotify
     events cause us to lose focus depends on whether or not we have
     received a FocusIn event for it.  */
  struct frame *ns_focus_event_frame;

  /* The frame which currently has the visual highlight, and should get
     keyboard input (other sorts of input have the frame encoded in the
     event).  It points to the NS focus frame's selected window's
     frame.  It differs from ns_focus_frame when we're using a global
     minibuffer.  */
  struct frame *ns_highlight_frame;
#endif
#if 0
  /* Connection number (normally a file descriptor number).  */
  int connection;
  /* This says how to access this display in Xlib.  */
  Display *display;
do  /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
do     The same cons cell also appears in x_display_name_list.  */
do  Lisp_Object name_list_element;
do  /* Number of frames that are on this display.  */
do  int reference_count;
  /* The Screen this connection is connected to.  */
  Screen *screen;
  /* The Visual being used for this display.  */
  Visual *visual;
do  /* Number of panes on this screen.  */
do  int n_planes;
do  /* Dimensions of this screen.  */
do  int height, width;
do  /* Mask of things that cause the mouse to be grabbed.  */
do  int grabbed;
do  /* Emacs bitmap-id of the default icon bitmap for this frame.
do     Or -1 if none has been allocated yet.  */
do  int icon_bitmap_id;
  /* The root window of this screen.  */
  Window root_window;
  /* The cursor to use for vertical scroll bars.  */
  Cursor vertical_scroll_bar_cursor;
  /* X Resource data base */
  XrmDatabase xrdb;

  /* A table of all the fonts we have already loaded.  */
  struct font_info *font_table;

  /* The current capacity of x_font_table.  */
  int font_table_size;

  /* Reusable Graphics Context for drawing a cursor in a non-default face. */
  GC scratch_cursor_gc;

do  /* These variables describe the range of text currently shown
do     in its mouse-face, together with the window they apply to.
do     As long as the mouse stays within this range, we need not
do     redraw anything on its account.  */
do  int mouse_face_beg_row, mouse_face_beg_col;
do  int mouse_face_end_row, mouse_face_end_col;
do  int mouse_face_past_end;
do  Lisp_Object mouse_face_window;
do  int mouse_face_face_id;
do
do  /* 1 if a mouse motion event came and we didn't handle it right away because
do     gc was in progress.  */
do  int mouse_face_deferred_gc;

do  /* FRAME and X, Y position of mouse when last checked for
do     highlighting.  X and Y can be negative or out of range for the frame.  */
do  struct frame *mouse_face_mouse_frame;
do  int mouse_face_mouse_x, mouse_face_mouse_y;

do  /* Nonzero means defer mouse-motion highlighting.  */
do  int mouse_face_defer;

  char *x_id_name;

  /* The number of fonts actually stored in x_font_table.
     font_table[n] is used and valid iff 0 <= n < n_fonts.
     0 <= n_fonts <= font_table_size.  */
  int n_fonts;

  /* Pointer to bitmap records.  */
  struct x_bitmap_record *bitmaps;

  /* Allocated size of bitmaps field.  */
  int bitmaps_size;

  /* Last used bitmap index.  */
  int bitmaps_last;

  /* Which modifier keys are on which modifier bits?

     With each keystroke, X returns eight bits indicating which modifier
     keys were held down when the key was pressed.  The interpretation
     of the top five modifier bits depends on what keys are attached
     to them.  If the Meta_L and Meta_R keysyms are on mod5, then mod5
     is the meta bit.

     meta_mod_mask is a mask containing the bits used for the meta key.
     It may have more than one bit set, if more than one modifier bit
     has meta keys on it.  Basically, if EVENT is a KeyPress event,
     the meta key is pressed if (EVENT.state & meta_mod_mask) != 0.

     shift_lock_mask is LockMask if the XK_Shift_Lock keysym is on the
     lock modifier bit, or zero otherwise.  Non-alphabetic keys should
     only be affected by the lock modifier bit if XK_Shift_Lock is in
     use; XK_Caps_Lock should only affect alphabetic keys.  With this
     arrangement, the lock modifier should shift the character if
     (EVENT.state & shift_lock_mask) != 0.  */
  int meta_mod_mask, shift_lock_mask;

  /* These are like meta_mod_mask, but for different modifiers.  */
  int alt_mod_mask, super_mod_mask, hyper_mod_mask;

  /* Communication with window managers.  */
  Atom Xatom_wm_protocols;
  /* Kinds of protocol things we may receive.  */
  Atom Xatom_wm_take_focus;
  Atom Xatom_wm_save_yourself;
  Atom Xatom_wm_delete_window;
  /* Atom for indicating window state to the window manager.  */
  Atom Xatom_wm_change_state;
  /* Other WM communication */
  Atom Xatom_wm_configure_denied; /* When our config request is denied */
  Atom Xatom_wm_window_moved;     /* When the WM moves us.  */
  /* EditRes protocol */
  Atom Xatom_editres;

  /* More atoms, which are selection types.  */
  Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE,
  Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
  Xatom_ATOM_PAIR;
do#ifdef MULTI_KBOARD
do  struct kboard *kboard;
do#endif
  int cut_buffers_initialized; /* Whether we're sure they all exist */

do  /* The frame (if any) which has the X window that has keyboard focus.
do     Zero if none.  This is examined by Ffocus_frame in xfns.c.  Note
do     that a mere EnterNotify event can set this; if you need to know the
do     last frame specified in a FocusIn or FocusOut event, use
do     x_focus_event_frame.  */
do  struct frame *x_focus_frame;
do
do  /* The last frame mentioned in a FocusIn or FocusOut event.  This is
do     separate from x_focus_frame, because whether or not LeaveNotify
do     events cause us to lose focus depends on whether or not we have
do     received a FocusIn event for it.  */
do  struct frame *x_focus_event_frame;
do
do  /* The frame which currently has the visual highlight, and should get
do     keyboard input (other sorts of input have the frame encoded in the
do     event).  It points to the X focus frame's selected window's
do     frame.  It differs from x_focus_frame when we're using a global
do     minibuffer.  */
do  struct frame *x_highlight_frame;
#endif  
};

/* This is a chain of structures for all the NS displays currently in use.  */
extern struct ns_display_info *ns_display_list;

extern Lisp_Object ns_display_name_list;

extern struct ns_display_info *ns_display_info_for_display ();
extern struct ns_display_info *ns_display_info_for_name ();

extern struct ns_display_info *ns_term_init ();

struct ns_output
   {
#ifdef __OBJC__
   id view;
   id miniimage;
   NXColor current_cursor_color;
   NXColor desired_cursor_color;
#else
   void *view;
   void *miniimage;
   char current_cursor_color[16];
   char desired_cursor_color[16];
#endif
   struct ns_face *face;
   float top;
   float left;
   Lisp_Object icon_top;
   Lisp_Object icon_left;
   int line_height;
   float internal_border_width;
   float border_width, border_height;
   enum ns_highlight_kinds current_cursor, desired_cursor;

  /* Table of parameter faces for this frame.  Any NS resources (pixel
      values, fonts) referred to here have been allocated explicitly
      for this face, and should be freed if we change the face.  */
   struct ns_face **param_faces;
   int n_param_faces;

   /* Table of computed faces for this frame.  These are the faces
      whose indexes go into the upper bits of a glyph, computed by
      combining the parameter faces specified by overlays, text
      properties, and what have you.  The NS resources mentioned here
      are all shared with parameter faces.  */
   struct ns_face **computed_faces;
   int n_computed_faces;                /* How many are valid */
   int size_computed_faces;     /* How many are allocated */

  /* This is the Emacs structure for the NS display this frame is on.  */
  struct ns_display_info *display_info;
};

#define NS_FONT_WIDTH(f)	((f)->width)
#ifndef COMPILING_MULTI_TERM
#define FONT_WIDTH(f)	((f)->width)
#define FONT_HEIGHT(f)	((f)->height)

/* Get at the computed faces of an NS window frame.  */
#define FRAME_PARAM_FACES(f) ((f)->output_data.ns->param_faces)
#define FRAME_N_PARAM_FACES(f) ((f)->output_data.ns->n_param_faces)
#define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
#define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])

#define FRAME_COMPUTED_FACES(f) ((f)->output_data.ns->computed_faces)
#define FRAME_N_COMPUTED_FACES(f) ((f)->output_data.ns->n_computed_faces)
#define FRAME_SIZE_COMPUTED_FACES(f) ((f)->output_data.ns->size_computed_faces)
#define FRAME_DEFAULT_FACE(f) ((f)->output_data.ns->computed_faces[0])
#define FRAME_MODE_LINE_FACE(f) ((f)->output_data.ns->computed_faces[1])
#endif /* ! COMPILING_MULTI_TERM */

/* Return the window associated with the frame F.  */
#define FRAME_NS_WINDOW(f) ((f)->output_data.ns->view)

#ifndef COMPILING_MULTI_TERM
#define FRAME_FONT(f) ((f)->output_data.ns->face)
#endif /* ! COMPILING_MULTI_TERM */
#define NS_FRAME_FONT(f) ((f)->output_data.ns->face)
#define NS_FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.ns->internal_border_width)
#define NS_FRAME_LINE_HEIGHT(f) ((f)->output_data.ns->line_height)

/* This gives the ns_display_info structure for the display F is on.  */
#define FRAME_NS_DISPLAY_INFO(f) ((f)->output_data.ns->display_info)

/* This is the `Display *' which frame F is on.  */
#define FRAME_NS_DISPLAY(f) (0)

/* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}.  */
#define NS_PIXEL_WIDTH(f) (ns_pixel_width (f))
#define NS_PIXEL_HEIGHT(f) (ns_pixel_height (f))

#ifndef COMPILING_MULTI_TERM
#define FRAME_DESIRED_CURSOR(f) ((f)->output_data.ns->desired_cursor)
#endif /* ! COMPILING_MULTI_TERM */

struct ns_face
{
  float width;
  float height;
  float descender;
  float underpos;
  float underwidth;
  float size;
  char underline;
#ifdef __OBJC__
  NXAtom name;
  id font;
  NXColor foreground_color;
  NXColor background_color;
  id stipple;
#else
  const char *name;
  void *font;
  char foreground_color[16];
  char background_color[16];
  void *stipple;
#endif
  unsigned int pixmap_w, pixmap_h;
};

extern int ns_new_font(), ns_load_font();
extern void check_ns(void);
extern void ns_set_frame_parameters();
extern void ns_display_menu_bar();
extern Lisp_Object ns_string_from_pasteboard();
extern void ns_string_to_pasteboard();
extern int ns_lisp_to_cursor_type();
extern struct frame *ns_focus_frame;

/* Create the first two computed faces for a frame -- the ones that
   have GC's.  */
extern void ns_init_frame_faces (/* FRAME_PTR */);

/* Free the resources for the faces associated with a frame.  */
extern void ns_free_frame_faces (/* FRAME_PTR */);

/* Given a frame and a face name, return the face's ID number, or
   zero if it isn't a recognized face name.  */
extern int ns_face_name_id_number (/* FRAME_PTR, Lisp_Object */);

/* Return non-zero if FONT1 and FONT2 have the same size bounding box.
   We assume that they're both character-cell fonts.  */
extern int same_size_fonts (/* XFontStruct *, XFontStruct * */);

/* Recompute the GC's for the default and modeline faces.
   We call this after changing frame parameters on which those GC's
   depend.  */
extern void ns_recompute_basic_faces (/* FRAME_PTR */);

/* Return the face ID associated with a buffer position POS.  Store
   into *ENDPTR the next position at which a different face is
   needed.  This does not take account of glyphs that specify their
   own face codes.  F is the frame in use for display, and W is a
   window displaying the current buffer.

   REGION_BEG, REGION_END delimit the region, so it can be highlighted.  */
extern int ns_compute_char_face (/* FRAME_PTR frame,
                                    struct window *w,
                                    int pos,
                                    int region_beg, int region_end,
                                    int *endptr */);
/* Return the face ID to use to display a special glyph which selects
   FACE_CODE as the face ID, assuming that ordinarily the face would
   be BASIC_FACE.  F is the frame.  */
extern int ns_compute_glyph_face (/* FRAME_PTR, int */);

#define BEANS 0xfabacaea
#define MINWIDTH 10
#define MINHEIGHT 10

#ifdef __OBJC__
#define XNS_SCROLL_BAR(vec) ((id) LISP_TO_VOID (vec))
#else
#define XNS_SCROLL_BAR(vec) LISP_TO_VOID (vec)
#endif

/* Screen max coordinate
 Using larger coordinates causes movewindow/placewindow to abort */
#define SCREENMAX 16000

/* Little utility macro */
#define BOUND(min,x,max) (((x)<(min)) ? (min) : (((x)>(max)) ? (max) : (x)))
#define SCREENMAXBOUND(x) (BOUND(-SCREENMAX,x,SCREENMAX))

#endif

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.