home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / BIPL.ZIP / DEBUG.ZIP / DEBCFG.ICN next >
Encoding:
Text File  |  1992-11-20  |  3.4 KB  |  98 lines

  1. ############################################################################
  2. #
  3. #    File:     debcfg.icn
  4. #
  5. #    Subject:  Configure debugify
  6. #
  7. #    Author:   Charles A. Shartsis
  8. #
  9. #    Date:     September 6, 1992
  10. #
  11. ###########################################################################
  12. #
  13. # See documentation in DEBUGIFY.DOC
  14. #
  15. ############################################################################
  16.  
  17. procedure main()
  18.  
  19.     local debcfgu1, debcfgu2, debic0, debicn, andfileid, andlineid, version, line
  20.     local debmarker, opcode, operand, debmark_found
  21.     
  22.     &file; &line
  23.     
  24.     write(&errout, "Configuring Debugify")
  25.     
  26.     debmarker := "# DO NOT MODIFY, MOVE, OR DELETE THIS COMMENT LINE"
  27.     
  28.     # get Version number from debcfg.u2
  29.     (debcfgu2 := open("debcfg.u2", "r")) | stop(&errout, "Could not open debcfg.u2")
  30.     write(&errout, "Reading debcfg.u2")
  31.     (line := read(debcfgu2)) | stop("Could not read debcfg.u2")
  32.     line ? (="version" & tab(many(' \t')) & version <- tab(many(~' \t')))
  33.     \line | stop(&errout, "Could not find version in debcfg.u2")
  34.     write(&errout, "Configuring for Icon Version ", version)
  35.     close(debcfgu2)
  36.     
  37.     # get &file & &line tokens from debcfg.u1
  38.     write(&errout, "Reading debcfg.u1")
  39.     (debcfgu1 := open("debcfg.u1", "r")) | stop(&errout, "Could not open debcfg.u1")
  40.     opcode := &null; operand := &null
  41.     while line := read(debcfgu1) do {
  42.         line ? {
  43.                 tab(upto(~' \t')) & opcode <- tab(many(~' \t')) & 
  44.                 tab(upto(~' \t')) & operand <- tab(many(~' \t')) &
  45.                 (tab(many(~' \t')) | "") & pos(0)
  46.         }
  47.         if opcode === "keywd" & \operand then {
  48.             write(&errout, "&file token is ", operand)
  49.             andfileid := operand
  50.             break
  51.         }
  52.     }
  53.     \andfileid | stop(&errout, "Could not find &file or &line tokens in debcfg.u1")
  54.     
  55.     opcode := &null; operand := &null
  56.     while line := read(debcfgu1) do {
  57.         line ? {
  58.                 tab(upto(~' \t')) & opcode <- tab(many(~' \t')) & 
  59.                 tab(upto(~' \t')) & operand <- tab(many(~' \t')) &
  60.                 (tab(many(~' \t')) | "") & pos(0)
  61.         }
  62.         if opcode === "keywd" & \operand then {
  63.             write(&errout, "&line token is ", operand)
  64.             andlineid := operand
  65.             break
  66.         }
  67.     }
  68.     \andlineid | stop(&errout, "Could not find &line token in debcfg.u1")
  69.     
  70.     close(debcfgu1)
  71.     
  72.     # create debugify.icn, inserting new statements where appropriate
  73.     (debic0 := open("debugify.ic0", "r")) | stop(&errout, "Could not open debugify.ic0")
  74.     (debicn := open("debugify.icn", "w")) | stop(&errout, "Could not open debugify.icn")
  75.     write(&errout, "Reading debugify.ic0 and writing debugify.icn")
  76.     debmark_found := &null
  77.     while line := read(debic0) do {
  78.     
  79.         write(debicn, line)
  80.     
  81.         if /debmark_found & 
  82.             reverse(trim(reverse(trim(line, ' \t')), ' \t')) == debmarker then {
  83.             # insert new statements
  84.             debmark_found := 1
  85.             write(debicn, "andfileid := \"", andfileid, "\"")
  86.             write(debicn, "andlineid := \"", andlineid, "\"")
  87.             write(debicn, "version := \"", version, "\"")
  88.             write(&errout, "Successfully inserted &file, &line tokens and Icon Version")
  89.         }
  90.     
  91.     }
  92.     
  93.     close(debic0)
  94.     close(debicn)
  95.  
  96. end
  97.  
  98.