home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 May / Chip_2003-05_cd1.bin / servis / rkedit / rkEdit.exe / Develop / xml.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-30  |  2.6 KB  |  97 lines

  1. //---------------------------------------------------------------------------
  2. //
  3. // This source code of DLL can be compiled by Borland C++ Compiler 5.5 for Win32
  4. //
  5. // Mentioned compiler is free and downloadable from
  6. //                        http://www.borland.com/bcppbuilder/freecompiler/
  7. //
  8. // If it is installed e.g. in C:\CPP55, for compiling do this steps:
  9. //  * in PATH enviroment variable must by path to the C:\CPP55\BIN directory
  10. //  * own compiling do with this statement:
  11. //      bcc32.exe -tWD -ps -IC:\CPP55\Include -LC:\CPP55\Lib xml.cpp
  12. //
  13. //      -tWD means destination platform is Windows DLL
  14. //      -ps  means stdcall calling convention (and no '_' before function name)
  15. //
  16. //
  17. // File created and edited in rkEdit
  18. //
  19. //   (c) 1991, 2001 Slßvek Rydval, slavek@rydval.cz
  20. //                             http://www.rydval.cz
  21. //                             http://www.rydval.cz/rkEdit
  22. //
  23. // This is example how to create own dll for rkEdit compiler log parser.
  24. // For more details see documentation.
  25. //
  26.  
  27. #include <windows.h>
  28. #include <string.h>
  29. #include <stdlib.h>
  30. #include "LOGANALYZATORSTYPES.H"
  31.  
  32.  
  33. //-------------------------------------------------------------GetCapability---
  34. // This function returns capability of XML.DLL
  35. //
  36. extern "C" __declspec(dllexport) TrkEditCapability GetCapability()
  37. {
  38.   TrkEditCapability pom;
  39.   pom.Version = "rkEdit DLLs 1.0.0.1";
  40.   pom.SupportedFunctionType = spPChar;
  41.   return pom;
  42. } //GetCapability
  43.  
  44.  
  45. //---------------------------------------------------------GetXYOfFirstError---
  46. //
  47. //
  48. #define MaxNum 10
  49.  
  50. extern "C" __declspec(dllexport) int GetXYOfFirstError (const char *Text,
  51.                                int *ErrX, int *ErrY, int *LogX, int *LogY)
  52. {
  53.   char Number [MaxNum];
  54.   int Row = 0;
  55.  
  56.   *ErrX = *ErrY = *LogX = *LogY = -1;
  57.   for (int i = 0; Text [i] != '\0'; i++)
  58.   {
  59.     if (Text [i] == '\r' && Text [i+1] == '\n')
  60.     {
  61.       Number [MaxNum-1] = '\0';
  62.       int j = MaxNum-2;
  63.       int k = i-1;
  64.  
  65.       for (; k>=0; j--, k--)
  66.       {
  67.         if (Text [k] >= '0' && Text [k] <= '9')
  68.           Number [j] = Text [k];
  69.         else
  70.           break;
  71.  
  72.         if (j == 0) break;
  73.       }
  74.       for (; j >= 0; j--) Number [j] = ' ';
  75.  
  76.       if (Row == 0)
  77.         *ErrY = atoi (Number);
  78.       else if (Row == 1)
  79.         *ErrX = atoi (Number);
  80.       else break;
  81.       Row++;
  82.     } //if
  83.   }//for
  84.   return 0;
  85. } //GetXYOfFirstError
  86.  
  87. //---------------------------------------------------------------------------
  88.  
  89. #pragma argsused
  90.  
  91. int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
  92. {
  93.   return 1;
  94. }
  95. //---------------------------------------------------------------------------
  96.  
  97.