This file is indexed.

/usr/include/Attribute/attrvalue.h is in ivtools-dev 1.2.11a1-11.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
/*
 * Copyright (c) 2001,2006 Scott E. Johnston
 * Copyright (c) 2000 IET Inc.
 * Copyright (c) 1994-1999 Vectaport Inc.
 *
 * Permission to use, copy, modify, distribute, and sell this software and
 * its documentation for any purpose is hereby granted without fee, provided
 * that the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the names of the copyright holders not be used in
 * advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  The copyright holders make
 * no representations about the suitability of this software for any purpose.
 * It is provided "as is" without express or implied warranty.
 *
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
 * IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 * 
 */

#if !defined(_attrvalue_h)
#define _attrvalue_h

#define RESOURCE_COMPVIEW

#include <leakchecker.h>

#include <stdlib.h>
#include <OS/enter-scope.h>
#include <Attribute/classid.h>
#include <Unidraw/Components/compview.h>
#include <ComUtil/comterp.h>

// extern "C" {
    int symbol_add(const char*);
    int symbol_del(int);
    int symbol_reference(int);
    int symbol_find(const char*);
    const char* symbol_pntr(int);
// }
class AttributeValueList;
class ComponentView;

#include <iosfwd>

//: struct for symbol value, symid + global flag for symbol value
// used in attr_value.
typedef struct {
       unsigned int symid;
       boolean globalflag;
} symval_struct;

//: void* pointer plus object classid (see macro in OverlayUnidraw/ovcomps.h)
// used in attr_value.
typedef struct {
       void *ptr;
       unsigned int type;
} objval_struct;

//: pointer to list of values, plus optional type id.
// used in attr_value.
typedef struct {
  AttributeValueList *ptr;
  unsigned int type;
} arrayval_struct;

//: void* pointer to ComFunc object plus optional type id
// used in attr_value.
typedef struct {
       void *funcptr;
       AttributeValueList *listptr;
} streamval_struct;

//: keyword symbol id, plus number of arguments that follow.
// used in attr_value.
typedef struct {
  unsigned int keyid;
  unsigned int keynarg;
} keyval_struct;

//: union for AttributeValue typed data storage.
typedef union attr_value_union
{
      char              charval;
      unsigned char     ucharval;
      short             shortval;
      unsigned short    ushortval;
      int               dfintval;
      unsigned int      dfunsval;
      long              lnintval;
      unsigned long     lnunsval;
      float             floatval;
      double            doublval;
      symval_struct     symval;
      objval_struct     objval;
      arrayval_struct   arrayval;
      streamval_struct  streamval;
      keyval_struct     keyval;
} attr_value;

typedef const char* const_char_ptr;

//: multi-type attribute value object.
class AttributeValue {
public:
    enum ValueType { UnknownType, CharType, UCharType, ShortType, UShortType, 
		     IntType, UIntType, LongType, ULongType, FloatType, DoubleType, 
                     StringType, SymbolType, ArrayType, StreamType, CommandType, KeywordType, 
                     ObjectType, EofType, BooleanType, OperatorType, BlankType,
		     ListType = ArrayType
};
    // enum for attribute value types.

    enum ValueState { UnknownState, OctState, HexState };
    // enum for states

    AttributeValue(ValueType type);
    // construct with specified type and unitialized value.
    AttributeValue(ValueType type, attr_value value);
    // construct with specified type and value struct.
    AttributeValue(AttributeValue&);
    // copy constructor.
    AttributeValue(AttributeValue*);
    // deep copy constructor.
    AttributeValue();
    // default constructor (UnknownType constructor).
    AttributeValue(postfix_token* token);
    // copy constructor from a postfix token generated by a scanner or parser.

    AttributeValue(char val);
    // CharType constructor.
    AttributeValue(unsigned char val);
    // UCharType constructor.
    AttributeValue(short val);
    // ShortType constructor.
    AttributeValue(unsigned short val);
    // UShortType constructor.
    AttributeValue(int val, ValueType type);
    // IntType constructor or any other int-like value.
    AttributeValue(unsigned int val, ValueType type);
    // UIntType constructor or any other unsigned-int-like value including SymbolType.
    AttributeValue(unsigned int keysym, unsigned int narg, ValueType=KeywordType);
    // KeywordType constructor (or can be used for ObjectType).
    AttributeValue(long val);
    // LongType constructor.
    AttributeValue(unsigned long val);
    // ULongType constructor.
    AttributeValue(float val);
    // FloatType constructor.
    AttributeValue(double);
    // DoubleType constructor.
    AttributeValue(int class_symid, void* objptr);
    // ObjectType constructor.
    AttributeValue(AttributeValueList* listptr);
    // ArrayType/ListType constructor.
    AttributeValue(void* comfunc, AttributeValueList* vallist);
    // StreamType constructor.
    AttributeValue(const char* val);
    // StringType constructor.
    AttributeValue(ComponentView* view, int compid);
    // ComponentView constructor.

    virtual ~AttributeValue();
    // set to UnknownType and unref pointer if ArrayType/ListType or StreamType.

    void clear(); 
    // clear bytes of multi-value union

    AttributeValue& operator= (const AttributeValue&);
    // copy assignment operator.

    ValueType type() const;
    // return type enum.
    void type(ValueType);
    // set type enum.
    int type_size() { return type_size(type()); }
    // return sizeof of value of this type.
    static int type_size(ValueType);
    // return sizeof of value of given type.
    int type_symid() const;
    // return symbol id corresponding to type
    const char* type_name() { return symbol_pntr(type_symid()); }
    // type name of object.

    void assignval (const AttributeValue&);
    // copy contents of AttributeValue

    char& char_ref();                 // char by reference.
    unsigned char& uchar_ref();       // unsigned char by reference.
    short& short_ref();               // short by reference.
    unsigned short& ushort_ref();     // unsigned short by reference.
    int& int_ref();                   // int by reference.
    unsigned int& uint_ref();         // unsigned int by reference.
    boolean& boolean_ref();           // boolean by reference.
    long& long_ref();                 // long by reference.
    unsigned long& ulong_ref();       // unsigned long by reference.
    float& float_ref();               // float by reference.
    double& double_ref();             // double by reference.
    unsigned int& string_ref();       // string symbol id by reference.
    unsigned int& symbol_ref();       // symbol id by reference.
    void*& obj_ref();                 // void* pointer to object by reference.
    unsigned int& obj_type_ref();     // classid of object by reference.
    AttributeValueList*& array_ref(); // values in list by reference.
    unsigned int& array_type_ref();   // type of values in list by reference
    AttributeValueList*& list_ref();  // values in list by reference.
    unsigned int& list_type_ref();    // type of values in list by reference
    unsigned int& keyid_ref();        // symbol id of keyword by reference.
    unsigned int& keynarg_ref();      // number of arguments after keyword by reference.

    char char_val();                  // char by value.                             
    unsigned char uchar_val();	      // unsigned char by value.                    
    short short_val();		      // short by value.                            
    unsigned short ushort_val();      // unsigned short by value.                   
    int int_val();		      // int by value.                              
    unsigned int uint_val();	      // unsigned int by value.                     
    boolean boolean_val();	      // boolean by value.                          
    long long_val();		      // long by value.                             
    unsigned long ulong_val();	      // unsigned long by value.                    
    float float_val();		      // float by value.                            
    double double_val();	      // double by value.                           
    unsigned int string_val();	      // string symbol id by value.                 
    unsigned int symbol_val();	      // symbol id by value.                        
    void* obj_val();		      // void* pointer to object by value.          
    unsigned int obj_type_val();      // classid of object by value.                
    AttributeValueList* array_val();  // values in list by value.                   
    unsigned int array_type_val();    // type of values in list by value            
    AttributeValueList* list_val();   // values in list by value.                   
    unsigned int list_type_val();     // type of values in list by value            
    unsigned int keyid_val();	      // symbol id of keyword by value.             
    unsigned int keynarg_val();	      // number of arguments after keyword by value.

    unsigned int& class_symid();      // classid of object.
    const char* class_name();         // class name of object.


    const char* string_ptr();
    // lookup and return pointer to string associated with string.
    const char* symbol_ptr();
    boolean global_flag();
    // return true if a symbol and the global flag is set.
    void global_flag(boolean flag);
    // set global flag of a symbol
    int array_len();
    // length of list of values when ArrayType/ListType.
    int list_len();
    // length of list of values when ArrayType/ListType.

    int command_symid();
    // symbol id of associated command name, for use with ComTerp.
    void command_symid(int, boolean alias=false);
    // set symbol id of associated command name, for use with ComTerp.
    // boolean command_alias();
    // returns true if command is an alias, not the first name.
    const char* command_name();
    // returns name of command.

    const boolean object_compview() { return is_object() && _object_compview; }
    // true if object is wrapped with a ComponentView
#if 0
    void object_compview(boolean flag);
    // true if object is wrapped with a ComponentView
#endif

    int stream_mode();
    // 0 = disabled, negative = internal, positive = external
    void stream_mode(int mode) { if (is_stream()) _stream_mode = mode; }
    // 0 = disabled, negative = internal, positive = external
    void* stream_func() { return is_stream() ? _v.streamval.funcptr : nil; }
    // return function pointer associated with stream object
    void stream_func(void* func) { if (is_stream()) _v.streamval.funcptr = func; }
    // set function pointer associated with stream object
    AttributeValueList* stream_list() { return is_stream() ? _v.streamval.listptr : nil; }
    // return pointer to AttributeValueList associated with stream object
    void stream_list(AttributeValueList* list); 
    // set pointer to AttributeValueList associated with stream object

    int state();
    // get generic state value useful for any type other than CommandType, ObjectType, or StreamType
    void state(int val);
    // set generic state value useful for any type other than CommandType, ObjectType, or StreamType

    void negate();
    // negate numeric values.

    boolean is_true() { return type() != UnknownType && boolean_val(); }
    // returns true if !UnknownType && boolean_val()
    boolean is_false() { return !is_true(); }
    // returns true if !is_true()
    boolean is_type(ValueType t) { return type() == t; }
    // returns true if type() == 't'.

    boolean is_boolean() { return is_boolean(type()); }
    // returns true if BooleanType.
    boolean is_char() { return is_char(type()); }
    // returns true if CharType || UCharType.
    boolean is_short() { return is_short(type()); }
    // returns true if ShortType || UShortType.
    boolean is_int() { return is_int(type()); }
    // returns true if IntType || UIntType.
    boolean is_long() { return is_long(type()); }
    // returns true if LongType || ULongType.
    boolean is_float() { return is_float(type()); }
    // returns true if FloatType.
    boolean is_double() { return is_double(type()); }
    // returns true if DoubleType.

    boolean is_integer() { return is_integer(type()); }
    // returns true if is_char() || is_short() || is_int() || is_long().
    boolean is_floatingpoint() { return is_floatingpoint(type()); }
    // returns true if is_float() || is_double().
    boolean is_num() { return is_integer(type()) || is_floatingpoint(type()); }
    // returns true if is_integer() || is_floatingpoint().
    boolean is_numeric() { return is_num(); }
    // same as AttributeValue::is_num().

    boolean is_array() { return is_type(ArrayType); }
    // returns true if ArrayType/ListType.
    boolean is_list() { return is_type(ArrayType); }
    // returns true if ArrayType/ListType.
    boolean is_stream() { return is_type(StreamType); }
    // returns true if StreamType.
    boolean is_key() { return is_type(KeywordType); }
    // returns true if KeywordType.
    boolean is_unknown() { return is_type(UnknownType); }
    // returns true if UnknownType.
    boolean is_null() { return is_unknown(); }
    // returns true if UnknownType.
    boolean is_nil() { return is_unknown(); }
    // returns true if UnknownType.
    boolean is_known() { return !is_type(UnknownType); }
    // returns true if !UnknownType.
    boolean is_string() { return is_type(StringType) || is_type(SymbolType); }
    // returns true if StringType || SymbolType.
    boolean is_only_string() { return is_type(StringType); }
    // returns true if StringType
    boolean is_symbol() { return is_type(SymbolType); }
    // returns true if SymbolType.
    boolean is_command() { return is_type(CommandType); }
    // returns true if CommandType (for use of ComTerp).
    boolean is_object() { return is_type(ObjectType); }
    // returns true if ObjectType.
    boolean is_object(int class_symid);
    // returns true if ObjectType and class_symid matches or belongs to a parent class.

    static boolean is_boolean(ValueType t) 
      { return t==BooleanType; }
    static boolean is_char(ValueType t) 
      { return t==CharType || t==UCharType; }
    static boolean is_short(ValueType t)
      { return t==ShortType || t==UShortType; }
    static boolean is_int(ValueType t)
      { return t==IntType || t==UIntType; }
    static boolean is_long(ValueType t) 
      { return t==LongType || t==ULongType; }
    static boolean is_float(ValueType t)
      { return t==FloatType; }
    static boolean is_double(ValueType t)
      { return t==DoubleType; }

    static boolean is_integer(ValueType t)
      { return is_char(t) || is_short(t) || is_int(t) | is_long(t); }
    static boolean is_floatingpoint(ValueType t)
      { return is_float(t) || is_double(t); }
    static boolean is_num(ValueType t)
      { return is_integer(t) || is_floatingpoint(t); }

    boolean is_blank() { return is_type(BlankType); }
    // returns true if BlankType.
    static boolean is_blank(ValueType t)
      { return t==BlankType; };

    boolean is_attributelist();
    // returns true if ObjectType with an AttributeList object.
    boolean is_attribute();
    // returns true if ObjectType with an Attribute object.

    virtual void* geta(int type); 
    // return a pointer if ObjectType matches or is a parent class
    virtual boolean isa(int type); 
    // return true if ObjectType matches or is a parent class

    friend ostream& operator << (ostream& s, const AttributeValue&);
    // output AttributeValue to ostream.

    void* value_ptr() { return &_v; }
    // returns void* pointer to value struct.

    void ref_as_needed();
    // increment ref counters as needed
    void unref_as_needed();
    // decrement ref counters as needed
    void dup_as_needed();
    // duplicate lists then increment ref counters as needed
    const boolean same_list(const AttributeValue& av);
    // check if arrayval or streamval are the same

    boolean equal(AttributeValue& av);
    // return true if values of both are the same

protected:

    ValueType _type;
    attr_value _v;
    union { 
      int _command_symid; // used for CommandType.
      boolean _object_compview; // used for ObjectType.
      int _stream_mode; // used for StreamType
      int _state; // useful for any type other than CommandType, ObjectType, or StreamType
    };
    static int* _type_syms;

#ifdef LEAKCHECK
 public:
    static LeakChecker* _leakchecker;
#endif
};

//: for quick casting in debugger
typedef class AttributeValue _AV; 

#endif /* !defined(_attrvalue_h) */