/ ARRAY public constructor. */ /
| 140 | /* ARRAY public constructor. */ |
| 141 | /***********************************************************************/ |
| 142 | ARRAY::ARRAY(PGLOBAL g, int type, int size, int length, int prec) |
| 143 | : CSORT(false) |
| 144 | { |
| 145 | Nval = 0; |
| 146 | Ndif = 0; |
| 147 | Bot = 0; |
| 148 | Top = 0; |
| 149 | Size = size; |
| 150 | Type = type; |
| 151 | Xsize = -1; |
| 152 | Len = 1; |
| 153 | X = 0; |
| 154 | Inf = 0; |
| 155 | Sup = 0; |
| 156 | |
| 157 | switch (type) { |
| 158 | case TYPE_STRING: |
| 159 | Len = length; |
| 160 | /* fall through */ |
| 161 | case TYPE_SHORT: |
| 162 | case TYPE_INT: |
| 163 | case TYPE_DOUBLE: |
| 164 | case TYPE_PCHAR: |
| 165 | Type = type; |
| 166 | break; |
| 167 | case TYPE_VOID: |
| 168 | Type = TYPE_INT; |
| 169 | break; |
| 170 | #if 0 |
| 171 | case TYPE_TOKEN: |
| 172 | break; |
| 173 | case TYPE_LIST: |
| 174 | Len = 0; |
| 175 | prec = length; |
| 176 | break; |
| 177 | #endif // 0 |
| 178 | default: // This is illegal an causes an ill formed array building |
| 179 | snprintf(g->Message, sizeof(g->Message), MSG(BAD_ARRAY_TYPE), type); |
| 180 | Type = TYPE_ERROR; |
| 181 | return; |
| 182 | } // endswitch type |
| 183 | |
| 184 | Valblk = new(g) MBVALS; |
| 185 | |
| 186 | if (!(Vblp = Valblk->Allocate(g, Type, Len, prec, Size))) |
| 187 | Type = TYPE_ERROR; |
| 188 | else if (!Valblk->GetMemp() && Type != TYPE_LIST) |
| 189 | // The error message was built by PlgDBalloc |
| 190 | Type = TYPE_ERROR; |
| 191 | else if (type != TYPE_PCHAR) |
| 192 | Value = AllocateValue(g, type, Len, prec); |
| 193 | |
| 194 | Constant = true; |
| 195 | } // end of ARRAY constructor |
| 196 | |
| 197 | #if 0 |
| 198 | /***********************************************************************/ |
nothing calls this directly
no test coverage detected