315 |
317 |
316 /* identifier ':' array_spec_init */ |
318 /* identifier ':' array_spec_init */ |
317 void *visit(array_type_declaration_c *symbol) { |
319 void *visit(array_type_declaration_c *symbol) { |
318 TRACE("array_type_declaration_c"); |
320 TRACE("array_type_declaration_c"); |
319 |
321 |
320 s4o_incl.print("__DECLARE_ARRAY_TYPE("); |
322 array_is_derived = false; |
|
323 current_basetypedeclaration = arrayderiveddeclaration_bd; |
|
324 symbol->array_spec_init->accept(*this); |
|
325 current_basetypedeclaration = none_bd; |
|
326 |
|
327 if (array_is_derived) |
|
328 s4o_incl.print("__DECLARE_DERIVED_TYPE("); |
|
329 else |
|
330 s4o_incl.print("__DECLARE_ARRAY_TYPE("); |
321 current_basetypedeclaration = arraybasetypeincl_bd; |
331 current_basetypedeclaration = arraybasetypeincl_bd; |
322 symbol->array_spec_init->accept(*this); |
332 symbol->array_spec_init->accept(*this); |
323 current_basetypedeclaration = none_bd; |
333 current_basetypedeclaration = none_bd; |
324 s4o_incl.print(","); |
334 s4o_incl.print(","); |
325 symbol->identifier->accept(*basedecl); |
335 symbol->identifier->accept(*basedecl); |
326 s4o_incl.print(","); |
336 if (!array_is_derived) { |
327 current_basetypedeclaration = arraysubrange_bd; |
337 s4o_incl.print(","); |
328 symbol->array_spec_init->accept(*this); |
338 current_basetypedeclaration = arraysubrange_bd; |
329 current_basetypedeclaration = none_bd; |
339 symbol->array_spec_init->accept(*this); |
|
340 current_basetypedeclaration = none_bd; |
|
341 } |
330 s4o_incl.print(")\n"); |
342 s4o_incl.print(")\n"); |
331 |
343 |
332 if (search_base_type.type_is_subrange(symbol->identifier)) { |
344 if (search_base_type.type_is_subrange(symbol->identifier)) { |
333 s4o.print("#define __CHECK_"); |
345 s4o.print("#define __CHECK_"); |
334 symbol->identifier->accept(*this); |
346 symbol->identifier->accept(*this); |
351 /* array_specification [ASSIGN array_initialization] */ |
363 /* array_specification [ASSIGN array_initialization] */ |
352 /* array_initialization may be NULL ! */ |
364 /* array_initialization may be NULL ! */ |
353 void *visit(array_spec_init_c *symbol) { |
365 void *visit(array_spec_init_c *symbol) { |
354 TRACE("array_spec_init_c"); |
366 TRACE("array_spec_init_c"); |
355 |
367 |
356 identifier_c *array_type_name = dynamic_cast<identifier_c *>(symbol->array_specification); |
368 identifier_c *array_type_name; |
357 |
369 |
358 if (array_type_name == NULL) { |
370 switch (current_basetypedeclaration) { |
359 current_typedefinition = array_td; |
371 case arrayderiveddeclaration_bd: |
360 symbol->array_specification->accept(*this); |
372 array_type_name = dynamic_cast<identifier_c *>(symbol->array_specification); |
361 current_typedefinition = none_td; |
373 array_is_derived = array_type_name != NULL; |
|
374 break; |
|
375 case arraytranslateindex_bd: |
|
376 if (!array_is_derived) { |
|
377 current_typedefinition = array_td; |
|
378 symbol->array_specification->accept(*this); |
|
379 current_typedefinition = none_td; |
|
380 } |
|
381 |
|
382 s4o.print("#define __"); |
|
383 current_type_name->accept(*this); |
|
384 s4o.print("_TRANSIDX(row, index) __"); |
|
385 if (array_is_derived) |
|
386 symbol->array_specification->accept(*this); |
|
387 else |
|
388 current_type_name->accept(*this); |
|
389 s4o.print("_TRANSIDX##row(index)"); |
|
390 break; |
|
391 default: |
|
392 if (array_is_derived) { |
|
393 symbol->array_specification->accept(*basedecl); |
|
394 } |
|
395 else { |
|
396 current_typedefinition = array_td; |
|
397 symbol->array_specification->accept(*this); |
|
398 current_typedefinition = none_td; |
|
399 } |
|
400 break; |
362 } |
401 } |
363 else |
|
364 symbol->array_specification->accept(*basedecl); |
|
365 return NULL; |
402 return NULL; |
366 } |
403 } |
367 |
404 |
368 /* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
405 /* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
369 void *visit(array_specification_c *symbol) { |
406 void *visit(array_specification_c *symbol) { |
423 |
460 |
424 s4o_incl.print("__DECLARE_DERIVED_TYPE("); |
461 s4o_incl.print("__DECLARE_DERIVED_TYPE("); |
425 symbol->simple_spec_init->accept(*this); |
462 symbol->simple_spec_init->accept(*this); |
426 s4o_incl.print(","); |
463 s4o_incl.print(","); |
427 symbol->simple_type_name->accept(*basedecl); |
464 symbol->simple_type_name->accept(*basedecl); |
428 s4o_incl.print(");\n"); |
465 s4o_incl.print(")\n"); |
429 return NULL; |
466 return NULL; |
430 } |
467 } |
431 |
468 |
432 /* simple_specification [ASSIGN constant] */ |
469 /* simple_specification [ASSIGN constant] */ |
433 //SYM_REF2(simple_spec_init_c, simple_specification, constant) |
470 //SYM_REF2(simple_spec_init_c, simple_specification, constant) |