?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. /*
  2.         CCONFIG.C
  3.         BDS C v1.6 Automated Configuration Program
  4.         Written 4/86 by  Leor Zolman
  5.                          BD Software, Inc.
  6.        
  7.         compile & link:
  8.                 cc cconfig.c -e5000
  9.                 cc cconfig2.c -e5000
  10.                 clink cconfig cconfig2
  11.  
  12.         Note: This program may be used as a template for creating a
  13.         configuration tool for any general purpose utility that contains
  14.         a block of bytes of customization data. I therefore donate this
  15.         program to the public domain.
  16.                                                 -leor
  17.  
  18. */
  19.  
  20. #include <stdio.h>
  21. #include "cconfig.h"
  22.  
  23. main()
  24. {
  25.         int i;
  26.  
  27.         init();
  28.  
  29.         p("\nBDS C v1.6 Automatic Configuration System\n\n")
  30.         p("This program makes physical changes to the files CC.COM and")
  31.         p("CLINK.COM so as to customize their operation for your specific")
  32.         p("file system and operating system environment. Do NOT run this")
  33.         p("program until you have backed up your master BDS C distribution")
  34.         p("disks and physically removed them from your disk drives.\n\n")
  35.  
  36.         p("Have you backed up your master disks and placed copies of CC.COM")
  37.         p("and CLINK.COM in the currently logged directory?")
  38.         if (!ask(0))
  39.         {
  40.                 p("Then do so now, and run this program again when ready\n")
  41.                 exit();
  42.         }
  43.  
  44.         p("\n\nThen we are ready to begin.\n")
  45.         p("\n   Note:   Typing ^Z-<CR> (control-Z and a return) in\n")
  46.         p("             response to any question in the option dialogue\n")
  47.         p("             causes the option value to remain unchanged and\n")
  48.         p("             control to return to the main menu.\n\n")
  49.  
  50.         read_block();
  51.  
  52.         setjmp(jbuf);
  53.  
  54.         while(1)
  55.         {
  56.                 display();      /* display current options status */
  57.                 p("Type the code number of the option you wish")
  58.                 p("to change, 'all' to go through the entire list, or")
  59.                 p("'q' to quit: ")
  60.                 switch(c = tolower(igsp(gets(strbuf))))
  61.                 {
  62.                      case 'q':  if (made_changes)
  63.                                   if (ask("\nWrite changes to disk?"))
  64.                                   {
  65.                                        write_block();
  66.                                        p("New CC.COM and CLINK.COM written.\n")
  67.                                   }
  68.                                   else
  69.                                        p("Old configuration left intact.\n")
  70.                                 else
  71.                                   p("No changes specified.\n")
  72.  
  73.                                 exit();
  74.  
  75.                      case 'a':  p("\n\tNote: ^Z <CR> returns to the main")
  76.                                 p("menu at any time.\n\n")
  77.                                 for (i = 0; i < NBYTES; i++)
  78.                                 {
  79.                                         p("\n\n");
  80.                                         old_val = cblock[i];
  81.                                         (*funcs[i])();
  82.                                         if (old_val != cblock[i])
  83.                                                 made_changes = TRUE;
  84.                                 }
  85.                                 continue;
  86.  
  87.                      default:   if (!isdigit(c) ||
  88.                                    (i = atoi(strbuf)) < 0 || i >= NBYTES)
  89.                                 {
  90.                                         p("Invalid selection. Try again...")
  91.                                         continue;
  92.                                 }
  93.                                 p("\n")
  94.                                 old_val = cblock[i];
  95.                                 (*funcs[i])();
  96.                                 if (old_val != cblock[i])
  97.                                         made_changes = TRUE;
  98.                 }
  99.         }
  100. }
  101.  
  102.  
  103. excurlog()
  104. {
  105.         p("\nNote: The term \"currently logged\", as used in the following")
  106.         p("dialogue, refers to the disk drive and user area that will be")
  107.         p("currently logged at the time CC.COM or CLINK.COM is invoked, not")
  108.         p("necessarily the drive and user area currently logged right now")
  109.         p("while you run CCONFIG.\n\n")
  110. }
  111.  
  112.  
  113. dodefdsk()
  114. {
  115.         p("DEFAULT LIBRARY DISK DRIVE:\n")
  116.         excurlog();
  117.         p("The default library disk drive is the drive that CC and CLINK")
  118.         p("automatically search for system header files and default library")
  119.         p("object modules. If you do not choose a specific drive, then")
  120.         p("the currently logged disk at the time of command invokation will")
  121.         p("be searched by default.")
  122.         p("Enter either an explicit default library disk drive, or type")
  123.         p("RETURN to always search the currently logged drive: ")
  124.  
  125.         if (isalpha(c = toupper(igsp(gets0(strbuf)))))
  126.                 defdsk = c - 'A';
  127.         else
  128.                 defdsk = 0xFF;
  129. }      
  130.  
  131. dodefusr()
  132. {
  133.         p("DEFAULT LIBRARY USER AREA:\n")
  134.         excurlog();
  135.         p("The default library user area is the user area that CC and CLINK")
  136.         p("automatically search for system header files and default library")
  137.         p("object modules. If you don't choose a specific user area, then")
  138.         p("the currently logged user area at the time of command invokation")
  139.         p("will be searched by default.\n")
  140.  
  141.         p("Enter either an explicit default library user area, or type RETURN")
  142.         p("to always search the currently logged user area: ")
  143.  
  144.         if (isdigit(igsp(gets0(strbuf))))
  145.                 defusr = atoi(strbuf);
  146.         else
  147.                 defusr = 0xFF;
  148. }
  149.  
  150. dodefsub()
  151. {
  152.         p("\"SUBMIT FILE\" DRIVE SELECTION:\n")
  153.         excurlog();
  154.         p("In order to terminate a batch (\"submit\") file sequence upon")
  155.         p("fatal compiler or linker error, CC and CLINK must know which")
  156.         p("disk drive contains the temporary scratch file used by SUBMIT.COM")
  157.         p("and similar utilities. This will usually be either drive A: or")
  158.         p("the currently logged drive. Enter the drive name now, or type")
  159.         p("RETURN to use the \"currently logged drive\": ")
  160.  
  161.         if (isalpha(c = toupper(igsp(gets0(strbuf)))))
  162.                 defsub = c - 'A';
  163.         else
  164.                 defsub = 0xFF;
  165. }
  166.  
  167. doconpol()
  168. {
  169.         p("CONSOLE POLLING FOR CONTROL-C:\n")
  170.         p("When console polling is enabled, CC and CLINK will constantly")
  171.         p("check the console keyboard during their operation to see if")
  172.         p("control-C has been typed. If control-C is detected, the command")
  173.         p("is immedieatly aborted and control returns to CP/M command level.")
  174.         p("Any characters OTHER than control-C are ignored and discarded.")
  175.         p("Therefore, if your system supports keyboard \"type-ahead\" and you")
  176.         p("want to take advantage of that feature during CC or CLINK")
  177.         p("operation, you may not want console-polling activated.\n")
  178.         p("Do you wish to have console-polling take place? ")
  179.        
  180.         conpol = yesp();
  181. }
  182.  
  183. dowboote()
  184. {
  185.         p("WARM-BOOT SUPPRESSION CONTROL:\n")
  186.         p("CC and CLINK have the ability to return to CP/M command level")
  187.         p("following completion of their tasks without having to perform")
  188.         p("a \"warm-boot\" (the re-loading of the CP/M Console Command")
  189.         p("Processor (CCP) from disk). They take advantage of this ability")
  190.         p("any time a compilation or linkage does not require the use of the")
  191.         p("memory occupied by the CCP. This \"warm-boot suppression\" results")
  192.         p("in a speedier return to command level.\nOn some CP/M-like systems,")
  193.         p("though, this feature doesn't work because a valid stack pointer is")
  194.         p("never provided to transient commands by the operating system. One")
  195.         p("symptom is that the command will appear to terminate normally, but")
  196.         p("instead of returning to command level, the system hangs.")
  197.         p("In the case of CC.COM, for example, a .CRL file may")
  198.         p("be successfully generated before the crash.\nIf something like")
  199.         p("this happens on")
  200.         p("your system, you must a) DISABLE warm-boot suppression to insure")
  201.         p("clean command termination, and b) don't use the -n CLINK option")
  202.         p("when the target system cannot handle warm-boot suppression.")
  203.         p("\nDo you want warm-boot suppression? ");
  204.  
  205.         wboote = !yesp();
  206. }
  207.  
  208. dopstrip()
  209. {
  210.         p("PARITY BIT CONTROL:\n")
  211.         p("This option deals with the handling of parity bits (the high-order")
  212.         p("bit of ASCII-encoded text characters) by the compiler during")
  213.         p("compilation. Normally, CC strips (forces to zero) the parity bits")
  214.         p("from C source input files.")
  215.         p("The only case where this might be undesireable is when a")
  216.         p("special character set, utilizing the high-order bit as part of")
  217.         p("the character representation, is being used. Bilingual or")
  218.         p("extended character sets, for example, may use the parity bit in")
  219.         p("this way. If this is the case in your situation, then do not")
  220.         p("enable parity-bit stripping. Otherwise, you should let")
  221.         p("the parity bits be stripped, so that the compiler will not be")
  222.         p("confused by source files produced under certain text editors")
  223.         p("that use the parity bit for formatting information.\n")
  224.  
  225.         p("Do you wish to let parity bits be stripped? ")
  226.         pstrip = yesp();
  227. }
  228.  
  229. donouser()
  230. {
  231.         p("USER-AREA SWITCHING CONTROL:\n")
  232.         p("Normally CC and CLINK expect to be running on a CP/M")
  233.         p("(or CP/M-like) system supporting \"user areas\" (the subdivision")
  234.         p("of disk drive directories into 32 partitions numbered 0-31.)")
  235.         p("The upshot is that specific user areas may be directly addressed")
  236.         p("by CC and CLINK during the course of their operations, thus")
  237.         p("possibly creating a conflict between themselves and certain")
  238.         p("third-party command processors (MicroShell, ZCPR3, etc.) that")
  239.         p("maintain an automatic search path mechanism for data files. If")
  240.         p("you are running such a utility on your system and you notice")
  241.         p("that files aren't being correctly located by CC and CLINK, try")
  242.         p("disabling user-area switching with this option. The effect will")
  243.         p("be that CC and CLINK will no longer perform any user-area")
  244.         p("operations at all, allowing your own command processor to")
  245.         p("determine the default user areas for file operations.\n")
  246.         p("If your system does not support user areas at all, then you")
  247.         p("definitely want to disable user-area switching here.\n")
  248.         p("\n(Note: In order to disable user-area switching in C-generated")
  249.         p("COM files, it is necessary to customize the run-time package")
  250.         p("by changing the value of the NOUSER symbol in CCC.ASM.)\n")
  251.         p("\nDo you wish to disable user-area switching? ")
  252.         nouser = yesp();
  253. }
  254.  
  255.  
  256. dowerrs()
  257. {
  258.         p("RED EDITOR ERROR FILE CONTROL:\n")
  259.         p("CC can write out an error file containing information about the")
  260.         p("location and nature of source file errors detected during")
  261.         p("the course of an unsuccessful compilation. The RED text editor")
  262.         p("recognizes this file and makes the editing of those errors very")
  263.         p("convenient. If you wish, you can have CC automatically write out")
  264.         p("such an error file whenever source file errors are detected. If")
  265.         p("you choose not to have CC write the file out automatically every")
  266.         p("time, you may still choose to have the file written during")
  267.         p("individual compilations through use of the CC command-line")
  268.         p("option \"-w\".\n")
  269.         p("Do you wish to have the RED error file written out automatically")
  270.         p("every time compilation errors are detected? ")
  271.         werrs = yesp();
  272. }
  273.  
  274. docdbrst()
  275. {
  276.         p("CDB RESTART VECTOR SELECTION:\n")
  277.         p("The CDB Debugger allows interactive debugging of C programs")
  278.         p("through the use of an interrupt vector down in low system")
  279.         p("memory, just as DDT or SID uses restart 7. As distributed,")
  280.         p("CDB is compiled to use RST 6 for this purpose, and the compiler")
  281.         p("correspondingly presumes a default of -k6 when the -k option is")
  282.         p("given without an argument. If you wish to change the restart")
  283.         p("vector used by CDB, then you must recompile CDB according to the")
  284.         p("CDB documentation to change its default restart location.\nBy")
  285.         p("choosing a new restart vector value HERE, you are only telling")
  286.         p("CC.COM what the new default is, so that you don't have to bother")
  287.         p("specifying it when using the -k option on the CC command line.\n")
  288.  
  289.         p("Enter the restart vector (1-7) you wish to have CC use as the")
  290.         p("default -k argument: ")
  291.  
  292.         if (isdigit(igsp(gets0(strbuf))))
  293.                 cdbrst = atoi(strbuf);
  294.         else
  295.                 p("Value left unchanged.\n")
  296. }
  297.