This will parse a base 10 int, and change ptr to one char beyond the end of the number.
| 728 | |
| 729 | // This will parse a base 10 int, and change ptr to one char beyond the end of the number. |
| 730 | inline int parseNextInt(char **ptr) |
| 731 | { |
| 732 | int num = 0; |
| 733 | for (char curChar = (*ptr)[0]; curChar != 0; curChar = (++(*ptr))[0]) |
| 734 | { |
| 735 | int digit = curChar - '0'; |
| 736 | if (digit >= 0 && digit <= 9) num = num*10 + digit; |
| 737 | else break; |
| 738 | } |
| 739 | return num; |
| 740 | } |
| 741 | |
| 742 | // This will the current char, and move the ptr ahead by one. |
| 743 | inline char parseNextOpCode(char **ptr) |