|
|
So, I'm trying to work through some of the PASCAL90 source code for
tetrahedrons, and I started with the first one:
I'm assuming "R8" is a real 8-bit number, or something like that.
!! R8_SWAP swaps two R8's.
!
! Licensing:
!
! This code is distributed under the GNU LGPL license.
!
! Modified:
!
! 22 December 2000
!
! Author:
!
! John Burkardt
!
! Parameters:
!
! Input/output, real ( kind = 8 ) X, Y. On output, the values of X and
! Y have been interchanged.
!
implicit none
real ( kind = 8 ) x
real ( kind = 8 ) y
real ( kind = 8 ) z
z = x
x = y
y = z
return
end
Which in SDL translates (roughly) to:
#macro SwapXY (X, Y)
// Input/output: X, Y
// On output, the values of X and Y have been interchanged.
#local Z = X; // Z is a placeholder variable
#local X = Y;
#local Y = Z;
#end
My question is, does a mechanism exist by which the true identities of the
variable names passed to the macro can be accessed?
Such that if I do:
#macro SwapXY (OneVariable, Another)
it will actually redefine THOSE variables?
(because until the macro is instantiated, X and Y are not yet defined (in the
macro microcosm) and are throw-away temporary variable names. Using #declare
would only create new variables or redefine any existing global-level X and Y.)
I'm guessing not, and that I'd best do a tuple-style assignment and have the
macro "return" those two values on the last line...
Post a reply to this message
|
|