Top
Back: 5.1.119 sres
Forward: 5.1.121 std
FastBack: 5. Functions and system variables
FastForward: 6. Tricks and pitfalls
Up: 5.1 Functions
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

5.1.120 status

Syntax:

status ( link_expression, string_expression )

Type:

string

Syntax:

status ( link_expression, string_expression, string_expression )
status ( link_expression, string_expression, string_expression, int_expression )

Type:

int

Purpose:

returns the status of the link as asked for by the second argument. If a third argument is given, the result of the comparison to the status string is returned: (status(l,s1)==s2) is equivalent to status(l,s1,s2). If a fourth integer argument (say, i) is given and if status(l,s1,s2) yields 0, then the execution of the current process is suspended (the process is put to “sleep”) for approximately i microseconds, and afterwards the result of another call to status(l,s1,s2) is returned. The latter is useful for “polling” the read status of MPtcp links such that busy loops are avoided (see Parallelization with MPtcp links for an example). Note that on some systems, the minimum time for a process to be put to sleep is one second.
The following string expressions are allowed:

"name"

the name string given by the definition of the link (usually the filename)

"type"

returns "ASCII", "MPfile", "MPtcp" or "DBM"

"open"

returns "yes" or "no"

"openread"

returns "yes" or "no"

"openwrite"

returns "yes" or "no"

"read"

returns "ready" or "not ready"

"write"

returns "ready" or "not ready"

"mode"

returns (depending on the type of the link and its status) "","w","a","r" or "rw"

Example:
 
  link l=":w example.txt";
  status(l,"write");
→ not ready
  open(l);
  status(l,"write","ready");
→ 1
  close(l);

See link; open; read; write.


Top Back: 5.1.119 sres Forward: 5.1.121 std FastBack: 5. Functions and system variables FastForward: 6. Tricks and pitfalls Up: 5.1 Functions Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.