Version-Management.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <html lang="en">
  2. <head>
  3. <title>Version Management - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="Library-Reference.html#Library-Reference" title="Library Reference">
  9. <link rel="prev" href="Invocation.html#Invocation" title="Invocation">
  10. <link rel="next" href="Error-Reporting.html#Error-Reporting" title="Error Reporting">
  11. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  12. <meta http-equiv="Content-Style-Type" content="text/css">
  13. <style type="text/css"><!--
  14. pre.display { font-family:inherit }
  15. pre.format { font-family:inherit }
  16. pre.smalldisplay { font-family:inherit; font-size:smaller }
  17. pre.smallformat { font-family:inherit; font-size:smaller }
  18. pre.smallexample { font-size:smaller }
  19. pre.smalllisp { font-size:smaller }
  20. span.sc { font-variant:small-caps }
  21. span.roman { font-family:serif; font-weight:normal; }
  22. span.sansserif { font-family:sans-serif; font-weight:normal; }
  23. --></style>
  24. </head>
  25. <body>
  26. <div class="node">
  27. <a name="Version-Management"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="Error-Reporting.html#Error-Reporting">Error Reporting</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="Invocation.html#Invocation">Invocation</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="Library-Reference.html#Library-Reference">Library Reference</a>
  32. <hr>
  33. </div>
  34. <h3 class="section">3.5 Version Management</h3>
  35. <p>The <code>avram</code> library is designed to support any number of backward
  36. <a name="index-versions-602"></a>compatibility modes with itself, by way of some functions declared in
  37. <samp><span class="file">vman.h</span></samp>. The assumption is that the library will go through a
  38. sequence of revisions during its life, each being identified by a unique
  39. number. In the event of a fork in the project, each branch will
  40. attempt to maintain compatibility at least with its own ancestors.
  41. <div class="defun">
  42. &mdash; Function: void <b>avm_set_version</b> (<var>char *number</var>)<var><a name="index-avm_005fset_005fversion-603"></a></var><br>
  43. <blockquote><p>This function can be used to delay the demise of a client program that
  44. uses the library but is not updated very often. The argument is a null
  45. terminated string representing a version number, such as <code>"0.13.0"</code>.
  46. <p>A call to this function requests that all library functions revert to
  47. their behavior as of that version in any cases where the current
  48. behavior is incompatible with it. It will also cause virtual code
  49. applications evaluated with <code>avm_apply</code> to detect a version number
  50. equal to the given one rather than the current one. (See <a href="Version.html#Version">Version</a>.)
  51. <p>The program will exit with an internal error message if any function in
  52. the library has already interrogated the version number before this
  53. function is called, or if it is passed a null pointer. This problem can
  54. be avoided by calling it prior to any of the <code>avm_initialize</code>
  55. functions with a valid address. The program will exit with the message
  56. <pre class="display"> <var>program-name</var><code>: multiple version specifications</code>
  57. </pre>
  58. <p>if this function is called more than once, even with the same number.
  59. If the number is not recognized as a present or past version, or is so
  60. old that it is no longer supported, the program will exit with this
  61. message.
  62. <pre class="display"> <code>avram: can't emulate version </code><var>number</var>
  63. </pre>
  64. <p>Client programs that are built to last should allow the version number
  65. to be specified as an option by the user, and let virtual code
  66. applications that they execute take care of their own backward
  67. compatibility problems. This strategy will at least guard against
  68. changes in the virtual machine specification and other changes that do
  69. not affect the library API.
  70. </p></blockquote></div>
  71. <div class="defun">
  72. &mdash; Function: int <b>avm_prior_to_version</b> (<var>char *number</var>)<var><a name="index-avm_005fprior_005fto_005fversion-604"></a></var><br>
  73. <blockquote><p>This function takes the address of a null terminated string representing
  74. a version number as an argument, such as <code>"0.13.0"</code>, and returns a
  75. non-zero value if the version currently being emulated predates it.
  76. <p>If no call has been made to <code>avm_set_version</code> prior to the call to
  77. this function, the current version is assumed, and subsequent calls to
  78. <code>avm_set_version</code> will cause an internal error.
  79. <p>The intended use for this function would be by a maintainer of the
  80. library introducing an enhancement that will not be backward compatible,
  81. who doesn't wish to break existing client programs and virtual code
  82. applications. For example, if a version <code>1.0</code> is developed at some
  83. time in the distant future, and it incorporates a previously unexpected
  84. way of doing something, code similar to the following could be used to
  85. maintain backward compatibility.
  86. <pre class="example"> if (avm_prior_to_version("1.0"))
  87. {
  88. /* do it the 0.x way */
  89. }
  90. else
  91. {
  92. /* do it the 1.0-and-later way */
  93. }
  94. </pre>
  95. <p class="noindent">This function will cause an internal error if the parameter does not
  96. match any known past or present version number, or if it is a null pointer.
  97. </p></blockquote></div>
  98. <div class="defun">
  99. &mdash; Function: char* <b>avm_version</b> ()<var><a name="index-avm_005fversion-605"></a></var><br>
  100. <blockquote><p>This function returns the number of the version currently being emulated
  101. as the address of a null terminated string. The string whose address is
  102. returned should not be modified by the caller.
  103. <p>If no call has been made to <code>avm_set_version</code> prior to the call to
  104. this function, the current version is assumed, and subsequent calls to
  105. <code>avm_set_version</code> will cause an internal error.
  106. </p></blockquote></div>
  107. </body></html>