From 0c237b8f50aabc2f3f4b7516e096ab126fe97858 Mon Sep 17 00:00:00 2001 From: kcudnik Date: Thu, 24 Mar 2022 12:40:43 +0100 Subject: [PATCH] [meta] Add enum for global apis --- meta/parse.pl | 24 ++++++++++++++++++++++-- meta/saisanitycheck.c | 4 ++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/meta/parse.pl b/meta/parse.pl index ad452cb7d..319c7bbb4 100755 --- a/meta/parse.pl +++ b/meta/parse.pl @@ -3180,16 +3180,36 @@ sub CreateGlobalFunctions WriteHeader ""; - WriteHeader "typedef enum _sai_global_api_type_t {"; + my $typename = "sai_global_api_type_t"; + + my $prefix = uc $typename; + + chop $prefix; + + WriteHeader "typedef enum _$typename {"; + + my @values = (); for my $name (sort keys %GLOBAL_APIS) { my $short = uc($1) if $name =~ /^sai_(\w+)/; WriteHeader "SAI_GLOBAL_API_TYPE_$short,"; + + push @values, "SAI_GLOBAL_API_TYPE_$short"; } - WriteHeader "} sai_global_api_type_t;"; + WriteHeader "} $typename;"; + + $SAI_ENUMS{$typename}{values} = \@values; + + WriteSectionComment "$typename metadata"; + + ProcessSingleEnum($typename, $typename, $prefix); + + WriteSectionComment "Get $typename helper method"; + + CreateEnumHelperMethod($typename); } sub CreateApisQuery diff --git a/meta/saisanitycheck.c b/meta/saisanitycheck.c index 6e720c5e4..c64e24e33 100644 --- a/meta/saisanitycheck.c +++ b/meta/saisanitycheck.c @@ -5347,6 +5347,10 @@ void check_all_enums() check_single_enum(emd); } + + check_single_enum(&sai_metadata_enum_sai_global_api_type_t); + check_single_enum(&sai_metadata_enum_sai_switch_notification_type_t); + check_single_enum(&sai_metadata_enum_sai_switch_pointer_type_t); } void check_sai_version()