PiDP-8/I SoftwareCheck-in [9b105fe0f5]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add ".decode()" to all uses of self_child.{before,after}. Now everything builds under python3.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | os8-run-python3
Files: files | file ages | folders
SHA1: 9b105fe0f5dc485225083f58f9cf3a314eecc1ab
User & Date: poetnerd 2020-03-24 23:50:09
Context
2020-03-24
23:50
Add ".decode()" to all uses of self_child.{before,after}. Now everything builds under python3. Leaf check-in: 9b105fe0f5 user: poetnerd tags: os8-run-python3
2019-05-11
18:35
Added all of the files renamed in [1860880163] to *.in to the Makefile's INFILES variable, so we autoreconf when any of them get touched. check-in: c67bd86630 user: tangent tags: os8-run-python3
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lib/os8script.py.in.

976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
....
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
....
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
....
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
....
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
....
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
....
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
....
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
    if self.debug:
      print("Loc: " + loc + ", old_val: " + old_val + ", new_val: " + \
          new_val)
    self.simh.os8_send_str (loc + "/")
    self.simh._child.expect(expect_val_str)
  
    if old_val.isdigit():          # We need to check old value
      found_val = self.simh._child.after.strip()
      if found_val != old_val:
        print("\tOld value: " + found_val + " does not match " +
            old_val + ". Aborting patch.")
        # Abort out of ODT back to the OS/8 Monitor
        self.simh.os8_send_ctrl('C')
        return "err"
  
................................................................................
      print("Aborting because of mal-formed FUTIL FILE command: " + line)
      self.simh.os8_send_ctrl('C')
      return "err"
    fname = match.group(2)
    expect_futil_file_str = "\n" + fname + "\s+(.*)$"
    self.simh.os8_send_line (line)
    self.simh._child.expect(expect_futil_file_str)
    result = self.simh._child.after.strip()
    match = _com_split_parse.match(result)
    if match == None:
      print("Aborting because unexpected return status: " + result + \
          " from: " + line)
      self.simh.os8_send_ctrl('C')
      return "err"
    if match.group(2).strip() == "LOOKUP FAILED":
................................................................................
    if reply != 0:
      print("PAL8 failed to start at line " + str(self.line_ct_stack[0]))
      return "fail"

    self.simh.os8_send_line (com_line)
    err_count = 0
    reply = self.simh._child.expect (pal8_replies)
    executed_line = self.simh._child.before.strip()
    reply_str = self.simh._child.after.strip()
    if reply == 0:
      self.simh._child.expect("\d+")
      err_count = int(self.simh._child.after.strip())
      reply_str += " " + self.simh._child.after.strip()
    if reply > 0 or err_count > 0:
      print("PAL8 Error: ")
      print("\t*" + executed_line)
      print("\t" + reply_str)
      self.simh.os8_send_ctrl ('c')      # exit PAL8 Just in case.
      # We could do something better than just dying, I expect.
      return "fail"
................................................................................
    ucname = line.upper()
    boot_replies = [ucname + "\s+(.+)\r", "Non-existent device"]
    self.simh.send_cmd("show " + line)
    retval = self.simh._child.expect(boot_replies)
    if retval == 1:
      print("Attempt to boot non-existent device: " + line)
      return "die"
    reply = self.simh._child.after.decode('ascii')
    m = re.match("^(\S+)\s(\S+),\s+(attached to |not attached)(\S+)?,\s+(.+)\r",
        reply)
    if m == None:
      print("Could not determine if device " + line + " is attached; " +
          "got '" + reply + "'")
      return "die"

................................................................................
              str(self.line_ct_stack[0]) + ".\nEncountered end: {" + \
              rest + "}. Exiting BUILD.")
          return "fail"
        
        if self.verbose:
          print("Line " + str(self.line_ct_stack[0]) + ": end BUILD")
        if self.debug:
          print("before: " + self.simh._child.before.strip())
          print("after: " + self.simh._child.after.strip())
        # Return to monitor level unless need_exit == False.
        if need_exit:
          self.simh.os8_send_ctrl ('c')

        return "success"
        
      build_re = _build_comm_regs[build_sub]
................................................................................
          build_build_replies.extend(_build_replies)
          
          if self.debug:
            print("expecting: " + str(build_build_replies))
          reply = self.simh._child.expect(build_build_replies)
          if self.debug:
            print("reply: " + str(reply))
            print("before: " + self.simh._child.before.strip())
            print("after: " + self.simh._child.after.strip())
          if reply != 0:
            print("No prompt for LOAD OS/8 in BUILD command within BUILD at line " + \
              str(self.line_ct_stack[0]) + ".")
            print("Instead got: {" + self.simh._child.after + "}.")
            print("Exiting BUILD.")
            return "die"
          if self.debug:
            print("sending to simh: " + kbm_arg)
          self.simh.os8_send_line (kbm_arg)

          build_build_replies = ["LOAD CD: "]
................................................................................
          build_build_replies.extend(_build_replies)
          
          if self.debug:
            print("expecting: " + str(build_build_replies))
          reply = self.simh._child.expect(build_build_replies)
          if self.debug:
            print("reply: " + str(reply))
            print("before: " + self.simh._child.before.strip())
            print("after: " + self.simh._child.after.strip())
          if reply != 0:
            print("No prompt for LOAD CD in BUILD command within BUILD at line " + \
              str(self.line_ct_stack[0]) + ".")
            print("Instead got: {" + self.simh._child.after + "}.")
            print("Exiting BUILD.")
            return "die"
          if self.debug:
            print("sending to simh: " + cd_arg)
          self.simh.os8_send_line (cd_arg)

          # Done with BUILD command dialog within BUILD.SV
................................................................................
        print("sending to simh: " + comm)
      self.simh.os8_send_line (comm)
      if self.debug:
        print("expecting: " + str(_build_replies))
      reply = self.simh._child.expect(_build_replies)
      if self.debug:
        print("reply: " + str(reply))
        print("before: " + self.simh._child.before.strip())
        print("after: " + self.simh._child.after.strip())
      if reply > 3:
        print("BUILD error at line " + str(self.line_ct_stack[0]) + \
          " with command " + self.simh._child.before.strip())
        print("\t" + self.simh._child.after.strip())
        self.simh.os8_send_ctrl ('c')
      # Special case "BOOT" sub-command: May ask, "WRITE ZERO DIRECT?"
      if build_sub == "BOOT":
        if reply == 2:
          if self.debug:
            print("Boot received \"WRITE ZERO DIRECT?\"")
            print("sending to simh: Y")
          self.simh.os8_send_line("Y")
          if self.debug:
            print("Expecting \"SYS BUILT\"")
          reply = self.simh._child.expect("SYS BUILT")
          if self.debug:
            print("ZeroDir: reply: " + str(reply))
            print("before: " + self.simh._child.before.strip())
            print("after: " + self.simh._child.after.strip())
          need_exit = False
        elif reply == 0:
          reply = self.simh._child.expect("SYS BUILT")
          if self.debug:
            print("$: reply: " + str(reply))
            print("before: " + self.simh._child.before.strip())
            print("after: " + self.simh._child.after.strip())
          need_exit = False
        elif reply == 1:
          reply = self.simh._child.expect("\\.")
          if self.debug:
            print("SysBuilt: reply: " + str(reply))
            print("before: " + self.simh._child.before.strip())
            print("after: " + self.simh._child.after.strip())
    print("Warning end of file encountered with no end of BUILD command block at line " + \
      str(self.line_ct_stack[0]) + ".")
    return "fail"
  
  #### cdprog_subcomm ##################################################
  # Cycle through OS/8 command decoder with the command specified
  # in the argument.







|







 







|







 







|
|


|
|







 







|







 







|
|







 







|
|



|







 







|
|



|







 







|
|


|
|













|
|





|
|





|
|







976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
....
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
....
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
....
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
....
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
....
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
....
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
....
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
    if self.debug:
      print("Loc: " + loc + ", old_val: " + old_val + ", new_val: " + \
          new_val)
    self.simh.os8_send_str (loc + "/")
    self.simh._child.expect(expect_val_str)
  
    if old_val.isdigit():          # We need to check old value
      found_val = self.simh._child.after.decode().strip()
      if found_val != old_val:
        print("\tOld value: " + found_val + " does not match " +
            old_val + ". Aborting patch.")
        # Abort out of ODT back to the OS/8 Monitor
        self.simh.os8_send_ctrl('C')
        return "err"
  
................................................................................
      print("Aborting because of mal-formed FUTIL FILE command: " + line)
      self.simh.os8_send_ctrl('C')
      return "err"
    fname = match.group(2)
    expect_futil_file_str = "\n" + fname + "\s+(.*)$"
    self.simh.os8_send_line (line)
    self.simh._child.expect(expect_futil_file_str)
    result = self.simh._child.after.decode().strip()
    match = _com_split_parse.match(result)
    if match == None:
      print("Aborting because unexpected return status: " + result + \
          " from: " + line)
      self.simh.os8_send_ctrl('C')
      return "err"
    if match.group(2).strip() == "LOOKUP FAILED":
................................................................................
    if reply != 0:
      print("PAL8 failed to start at line " + str(self.line_ct_stack[0]))
      return "fail"

    self.simh.os8_send_line (com_line)
    err_count = 0
    reply = self.simh._child.expect (pal8_replies)
    executed_line = self.simh._child.before.decode().strip()
    reply_str = self.simh._child.after.decode().strip()
    if reply == 0:
      self.simh._child.expect("\d+")
      err_count = int(self.simh._child.after.decode().strip())
      reply_str += " " + self.simh._child.after.decode().strip()
    if reply > 0 or err_count > 0:
      print("PAL8 Error: ")
      print("\t*" + executed_line)
      print("\t" + reply_str)
      self.simh.os8_send_ctrl ('c')      # exit PAL8 Just in case.
      # We could do something better than just dying, I expect.
      return "fail"
................................................................................
    ucname = line.upper()
    boot_replies = [ucname + "\s+(.+)\r", "Non-existent device"]
    self.simh.send_cmd("show " + line)
    retval = self.simh._child.expect(boot_replies)
    if retval == 1:
      print("Attempt to boot non-existent device: " + line)
      return "die"
    reply = self.simh._child.after.decode()
    m = re.match("^(\S+)\s(\S+),\s+(attached to |not attached)(\S+)?,\s+(.+)\r",
        reply)
    if m == None:
      print("Could not determine if device " + line + " is attached; " +
          "got '" + reply + "'")
      return "die"

................................................................................
              str(self.line_ct_stack[0]) + ".\nEncountered end: {" + \
              rest + "}. Exiting BUILD.")
          return "fail"
        
        if self.verbose:
          print("Line " + str(self.line_ct_stack[0]) + ": end BUILD")
        if self.debug:
          print("before: " + self.simh._child.before.decode().strip())
          print("after: " + self.simh._child.after.decode().strip())
        # Return to monitor level unless need_exit == False.
        if need_exit:
          self.simh.os8_send_ctrl ('c')

        return "success"
        
      build_re = _build_comm_regs[build_sub]
................................................................................
          build_build_replies.extend(_build_replies)
          
          if self.debug:
            print("expecting: " + str(build_build_replies))
          reply = self.simh._child.expect(build_build_replies)
          if self.debug:
            print("reply: " + str(reply))
            print("before: " + self.simh._child.before.decode().strip())
            print("after: " + self.simh._child.after.decode().strip())
          if reply != 0:
            print("No prompt for LOAD OS/8 in BUILD command within BUILD at line " + \
              str(self.line_ct_stack[0]) + ".")
            print("Instead got: {" + self.simh._child.after.decode() + "}.")
            print("Exiting BUILD.")
            return "die"
          if self.debug:
            print("sending to simh: " + kbm_arg)
          self.simh.os8_send_line (kbm_arg)

          build_build_replies = ["LOAD CD: "]
................................................................................
          build_build_replies.extend(_build_replies)
          
          if self.debug:
            print("expecting: " + str(build_build_replies))
          reply = self.simh._child.expect(build_build_replies)
          if self.debug:
            print("reply: " + str(reply))
            print("before: " + self.simh._child.before.decode().strip())
            print("after: " + self.simh._child.after.decode().strip())
          if reply != 0:
            print("No prompt for LOAD CD in BUILD command within BUILD at line " + \
              str(self.line_ct_stack[0]) + ".")
            print("Instead got: {" + self.simh._child.after.decode() + "}.")
            print("Exiting BUILD.")
            return "die"
          if self.debug:
            print("sending to simh: " + cd_arg)
          self.simh.os8_send_line (cd_arg)

          # Done with BUILD command dialog within BUILD.SV
................................................................................
        print("sending to simh: " + comm)
      self.simh.os8_send_line (comm)
      if self.debug:
        print("expecting: " + str(_build_replies))
      reply = self.simh._child.expect(_build_replies)
      if self.debug:
        print("reply: " + str(reply))
        print("before: " + self.simh._child.before.decode().strip())
        print("after: " + self.simh._child.after.decode().strip())
      if reply > 3:
        print("BUILD error at line " + str(self.line_ct_stack[0]) + \
          " with command " + self.simh._child.before.decode().strip())
        print("\t" + self.simh._child.after.decode().strip())
        self.simh.os8_send_ctrl ('c')
      # Special case "BOOT" sub-command: May ask, "WRITE ZERO DIRECT?"
      if build_sub == "BOOT":
        if reply == 2:
          if self.debug:
            print("Boot received \"WRITE ZERO DIRECT?\"")
            print("sending to simh: Y")
          self.simh.os8_send_line("Y")
          if self.debug:
            print("Expecting \"SYS BUILT\"")
          reply = self.simh._child.expect("SYS BUILT")
          if self.debug:
            print("ZeroDir: reply: " + str(reply))
            print("before: " + self.simh._child.before.decode().strip())
            print("after: " + self.simh._child.after.decode().strip())
          need_exit = False
        elif reply == 0:
          reply = self.simh._child.expect("SYS BUILT")
          if self.debug:
            print("$: reply: " + str(reply))
            print("before: " + self.simh._child.before.decode().strip())
            print("after: " + self.simh._child.after.decode().strip())
          need_exit = False
        elif reply == 1:
          reply = self.simh._child.expect("\\.")
          if self.debug:
            print("SysBuilt: reply: " + str(reply))
            print("before: " + self.simh._child.before.decode().strip())
            print("after: " + self.simh._child.after.decode().strip())
    print("Warning end of file encountered with no end of BUILD command block at line " + \
      str(self.line_ct_stack[0]) + ".")
    return "fail"
  
  #### cdprog_subcomm ##################################################
  # Cycle through OS/8 command decoder with the command specified
  # in the argument.

Changes to lib/simh.py.in.

315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
...
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
...
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821

  def os8_send_cmd (self, prompt, line, debug=False, timeout=60):
    if self._context != 'os8': 
      print("OS/8 is not running. Cannot execute: " + lin)
      return
    if debug:
      print("os8_send_cmd: expecting: " + prompt)
      print("\tLast match before: {" + self._child.before + "}")
      print("\tLast match after: {" + self._child.after + "}")
    self._child.expect ("\n%s$" % prompt, timeout = timeout)
    self.os8_send_line (line)


  #### os8_send_ctrl ###################################################
  # Send a control character to OS/8 corresponding to the ASCII letter
  # given.  We precede it with the OS/8 keyboard delay, since we're
................................................................................


  #### pip_error_handler ###############################################
  # Common error handler for os8_pip_to and os8_pip_from

  def pip_error_handler(self, caller, reply):
    print("PIP error from inside " + caller + ": ")
    print("\t" + self._child.before.strip())
    print("\t" + self._child.after.strip())
    
    # Was this error fatal or do we need to clean up?
    # Remember we subtract 1 from reply to get index into error tables.
    if not self._os8_fatal_check[reply - 1]:
      # Non fatal error.  Exit pip to the monitor
      self.os8_send_ctrl ('[')      # exit PIP

................................................................................
  def do_simh_show (self, name):
    supported_shows = ["dt", "td", "tti", "rx"]
    if name not in supported_shows: return None
    
    ucname = name.upper()
    self.send_cmd("show " + name)
    self._child.expect(ucname + "\s+(.+)\r")
    lines = self._child.after.split ("\r")
    return lines


  #### parse_show_tape_dev  ############################################
  # Returns current state of DECtape support.
  # One of: disabled, td, dt, or None if parse fails.








|
|







 







|
|







 







|







315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
...
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
...
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821

  def os8_send_cmd (self, prompt, line, debug=False, timeout=60):
    if self._context != 'os8': 
      print("OS/8 is not running. Cannot execute: " + lin)
      return
    if debug:
      print("os8_send_cmd: expecting: " + prompt)
      print("\tLast match before: {" + self._child.before.decode() + "}")
      print("\tLast match after: {" + self._child.after.decode() + "}")
    self._child.expect ("\n%s$" % prompt, timeout = timeout)
    self.os8_send_line (line)


  #### os8_send_ctrl ###################################################
  # Send a control character to OS/8 corresponding to the ASCII letter
  # given.  We precede it with the OS/8 keyboard delay, since we're
................................................................................


  #### pip_error_handler ###############################################
  # Common error handler for os8_pip_to and os8_pip_from

  def pip_error_handler(self, caller, reply):
    print("PIP error from inside " + caller + ": ")
    print("\t" + self._child.before.decode().strip())
    print("\t" + self._child.after.decode().strip())
    
    # Was this error fatal or do we need to clean up?
    # Remember we subtract 1 from reply to get index into error tables.
    if not self._os8_fatal_check[reply - 1]:
      # Non fatal error.  Exit pip to the monitor
      self.os8_send_ctrl ('[')      # exit PIP

................................................................................
  def do_simh_show (self, name):
    supported_shows = ["dt", "td", "tti", "rx"]
    if name not in supported_shows: return None
    
    ucname = name.upper()
    self.send_cmd("show " + name)
    self._child.expect(ucname + "\s+(.+)\r")
    lines = self._child.after.decode().split ("\r")
    return lines


  #### parse_show_tape_dev  ############################################
  # Returns current state of DECtape support.
  # One of: disabled, td, dt, or None if parse fails.

Deleted media/etos/etosv5b-demo.rk05.