[svn-commits] tzafrir: branch 1.4 r4591 - /branches/1.4/build_tools/cvt_zapdahdi

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Nov 30 08:45:28 CST 2008


Author: tzafrir
Date: Sun Nov 30 08:45:28 2008
New Revision: 4591

URL: http://svn.digium.com/view/zaptel?view=rev&rev=4591
Log:
cvt_zapdahdi: convert source files between Zaptel and DAHDI
              Helps showing the real changes

Added:
    branches/1.4/build_tools/cvt_zapdahdi   (with props)

Added: branches/1.4/build_tools/cvt_zapdahdi
URL: http://svn.digium.com/view/zaptel/branches/1.4/build_tools/cvt_zapdahdi?view=auto&rev=4591
==============================================================================
--- branches/1.4/build_tools/cvt_zapdahdi (added)
+++ branches/1.4/build_tools/cvt_zapdahdi Sun Nov 30 08:45:28 2008
@@ -1,0 +1,347 @@
+#! /usr/bin/perl -w
+
+# cvt_zapdahdi: convert source files between Zaptel and DAHDI
+#               Helps showing the real changes
+#
+# Written by Oron Peled <oron at actcom.co.il>
+# Copyright (C) 2008 by Xorcom <support at xorcom.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+use strict;
+use Getopt::Std;
+
+my $VERSION = '$Id:';
+
+sub usage() {
+	warn "Usage: $0 [-v] {-d|-z} source_file\n";
+	warn "-v -- verbose\n";
+	warn "-d -- to dahdi\n";
+	warn "-z -- to zaptel\n";
+	warn "";
+	warn "Output file is <source_file>.to_<zap|dahdi>";
+	exit(1);
+}
+
+my %opts;
+getopts('zdv', \%opts);
+
+$opts{'d'} || $opts{'z'} || usage();
+
+my $suffix = ($opts{'d'}) ? "to_dahdi" : "to_zap";
+
+ at ARGV == 1 or die "Usage: $0 source_file\n";
+my $infile = shift;
+
+# Map only differing filenames
+# Note that this is a full name
+my %dahdi2zap_filenames = (
+		'dahdi-base.c'		=> 'zaptel-base.c',
+		'dahdi_dynamic.c' 	=> 'ztdynamic.c',
+		'dahdi_dynamic_eth.c' 	=> 'ztd-eth.c',
+		'dahdi_dynamic_local.c'	=> 'ztd-local.c',
+		'dahdi_transcode.c'	=> 'zttranscode.c',
+		'xpp_dahdi.c'		=> 'xpp_zap.c',
+		'xpp_dahdi.h'		=> 'xpp_zap.h',
+		'dahdi_debug.c'		=> 'zap_debug.c',
+		'dahdi_debug.h'		=> 'zap_debug.h',
+	);
+
+my %filenames = ($opts{'z'}) ? %dahdi2zap_filenames : reverse %dahdi2zap_filenames;
+my $outfile = $filenames{$infile} || $infile;
+$outfile .= ".$suffix";
+
+my %dahdi2zap_names = (
+		__DAHDI_SIG_FXO			=> '__ZT_SIG_FXO',
+		__DAHDI_SIG_FXS			=> '__ZT_SIG_FXS',
+		DAHDI_ALARM_BLUE		=> 'ZT_ALARM_BLUE',
+		DAHDI_ALARM_LOOPBACK		=> 'ZT_ALARM_LOOPBACK',
+		DAHDI_ALARM_NONE		=> 'ZT_ALARM_NONE',
+		DAHDI_ALARM_NOTOPEN		=> 'ZT_ALARM_NOTOPEN',
+		DAHDI_ALARM_RECOVER		=> 'ZT_ALARM_RECOVER',
+		DAHDI_ALARM_RED			=> 'ZT_ALARM_RED',
+		DAHDI_ALARM_YELLOW		=> 'ZT_ALARM_YELLOW',
+		DAHDI_AUDIOMODE			=> 'ZT_AUDIOMODE',
+		dahdi_bufferinfo		=> 'zt_bufferinfo',
+		DAHDI_CHANNO			=> 'ZT_CHANNO',
+		DAHDI_CHECK_HOOKSTATE		=> 'ZT_CHECK_HOOKSTATE',
+		DAHDI_CONF_CONF			=> 'ZT_CONF_CONF',
+		DAHDI_CONF_CONFANN		=> 'ZT_CONF_CONFANN',
+		DAHDI_CONF_CONFANNMON		=> 'ZT_CONF_CONFANNMON',
+		DAHDI_CONF_CONFMON		=> 'ZT_CONF_CONFMON',
+		DAHDI_CONF_DIGITALMON		=> 'ZT_CONF_DIGITALMON',
+		DAHDI_CONF_LISTENER		=> 'ZT_CONF_LISTENER',
+		DAHDI_CONF_MONITORBOTH		=> 'ZT_CONF_MONITORBOTH',
+		DAHDI_CONF_NORMAL		=> 'ZT_CONF_NORMAL',
+		DAHDI_CONF_PSEUDO_LISTENER	=> 'ZT_CONF_PSEUDO_LISTENER',
+		DAHDI_CONF_PSEUDO_TALKER	=> 'ZT_CONF_PSEUDO_TALKER',
+		DAHDI_CONF_REALANDPSEUDO	=> 'ZT_CONF_REALANDPSEUDO',
+		DAHDI_CONF_TALKER		=> 'ZT_CONF_TALKER',
+		DAHDI_CONFDIAG			=> 'ZT_CONFDIAG',
+		dahdi_confinfo			=> 'zt_confinfo',
+		DAHDI_CONFMUTE			=> 'ZT_CONFMUTE',
+		DAHDI_DEFAULT_NUM_BUFS		=> 'ZT_DEFAULT_NUM_BUFS',
+		DAHDI_DIAL			=> 'ZT_DIAL',
+		DAHDI_DIALING			=> 'ZT_DIALING',
+		DAHDI_DIAL_OP_APPEND		=> 'ZT_DIAL_OP_APPEND',
+		dahdi_dialoperation		=> 'zt_dialoperation',
+		DAHDI_DIAL_OP_REPLACE		=> 'ZT_DIAL_OP_REPLACE',
+		dahdi_dialparams		=> 'zt_dialparams',
+		DAHDI_ECHOCANCEL		=> 'ZT_ECHOCANCEL',
+		DAHDI_ECHOTRAIN			=> 'ZT_ECHOTRAIN',
+		DAHDI_EVENT_ALARM		=> 'ZT_EVENT_ALARM',
+		DAHDI_EVENT_BITSCHANGED		=> 'ZT_EVENT_BITSCHANGED',
+		DAHDI_EVENT_DIALCOMPLETE	=> 'ZT_EVENT_DIALCOMPLETE',
+		DAHDI_EVENT_DTMFDOWN		=> 'ZT_EVENT_DTMFDOWN',
+		DAHDI_EVENT_DTMFUP		=> 'ZT_EVENT_DTMFUP',
+		DAHDI_EVENT_EC_DISABLED		=> 'ZT_EVENT_EC_DISABLED',
+		DAHDI_EVENT_HOOKCOMPLETE	=> 'ZT_EVENT_HOOKCOMPLETE',
+		DAHDI_EVENT_NOALARM		=> 'ZT_EVENT_NOALARM',
+		DAHDI_EVENT_NONE		=> 'ZT_EVENT_NONE',
+		DAHDI_EVENT_ONHOOK		=> 'ZT_EVENT_ONHOOK',
+		DAHDI_EVENT_POLARITY		=> 'ZT_EVENT_POLARITY',
+		DAHDI_EVENT_PULSEDIGIT		=> 'ZT_EVENT_PULSEDIGIT',
+		DAHDI_EVENT_PULSE_START		=> 'ZT_EVENT_PULSE_START',
+		DAHDI_EVENT_REMOVED		=> 'ZT_EVENT_REMOVED',
+		DAHDI_EVENT_RINGBEGIN		=> 'ZT_EVENT_RINGBEGIN',
+		DAHDI_EVENT_RINGEROFF		=> 'ZT_EVENT_RINGEROFF',
+		DAHDI_EVENT_RINGERON		=> 'ZT_EVENT_RINGERON',
+		DAHDI_EVENT_RINGOFFHOOK		=> 'ZT_EVENT_RINGOFFHOOK',
+		DAHDI_EVENT_TIMER_EXPIRED	=> 'ZT_EVENT_TIMER_EXPIRED',
+		DAHDI_EVENT_TIMER_PING		=> 'ZT_EVENT_TIMER_PING',
+		DAHDI_EVENT_WINKFLASH		=> 'ZT_EVENT_WINKFLASH',
+		DAHDI_FLASH			=> 'ZT_FLASH',
+		DAHDI_FLUSH			=> 'ZT_FLUSH',
+		DAHDI_FLUSH_ALL			=> 'ZT_FLUSH_ALL',
+		DAHDI_FLUSH_BOTH		=> 'ZT_FLUSH_BOTH',
+		DAHDI_FLUSH_READ		=> 'ZT_FLUSH_READ',
+		DAHDI_FLUSH_WRITE		=> 'ZT_FLUSH_WRITE',
+		dahdi_gains			=> 'zt_gains',
+		DAHDI_GET_BUFINFO		=> 'ZT_GET_BUFINFO',
+		DAHDI_GETCONF			=> 'ZT_GETCONF',
+		DAHDI_GETCONFMUTE		=> 'ZT_GETCONFMUTE',
+		DAHDI_GETEVENT			=> 'ZT_GETEVENT',
+		DAHDI_GETGAINS			=> 'ZT_GETGAINS',
+		DAHDI_GET_PARAMS		=> 'ZT_GET_PARAMS',
+		DAHDI_HOOK			=> 'ZT_HOOK',
+		DAHDI_IOMUX			=> 'ZT_IOMUX',
+		DAHDI_IOMUX_READ		=> 'ZT_IOMUX_READ',
+		DAHDI_IOMUX_SIGEVENT		=> 'ZT_IOMUX_SIGEVENT',
+		DAHDI_IOMUX_WRITE		=> 'ZT_IOMUX_WRITE',
+		DAHDI_LAW_ALAW			=> 'ZT_LAW_ALAW',
+		DAHDI_LAW_DEFAULT		=> 'ZT_LAW_DEFAULT',
+		DAHDI_LAW_MULAW			=> 'ZT_LAW_MULAW',
+		DAHDI_MAX_NUM_BUFS		=> 'ZT_MAX_NUM_BUFS',
+		DAHDI_MAX_SPANS			=> 'ZT_MAX_SPANS',
+		DAHDI_OFFHOOK			=> 'ZT_OFFHOOK',
+		DAHDI_ONHOOK			=> 'ZT_ONHOOK',
+		DAHDI_ONHOOKTRANSFER		=> 'ZT_ONHOOKTRANSFER',
+		dahdi_params			=> 'zt_params',
+		DAHDI_POLICY_IMMEDIATE		=> 'ZT_POLICY_IMMEDIATE',
+		DAHDI_POLICY_WHEN_FULL		=> 'ZT_POLICY_WHEN_FULL',
+		DAHDI_PRI			=> 'ZT_PRI',
+		DAHDI_RING			=> 'ZT_RING',
+		DAHDI_RINGOFF			=> 'ZT_RINGOFF',
+		DAHDI_SENDTONE			=> 'ZT_SENDTONE',
+		DAHDI_SET_BLOCKSIZE		=> 'ZT_SET_BLOCKSIZE',
+		DAHDI_SET_BUFINFO		=> 'ZT_SET_BUFINFO',
+		DAHDI_SETCADENCE		=> 'ZT_SETCADENCE',
+		DAHDI_SETCONF			=> 'ZT_SETCONF',
+		DAHDI_SET_DIALPARAMS		=> 'ZT_SET_DIALPARAMS',
+		DAHDI_SETGAINS			=> 'ZT_SETGAINS',
+		DAHDI_SETLAW			=> 'ZT_SETLAW',
+		DAHDI_SETLINEAR			=> 'ZT_SETLINEAR',
+		DAHDI_SET_PARAMS		=> 'ZT_SET_PARAMS',
+		DAHDI_SETTONEZONE		=> 'ZT_SETTONEZONE',
+		DAHDI_SIG_CLEAR			=> 'ZT_SIG_CLEAR',
+		DAHDI_SIG_EM			=> 'ZT_SIG_EM',
+		DAHDI_SIG_EM_E1			=> 'ZT_SIG_EM_E1',
+		DAHDI_SIG_FXO			=> 'ZT_SIG_FXO',
+		DAHDI_SIG_FXOGS			=> 'ZT_SIG_FXOGS',
+		DAHDI_SIG_FXOKS			=> 'ZT_SIG_FXOKS',
+		DAHDI_SIG_FXOLS			=> 'ZT_SIG_FXOLS',
+		DAHDI_SIG_FXS			=> 'ZT_SIG_FXS',
+		DAHDI_SIG_FXSGS			=> 'ZT_SIG_FXSGS',
+		DAHDI_SIG_FXSKS			=> 'ZT_SIG_FXSKS',
+		DAHDI_SIG_FXSLS			=> 'ZT_SIG_FXSLS',
+		DAHDI_SIG_HARDHDLC		=> 'ZT_SIG_HARDHDLC',
+		DAHDI_SIG_HDLCFCS		=> 'ZT_SIG_HDLCFCS',
+		DAHDI_SIG_SF			=> 'ZT_SIG_SF',
+		dahdi_spaninfo			=> 'zt_spaninfo',
+		DAHDI_SPANSTAT			=> 'ZT_SPANSTAT',
+		DAHDI_SPECIFY			=> 'ZT_SPECIFY',
+		DAHDI_START			=> 'ZT_START',
+		DAHDI_TC_ALLOCATE		=> 'ZT_TC_ALLOCATE',
+		DAHDI_TC_GETINFO		=> 'ZT_TC_GETINFO',
+		DAHDI_TIMERACK			=> 'ZT_TIMERACK',
+		DAHDI_TIMERCONFIG		=> 'ZT_TIMERCONFIG',
+		DAHDI_TIMERPING			=> 'ZT_TIMERPING',
+		DAHDI_TIMERPONG			=> 'ZT_TIMERPONG',
+		DAHDI_TONE_BUSY			=> 'ZT_TONE_BUSY',
+		DAHDI_TONE_CONGESTION		=> 'ZT_TONE_CONGESTION',
+		DAHDI_TONEDETECT		=> 'ZT_TONEDETECT',
+		DAHDI_TONEDETECT_MUTE		=> 'ZT_TONEDETECT_MUTE',
+		DAHDI_TONEDETECT_ON		=> 'ZT_TONEDETECT_ON',
+		DAHDI_TONE_DIALRECALL		=> 'ZT_TONE_DIALRECALL',
+		DAHDI_TONE_DIALTONE		=> 'ZT_TONE_DIALTONE',
+		DAHDI_TONE_DTMF_A		=> 'ZT_TONE_DTMF_A',
+		DAHDI_TONE_DTMF_BASE		=> 'ZT_TONE_DTMF_BASE',
+		DAHDI_TONE_DTMF_p		=> 'ZT_TONE_DTMF_p',
+		DAHDI_TONE_DTMF_s		=> 'ZT_TONE_DTMF_s',
+		DAHDI_TONE_INFO			=> 'ZT_TONE_INFO',
+		DAHDI_TONE_RINGTONE		=> 'ZT_TONE_RINGTONE',
+		DAHDI_TONE_STUTTER		=> 'ZT_TONE_STUTTER',
+		dahdi_transcoder_formats	=> 'zt_transcoder_formats',
+		dahdi_transcoder_info		=> 'zt_transcoder_info',
+		DAHDI_vldtmf			=> 'ZT_vldtmf',
+		DAHDI_WINK			=> 'ZT_WINK',
+		HAVE_DAHDI			=> 'HAVE_ZAPTEL',
+		dahdi_ring_cadence		=> 'zt_ring_cadence',
+		dahdi_span			=> 'zt_span',
+		dahdi_chan			=> 'zt_chan',
+		'enum dahdi_txsig'		=> 'zt_txsig_t',
+		'enum dahdi_rxsig'		=> 'zt_rxsig_t',
+		dahdi_hooksig			=> 'zt_hooksig',
+		dahdi_register			=> 'zt_register',
+		dahdi_alarm_notify		=> 'zt_alarm_notify',
+		dahdi_qevent_lock		=> 'zt_qevent_lock',
+		CONFIG_DAHDI_BRI_DCHANS		=> 'CONFIG_ZAPATA_BRI_DCHANS',
+		DAHDI_SIG_HDLCRAW		=> 'ZT_SIG_HDLCRAW',
+		DAHDI_SIG_HDLCFCS		=> 'ZT_SIG_HDLCFCS',
+		DAHDI_SIG_HDLCNET		=> 'ZT_SIG_HDLCNET',
+		DAHDI_SIG_SLAVE			=> 'ZT_SIG_SLAVE',
+		DAHDI_SIG_CAS			=> 'ZT_SIG_CAS',
+		DAHDI_SIG_DACS			=> 'ZT_SIG_DACS',
+		DAHDI_SIG_DACS_RBS		=> 'ZT_SIG_DACS_RBS',
+		DAHDI_SIG_SF			=> 'ZT_SIG_SF',
+		DAHDI_SIG_NONE			=> 'ZT_SIG_NONE',
+		dahdi_lineconfig		=> 'zt_lineconfig',
+		DAHDI_CONFIG_B8ZS		=> 'ZT_CONFIG_B8ZS',
+		DAHDI_CONFIG_AMI		=> 'ZT_CONFIG_AMI',
+		DAHDI_CONFIG_HDB3		=> 'ZT_CONFIG_HDB3',
+		DAHDI_CONFIG_ESF		=> 'ZT_CONFIG_ESF',
+		DAHDI_CONFIG_D4			=> 'ZT_CONFIG_D4',
+		DAHDI_CONFIG_CCS		=> 'ZT_CONFIG_CCS',
+		DAHDI_CONFIG_CRC4		=> 'ZT_CONFIG_CRC4',
+		DAHDI_CONFIG_NOTOPEN		=> 'ZT_CONFIG_NOTOPEN',
+		DAHDI_FLAG_RUNNING		=> 'ZT_FLAG_RUNNING',
+		DAHDI_FLAG_PRIDCHAN		=> 'ZT_FLAG_PRIDCHAN',
+		DAHDI_FLAG_HDLC			=> 'ZT_FLAG_HDLC',
+		DAHDI_FLAG_RBS			=> 'ZT_FLAG_RBS',
+		DAHDI_RXSIG_RING		=> 'ZT_RXSIG_RING',
+		DAHDI_RXSIG_OFFHOOK		=> 'ZT_RXSIG_OFFHOOK',
+		DAHDI_RXSIG_ONHOOK		=> 'ZT_RXSIG_ONHOOK',
+		DAHDI_RXSIG_START		=> 'ZT_RXSIG_START',
+		DAHDI_RXSIG_INITIAL		=> 'ZT_RXSIG_INITIAL',
+		DAHDI_TXSIG_START		=> 'ZT_TXSIG_START',
+		DAHDI_TXSIG_TOTAL		=> 'ZT_TXSIG_TOTAL',
+		DAHDI_EVENT_ABORT		=> 'ZT_EVENT_ABORT',
+		DAHDI_EVENT_OVERRUN		=> 'ZT_EVENT_OVERRUN',
+		DAHDI_EVENT_BADFCS		=> 'ZT_EVENT_BADFCS',
+		DAHDI_TXSIG_OFFHOOK		=> 'ZT_TXSIG_OFFHOOK',
+		DAHDI_TXSIG_ONHOOK		=> 'ZT_TXSIG_ONHOOK',
+		DAHDI_TXSIG_KEWL		=> 'ZT_TXSIG_KEWL',
+		DAHDI_MAINT_NONE		=> 'ZT_MAINT_NONE',
+		DAHDI_MAINT_LOCALLOOP		=> 'ZT_MAINT_LOCALLOOP',
+		DAHDI_MAINT_REMOTELOOP		=> 'ZT_MAINT_REMOTELOOP',
+		DAHDI_MAINT_LOOPUP		=> 'ZT_MAINT_LOOPUP',
+		DAHDI_MAINT_LOOPDOWN		=> 'ZT_MAINT_LOOPDOWN',
+		DAHDI_MAINT_LOOPSTOP		=> 'ZT_MAINT_LOOPSTOP',
+		DAHDI_SETPOLARITY		=> 'ZT_SETPOLARITY',
+		DAHDI_CHUNKSIZE			=> 'ZT_CHUNKSIZE',
+		CONFIG_DAHDI_WATCHDOG		=> 'CONFIG_ZAPTEL_WATCHDOG',
+		DAHDI_XLAW			=> 'ZT_XLAW',
+		DAHDI_VMWI			=> 'ZT_VMWI',
+		dahdi_alarm_channel		=> 'zt_alarm_channel',
+		dahdi_ec_chunk			=> 'zt_ec_chunk',
+		dahdi_transmit			=> 'zt_transmit',
+		dahdi_receive			=> 'zt_receive',
+		dahdi_rbsbits			=> 'zt_rbsbits',
+		'dahdi/kernel.h'		=> 'zaptel.h',
+# XPP substitutions
+		DAHDI_SYNC_TICK			=> 'ZAPTEL_SYNC_TICK',
+		dahdi_ticker			=> 'zaptel_ticker',
+		card_dahdi_preregistration	=> 'card_zaptel_preregistration',
+		card_dahdi_postregistration	=> 'card_zaptel_postregistration',
+		FXS_card_dahdi_preregistration	=> 'FXS_card_zaptel_preregistration',
+		FXS_card_dahdi_postregistration	=> 'FXS_card_zaptel_postregistration',
+		FXO_card_dahdi_preregistration	=> 'FXO_card_zaptel_preregistration',
+		FXO_card_dahdi_postregistration	=> 'FXO_card_zaptel_postregistration',
+		BRI_card_dahdi_preregistration	=> 'BRI_card_zaptel_preregistration',
+		BRI_card_dahdi_postregistration	=> 'BRI_card_zaptel_postregistration',
+		PRI_card_dahdi_preregistration	=> 'PRI_card_zaptel_preregistration',
+		PRI_card_dahdi_postregistration	=> 'PRI_card_zaptel_postregistration',
+		dahdi_registration		=> 'zt_registration',
+		dahdi_registered		=> 'zt_registered',
+		dahdi_unregister		=> 'zt_unregister',
+		dahdi_register_xpd		=> 'zaptel_register_xpd',
+		dahdi_unregister_xpd		=> 'zaptel_unregister_xpd',
+		dahdi_autoreg			=> 'zap_autoreg',
+		dahdi_reg			=> 'zt_reg',
+		dahdi_update_syncsrc		=> 'zap_update_syncsrc',
+		dahdi_sync_tick			=> 'zaptel_sync_tick',
+		dahdi_tick			=> 'zaptel_tick',
+		dahdi_tick_count		=> 'zaptel_tick_count',
+		force_dahdi_sync		=> 'force_zaptel_sync',
+		xpp_dahdi_init			=> 'xpp_zap_init',
+		xpp_dahdi_cleanup		=> 'xpp_zap_cleanup',
+		dahdi_report_battery		=> 'zap_report_battery',
+		update_dahdi_ring		=> 'update_zap_ring',
+		'xpp_dahdi.h'			=> 'xpp_zap.h',
+		'dahdi_debug.h'			=> 'zap_debug.h',
+		update_dahdi			=> 'update_zap',
+		dahdi_cfg			=> 'ztcfg',
+		dahdi				=> 'zaptel',
+		Dahdi				=> 'Zaptel',
+		DAHDI				=> 'ZAPTEL',
+		'<dahdi/kernel.h>'		=> '<zaptel.h>',
+		'<dahdi/wctdm_user.h>'		=> '<wctdm.h>',
+		'XPP_DAHDI_H'			=> 'XPP_ZAP_H',
+		'DAHDI_DEBUG_H'			=> 'ZAP_DEBUG_H',
+	);
+
+my %names = ($opts{'z'}) ? %dahdi2zap_names : reverse %dahdi2zap_names;
+
+sub build_regex(@) {
+	# Match longer strings first
+	my @keys = sort { length($b) <=> length($a) } @_;
+	return '\b' . join('\b|\b', @keys) . '\b';
+}
+
+my $huge_regex = build_regex(keys %names);
+#print STDERR "huge_regex:  '$huge_regex'\n";
+
+sub map_one($) {
+	my $k = shift;
+	my $v = $names{$k};
+	if(defined $v) {
+		#print STDERR "Replace: '$k'\n";
+		return $v;
+	}
+	warn "$0: Unmapped '$k'. Leave as is...\n";
+	return $k;
+}
+
+open(F, $infile) || die "$infile: $!\n";
+open(G, ">$outfile") || die "$outfile: $!\n";
+while(<F>) {
+	chomp;
+	if(s/$huge_regex/&map_one($&)/ge) {
+		print STDERR "Fixed: '$_'\n" if $opts{'v'};
+	}
+	print G "$_\n";
+}
+close F;
+close G;

Propchange: branches/1.4/build_tools/cvt_zapdahdi
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/1.4/build_tools/cvt_zapdahdi
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/1.4/build_tools/cvt_zapdahdi
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: branches/1.4/build_tools/cvt_zapdahdi
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the svn-commits mailing list