home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / source / clintsrc.sit / unixDA.r < prev    next >
Text File  |  1990-03-06  |  8KB  |  401 lines

  1. /*========================================================================
  2. ===  unixDA.r
  3. ===
  4. ===  Greg Anderson
  5. ===  29 Kerr Hall
  6. ===  Social Sciences Computing
  7. ===  University of California at Santa Cruz
  8. ===  Santa Cruz CA  95062
  9. ===
  10. ===  (408) 476-9338
  11. ===  sirkm@ssyx
  12. ===
  13. ===  unixDA is a desk accessory that interfaces to Unix services
  14. ===  offered with Steven Grimm's client/server software.
  15. ===
  16. ===  unixDA requires MacTCP to run.  It was written with MPW and
  17. ===  is based on the example "memory" desk accessory provided with
  18. ===  that package.
  19. ===
  20. ========================================================================*/
  21. #include "Types.r"                /* To get system types */
  22. #include "SysTypes.r"
  23. #include "MPWTypes.r"            /* To get 'DRVW' type */
  24.  
  25. #include "unixDA.h"
  26.  
  27. type 'DRVR' as 'DRVW';            /* Map 'DRVW' => 'DRVR' */
  28.  
  29. /*
  30.  * This will produce a DRVR resource from the special DRVW type.
  31.  *
  32.  * Note that the ID 12 is irrelevant, since the Font/DA Mover
  33.  * will renumber it to something else when installing it anyway.
  34.  *
  35.  * The leading NUL in the resource name is required to
  36.  * conform to the desk accessory naming convention.
  37.  *
  38.  * The resource is declared purgeable.    If the code were to
  39.  * do funky things like SetTrapAddress calls (requiring the code to
  40.  * be around at all times), we would have to set it nonpurgeable.
  41.  */
  42.  
  43. #define DriverID    12
  44.  
  45. resource 'DRVR' (DriverID, "\0x00"DA_name, purgeable) {
  46.     /*
  47.      * DRVR flags
  48.      */
  49.     dontNeedLock,            /* OK to float around, not saving ProcPtrs */
  50.     needTime,                /* Yes, give us periodic Control calls */
  51.     dontNeedGoodbye,        /* No special requirements */
  52.     noStatusEnable,
  53.     ctlEnable,                /* Desk accessories only do Control calls */
  54.     noWriteEnable,
  55.     noReadEnable,
  56.     6,                        /* drvrDelay - Wake up every 6 jiffies */
  57.     updateMask    |             /* drvrEMask */
  58.     activMask    |
  59.     mDownMask    |
  60.     keyDownMask    |
  61.     autoKeyMask,
  62.     0,                        /* drvrMenu - This DA has no menu */
  63.     DA_name,                /* drvrName - This isn't used by the DA */
  64.     /*
  65.      * This directive inserts the contents of the DRVW resource
  66.      * produced by linking DRVRRuntime.o with our DA code
  67.      */
  68.     $$resource("unixDA.DRVW", 'DRVW', 0)
  69. };
  70.  
  71. resource 'vers' (1)
  72. {
  73.     1,1,
  74.     0x80,0,0,
  75.     version,
  76.     "Client " version " by Greg Anderson\nIn the Public Domain--not for resale"
  77. };
  78.  
  79. resource 'vers' (2)
  80. {
  81.     1,1,
  82.     0x80,0,0,
  83.     version,
  84.     "⌐ 1990 UC Regents"
  85. };
  86.  
  87. resource 'STR '(0xC000 | (DriverID << 5), "Default host")
  88. {
  89.     "ssyx.ucsc.edu"
  90. };
  91.  
  92. resource 'STR#'(0xC000 | (DriverID << 5)+1, "Known hosts")
  93. {
  94.     {
  95.         "ssyx.ucsc.edu=128.114.133.1\n";
  96.         "ucschu.ucsc.edu=128.114.180.1\n";
  97.         ""
  98.     }
  99. };
  100.  
  101. /*
  102.         "ucscb.ucsc.edu,b=128.114.129.6\n";
  103.         "ucscc.ucsc.edu=128.114.129.1\n";
  104.         "ucsce.ucsc.edu=128.114.129.3\n";
  105.         "ucsco.ucsc.edu=128.114.129.14\n";
  106. */
  107.  
  108. resource 'STR#' (0xC000 | (DriverID << 5), "Client's string constants")
  109. {
  110.     {
  111.     "ucsco.ucsc.edu";
  112.     "[   Abort   ]";
  113.     "[ Reconnect ]";
  114.     "Not enough memory to do Cut";
  115.     "Cannot do Cut";
  116.     "Cannot do Copy";
  117.     "Cannot exceed 32,000 characters with Paste";
  118.     "Not enough memory to do Paste";
  119.     "Cannot create window";
  120.     "Cannot exceed 32,000 characters";
  121.     "Cannot do Paste";
  122.     "Waiting to open";
  123.     "";
  124.     ".IPP";
  125.     "LIST\r\r\r";
  126.     "Error:  Out of memory";
  127.     "MacTCP driver could not be opened";
  128.     "Could not create a stream";
  129.     "Error while releasing stream";
  130.     "Could not open a connection";
  131.     "Error while sending";
  132.     "Error while recieving";
  133.     
  134.     /*
  135.      *  TCP errors
  136.      */
  137.     "";
  138.     "TCPClose command was already issued";
  139.     "The TCP stream already has an open connection";
  140.     "No connection on this TCP stream";
  141.     "TCP stream is not open";
  142.     "Attempted to open stream twice";
  143.     "Connection came halfway up and then failed";
  144.     "Timeout";
  145.     "This socket is in use";
  146.     "The destination is dead";
  147.     "Unknown error";
  148.     "Connection Terminating";
  149.     
  150.     "Looking up Internet Address...";
  151.     "No services on ";
  152.     "Reading service list...";
  153.     
  154.     "Host Name:";
  155.     "mark";
  156.     
  157.     /*
  158.      *  Connection state messages
  159.      */
  160.     "Connection Closed";
  161.     "Listening";
  162.     "SYN recived";
  163.     "SYN sent";
  164.     "Connection Established";
  165.     "FIN Wait 1 (close issued)";
  166.     "FIN Wait 2 (close completed)";
  167.     "Waiting to close";
  168.     "Connection Closing...";
  169.     "Last ACK";
  170.     "Connection going down...";
  171.     
  172.     "Couldn't get inet address";
  173.     "Timed out looking up address";
  174.     "Domain Name resolver failed";
  175.     "Couldn't open MacTCP resource";
  176.     "NameToAddr worked";
  177.     "56?"
  178.     };
  179. };
  180.  
  181.  
  182. /*    documentProc, */
  183. resource 'WIND' (0xC000 | (DriverID << 5), "unixDA's Window") {
  184.     {64, 4, 314, 504},
  185.     zoomDocProc,
  186.     invisible,
  187.     goAway,
  188.     0x0,
  189.     DA_name
  190. };
  191.  
  192. /* Vertical scroll bar */
  193. resource 'CNTL' (0xC000 | (DriverID << 5), preload) {
  194.     {-1, 485, 236, 501},
  195.     0, visible, 0, 0, scrollBarProc, 0, ""
  196. };
  197.  
  198. /* Horizontal scroll bar */
  199. resource 'CNTL' (0xC000 | (DriverID << 5) + 1, preload) {
  200.     {235, -1, 251, 486},
  201.     0, visible, 0, 0, scrollBarProc, 0, ""
  202. };
  203.  
  204.  
  205.  
  206. /* this ALRT and DITL are used as an error screen */
  207. resource 'ALRT' (0xC000 | (DriverID << 5), purgeable) {
  208.     {40, 20, 150, 260},
  209.     0xC000 | (DriverID << 5)+1,
  210.     { /* array: 4 elements */
  211.         /* [1] */
  212.         OK, visible, silent,
  213.         /* [2] */
  214.         OK, visible, silent,
  215.         /* [3] */
  216.         OK, visible, silent,
  217.         /* [4] */
  218.         OK, visible, silent
  219.     }
  220. };
  221.  
  222. resource 'DITL' (0xC000 | (DriverID << 5)+1, purgeable) {
  223.     { /* array DITLarray: 3 elements */
  224.         /* [1] */
  225.         {80, 150, 100, 230},
  226.         Button {
  227.             enabled,
  228.             "OK"
  229.         },
  230.         /* [2] */
  231.         {10, 60, 60, 230},
  232.         StaticText {
  233.             disabled,
  234.             "^0.  ^1"
  235.         },
  236.         /* [3] */
  237.         {8, 8, 40, 40},
  238.         Icon {
  239.             disabled,
  240.             2
  241.         }
  242.     }
  243. };
  244.  
  245. /* Main dialog box for selecting services */
  246.  
  247. resource 'DLOG' (0xC000 | (DriverID << 5)) {
  248.     {33, 44, 327, 440},
  249.     dBoxProc,
  250.     invisible,
  251.     goAway,
  252.     0x0,
  253.     0xC000 | (DriverID << 5),
  254.     DA_name
  255. };
  256.  
  257. resource 'DITL' (0xC000 | (DriverID << 5)) {
  258.     {    /* array DITLarray: 12 elements */
  259.         /* [1] */
  260.         {268, 254, 288, 326},
  261.         Button {
  262.             enabled,
  263.             "Okay"
  264.         },
  265.         /* [2] */
  266.         {268, 55, 288, 127},
  267.         Button {
  268.             enabled,
  269.             "Cancel"
  270.         },
  271.         /* [3] */
  272.         {238, 16, 254, 384},
  273.         EditText {
  274.             enabled,
  275.             ""
  276.         },
  277.         /* [4] */
  278.         {216, 16, 232, 384},
  279.         StaticText {
  280.             enabled,
  281.             "Parameters:"
  282.         },
  283.         /* [5] */
  284.         {268, 182, 288, 198},
  285.         Button {
  286.             enabled,
  287.             "?"
  288.         },
  289.         /* [6] */
  290.         {120, 208, 136, 336},
  291.         StaticText {
  292.             enabled,
  293.             "Internet Address:"
  294.         },
  295.         /* [7] */
  296.         {80, 208, 96, 376},
  297.         EditText {
  298.             enabled,
  299.             "ssyx.ucsc.edu"
  300.         },
  301.         /* [8] */
  302.         {140, 208, 156, 376},
  303.         StaticText {
  304.             enabled,
  305.             ""
  306.         },
  307.         /* [9] */
  308.         {48, 16, 210, 184},
  309.         UserItem {
  310.             enabled
  311.         },
  312.         /* [10] */
  313.         {6, 40, 40, 368},
  314.         StaticText {
  315.             enabled,
  316.             "  Macintosh Client to Unix Server    " version "\n          Greg Anderson     (c) 1990 UC Regents"
  317.         },
  318.         /* [11] */
  319.         {176, 208, 208, 384},
  320.         StaticText {
  321.             enabled,
  322.             ""
  323.         },
  324.         /* [12] */
  325.         {56, 205, 72, 313},
  326.         UserItem {
  327.             enabled
  328.         }
  329.     }
  330. };
  331.  
  332. /* HELP dialog box */
  333.  
  334. resource 'DLOG' (0xC000 | (DriverID << 5) + 2) {
  335.     {33, 44, 327, 440},
  336.     dBoxProc,
  337.     invisible,
  338.     goAway,
  339.     0x0,
  340.     0xC000 | (DriverID << 5)+2,
  341.     DA_name " Help"
  342. };
  343.  
  344. resource 'DITL' (0xC000 | (DriverID << 5) + 2) {
  345.     {    /* array DITLarray: 9 elements */
  346.         /* [1] */
  347.         {268, 154, 288, 230},
  348.         Button {
  349.             enabled,
  350.             "Okay"
  351.         },
  352.         /* [2] */
  353.         {208, 40, 264, 72},
  354.         StaticText {
  355.             enabled,
  356.             "-.\n-A\n-R"
  357.         },
  358.         /* [3] */
  359.         {208, 80, 264, 360},
  360.         StaticText {
  361.             enabled,
  362.             "Abort.  The current session will be closed.\nSelect all.\nReturn to the service selection dialog."
  363.         },
  364.         /* [4] */
  365.         {184, 8, 200, 392},
  366.         StaticText {
  367.             enabled,
  368.             "Command key shortcuts available in the Client window:"
  369.         },
  370.         /* [5] */
  371.         {144, 128, 176, 392},
  372.         StaticText {
  373.             enabled,
  374.             "Click on this icon to pull down a list of recently used hosts."
  375.         },
  376.         /* [6] */
  377.         {8, 8, 88, 392},
  378.         StaticText {
  379.             enabled,
  380.             "The Macintosh Client Desk Accessory provides access to programs residing on a Unix host that is running Steven Grimm's superserver.  Source code for this server and the Unix-side clients is available via anonymous ftp from ssyx.ucsc.edu."
  381.         },
  382.         /* [7] */
  383.         {88, 8, 120, 392},
  384.         StaticText {
  385.             enabled,
  386.             "This Desk Accessory was developed by Greg Anderson at Social Sciences Computing at UC Santa Cruz."
  387.         },
  388.         /* [8] */
  389.         {120, 8, 136, 392},
  390.         StaticText {
  391.             enabled,
  392.             "It is in the public domain."
  393.         },
  394.         /* [9] */
  395.         {144, 8, 160, 116},
  396.         UserItem {
  397.             enabled
  398.         }
  399.     }
  400. };
  401.