blob: 7f4dc217040072874d0bfbae83595f0b551780e7 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001#!/usr/bin/perl
2#
3# Copyright Statement:
4# --------------------
5# This software is protected by Copyright and the information contained
6# herein is confidential. The software may not be copied and the information
7# contained herein may not be used or disclosed except with the written
8# permission of MediaTek Inc. (C) 2005
9#
10# BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
11# THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
12# RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
13# AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
14# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
15# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
16# NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
17# SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
18# SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
19# THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
20# NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
21# SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
22#
23# BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
24# LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
25# AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
26# OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
27# MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
28#
29# THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
30# WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
31# LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
32# RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
33# THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
34#
35#
36#*****************************************************************************
37#*
38#* Filename:
39#* ---------
40#* lnitem.pl
41#*
42#* Project:
43#* --------
44#* Maui_Software
45#*
46#* Description:
47#* ------------
48#* This script will gererate files based [<file name>]<file content> format
49#*
50#* Author:
51#* -------
52#* Sherman Wang (mtk00590)
53#*
54#*============================================================================
55#* HISTORY
56#* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
57#*------------------------------------------------------------------------------
58#* $Revision: 1.1 $
59#* $Modtime: Jun 20 2005 18:37:52 $
60#* $Log: //mtkvs01/vmdata/Maui_sw/archives/mcu/pcore/tools/lst2file.pl-arc $
61 #
62 # Rev 1.1 Jun 20 2005 18:39:24 BM
63 #Karlos:
64 #add copyright and disclaimer
65 #
66 # Rev 1.0 Sep 10 2004 18:37:34 BM
67 #Initial revision.
68#*------------------------------------------------------------------------------
69#* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
70#*============================================================================
71#****************************************************************************/
72
73#****************************************************************************
74# Included Modules
75#****************************************************************************
76use strict;
77
78#****************************************************************************
79# Constants
80#****************************************************************************
81my $DebugPrint = 0; # 1 for debug; 0 for non-debug
82
83#****************************************************************************
84# parse dir result and extract information for file setting
85#****************************************************************************
86my $DEF_FLIE = $ARGV[0];
87
88open DEF_FLIE, "+<$DEF_FLIE" or die "cannot open $DEF_FLIE\n";
89
90my $reading = <DEF_FLIE>;
91exit(0) unless ($reading =~ /\[.+\]\s*\w+/g);
92
93# replace all \[ with \n
94$reading =~ s/\[/\n/g;
95
96seek(DEF_FLIE,0,0);
97print DEF_FLIE $reading;
98close DEF_FLIE;
99
100# re-open & generate files
101open DEF_FLIE, "<$DEF_FLIE" or die "cannot open $DEF_FLIE\n";
102
103while (<DEF_FLIE>)
104{
105 my $FILE;
106
107 if (/(.+)\](.+\n)/)
108 {
109 $FILE = $1;
110 $FILE =~ tr/A-Z/a-z/;
111 open FILE, ">$FILE" or die "cannot open $FILE\n";
112 print FILE $2;
113 close FILE;
114 }
115}
116
117close DEF_FLIE;