home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / r / riscos < prev    next >
Encoding:
Text File  |  1996-11-14  |  4.7 KB  |  109 lines

  1. <TITLE>riscos -- Python library reference</TITLE>
  2. Next: <A HREF="../r/riscospath" TYPE="Next">riscospath</A>  
  3. Prev: <A HREF="../r/riscos_only" TYPE="Prev">RISCOS ONLY</A>  
  4. Up: <A HREF="../r/riscos_only" TYPE="Up">RISCOS ONLY</A>  
  5. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  6. <H1>13.1. Built-in Module <CODE>riscos</CODE></H1>
  7. This module provides RiscOS ports of some POSIX funtions, and some RiscOS
  8. specific functions.
  9. <P>
  10. Errors are reported as exceptions; the usual exceptions are given
  11. for type errors, while errors reported by the system calls raise
  12. <CODE>riscos.error</CODE>, described below.
  13. <P>
  14. <DL><DT><B>error</B> -- exception of module riscos<DD>
  15. This exception is raised when an RiscOS function returns a
  16. RiscOS-related error (e.g., not for illegal argument types).  Its
  17. string value is <CODE>'riscos.error'</CODE>.  The accompanying value is a
  18. string describing the error, often that returned by the relevant SWI.
  19. </DL>
  20. It defines the following functions:
  21. <P>
  22. <DL><DT><B>chdir</B> (<VAR>path</VAR>) -- function of module riscos<DD>
  23. Change the current working directory to <VAR>path</VAR>.
  24. </DL>
  25. <DL><DT><B>chmod</B> (<VAR>path</VAR>, <VAR>mode</VAR>) -- function of module riscos<DD>
  26. Change the mode of <VAR>path</VAR> to the numeric <VAR>mode</VAR>.
  27. </DL>
  28. <DL><DT><B>expand</B> (<VAR>path</VAR>) -- function of module riscos<DD>
  29. Returns the canonical expansion of a pathname.
  30. </DL>
  31. <DL><DT><B>getcwd</B> () -- function of module riscos<DD>
  32. Return a string representing the current directory.
  33. </DL>
  34. <DL><DT><B>getenv</B> (<VAR>string</VAR>) -- function of module riscos<DD>
  35. Returns the string value of the environment variable <VAR>string</VAR>
  36. or <CODE>None</CODE> if it does not exist.
  37. </DL>
  38. <DL><DT><B>listdir</B> (<VAR>path</VAR>) -- function of module riscos<DD>
  39. Return a list containing the names of the entries in the directory.
  40. The list is in arbitrary order.
  41. </DL>
  42. <DL><DT><B>mkdir</B> (<VAR>path</VAR> [, <VAR>mode</VAR>]) -- function of module riscos<DD>
  43. Create a directory named <VAR>path</VAR>, at present <VAR>mode</VAR> is ignored.
  44. </DL>
  45. <DL><DT><B>putenv</B> (<VAR>name</VAR>, <VAR>string</VAR> [, <VAR>type</VAR>]) -- function of module riscos<DD>
  46. Sets the environment variable <VAR>name</VAR> to <VAR>string</VAR>.
  47. <DL>
  48. <DT><I>type</I><DD>  ---  <I>Meaning</I>
  49. <P>
  50. <DT>`<SAMP>0</SAMP>'<DD>GSTrans the string
  51. <DT>`<SAMP>1</SAMP>'<DD>Evaluate the string
  52. <DT>`<SAMP>3</SAMP>'<DD>Macro variable
  53. <DT>`<SAMP>4</SAMP>'<DD>No translation
  54. </DL>
  55. <VAR>type</VAR> defaults to 4 (no translation of the value string).
  56. </DL>
  57. <DL><DT><B>remove</B> (<VAR>path</VAR>) -- function of module riscos<DD>
  58. Remove the directory or file <VAR>path</VAR>.
  59. </DL>
  60. <DL><DT><B>rename</B> (<VAR>src</VAR>, <VAR>dst</VAR>) -- function of module riscos<DD>
  61. Rename the file or directory <VAR>src</VAR> to <VAR>dst</VAR>.
  62. </DL>
  63. <DL><DT><B>rmdir</B> (<VAR>path</VAR>) -- function of module riscos<DD>
  64. Remove the directory or file <VAR>path</VAR> (Same as remove).
  65. </DL>
  66. <DL><DT><B>settype</B> (<VAR>filename</VAR>, <VAR>type</VAR>) -- function of module riscos<DD>
  67. Sets the type of <VAR>filename</VAR>. <VAR>type</VAR> can be an integer or a string.
  68. </DL>
  69. <DL><DT><B>stat</B> (<VAR>path</VAR>) -- function of module riscos<DD>
  70. Perform a <I>stat</I> system call on the given path.  The return value
  71. is a tuple of at least 10 integers giving the most important (and
  72. portable) members of the <I>stat</I> structure, in the order
  73. <CODE>st_mode</CODE>,
  74. <CODE>st_ino</CODE>,
  75. <CODE>st_dev</CODE>,
  76. <CODE>st_nlink</CODE>,
  77. <CODE>st_uid</CODE>,
  78. <CODE>st_gid</CODE>,
  79. <CODE>st_size</CODE>,
  80. <CODE>st_atime</CODE>,
  81. <CODE>st_mtime</CODE>,
  82. <CODE>st_ctime</CODE>.
  83. The RiscOS version adds three extra values, the file type, attributes and 
  84. object type, as returned by osfile_read_stamped_no_path.
  85. The values <CODE>st_ino</CODE>,
  86. <CODE>st_dev</CODE>,
  87. <CODE>st_nlink</CODE>,
  88. <CODE>st_uid</CODE> and
  89. <CODE>st_gid</CODE> are all zero. The three times are all equal.
  90. <P>
  91. Note: The standard module <CODE>stat</CODE> defines functions and constants
  92. that are useful for extracting information from a stat structure.
  93. </DL>
  94. <DL><DT><B>system</B> (<VAR>command</VAR>) -- function of module riscos<DD>
  95. Execute the command (a string).  This is implemented by
  96. calling the Standard C function <CODE>system()</CODE>, and has the same
  97. limitations.
  98. The return value is the exit status of the process as returned by Standard C
  99. <CODE>system()</CODE>.
  100. </DL>
  101. <DL><DT><B>unlink</B> (<VAR>path</VAR>) -- function of module riscos<DD>
  102. Unlink <VAR>path</VAR> (Same as remove).
  103. </DL>
  104. <DL><DT><B>utime</B> (<VAR>path</VAR>, (<VAR>atime</VAR>, <VAR>mtime</VAR>)) -- function of module riscos<DD>
  105. Set the time stamp of the file.
  106. (The second argument is a tuple of two items.) At present the second argument
  107. is ignored and the time is set to the current time.
  108. </DL>
  109.