From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- security/nss/lib/ckfw/ckapi.perl | 434 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 434 insertions(+) create mode 100644 security/nss/lib/ckfw/ckapi.perl (limited to 'security/nss/lib/ckfw/ckapi.perl') diff --git a/security/nss/lib/ckfw/ckapi.perl b/security/nss/lib/ckfw/ckapi.perl new file mode 100644 index 0000000000..f294ba79dd --- /dev/null +++ b/security/nss/lib/ckfw/ckapi.perl @@ -0,0 +1,434 @@ +#!perl +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +$copyright = '/* THIS IS A GENERATED FILE */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +'; + +$count = -1; +$i = 0; + +open(INPUT, "<$ARGV[0]") || die "Can't open $ARGV[0]: $!"; + +while() { + s/^((?:[^"#]+|"[^"]*")*)(\s*#.*$)/$1/; + next if (/^\s*$/); + +# print; + + /^([\S]+)\s+([^"][\S]*|"[^"]*")/; + $name = $1; + $value = $2; + + if( ($name =~ "FUNCTION") && !($name =~ "CK_FUNCTION") ) { + $count++; + $x[$count]{name} = $value; + $i = 0; + } else { + if( $count < 0 ) { + $value =~ s/"//g; + $g{$name} = $value; + } else { + $x[$count]{args}[$i]{type} = $name; + $x[$count]{args}[$i]{name} = $value; + $i++; + $x[$count]{nargs} = $i; # rewritten each time, oh well + } + } +} + +close INPUT; + +# dodump(); +doprint(); + +sub dodump { + for( $j = 0; $j <= $count; $j++ ) { + print "CK_RV CK_ENTRY $x[$j]{name}\n"; + for( $i = 0; $i < $x[$j]{nargs}; $i++ ) { + print " $x[$j]{args}[$i]{type} $x[$j]{args}[$i]{name}"; + if( $i == ($x[$j]{nargs} - 1) ) { + print "\n"; + } else { + print ",\n"; + } + } + } +} + +sub doprint { +open(PROTOTYPE, ">nssckg.h") || die "Can't open nssckg.h: $!"; +open(TYPEDEF, ">nssckft.h") || die "Can't open nssckft.h: $!"; +open(EPV, ">nssckepv.h") || die "Can't open nssckepv.h: $!"; +open(API, ">nssck.api") || die "Can't open nssck.api: $!"; + +select PROTOTYPE; + +print $copyright; +print <