Path: blob/main/crypto/openssl/VMS/translatesyms.pl
34860 views
#! /usr/bin/env perl1# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.2#3# Licensed under the Apache License 2.0 (the "License"). You may not use4# this file except in compliance with the License. You can obtain a copy5# in the file LICENSE in the source distribution or at6# https://www.openssl.org/source/license.html789# This script will translate any SYMBOL_VECTOR item that has a translation10# in CXX$DEMANGLER_DB. The latter is generated by and CC/DECC command that11# uses the qualifier /REPOSITORY with the build directory as value. When12# /NAMES=SHORTENED has been used, this file will hold the translations from13# the original symbols to the shortened variants.14#15# CXX$DEMAGLER_DB. is an ISAM file, but with the magic of RMS, it can be16# read as a text file, with each record as one line.17#18# The lines will have the following syntax for any symbol found that's longer19# than 31 characters:20#21# LONG_symbol_34567890123{cksum}$LONG_symbol_34567890123_more_than_31_chars22#23# $ is present at the end of the shortened symbol name, and is preceded by a24# 7 character checksum. The $ makes it easy to separate the shortened name25# from the original one.2627use strict;28use warnings;2930usage() if scalar @ARGV < 1;3132my %translations = ();3334open DEMANGLER_DATA, $ARGV[0]35or die "Couldn't open $ARGV[0]: $!\n";36while(<DEMANGLER_DATA>) {37s|\R$||;38(my $translated, my $original) = split /\$/;39$translations{$original} = $translated.'$';40}41close DEMANGLER_DATA;4243$| = 1; # Autoflush44while(<STDIN>) {45s@46((?:[A-Za-z0-9_]+)\/)?([A-Za-z0-9_]+)=(PROCEDURE|DATA)47@48if (defined($translations{$2})) {49my $trans = $translations{$2};50my $trans_uc = uc $trans;51if (defined($1) && $trans ne $trans_uc) {52"$trans_uc/$trans=$3"53} else {54"$trans=$3"55}56} else {57$&58}59@gxe;60print $_;61}626364