(component ComponentDefinition, w LanguageWriter, NameSpace string, useCPPTypes bool)
| 479 | } |
| 480 | |
| 481 | func buildCCPPEnums(component ComponentDefinition, w LanguageWriter, NameSpace string, useCPPTypes bool) (error) { |
| 482 | if (len(component.Enums) == 0) { |
| 483 | return nil |
| 484 | } |
| 485 | |
| 486 | w.Writeln("/*************************************************************************************************************************"); |
| 487 | w.Writeln(" Declaration of enums"); |
| 488 | w.Writeln("**************************************************************************************************************************/"); |
| 489 | w.Writeln(""); |
| 490 | |
| 491 | for i := 0; i < len(component.Enums); i++ { |
| 492 | enum := component.Enums[i]; |
| 493 | if (useCPPTypes) { |
| 494 | w.Writeln("enum class e%s : %s_int32 {", enum.Name, NameSpace); |
| 495 | } else { |
| 496 | w.Writeln("typedef enum e%s%s {", NameSpace, enum.Name); |
| 497 | } |
| 498 | |
| 499 | for j := 0; j < len(enum.Options); j++ { |
| 500 | comma := ""; |
| 501 | if (j < len(enum.Options) - 1) { |
| 502 | comma = ","; |
| 503 | } |
| 504 | option := enum.Options[j]; |
| 505 | if (useCPPTypes) { |
| 506 | w.Writeln(" %s = %d%s", option.Name, option.Value, comma); |
| 507 | } else { |
| 508 | w.Writeln(" e%s%s = %d%s", enum.Name, option.Name, option.Value, comma); |
| 509 | } |
| 510 | } |
| 511 | if (useCPPTypes) { |
| 512 | w.Writeln("};"); |
| 513 | } else { |
| 514 | w.Writeln("} e%s%s;", NameSpace, enum.Name); |
| 515 | } |
| 516 | w.Writeln(""); |
| 517 | } |
| 518 | |
| 519 | if (!useCPPTypes) { |
| 520 | w.Writeln("/*************************************************************************************************************************"); |
| 521 | w.Writeln(" Declaration of enum members for 4 byte struct alignment"); |
| 522 | w.Writeln("**************************************************************************************************************************/"); |
| 523 | w.Writeln(""); |
| 524 | |
| 525 | for i := 0; i < len(component.Enums); i++ { |
| 526 | enum := component.Enums[i]; |
| 527 | w.Writeln("typedef union {"); |
| 528 | w.Writeln(" e%s%s m_enum;", NameSpace, enum.Name); |
| 529 | w.Writeln(" int m_code;"); |
| 530 | w.Writeln("} structEnum%s%s;", NameSpace, enum.Name); |
| 531 | w.Writeln(""); |
| 532 | } |
| 533 | } |
| 534 | return nil |
| 535 | } |
| 536 | |
| 537 | |
| 538 | func buildCCPPFunctionPointers(component ComponentDefinition, w LanguageWriter, NameSpace string, useCPPTypes bool) (error) { |
no test coverage detected