VER_FUNC.TXT 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /***********************************************************************************************
  2. * Version_Number -- Determines the version number. *
  3. * *
  4. * This routine will determine the version number by analyzing the date and teim that the *
  5. * program was compiled and then generating a unique version number based on it. The *
  6. * version numbers are guaranteed to be larger for later dates. *
  7. * *
  8. * INPUT: none *
  9. * *
  10. * OUTPUT: Returns with the version number. *
  11. * *
  12. * WARNINGS: none *
  13. * *
  14. * HISTORY: *
  15. * 03/24/1995 JLB : Created. *
  16. *=============================================================================================*/
  17. int Version_Number(void)
  18. {
  19. #ifdef OBSOLETE
  20. static bool initialized = false;
  21. static int version;
  22. static char * date = __DATE__;
  23. static char * time = __TIME__;
  24. static char const * months = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
  25. if (!initialized) {
  26. char * ptr;
  27. char * tok;
  28. /*
  29. ** Fetch the month and place in the first two digit positions.
  30. */
  31. strupr(date);
  32. tok = strtok(date, " ");
  33. ptr = strstr(months, tok);
  34. if (ptr) {
  35. version = (((ptr - months) / 3)+1) * 10000;
  36. }
  37. /*
  38. ** Fetch the date and place that in the next two digit positions.
  39. */
  40. tok = strtok(NULL, " ");
  41. if (tok) {
  42. version += atoi(tok) * 100;
  43. }
  44. /*
  45. ** Fetch the time and place that in the last two digit positions.
  46. */
  47. tok = strtok(time, ": ");
  48. if (tok) {
  49. version += atoi(tok);
  50. }
  51. /*
  52. ** Fetch the virgin text file (if present).
  53. */
  54. RawFileClass file("VERSION.TXT");
  55. if (file.Is_Available()) {
  56. file.Read(VersionText, sizeof(VersionText));
  57. VersionText[sizeof(VersionText)-1] = '\0';
  58. while (VersionText[sizeof(VersionText)-1] == '\r') {
  59. VersionText[sizeof(VersionText)-1] = '\0';
  60. }
  61. } else {
  62. VersionText[0] = '\0';
  63. }
  64. initialized = true;
  65. }
  66. return(version);
  67. #endif
  68. #ifdef PATCH
  69. #ifdef DEMO
  70. sprintf(VersionText, " 1.1a"); // Demo version.
  71. #else
  72. strcpy(VersionText, ".19a ");
  73. // strcpy(VersionText, ".34 ");
  74. #endif
  75. return(1);
  76. #else
  77. #ifdef DEMO
  78. sprintf(VersionText, " 1.0a"); // Demo version.
  79. #else
  80. // sprintf(VersionText, ".%02dp", 13); // Patch version.
  81. sprintf(VersionText, ".%02d", 14); // Master version.
  82. #endif
  83. return(1);
  84. #endif
  85. }