Advertisement
Y_Less

stripped utils

Jul 19th, 2012
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.43 KB | None | 0 0
  1. /*----------------------------------------------------------------------------*\
  2.                     =================================
  3.                     Y Sever Includes - Misc Functions
  4.                     =================================
  5. Description:
  6.     Misc functions used throughout.
  7. Legal:
  8.     Version: MPL 1.1
  9.    
  10.     The contents of this file are subject to the Mozilla Public License Version
  11.     1.1 (the "License"); you may not use this file except in compliance with
  12.     the License. You may obtain a copy of the License at
  13.     http://www.mozilla.org/MPL/
  14.    
  15.     Software distributed under the License is distributed on an "AS IS" basis,
  16.     WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  17.     for the specific language governing rights and limitations under the
  18.     License.
  19.    
  20.     The Original Code is the YSI utils include.
  21.    
  22.     The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  23.     Portions created by the Initial Developer are Copyright (C) 2011
  24.     the Initial Developer. All Rights Reserved.
  25.    
  26.     Contributors:
  27.         ZeeX, koolk, JoeBullet/Google63, g_aSlice/Slice
  28.    
  29.     Thanks:
  30.         JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  31.         ZeeX - Very productive conversations.
  32.         koolk - IsPlayerinAreaEx code.
  33.         TheAlpha - Danish translation.
  34.         breadfish - German translation.
  35.         Fireburn - Dutch translation.
  36.         yom - French translation.
  37.         50p - Polish translation.
  38.         Zamaroht - Spanish translation.
  39.         Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes
  40.             for me to strive to better.
  41.         Pixels^ - Running XScripters where the idea was born.
  42.         Matite - Pestering me to release it and using it.
  43.    
  44.     Very special thanks to:
  45.         Thiadmer - PAWN, whose limits continue to amaze me!
  46.         Kye/Kalcor - SA:MP.
  47.         SA:MP Team past, present and future - SA:MP.
  48.    
  49. Version:
  50.     0.1.3
  51. Changelog:
  52.     22/12/11:
  53.         Changed "ceildiv" to only evaluate arguments once.
  54.     05/12/11:
  55.         Added NO_VALUE to test if macros have no value.
  56.     08/09/10:
  57.         Added strcpy and StripNL.
  58.     08/08/10:
  59.         Scrapped almost everything.  Only VERY usefult things go in now.
  60. Functions:
  61.     Stock:
  62.         StripNL - Strips the newline characters from the end of a string.
  63.     Inline:
  64.         iseven - Checks if a number is even.
  65.         isodd - Checks if a number is odd.
  66.         isnull - Checks if a string is NULL ("\1\0").
  67.         strcpy - Copy one string to another.
  68. Variables:
  69.     Global:
  70.         TRUE - True hack for infinate loops.
  71.         FALSE - False hack for one-time loops.
  72.         NULL - 1 long string for passing via Call(Remote|Local)Function.
  73. \*----------------------------------------------------------------------------*/
  74.  
  75. #include "internal\y_version"
  76.  
  77. #include "y_debug"
  78. #include "y_amx"
  79. //#tryinclude <sscanf>
  80.  
  81. /*// "File,Float," must remain last always.
  82. #if defined CUSTOM_TAG_TYPES
  83.     #define File,Float, Float,File,CUSTOM_TAG_TYPES
  84. #else
  85.     #define File,Float, Float,File
  86. #endif*/
  87. // Add new tags to the START of this list.
  88. #include "internal\y_globaltags"
  89.  
  90. // VERY VERY VERY IMPORTANT!!! y_inline uses "130" instead of "YSI_MAX_STRING"
  91. // for two lines (one is "520" for "130 * 4").
  92. #define YSI_MAX_STRING                  (130)
  93.  
  94. #define FUNCTION_LENGTH                 (32)
  95.  
  96. #define NO_VALUE(%0) ((2*%0-1+1)==-1)
  97. #if !defined NULL
  98. new stock
  99.     NULL[2] = {1, 0};
  100. #endif
  101.  
  102. // Define "volatile" as nothing.
  103. #if !defined volatile
  104.     #define volatile
  105. #endif
  106.  
  107. #define YSIM_MASTER #M
  108.  
  109. #define YSIM_RETURN #R
  110.  
  111. #define YSIM_CALLER #C
  112.  
  113.  
  114. //#pragma unused TRUE, FALSE, NULL
  115.  
  116. #define ceildiv(%0,%1) \
  117.     (((%0)-1)/(%1)+1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement