1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It is one of the source files comprising zwgc, the Zephyr WindowGram
5 * Created by: Marc Horowitz <marc@athena.mit.edu>
9 * Copyright (c) 1989 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
15 #include <zephyr/mit-copyright.h>
20 #include "new_string.h"
23 * void var_clear_all_variables()
24 * Requires: This routine must be called before any other
25 * var module routine is called.
26 * Modifies: All description language variables
27 * Effects: Sets all description langauge variables to "".
30 extern void var_clear_all_variables(void);
33 * string var_get_variable(string name)
34 * Requires: var_clear_all_variables has been called
35 * Effects: Returns the value of the description langauge variable
36 * named name. The returned string is read-only and is
37 * guarenteed to last only until the next var module
38 * call. DO NOT FREE THIS STRING.
41 extern string var_get_variable(string);
44 * void var_set_variable(string name, value)
45 * Requires: var_clear_all_variables has been called
46 * Modifies: The value of description langauge variable
48 * Effects: Sets the description langauge variable named name
49 * to have the value value.
52 extern void var_set_variable(string, string);
55 * void var_set_variable_to_number(string name; int number)
56 * Requires: var_clear_all_variables has been called
57 * Modifies: The value of description langauge variable
59 * Effects: Sets the description langauge variable named name
60 * to have as its value number's ascii representation.
63 extern void var_set_variable_to_number(string, int);
66 * void var_set_variable_then_free_value(string name, value)
67 * Requires: var_clear_all_variables has been called, value is
69 * Modifies: The value of description langauge variable
71 * Effects: Sets the description langauge variable named name
72 * to have the value value then frees value. This
73 * routine is slightly faster than calling var_set_variable
74 * then freeing value. It is provided mainly for
75 * convenience reasons.
78 extern void var_set_variable_then_free_value(string, string);
81 * void var_set_number_variables_to_fields(char *data, int length)
82 * Requires: var_clear_all_variables has been called
83 * Modifies: All numeric description language variables
84 * Effects: Treats data[0]..data[length-1] as a series of
85 * null-seperated fields. Sets $<number> (<number>
86 * here means [0-9]+ to field # <number> in data.
87 * Field 0 is defined to be "" as are all field #'s
88 * greater than the number of fields in data.
89 * Data[0]..data[length-1] must not be changed (or freed)
90 * until either this call is made again with different
91 * data or var_clear_all_variables is called.
94 extern void var_set_number_variables_to_fields(char *, int);