ddimension.inc
Original include source with line numbers.
| 1 | /* |
| 2 | |
| 3 | dDimension ( Definition Dimension ) |
| 4 | Version 1.1 |
| 5 | |
| 6 | Copyright © 2010 SnoW |
| 7 | |
| 8 | This program is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 2 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program. If not, see http://www.gnu.org/licenses/. |
| 20 | |
| 21 | */ |
| 22 | |
| 23 | #if defined _ddimension_included |
| 24 | #endinput |
| 25 | #endif |
| 26 | |
| 27 | #define _ddimension_included |
| 28 | |
| 29 | #pragma tabsize 0 |
| 30 | |
| 31 | stock dGetArrayDimension( ArrayIndex[ ], any: ... ) |
| 32 | { |
| 33 | new Args = numargs( ), Arg = 1, DimensionValue; |
| 34 | |
| 35 | DimensionValue += getarg( Arg++ ); |
| 36 | |
| 37 | while( Arg < Args ) |
| 38 | { |
| 39 | DimensionValue *= ArrayIndex[ Arg + 1 ]; |
| 40 | DimensionValue += getarg( Arg++ ); |
| 41 | } |
| 42 | |
| 43 | return DimensionValue; |
| 44 | } |
| 45 | |
| 46 | #define c{%1:%2[%3][%4][%5]%6} enum{ %6 }; %1: %2[ %3 ][ %4 ][ _:( %5 ) ], %2@[ ] = { _:( %3 ), _:( %4 ), _: ( %5 ) } |
| 47 | #define enum{[%1]%2};%3[%4][%5][%6],%7[]={%8} enum{%2};%3[%4][%5][%6*_:(%1)],%7[]={%8,_:(%1)} |
| 48 | |
| 49 | #define d{%1[%2][%3][%4]%5} %1[ %2 ][ %3 ][ dGetArrayDimension( %1@ [%4]%5 ) ] |
| 50 | #define dGetArrayDimension(%1[%2]%3) dGetArrayDimension( %1, %2 %3 ) |
| 51 | |
| 52 | #define p{%1} %1, %1@ |
| 53 | #define g{%1} %1[ ][ ][ ], %1@[ ] |