deprecated/wveconv/wveconv.cpp
author Zheng Shen <zheng.shen@nokia.com>
Tue, 26 Oct 2010 11:12:31 +0800
changeset 654 7c11c3d8d025
parent 600 6d08f4a05d93
permissions -rw-r--r--
romtools 13.2.0.1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
600
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     2
// All rights reserved.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     3
// This component and the accompanying materials are made available
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     5
// which accompanies this distribution, and is available
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     7
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     8
// Initial Contributors:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    10
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    11
// Contributors:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    12
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    13
// Description:
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    14
// Psion3a WVE to Series5 sound file convertor
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    15
// 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    16
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    17
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    18
#if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    19
#include <iostream>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    20
#include <fstream>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    21
using namespace std;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    22
#else  //!__MSVCDOTNET__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    23
#include <iostream.h>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    24
#include <fstream.h>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    25
#ifdef __CW32__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    26
using std::streampos;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    27
#endif //__CW32__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    28
#endif //__MSVCDOTNET__
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    29
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    30
#include <string.h>
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    31
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    32
#if defined(__VC32__) && !defined(__MSVCDOTNET__)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    33
#pragma warning( disable : 4710 )	// 'fn': function not inlined
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    34
#endif // old MSVC
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    35
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    36
#define KUidRecordApp 0x1000007e
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    37
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    38
#define KUid1 0x10000037
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    39
#define KUid2 0x1000006d
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    40
#define KUid3 KUidRecordApp
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    41
#define KUidCheckSum 0x5508accf
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    42
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    43
#define KUidAppStream 0x10000089
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    44
#define KUidSampleStream 0x10000052
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    45
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    46
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    47
int ErrorNotWveFile()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    48
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    49
	cout << "The specified input file is not a Series 3a WVE file" << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    50
	return(0);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    51
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    52
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    53
int ErrorNotFound()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    54
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    55
	cout << "Unable to open input file" << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    56
	return(0);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    57
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    58
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    59
int ReadInt32(ifstream& inStream)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    60
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    61
    char ch[4];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    62
    inStream.read(&ch[0],4);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    63
    return *(int*)&ch[0];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    64
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    65
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    66
int ReadInt16(ifstream& inStream)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    67
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    68
    char ch[4];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    69
    inStream.read(&ch[0],2);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    70
    ch[2]=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    71
    ch[3]=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    72
    return *(int*)&ch[0];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    73
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    74
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    75
int WriteWord(ofstream& outStream,unsigned int aWord)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    76
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    77
    outStream.write((char*)&aWord,4);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    78
	return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    79
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    80
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    81
int WriteByte(ofstream& outStream,const char aByte)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    82
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    83
    outStream.write((char*)&aByte,1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    84
	return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    85
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    86
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    87
int WriteText(ofstream& outStream,const char* aText)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    88
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    89
	char ch;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    90
	while((ch=*aText++)!=0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    91
		outStream << ch;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    92
	return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    93
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    94
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    95
void ShowHelp()
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    96
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    97
	cout << "WveConv 0.04";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    98
	cout << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
    99
	cout << "Converts a Psion 3a WVE file to an EPOC sound file" << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   100
	cout << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   101
	cout << "Usage: WVECONV S3AFILE.WVE [EPOCFILE]" << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   102
	cout << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   103
	cout << "If [EPOCFILE] is omitted, the input filename" << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   104
    cout << "without the extension will be used" << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   105
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   106
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   107
int ConvertFile(const char* inputFile,const char* outputFile)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   108
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   109
	ifstream inStream(inputFile,ios::in|ios::binary);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   110
	ofstream outStream(outputFile,ios::out|ios::binary);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   111
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   112
	if(!inStream.is_open())
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   113
		return(ErrorNotFound());
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   114
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   115
	const char* appName="Record.app";
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   116
	char header[16];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   117
	
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   118
	inStream.read(&header[0],16);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   119
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   120
	if(strcmp(header,"ALawSoundFile**")!=0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   121
		return(ErrorNotWveFile());
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   122
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   123
	int compressedLength=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   124
	int trailingSilence=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   125
	int compressorUid=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   126
	int sampleLength=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   127
	int repeatCount=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   128
    int versionNumber=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   129
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   130
// extract the sample length, repeat count and trailing silence...
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   131
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   132
	versionNumber=ReadInt16(inStream);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   133
	sampleLength=ReadInt32(inStream);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   134
	trailingSilence=ReadInt16(inStream);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   135
	repeatCount=ReadInt16(inStream);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   136
    if(repeatCount==0) // 0 and 1 are the same on Series 3 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   137
        repeatCount=1; 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   138
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   139
	trailingSilence*=31250;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   140
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   141
	compressedLength=sampleLength;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   142
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   143
	cout << "Converting " << inputFile << " to " << outputFile << endl << endl;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   144
    cout << "Version number  :" << versionNumber << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   145
	cout << "Sample length   :" << sampleLength << " bytes" << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   146
	cout << "Repeat count    :" << repeatCount << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   147
	cout << "Trailing silence:" << trailingSilence << " uS" << endl ;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   148
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   149
	inStream.seekg((streampos)0x20);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   150
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   151
// Write out the header...
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   152
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   153
	unsigned int rootstreamid=0x14;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   154
	unsigned int appstreamid=0x25;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   155
	unsigned int samplestreamid=0x34;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   156
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   157
// checked uid header
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   158
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   159
	WriteWord(outStream,KUid1);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   160
	WriteWord(outStream,KUid2);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   161
	WriteWord(outStream,KUidRecordApp);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   162
	WriteWord(outStream,KUidCheckSum);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   163
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   164
// root stream id
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   165
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   166
	WriteWord(outStream,rootstreamid);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   167
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   168
//stream dictionary @ 0x14 root stream
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   169
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   170
	WriteByte(outStream,4);		// two entries in dictionary
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   171
	WriteWord(outStream,KUidSampleStream);	// sample stream
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   172
	WriteWord(outStream,samplestreamid);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   173
	WriteWord(outStream,KUidAppStream);	// appid stream
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   174
	WriteWord(outStream,appstreamid);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   175
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   176
// record app identifier stream @ 0x25
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   177
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   178
	WriteWord(outStream,KUidRecordApp);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   179
	WriteByte(outStream,42);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   180
	WriteText(outStream,appName);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   181
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   182
//  sample header @ 0x34
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   183
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   184
	WriteWord(outStream,sampleLength);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   185
	WriteWord(outStream,compressorUid);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   186
	WriteWord(outStream,repeatCount-1); // repeats are zero based on Series 5 
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   187
	WriteWord(outStream,trailingSilence);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   188
	WriteWord(outStream,compressedLength);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   189
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   190
// Copy the sample data...
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   191
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   192
	streampos newPos=0x20; // start of sample data in 3a file...
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   193
	inStream.seekg(newPos);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   194
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   195
	char buffer[256];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   196
	int count;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   197
	int actualLength=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   198
	do
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   199
		{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   200
		inStream.read(&buffer[0],256);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   201
		if((count=inStream.gcount())!=0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   202
			{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   203
			outStream.write(&buffer[0],count);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   204
			actualLength+=count;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   205
			}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   206
		} while(count);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   207
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   208
// should check actualLength==sampleLength...but what the heck
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   209
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   210
	outStream.close();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   211
	inStream.close();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   212
	return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   213
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   214
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   215
int main(int aNumArgs,char* aArgs[])
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   216
	{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   217
	if(aNumArgs<=1 || aArgs[1][0]=='?' || aArgs[1][0]=='/')
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   218
		{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   219
		ShowHelp();
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   220
		return 0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   221
		}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   222
	char inputFile[255];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   223
	char outputFile[255];
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   224
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   225
	strcpy(inputFile,aArgs[1]);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   226
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   227
	if(aNumArgs==3)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   228
		strcpy(outputFile,aArgs[2]);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   229
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   230
	if(aNumArgs==2 || outputFile[0]==0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   231
		{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   232
		strcpy(outputFile,inputFile);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   233
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   234
// remove the extension
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   235
//
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   236
		int len=strlen(outputFile);
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   237
		for(;;)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   238
			{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   239
			if(--len<0)
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   240
				break;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   241
			if(outputFile[len]=='.')
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   242
				{
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   243
				outputFile[len]=0;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   244
				break;
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   245
				}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   246
			}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   247
		}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   248
	return(ConvertFile(inputFile,outputFile));
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   249
	}
6d08f4a05d93 add deprecated files
jjkang
parents:
diff changeset
   250