Created
September 24, 2010 20:24
-
-
Save paulbaumgart/595973 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CPVarArgHandling_Index = nil; | |
| va_start = function (args, startIndex) // startIndex instead of parameter name | |
| // isn't great, but is unavoidable since | |
| // they took out argument names in JS 1.3. | |
| // Only way to fix this would be to add it | |
| // to the Obj-J preprocessor. | |
| { | |
| if (startIndex) | |
| { | |
| if (typeof startIndex !== "number") | |
| throw new Error("Invalid var-args start index: " + startIndex); | |
| CPVarArgHandling_Index = startIndex + 2; | |
| } | |
| else | |
| CPVarArgHandling_Index = 2; | |
| }; | |
| va_arg = function (args) | |
| { | |
| var value = args[CPVarArgHandling_Index++]; | |
| return value ? value : nil; | |
| }; | |
| va_end = function(args) | |
| { | |
| CPVarArgHandling_Index = nil; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment