homedir.sl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. %
  2. % HOMEDIR.SL - USER-HOMEDIR-STRING function for Tops-20
  3. %
  4. % Author: Eric Benson
  5. % Symbolic Computation Group
  6. % Computer Science Dept.
  7. % University of Utah
  8. % Date: 21 September 1982
  9. % Copyright (c) 1982 University of Utah
  10. %
  11. (compiletime (progn
  12. (load monsym syslisp)
  13. (put 'get-user-number 'opencode '((gjinf)))
  14. (flag '(user-homedir-string-aux get-dir-string)
  15. 'internalfunction)))
  16. % Returns a string which is the init file for program-name.
  17. % Optional HOST is not supported.
  18. (de init-file-string (program-name)
  19. (concat (user-homedir-string) (concat program-name ".INIT")))
  20. % Returns a string which is the users home directory name.
  21. % Optional HOST is not supported.
  22. (lap '((*entry user-homedir-string expr 0)
  23. (movei (reg 1) (indexed (reg st) 1)) % Pointer into the stack
  24. (*alloc 20) % allocate space
  25. (*call user-homedir-string-aux) % call the real function
  26. (*exit 20))) % deallocate and return
  27. (de user-homedir-string-aux (p)
  28. (concat "PS:<" (mkstr (get-dir-string p (get-user-number)))))
  29. (lap '((*entry get-dir-string expr 2)
  30. (*move (reg 1) (reg 5)) % save original addr in ac5
  31. (hrli (reg 1) 8#10700) % make a byte pointer
  32. (*move (reg 1) (reg 3)) % save it in ac3
  33. (dirst)
  34. (erjmp cant-get-dir)
  35. (movei (reg 4) 62) % put a closing > on it
  36. (idpb (reg 4) (reg 1))
  37. (setz (reg 4) 0) % put a null char on the end
  38. (idpb (reg 4) (reg 1))
  39. (seto (reg 4) 0) % initialize length to -1
  40. string-length-loop
  41. (ildb (reg 2) (reg 3))
  42. (jumpe (reg 2) done-computing-length)
  43. (aoja (reg 4) string-length-loop)
  44. done-computing-length
  45. (movem (reg 4) (indexed (reg 5) 0)) % put len in string header
  46. (*move (reg 5) (reg 1)) % return original pointer
  47. (*exit 0)
  48. cant-get-dir
  49. (*move (reg 1) '"UNKNOWN>")
  50. (*exit 0)))