Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:03

0001 #ifndef MAD_ARRAY_H
0002 #define MAD_ARRAY_H
0003 
0004 // types
0005 
0006 struct char_array               /* dynamic array of char */
0007 {
0008   int stamp;
0009   int max,                      /* max. array size */
0010       curr;                     /* current occupation */
0011   char* c;
0012 };
0013 
0014 struct char_p_array             /* dynamic array of char pointers */
0015 {
0016   char name[NAME_L];
0017   int  max,                     /* max. array size */
0018        curr,                    /* current occupation */
0019        flag;                    /* ancillary flag */
0020   int stamp;
0021   char** p;
0022 };
0023 
0024 struct int_array                /* dynamic array of int */
0025 {
0026   int stamp;
0027   char name[NAME_L];
0028   int  max,                     /* max. array size */
0029        curr;                    /* current occupation */
0030   int* i;
0031 };
0032 
0033 struct double_array             /* dynamic array of double */
0034 {
0035   int stamp;
0036   int max,                      /* max. array size */
0037       curr;                     /* current occupation */
0038   double* a;
0039 };
0040 
0041 struct char_array_list
0042 {
0043   char name[NAME_L];
0044   int stamp;
0045   int  max,                     /* max. pointer array size */
0046        curr;                    /* current occupation */
0047   struct char_array** ca;
0048 };
0049 
0050 // interface
0051 
0052 struct char_array*      new_char_array(int length);
0053 struct char_p_array*    new_char_p_array(int length);
0054 struct int_array*       new_int_array(int length);
0055 struct double_array*    new_double_array(int length);
0056 struct char_array_list* new_char_array_list(int size);
0057 
0058 int    addto_char_p_array(struct char_p_array* ch_p_arr, struct char_array* ch_arr);
0059 
0060 struct char_p_array*    clone_char_p_array(struct char_p_array* p);
0061 struct int_array*       clone_int_array(struct int_array* p);
0062 struct double_array*    clone_double_array(struct double_array* p);
0063 struct char_array*      delete_char_array(struct char_array* pa);
0064 struct char_p_array*    delete_char_p_array(struct char_p_array* pa, int flag);
0065 struct int_array*       delete_int_array(struct int_array* i);
0066 struct double_array*    delete_double_array(struct double_array* a);
0067 void    dump_char_array(struct char_array* a);
0068 void    dump_char_p_array(struct char_p_array* p);
0069 void    dump_int_array(struct int_array* ia);
0070 void    grow_char_array(struct char_array* p);
0071 void    grow_char_p_array(struct char_p_array* p);
0072 void    grow_int_array(struct int_array* p);
0073 void    grow_double_array(struct double_array* p);
0074 void    grow_char_array_list(struct char_array_list* p);
0075 
0076 void    copy_double(double* source, double* target, int n);
0077 int     char_p_pos(char* name, struct char_p_array* p);
0078 void    ftoi_array(struct double_array* da, struct int_array* ia);
0079 int     int_in_array(int k, int n, int* array);
0080 
0081 #endif // MAD_ARRAY_H
0082