]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/zwgc/variables.h
r4264@bucket (orig r254): kcr | 2008-01-20 22:11:44 -0500
[1ts-debian.git] / zephyr / zwgc / variables.h
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
3  * client.
4  *
5  *      Created by:     Marc Horowitz <marc@athena.mit.edu>
6  *
7  *      $Id$
8  *
9  *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
10  *      For copying and distribution information, see the file
11  *      "mit-copyright.h".
12  */
13
14
15 #include <zephyr/mit-copyright.h>
16
17 #ifndef var_MODULE
18 #define var_MODULE
19
20 #include "new_string.h"
21
22 /*
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 "".
28  */
29
30 extern void var_clear_all_variables(void);
31
32 /*
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.
39  */
40
41 extern string var_get_variable(string);
42
43 /*
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
47  *                  named name.
48  *        Effects: Sets the description langauge variable named name
49  *                 to have the value value.
50  */
51
52 extern void var_set_variable(string, string);
53
54 /*
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
58  *                  named name.
59  *        Effects: Sets the description langauge variable named name
60  *                 to have as its value number's ascii representation.
61  */
62
63 extern void var_set_variable_to_number(string, int);
64
65 /*
66  *    void var_set_variable_then_free_value(string name, value)
67  *        Requires: var_clear_all_variables has been called, value is
68  *                  on the heap.
69  *        Modifies: The value of description langauge variable
70  *                  named name, value
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.
76  */
77
78 extern void var_set_variable_then_free_value(string, string);
79
80 /*
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.
92  */
93
94 extern void var_set_number_variables_to_fields(char *, int);
95
96 #endif