Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
3.2 KiB

  1. sub PrintArgs
  2. {
  3. local $m = shift;
  4. if ( $m > 0 ) { for $k ( 1 .. $m )
  5. {
  6. print ", " if ( $k > 1 );
  7. print "ArgType$k, ArgName$k";
  8. } }
  9. }
  10. sub PrintArgsC
  11. {
  12. local $m = shift;
  13. if ( $m > 0 ) { for $k ( 1 .. $m )
  14. {
  15. print "ArgType$k ArgName$k, ";
  16. } }
  17. }
  18. sub PrintArgsA
  19. {
  20. local $m = shift;
  21. if ( $m > 0 ) { for $k ( 1 .. $m )
  22. {
  23. print ", m_##ArgName$k( ArgName$k )";
  24. } }
  25. }
  26. sub PrintArgsP
  27. {
  28. local $m = shift;
  29. if ( $m > 0 ) { for $k ( 1 .. $m )
  30. {
  31. print "m_##ArgName$k, ";
  32. } }
  33. }
  34. sub PrintArgsI
  35. {
  36. local $m = shift;
  37. if ( $m > 0 ) { for $k ( 1 .. $m )
  38. {
  39. print "ArgName$k, ";
  40. } }
  41. }
  42. sub PrintArgsM
  43. {
  44. local $m = shift;
  45. if ( $m > 0 ) { for $k ( 1 .. $m )
  46. {
  47. print "ArgType$k m_##ArgName$k;";
  48. } }
  49. }
  50. for $n ( 0 .. 9 )
  51. {
  52. print "#define HELPER_OVERLAPPED_SESSION_CALL_C_$n( ";
  53. PrintArgs( $n );
  54. print " ) ";
  55. PrintArgsC( $n );
  56. print "\n";
  57. print "#define HELPER_OVERLAPPED_SESSION_CALL_A_$n( ";
  58. PrintArgs( $n );
  59. print " ) ";
  60. PrintArgsA( $n );
  61. print "\n";
  62. print "#define HELPER_OVERLAPPED_SESSION_CALL_P_$n( ";
  63. PrintArgs( $n );
  64. print " ) ";
  65. PrintArgsP( $n );
  66. print "\n";
  67. print "#define HELPER_OVERLAPPED_SESSION_CALL_I_$n( ";
  68. PrintArgs( $n );
  69. print " ) ";
  70. PrintArgsI( $n );
  71. print "\n";
  72. print "#define HELPER_OVERLAPPED_SESSION_CALL_M_$n( ";
  73. PrintArgs( $n );
  74. print " ) ";
  75. PrintArgsM( $n );
  76. print "\n";
  77. print "\n";
  78. print "#define DECLARE_OVERLAPPED_SESSION_CALL_$n( XCallNameFN_T";
  79. print ", " if ( $n > 0 );
  80. PrintArgs( $n );
  81. print " ) \\\n";
  82. print "struct XCallNameFN_T##_OverlappedCall_t : public XSessionCallStack::OverlappedSessionCall { \\\n";
  83. print " XCallNameFN_T##_OverlappedCall_t( HANDLE hSession, \\\n";
  84. print " HELPER_OVERLAPPED_SESSION_CALL_C_$n( ";
  85. PrintArgs( $n );
  86. print " ) \\\n";
  87. print " PXOVERLAPPED pxOverlapped ) : \\\n";
  88. print " XSessionCallStack::OverlappedSessionCall( hSession, pxOverlapped ) \\\n";
  89. print " HELPER_OVERLAPPED_SESSION_CALL_A_$n( ";
  90. PrintArgs( $n );
  91. print " ) {} \\\n";
  92. print " virtual char const * Name() { return #XCallNameFN_T; } \\\n";
  93. print " virtual DWORD Run() { \\\n";
  94. print " DWORD ret = ::XCallNameFN_T( m_hSession, \\\n";
  95. print " HELPER_OVERLAPPED_SESSION_CALL_P_$n( ";
  96. PrintArgs( $n );
  97. print " ) \\\n";
  98. print " m_pxOverlapped ? &m_xOverlapped : NULL ); \\\n";
  99. print " if ( ret != ERROR_SUCCESS && ret != ERROR_IO_PENDING ) { Warning( \"XCall \" #XCallNameFN_T \" failed ( ret = %d, overlapped = %p )!\\n\", ret, m_pxOverlapped ); Assert( 0 ); } \\\n";
  100. print " return ret; } \\\n";
  101. print " HELPER_OVERLAPPED_SESSION_CALL_M_$n( ";
  102. PrintArgs( $n );
  103. print " ) \\\n";
  104. print "};\n\n";
  105. print "#define IMPLEMENT_OVERLAPPED_SESSION_CALL_$n( XCallNameFN_T";
  106. print ", " if ( $n > 0 );
  107. PrintArgs( $n );
  108. print " ) \\\n";
  109. print "DECLARE_OVERLAPPED_SESSION_CALL_$n( XCallNameFN_T";
  110. print ", " if ( $n > 0 );
  111. PrintArgs( $n );
  112. print " ) \\\n";
  113. print "virtual DWORD XCallNameFN_T( HANDLE hSession, \\\n";
  114. print " HELPER_OVERLAPPED_SESSION_CALL_C_$n( ";
  115. PrintArgs( $n );
  116. print " ) \\\n";
  117. print " PXOVERLAPPED pxOverlapped ) { \\\n";
  118. print " return g_XSessionCallStack.ScheduleOverlappedSessionCall( new XCallNameFN_T##_OverlappedCall_t( hSession, \\\n";
  119. print " HELPER_OVERLAPPED_SESSION_CALL_I_$n( ";
  120. PrintArgs( $n );
  121. print " ) \\\n";
  122. print " pxOverlapped ) ); \\\n";
  123. print "};\n\n";
  124. print "\n\n";
  125. }