12.07.2015 Views

spec - Local Sector 7 web page

spec - Local Sector 7 web page

spec - Local Sector 7 web page

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

¡with dlog or ends with .dlog . Debugging messages (generated when a value isassigned to the built-in variable DEBUG )are only written to such a file, not to thescreen or any other file or device.Another kind of log file is available (as of release 4.05.01) that records typed commands,error messages and optional time stamps. The file is intended to be useful toadministrators trying to diagnose user problems. Afile opened for output namedelog or that ends in .elog is such a file. Commands entered at the <strong>spec</strong> prompt arelogged prefixed by a #C . Error messages produced by the built-in C code, or generatedby the eprint or eprintf() built-in keywords, are logged prefixed by a #E . Iftime stamps are enabled (via the <strong>spec</strong>_par() "elog_timestamp" option), the UNIXepoch and the corresponding date string are logged (at the time-stamp interval) prefixedby a #T .Reading From FilesThe first function below is for reading strings from a file one line at a time. The secondand third functions cause <strong>spec</strong> to switch its source of command input from thekeyboard to the <strong>spec</strong>ified files.getline(file [, arg ]) — This function reads successive lines from the ASCII filefile each time it is called and returns the string so obtained, including thetrailing newline. If arg is the string "open" ,the function returns zero if thefile can opened for reading. ¤ § ¢file is closed and zero is returned. If arg is zero, the first line of the file isreturned. If only the first argument is present, the next line of the file is readand returned. ¡ ¤ £ ¥ ¢§¥¤¡£¢ ¢¡£§ § £¦¥ If arg is "close" ,the¢£¢¡£§ §£ ¦¥The previous file, if any, isclosed and the new file is opened automaticallywhen the filename argument changes (at least in this preliminary implementation).¤ ¢¥dofile(file [, line_num|search_pattern ]) — Queues the file file for reading commands.file must be a string constant or expression. Returns nonzero if thefile doesn’t exist or permit read access. As of release 4.05.01, an optional secondargument can <strong>spec</strong>ify a line number or a text pattern that will be used tolocate the point in the file to begin reading. If the argument is an integer, thenumber <strong>spec</strong>ifies at which line to start reading the file. (Currently, only positiveintegers are allowed.) If the argument is anything else, it is considered asearch string, and text is read from the file starting at the first line containingthat search string. The metacharacters * ,which matches any string, and ? ,which matches any single character, are allowed in the search string. Initialand trailing white space is ignored in the file.INTERIM WORK-IN-PROGRESS (8/16/01) NOT FOR GENERAL DISTRIBUTION REFERENCE MANUAL 83

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!