home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / lilith / m2set.mod < prev    next >
Text File  |  2020-01-01  |  14KB  |  530 lines

  1. IMPLEMENTATION MODULE KermSet;
  2. (************************************************************************)
  3. (*  Set changes the value of any local parameter                        *)
  4. (*  written:            09.10.85     Matthias Aebi                      *)
  5. (*  last modification:  18.03.86     Matthias Aebi                      *)
  6. (************************************************************************)
  7.  
  8. FROM KermMisc   IMPORT SetBaud, StringToCard;
  9. FROM KermParam  IMPORT LBaudRate, LCheckType, LCurrPort, LEcho, LEOLChar,
  10.                        LEscChar, LFileType, LFilNamConv, LMaxRetries,
  11.                        LNumOfPad, LPackSize, LPadChar, LParity, LPrefChar,
  12.                        LQuoteChar, LStartChar, LTimeOut, LTimer,LDebug,
  13.                        LWarning, LPrompt, ParityTyp, FileTyp;
  14. FROM Terminal   IMPORT WriteString, WriteLn;
  15. FROM String     IMPORT Copy;
  16. FROM M2Kermit   IMPORT Param1, Param2;
  17.  
  18. (************************************************************************)
  19.                               PROCEDURE Set;
  20. (************************************************************************)
  21. VAR
  22.     displayParam : BOOLEAN;
  23.     displayValue : BOOLEAN;
  24.     paramCard    : CARDINAL;
  25.  
  26. BEGIN
  27.     displayParam := FALSE;
  28.     displayValue := FALSE;
  29.  
  30.     CASE CAP(Param1[0]) OF
  31.     "?": (* Help *)
  32.         displayParam := TRUE; |
  33.  
  34.     "B": (* Baud Rate *)
  35.         (* If Param2 is a ?, StringToCard returns FALSE *)
  36.         IF NOT StringToCard(Param2, paramCard)
  37.         THEN
  38.             displayValue := TRUE;
  39.         ELSE
  40.             IF (paramCard<>  300) AND (paramCard<> 600) AND
  41.                (paramCard<> 1200) AND (paramCard<>2400) AND
  42.                (paramCard<> 4800) AND (paramCard<>9600) AND
  43.                (paramCard<>19200)
  44.             THEN
  45.                 WriteString("Undefined baud rate");
  46.                 displayValue := TRUE;
  47.             ELSE
  48.                 LBaudRate := paramCard;
  49.                 SetBaud(LBaudRate, LCurrPort);
  50.             END;
  51.         END;
  52.         IF displayValue
  53.         THEN
  54.             WriteLn;
  55.             WriteString("Available baud rates are:"); WriteLn;
  56.             WriteString("  300  600  1200  2400  4800  9600  19200");
  57.             WriteLn;
  58.         END; |
  59.  
  60.     "C": (* Check type *)
  61.         IF NOT StringToCard(Param2, paramCard)
  62.         THEN
  63.             displayValue := TRUE;
  64.         ELSE
  65.             IF NOT ((paramCard >= 1) AND (paramCard <= 3))
  66.             THEN
  67.                 WriteString("Invalid check type");
  68.                 displayValue := TRUE;
  69.             ELSE
  70.                 LCheckType := paramCard;
  71.             END;
  72.         END;
  73.         IF displayValue
  74.         THEN
  75.             WriteLn;
  76.             WriteString("Available check types are:");
  77.             WriteLn;
  78.             WriteString("  1   2   3");
  79.             WriteLn;
  80.         END; |
  81.  
  82.  
  83.     "D": (* Debug *)
  84.         CASE CAP(Param2[0]) OF
  85.         "?":
  86.             displayValue := TRUE; |
  87.  
  88.         "O":
  89.             CASE CAP(Param2[1]) OF
  90.             "N":
  91.                 LDebug := TRUE; |
  92.  
  93.             "F":
  94.                 LDebug := FALSE;
  95.  
  96.             ELSE
  97.                 displayValue := TRUE;
  98.             END;
  99.  
  100.         ELSE
  101.             displayValue := TRUE;
  102.         END;
  103.         IF displayValue
  104.         THEN
  105.             WriteLn;
  106.             WriteString("Specify ON or OFF");
  107.             WriteLn;
  108.         END; |
  109.  
  110.  
  111.     "E":
  112.         CASE CAP(Param1[1]) OF
  113.         "N": (* EOL character *)
  114.             IF NOT StringToCard(Param2, paramCard)
  115.             THEN
  116.                 displayValue := TRUE;
  117.             ELSE
  118.                 IF paramCard > 127
  119.                 THEN
  120.                     WriteString("Invalid EOL character number");
  121.                     displayValue := TRUE;
  122.                 ELSE
  123.                     LEOLChar := CHR(paramCard);
  124.                 END;
  125.             END;
  126.             IF displayValue
  127.             THEN
  128.                 WriteLn;
  129.                 WriteString("Enter the EOL character as a number (0..127)");
  130.                 WriteLn;
  131.             END; |
  132.  
  133.  
  134.         "S": (* Escape character *)
  135.             IF (Param2[0] = "?") OR (Param2[0] = 0C)
  136.             THEN
  137.                 WriteLn;
  138.                 WriteString("Enter the 'connect escape' character");
  139.                 WriteLn;
  140.             ELSE
  141.                 LEscChar := Param2[0];
  142.             END;
  143.  
  144.         ELSE
  145.             WriteLn;
  146.             WriteString("Undefined parameter");
  147.             displayParam := TRUE;
  148.         END; |
  149.  
  150.  
  151.      "F": (* File Type *)
  152.         CASE CAP(Param2[0]) OF
  153.         "?":
  154.             displayValue := TRUE; |
  155.  
  156.         "T":
  157.             LFileType := text; |
  158.  
  159.         "B":
  160.             LFileType := binary;
  161.  
  162.         ELSE
  163.             WriteLn;
  164.             WriteString("Undefined file type");
  165.             displayValue := TRUE;
  166.         END;
  167.         IF displayValue
  168.         THEN
  169.             WriteLn;
  170.             WriteString("Possible file types are:");
  171.             WriteLn;
  172.             WriteString("  Text   Binary");
  173.             WriteLn;
  174.         END; |
  175.  
  176.  
  177.     "L": (* Local echo *)
  178.         CASE CAP(Param2[0]) OF
  179.         "?":
  180.             displayValue := TRUE; |
  181.  
  182.         "O":
  183.             CASE CAP(Param2[1]) OF
  184.             "N":
  185.                 LEcho := TRUE; |
  186.  
  187.             "F":
  188.                 LEcho := FALSE;
  189.  
  190.             ELSE
  191.                 displayValue := TRUE;
  192.             END;
  193.  
  194.         ELSE
  195.             displayValue := TRUE;
  196.         END;
  197.         IF displayValue
  198.         THEN
  199.             WriteLn;
  200.             WriteString("Specify ON or OFF");
  201.             WriteLn;
  202.         END; |
  203.  
  204.  
  205.     "N":  (* Name conversion *)
  206.         CASE CAP(Param2[0]) OF
  207.         "?":
  208.             displayValue := TRUE; |
  209.  
  210.         "O":
  211.             CASE CAP(Param2[1]) OF
  212.             "N":
  213.                 LFilNamConv := TRUE; |
  214.  
  215.             "F":
  216.                 LFilNamConv := FALSE;
  217.  
  218.             ELSE
  219.                 displayValue := TRUE;
  220.             END;
  221.  
  222.         ELSE
  223.             displayValue := TRUE;
  224.         END;
  225.         IF displayValue
  226.         THEN
  227.             WriteLn;
  228.             WriteString("Specify ON or OFF");
  229.             WriteLn;
  230.         END; |
  231.  
  232.  
  233.     "P":
  234.         CASE CAP(Param1[1]) OF
  235.         "A":
  236.             CASE CAP(Param1[2]) OF
  237.             "C": (* PACket length *)
  238.                 IF NOT StringToCard(Param2, paramCard)
  239.                 THEN
  240.                     WriteLn;
  241.                     WriteString("Enter packet size");
  242.                     WriteLn;
  243.                 ELSE
  244.                     LPackSize := paramCard;
  245.                 END; |
  246.  
  247.  
  248.             "D":
  249.                 CASE CAP(Param1[3]) OF
  250.                 "C": (* PADChar *)
  251.                     IF NOT StringToCard(Param2, paramCard)
  252.                     THEN
  253.                         displayValue := TRUE;
  254.                     ELSE
  255.                         IF paramCard > 127
  256.                         THEN
  257.                             WriteString("Invalid padding character number");
  258.                             displayValue := TRUE;
  259.                         ELSE
  260.                             LPadChar := CHR(paramCard);
  261.                         END;
  262.                     END;
  263.                     IF displayValue
  264.                     THEN
  265.                         WriteLn;
  266.                         WriteString("Enter the padding character as a number (0..127)");
  267.                         WriteLn;
  268.                     END; |
  269.  
  270.  
  271.                 "D": (* PADDing *)
  272.                     IF NOT StringToCard(Param2, paramCard)
  273.                     THEN
  274.                         WriteLn;
  275.                         WriteString("Enter number of padding characters");
  276.  
  277.                         WriteLn;
  278.                     ELSE
  279.                         LNumOfPad := paramCard;
  280.                     END;
  281.  
  282.                 ELSE
  283.                     WriteLn;
  284.                     WriteString("Undefined parameter");
  285.                     displayParam := TRUE;
  286.                 END; |
  287.  
  288.  
  289.             "R": (* PARity *)
  290.                 CASE CAP(Param2[0]) OF
  291.                 "?":
  292.                     displayValue := TRUE; |
  293.  
  294.                 "N":
  295.                     LParity := none; |
  296.  
  297.                 "O":
  298.                     LParity := odd; |
  299.  
  300.                 "E":
  301.                     LParity := even; |
  302.  
  303.                 "M":
  304.                     LParity := mark; |
  305.  
  306.                 "S":
  307.                     LParity := space;
  308.  
  309.                 ELSE
  310.                     WriteLn;
  311.                     WriteString("Invalid parity");
  312.                     displayValue := TRUE;
  313.                 END;
  314.                 IF displayValue
  315.                 THEN
  316.                     WriteLn;
  317.                     WriteString("Available parity types are:");
  318.                     WriteLn;
  319.                     WriteString("  None  Even  Odd  Space  Mark");
  320.                     WriteLn;
  321.                 END;
  322.  
  323.             ELSE
  324.                 WriteLn;
  325.                 WriteString("Undefined parameter");
  326.                 displayParam := TRUE;
  327.             END; |
  328.  
  329.  
  330.         "O": (* POrt *)
  331.             IF NOT StringToCard(Param2, paramCard)
  332.             THEN
  333.                 WriteLn;
  334.                 WriteString("Enter port number");
  335.                 WriteLn;
  336.             ELSE
  337.                 LCurrPort := paramCard;
  338.             END; |
  339.  
  340.  
  341.         "R":
  342.             CASE CAP(Param1[2]) OF
  343.             "E": (* PREfix *)
  344.                 IF (Param2[0] = "?") OR (Param2[0] = 0C)
  345.                 THEN
  346.                     WriteLn;
  347.                     WriteString("Enter 8th bit prefix character");
  348.                     WriteLn;
  349.                 ELSE
  350.                     LPrefChar := Param2[0];
  351.                 END; |
  352.  
  353.  
  354.             "O": (* PROmpt *)
  355.                 IF (Param2[0] = "?") OR (Param2[0] = 0C)
  356.                 THEN
  357.                     WriteLn;
  358.                     WriteString("Enter the prompt to be used ");
  359.                     WriteString("for M2-Kermit");
  360.                     WriteLn;
  361.                 ELSE
  362.                     Copy(LPrompt, Param2, 0, HIGH(LPrompt));
  363.                 END;
  364.  
  365.             ELSE
  366.                 WriteLn;
  367.                 WriteString("Undefined parameter");
  368.                 WriteLn;
  369.                 displayParam := TRUE;
  370.             END;
  371.  
  372.         ELSE
  373.             WriteLn;
  374.             WriteString("Undefined parameter");
  375.             displayParam := TRUE;
  376.         END; |
  377.  
  378.  
  379.     "Q": (* Quote *)
  380.         IF (Param2[0] = "?") OR (Param2[0] = 0C)
  381.         THEN
  382.             WriteLn;
  383.             WriteString("Enter quote character");
  384.             WriteLn;
  385.         ELSE
  386.             LQuoteChar := Param2[0];
  387.         END; |
  388.  
  389.  
  390.     "R": (* Retries *)
  391.         IF NOT StringToCard(Param2, paramCard)
  392.         THEN
  393.             WriteLn;
  394.             WriteString("Enter number of retries before timeout");
  395.             WriteLn;
  396.         ELSE
  397.             LMaxRetries := paramCard;
  398.         END; |
  399.  
  400.  
  401.     "S": (* Start of packet *)
  402.         IF NOT StringToCard(Param2, paramCard)
  403.         THEN
  404.             displayValue := TRUE;
  405.         ELSE
  406.             IF paramCard > 127
  407.             THEN
  408.                 WriteString("Invalid padding character number");
  409.                 displayValue := TRUE;
  410.             ELSE
  411.                 LStartChar := CHR(paramCard);
  412.             END;
  413.         END;
  414.         IF displayValue
  415.         THEN
  416.             WriteLn;
  417.             WriteString("Enter the packet start character as a ");
  418.             WriteString("number (0..127)");
  419.             WriteLn;
  420.         END; |
  421.  
  422.  
  423.     "T":
  424.         CASE CAP(Param1[1]) OF
  425.         "I": (* TImer *)
  426.             CASE CAP(Param2[0]) OF
  427.             "?":
  428.                 displayValue := TRUE; |
  429.  
  430.             "O":
  431.                 CASE CAP(Param2[1]) OF
  432.                 "N":
  433.                     LTimer := TRUE; |
  434.  
  435.                 "F":
  436.                     LTimer := FALSE;
  437.  
  438.                 ELSE
  439.                     displayValue := TRUE;
  440.                 END;
  441.  
  442.             ELSE
  443.                 displayValue := TRUE;
  444.             END;
  445.             IF displayValue
  446.             THEN
  447.                 WriteLn;
  448.                 WriteString("Specify ON or OFF");
  449.                 WriteLn;
  450.              END; |
  451.  
  452.  
  453.         "O": (* Time Out *)
  454.             IF NOT StringToCard(Param2, paramCard)
  455.             THEN
  456.                 WriteString("Enter time out (seconds)");
  457.                 WriteLn;
  458.             ELSE
  459.                 LTimeOut := paramCard;
  460.             END;
  461.  
  462.         ELSE
  463.             WriteLn;
  464.             WriteString("Undefined parameter");
  465.             WriteLn;
  466.             displayParam := TRUE;
  467.         END; |
  468.  
  469.  
  470.     "W": (* Warning *)
  471.         CASE CAP(Param2[0]) OF
  472.         "?":
  473.             displayValue := TRUE; |
  474.  
  475.  
  476.         "O":
  477.             CASE CAP(Param2[1]) OF
  478.             "N":
  479.                 LWarning := TRUE; |
  480.  
  481.             "F":
  482.                 LWarning := FALSE;
  483.  
  484.             ELSE
  485.                 displayValue := TRUE;
  486.             END;
  487.  
  488.         ELSE
  489.             displayValue := TRUE;
  490.         END;
  491.  
  492.         IF displayValue
  493.         THEN
  494.             WriteLn;
  495.             WriteString("Specify ON or OFF");
  496.             WriteLn;
  497.         END;
  498.  
  499.     ELSE
  500.         WriteLn;
  501.         WriteString("Undefined parameter");
  502.         WriteLn;
  503.         displayParam := TRUE;
  504.     END;
  505.  
  506.     WriteLn;
  507.  
  508.     IF displayParam
  509.     THEN
  510.         WriteLn;
  511.         WriteString("Choose one of the following:"); WriteLn;
  512.         WriteLn;
  513.         WriteString("  Baud rate            PARity");          WriteLn;
  514.         WriteString("  Check type           POrt ");           WriteLn;
  515.         WriteString("  Debugging            PREfix char");     WriteLn;
  516.         WriteString("  ENd of line char     PROmpt");          WriteLn;
  517.         WriteString("  EScape character     Quote char");      WriteLn;
  518.         WriteString("  File type            Retries");         WriteLn;
  519.         WriteString("  Local echo           Start of packet"); WriteLn;
  520.         WriteString("  Name conversion      TImer");           WriteLn;
  521.         WriteString("  PACket Size          Time Out");        WriteLn;
  522.         WriteString("  PAD Character        Warning");         WriteLn;
  523.         WriteString("  PADDing");                              WriteLn;
  524.         WriteLn;
  525.     END;
  526.  
  527. END Set;
  528.  
  529. END KermSet.
  530.