Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. test.c
  5. Abstract:
  6. This file contains the main entrypooint
  7. for the TIFF library test program.
  8. Environment:
  9. WIN32 User Mode
  10. Author:
  11. Wesley Witt (wesw) 17-Feb-1996
  12. --*/
  13. #include "test.h"
  14. #pragma hdrstop
  15. int _cdecl
  16. main(
  17. int argc,
  18. char *argvA[]
  19. )
  20. /*++
  21. Routine Description:
  22. Main entrypoint to test TIFF library program.
  23. Arguments:
  24. argc - Argument count
  25. argvA - Ansii argument list
  26. Return Value:
  27. None.
  28. --*/
  29. {
  30. LPTSTR *argv;
  31. DWORD i,j;
  32. DWORD CompressionType = (DWORD)-1;
  33. BOOL PrintTiff = FALSE;
  34. BOOL TiffToBmp = FALSE;
  35. BOOL PostProcess = FALSE;
  36. BOOL PreProcess = FALSE;
  37. BOOL Recover = FALSE;
  38. DWORD Total,Recovered;
  39. #ifdef UNICODE
  40. argv = CommandLineToArgvW( GetCommandLine(), &argc );
  41. #else
  42. argv = argvA;
  43. #endif
  44. HeapInitialize(NULL,NULL,NULL,0);
  45. FaxTiffInitialize();
  46. for (i=1; i<(DWORD)argc; i++) {
  47. if ((argv[i][0] == TEXT('-')) || (argv[i][0] == TEXT('/'))) {
  48. if (tolower( argv[i][1] ) == TEXT('c')) {
  49. //
  50. // specify compression method
  51. //
  52. if (argv[i][2] == TEXT(':')) {
  53. j = 3;
  54. } else {
  55. j = 2;
  56. }
  57. if (_istdigit(argv[i][j])) {
  58. if (argv[i][j] == TEXT('0')) {
  59. CompressionType = TIFF_COMPRESSION_NONE;
  60. } else if (argv[i][j] == TEXT('1')) {
  61. CompressionType = TIFF_COMPRESSION_MH;
  62. } else if (argv[i][j] == TEXT('2')) {
  63. CompressionType = TIFF_COMPRESSION_MR;
  64. }
  65. }
  66. }
  67. if (tolower( argv[i][1] ) == TEXT('p')) {
  68. PrintTiff = TRUE;
  69. }
  70. if (tolower( argv[i][1] ) == TEXT('r')) {
  71. Recover = TRUE;
  72. }
  73. if (tolower( argv[i][1] ) == TEXT('d')) {
  74. TiffToBmp = TRUE;
  75. }
  76. if (tolower( argv[i][1] ) == TEXT('z')) {
  77. PostProcess = TRUE;
  78. }
  79. if (tolower( argv[i][1] ) == TEXT('m')) {
  80. PreProcess = TRUE;
  81. }
  82. if (tolower( argv[i][1] ) == TEXT('?')) {
  83. }
  84. } else {
  85. break;
  86. }
  87. }
  88. _tprintf(L"1: %8x\n2: %8x\n", (0xFFFFFFFC) , ~(0x3));
  89. if (PostProcess) {
  90. TiffPostProcessFast( argv[i], NULL );
  91. } else if (PreProcess) {
  92. TiffPreProcess( argv[i], CompressionType );
  93. } else if (PrintTiff) {
  94. TCHAR Branding[300];
  95. _stprintf(Branding, TEXT("09/24/1996 12:03AM FROM: 12345678901234567890 TO: 12345678901234567890 ") );
  96. MmrAddBranding( argv[i], Branding, TEXT("OF"), 22);
  97. /*
  98. GetProfileString( TEXT("windows"),
  99. TEXT("device"),
  100. NULL,
  101. (LPTSTR) &Printer,
  102. 256 );
  103. TiffPrint( argv[i], Printer, &Result );
  104. */
  105. } else if (Recover) {
  106. if (argc < 2) {
  107. _tprintf( TEXT("missing arguments\n") );
  108. return -1;
  109. }
  110. Recover = TiffRecoverGoodPages( argv[i], &Recovered, &Total );
  111. _tprintf(L"TiffRecoverPages returns %s, Recovered = %d, Total = %d\n",Recover?L"TRUE":L"FALSE",Recovered,Total);
  112. } else if (TiffToBmp) {
  113. if (argc < 2) {
  114. _tprintf( TEXT("missing arguments\n") );
  115. return -1;
  116. }
  117. ConvertTiffToBmp( argv[i], argv[i+1] );
  118. } else if (CompressionType != (DWORD)-1) {
  119. if (argc < 2) {
  120. _tprintf( TEXT("missing arguments\n") );
  121. return -1;
  122. }
  123. ConvertBmpToTiff( argv[i], argv[i+1], CompressionType );
  124. }
  125. return 0;
  126. }