sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32test\math\t_gen32.cpp sl@0: // Generates files to be used in testing whether arithmetic in TReal32 gives sl@0: // exactly the same results using the MSDEV complier as on the rack. sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "t_math.h" sl@0: #include "../server/t_server.h" sl@0: sl@0: #if defined(__VC32__) sl@0: // sl@0: // Some symbols generated by the VC++ compiler for floating point stuff. sl@0: // sl@0: extern "C" { sl@0: GLDEF_D TInt _adj_fdiv_m32; sl@0: } sl@0: #endif sl@0: sl@0: GLDEF_D RTest test(_L("T_GEN32")); sl@0: sl@0: LOCAL_D RFile f; sl@0: LOCAL_D const TFileName fileName32 = _L("T_REAL32.H"); sl@0: sl@0: LOCAL_D const TFileName pathName = _L("C:\\E32-MATH\\"); sl@0: LOCAL_D TBuf<0x100> buf; sl@0: LOCAL_D TBuf8<0x100> buf8; sl@0: sl@0: // Data for tests from T_R32DTA.cpp sl@0: GLREF_D TReal32 addInput[]; sl@0: GLREF_D TReal32 subInput[]; sl@0: GLREF_D TReal32 multInput[]; sl@0: GLREF_D TReal32 divInput[]; sl@0: //GLREF_D TApprox32 subApprox[]; sl@0: GLREF_D TReal32 unaryInput[]; sl@0: GLREF_D TReal32 incDecInput[]; sl@0: GLREF_D TInt sizeAdd; sl@0: GLREF_D TInt sizeSub; sl@0: GLREF_D TInt sizeMult; sl@0: GLREF_D TInt sizeDiv; sl@0: //GLREF_D TInt sizeSubApprox; sl@0: GLREF_D TInt sizeUnary; sl@0: GLREF_D TInt sizeIncDec; sl@0: sl@0: LOCAL_C void appendStart() sl@0: { sl@0: f.Write(_L8("// Generated by \\E32\\TMATH\\T_GEN32.MAK\n\n")); sl@0: f.Write(_L8("#include \n\n")); sl@0: f.Write(_L8("#if defined(__WINS__)\n#include \"t_vals.hwg\"\n")); sl@0: f.Write(_L8("#else\n#include \"t_vals.hag\"\n#endif\n")); sl@0: } sl@0: sl@0: LOCAL_C void appendArrayName32(TPtrC aName) sl@0: { sl@0: buf=_L(""); sl@0: buf.AppendFormat(_L("const TInt32x %S[] = \n{\n"),&aName); sl@0: buf8.Copy(buf); sl@0: f.Write(buf8); sl@0: } sl@0: sl@0: LOCAL_C void appendValue32(TReal32* aVal) sl@0: { sl@0: buf=_L(""); sl@0: buf.AppendFormat(_L(" TInt32x(0x%x),\n"),*(TUint32*)aVal); sl@0: buf8.Copy(buf); sl@0: f.Write(buf8); sl@0: } sl@0: sl@0: LOCAL_C void appendArrayTerm() sl@0: { sl@0: buf8=_L8("};\n\n"); sl@0: f.Write(buf8); sl@0: } sl@0: sl@0: LOCAL_C void createAddArray() sl@0: // sl@0: // Writes an array of results of additions to the header file sl@0: // sl@0: { sl@0: TInt ii; sl@0: TReal32 ff; sl@0: sl@0: appendArrayName32(_L("addArray")); sl@0: for (ii=0; ii