You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2002/04/12 08:49:31 UTC

cvs commit: xml-xalan/c/Tests/C-API c-api.c CAPI.dsp

dbertoni    02/04/11 23:49:31

  Added:       c/Tests/C-API c-api.c CAPI.dsp
  Log:
  Initial revision.
  
  Revision  Changes    Path
  1.1                  xml-xalan/c/Tests/C-API/c-api.c
  
  Index: c-api.c
  ===================================================================
  #include <XalanTransformer/XalanCAPI.h>
  
  
  
  #include <assert.h>
  #include <stdio.h>
  
  
  
  // This is here for memory leak testing.
  #if !defined(NDEBUG) && defined(_MSC_VER)
  #include <crtdbg.h>
  #endif
  
  
  
  void
  Usage()
  {
  	fprintf(stderr, "Usage: c-api <xml file> [<xsl file>]\n");
  }
  
  
  
  CallbackSizeType
  OutputHandler(
  			const char*			data,
  			CallbackSizeType	length,
  			void*				handle)
  {
  	FILE*	theHandle = (FILE*)handle;
  
  	return fwrite(data, sizeof(char), length, theHandle);
  }
  
  
  
  void
  FlushHandler(void*	handle)
  {
  	FILE*	theHandle = (FILE*)handle;
  
  	fflush(theHandle);
  }
  
  
  
  int
  main(
  			int				argc,
  			const char*		argv[])
  {
  #if !defined(NDEBUG) && defined(_MSC_VER)
  	_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
  
  	_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  #endif
  
  	if (argc < 2 || argc > 3)
  	{
  		Usage();
  	}
  	else
  	{
  		int			error = 0;
  		XalanHandle	xalan = NULL;
  
  		XalanInitialize();
  
  		xalan = CreateXalanTransformer();
  
  		if (xalan == 0)
  		{
  			fprintf(stderr, "Unable to create transformer...\n");
  		}
  		else if (argc == 2)
  		{
  			error = XalanTransformToHandler(argv[1], NULL, xalan, stdout, OutputHandler, FlushHandler);
  		}
  		else
  		{
  			error = XalanTransformToHandler(argv[1], argv[2], xalan, stdout, OutputHandler, FlushHandler);
  		}
  
  		if (error != 0)
  		{
  			fprintf(
  				stderr,
  				"Error transforming.  The error code is %d.  The message is %s.\n",
  				error,
  				XalanGetLastError(xalan));
  		}
  
  		XalanTerminate();
  	}
  
  	return 0;
  }
  
  
  
  1.1                  xml-xalan/c/Tests/C-API/CAPI.dsp
  
  Index: CAPI.dsp
  ===================================================================
  # Microsoft Developer Studio Project File - Name="CAPI" - Package Owner=<4>
  # Microsoft Developer Studio Generated Build File, Format Version 6.00
  # ** DO NOT EDIT **
  
  # TARGTYPE "Win32 (x86) Console Application" 0x0103
  
  CFG=CAPI - Win32 Debug
  !MESSAGE This is not a valid makefile. To build this project using NMAKE,
  !MESSAGE use the Export Makefile command and run
  !MESSAGE 
  !MESSAGE NMAKE /f "CAPI.mak".
  !MESSAGE 
  !MESSAGE You can specify a configuration when running NMAKE
  !MESSAGE by defining the macro CFG on the command line. For example:
  !MESSAGE 
  !MESSAGE NMAKE /f "CAPI.mak" CFG="CAPI - Win32 Debug"
  !MESSAGE 
  !MESSAGE Possible choices for configuration are:
  !MESSAGE 
  !MESSAGE "CAPI - Win32 Release" (based on "Win32 (x86) Console Application")
  !MESSAGE "CAPI - Win32 Debug" (based on "Win32 (x86) Console Application")
  !MESSAGE 
  
  # Begin Project
  # PROP AllowPerConfigDependencies 0
  # PROP Scc_ProjName ""
  # PROP Scc_LocalPath ""
  CPP=xicl6.exe
  RSC=rc.exe
  
  !IF  "$(CFG)" == "CAPI - Win32 Release"
  
  # PROP BASE Use_MFC 0
  # PROP BASE Use_Debug_Libraries 0
  # PROP BASE Output_Dir "Release"
  # PROP BASE Intermediate_Dir "Release"
  # PROP BASE Target_Dir ""
  # PROP Use_MFC 0
  # PROP Use_Debug_Libraries 0
  # PROP Output_Dir "..\..\Build\Win32\VC6\Release"
  # PROP Intermediate_Dir "..\..\Build\Win32\VC6\Release\CAPI"
  # PROP Ignore_Export_Lib 0
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
  # ADD CPP /nologo /MD /W4 /GR /GX /O2 /Ob2 /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
  # SUBTRACT CPP /YX
  # ADD BASE RSC /l 0x409 /d "NDEBUG"
  # ADD RSC /l 0x409 /d "NDEBUG"
  BSC32=bscmake.exe
  # ADD BASE BSC32 /nologo
  # ADD BSC32 /nologo
  LINK32=xilink6.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
  # ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"..\..\Build\Win32\VC6\Release/c-api.exe"
  
  !ELSEIF  "$(CFG)" == "CAPI - Win32 Debug"
  
  # PROP BASE Use_MFC 0
  # PROP BASE Use_Debug_Libraries 1
  # PROP BASE Output_Dir "Debug"
  # PROP BASE Intermediate_Dir "Debug"
  # PROP BASE Target_Dir ""
  # PROP Use_MFC 0
  # PROP Use_Debug_Libraries 1
  # PROP Output_Dir "..\..\Build\Win32\VC6\Debug"
  # PROP Intermediate_Dir "..\..\Build\Win32\VC6\Debug\CAPI"
  # PROP Ignore_Export_Lib 0
  # PROP Target_Dir ""
  # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
  # ADD CPP /nologo /MDd /W4 /Gm /GR /GX /Zi /Od /I "..\..\..\..\xml-xerces\c\src" /I "..\..\src\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
  # ADD BASE RSC /l 0x409 /d "_DEBUG"
  # ADD RSC /l 0x409 /d "_DEBUG"
  BSC32=bscmake.exe
  # ADD BASE BSC32 /nologo
  # ADD BSC32 /nologo
  LINK32=xilink6.exe
  # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
  # ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"..\..\Build\Win32\VC6\Debug/c-api.exe" /pdbtype:sept
  
  !ENDIF 
  
  # Begin Target
  
  # Name "CAPI - Win32 Release"
  # Name "CAPI - Win32 Debug"
  # Begin Group "Source Files"
  
  # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
  # Begin Source File
  
  SOURCE=".\c-api.c"
  # End Source File
  # End Group
  # Begin Group "Header Files"
  
  # PROP Default_Filter "h;hpp;hxx;hm;inl"
  # End Group
  # Begin Group "Resource Files"
  
  # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
  # End Group
  # End Target
  # End Project
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org