Others



next up previous contents index
Next: Error messages Up: Functions Previous: Modes

Others

last_key

  int last_key()

Returns the last character of the last keys sequence which called Smac. For instance, only one function is defined to blink {,( and [, it calls last\_key to know if you have typed a }, a ), or a ].

blink

  void blink(int nth)

If nth is negative writes No Match in the mini buffer, else highlights the nth character if it is visible, else writes Match '<the char>' at line <the line> pos <nth>. This function is used by the Cmode5.24 page gif) when you press },) and ] keys to indicate corresponding {,( and [ position. Obviously its visibility effect is obtained when blink is called, not when the current Smac execution is finished.

cmd_shell

  void cmd_shell(char * cmd)

Executes sh -c cmd in a sub-shell and inserts the result in a Shell window. All the characters produced by the command cmd in the stdout are inserted starting at the current position. To get the characters produced in stdout and stderr:

cmd_shell_to_string

  char * cmd_shell_to_string(char * cmd)

Executes sh -c cmd in a sub-shell and returns a new allocated string containing all the characters produced by the command cmd in the stdout or stderr.

ATTENTION Be careful, the string is allocated each time the function is called, use free() to release it.

file_select

  char * file_select()

Returns a new allocated string containing the absolute filename selected by a file selector, or 0 if you cancel the selection.

ATTENTION Be careful, the string is allocated each time the function is called, use free() to release it.

select_from_list

  char * select_from_list(char * title)

Displays the Xcoral List Box with given items (look at the next two functions) and the given title. Returns the item chosen with a mouse click, or 0 if cancelled.

add_list_item

  void add_list_item(char * item)

Adds item to the items list. There is no check to verify that items are different.

clear_list

  void clear_list()

Empties the items list.

display_message

   void display_message(char * msg)
void display_message(char * msg, char * title)
void display_message(char * msg, char * title, int flag)

Writes msg in the Xcoral Messages Box. If title is given, it is written at the top of the window, otherwise previous title is cleared. If flag is not null, a separator is inserted before msg (i.e. the string '>>>' and a return are inserted , thus the message will be displayed on a new line); when flag is not given its value is 0.

getchar

  char getchar()
char getchar(char * strprompt)

Displays the Xcoral Dialog Box to get a character. If strprompt is not given, it is replaced by "getchar ? ", which is written before the prompt. Only one character may be given, without line editing nor required return. If you choose the ok button, returns 0, if you choose cancel returns 7 (the bell).

gets

  char * gets()
char * gets(char * strprompt)

Displays the Xcoral Dialog Box to get a string with the prompt strprompt ("gets ? " if strprompt is omitted). You have line editing, and the return or ok button is required to validate the input string. If you choose the cancel button, returns a string with one character (and the null terminator) of code 7. If you select the ok button without inputting a string, returns 0.

ATTENTION Be careful, the string is allocated each time the function is called, use free() to release it.

usleep

  void usleep(int us)

Waits us micro-seconds.

watch_off

  void watch_off()

Displays the default cursor.

watch_on

  void watch_on()

Displays the cursor as a watch. It is sometimes useful to display a watch as cursor when Smac works, typically when a function runs several seconds.



next up previous contents index
Next: Error messages Up: Functions Previous: Modes



Lionel Fournigault
Mon Mar 6 13:33:34 MET 1995