我有一系列的子程序調用,我需要對各種數據類型名稱進行調用。例如:Fortran宏函數的文字字符串?
print*, 'Now giving information about Matrix1'
call mysub(Matrix1, size(Matrix1,1), size(Matrix1,2))
print*, 'About to do function on Matrix1'
call dofunction(Matrix1)
print*, 'Matrix1 is a nice matrix! Huzzah!'
print*, 'Now giving information about Matrix2'
call mysub(Matrix2, size(Matrix2,1), size(Matrix2,2))
print*, 'About to do function on Matrix2'
call dofunction(Matrix2)
print*, 'Matrix2 is a nice matrix! Huzzah!'
print*, 'Now giving information about OtherMat'
call mysub(OtherMat, size(OtherMat,1), size(OtherMat,2))
print*, 'About to do function on OtherMat'
call dofunction(OtherMat)
print*, 'OtherMat is a nice matrix! Huzzah!'
,我想定義一個宏,將採取#define
值,這樣我可以換調用順序。例如,定義一個宏mymacro
,我想能夠調用簡單
mymacro(Matrix1)
mymacro(Matrix2)
mymacro(OtherMat)
來完成同樣的事情。這可能嗎?
那你試試這麼遠嗎? –
我曾嘗試google搜索如何做到這一點,並拿出什麼:) – drjrm3