home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / EmacsTeX / Emacs-3.0.1 / Source / EditListener.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  2.0 KB  |  83 lines

  1. #import <appkit/appkit.h>
  2. #import "EditListener.h"
  3. #import <mach/mach.h>
  4. #import <mach/message.h>
  5. #import <servers/netname.h>
  6. extern port_t name_server_port;
  7. extern id NXResponsibleDelegate();
  8. @implementation  EditListener :Listener
  9. {}
  10. static NXRemoteMethod *remoteMethods = NULL;
  11. #define REMOTEMETHODS 2
  12. + initialize 
  13. /* */
  14. {
  15.     if (!remoteMethods) {
  16.     remoteMethods =
  17.     (NXRemoteMethod *) malloc((REMOTEMETHODS+1)*sizeof(NXRemoteMethod));
  18.     remoteMethods[0].key = 
  19.     @selector(openFile:onHost:atTrueLine:);
  20.     remoteMethods[0].types = "cci";
  21.     remoteMethods[1].key = 
  22.     @selector(openFile:onHost:fromTrueLine:to:);
  23.     remoteMethods[1].types = "ccii";
  24.     remoteMethods[REMOTEMETHODS].key = NULL;
  25.     }
  26.     return self;
  27. }
  28. -(int)openFile : (char *) fileName
  29.     onHost : (char *) hostName
  30.     atTrueLine : (int) line
  31. /* */
  32. {
  33.     id _NXd;
  34.     if (_NXd = NXResponsibleDelegate(self,
  35.     @selector(openFile:onHost:atTrueLine:)))
  36.     return [_NXd openFile : fileName
  37.         onHost : hostName
  38.         atTrueLine : line];
  39.     return -1;
  40. }
  41.  
  42. -(int)openFile : (char *) fileName
  43.     onHost : (char *) hostName
  44.     fromTrueLine : (int) line1
  45.     to : (int) line2
  46. /* */
  47. {
  48.     id _NXd;
  49.     if (_NXd = NXResponsibleDelegate(self,
  50.     @selector(openFile:onHost:fromTrueLine:to:)))
  51.     return [_NXd openFile : fileName
  52.         onHost : hostName
  53.         fromTrueLine : line1
  54.         to : line2];
  55.     return -1;
  56. }
  57.  
  58. - (int) performRemoteMethod : (NXRemoteMethod *) method
  59.                   paramList : (NXParamValue *) paramList {
  60. /* */
  61.     switch (method - remoteMethods) {
  62.     case 0:
  63.     return [self openFile : paramList[0].bval.p
  64.         onHost : paramList[1].bval.p
  65.         atTrueLine : paramList[2].ival];
  66.     case 1:
  67.     return [self openFile : paramList[0].bval.p
  68.         onHost : paramList[1].bval.p
  69.         fromTrueLine : paramList[2].ival
  70.         to : paramList[3].ival];
  71.     default:
  72.     return [super performRemoteMethod : method paramList : paramList];
  73.     }
  74. }
  75. - (NXRemoteMethod *) remoteMethodFor: (SEL) aSel {
  76. /* */
  77.     NXRemoteMethod *rm;
  78.     if (rm = NXRemoteMethodFromSel(aSel,remoteMethods))
  79.         return rm;
  80.     return [super remoteMethodFor : aSel];
  81. }
  82. @end
  83.