root/lib/ubasic/tokenizer.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright (c) 2006, Adam Dunkels
   3  * All rights reserved.
   4  *
   5  * Redistribution and use in source and binary forms, with or without
   6  * modification, are permitted provided that the following conditions
   7  * are met:
   8  * 1. Redistributions of source code must retain the above copyright
   9  *    notice, this list of conditions and the following disclaimer.
  10  * 2. Redistributions in binary form must reproduce the above copyright
  11  *    notice, this list of conditions and the following disclaimer in the
  12  *    documentation and/or other materials provided with the distribution.
  13  * 3. Neither the name of the author nor the names of its contributors
  14  *    may be used to endorse or promote products derived from this software
  15  *    without specific prior written permission.
  16  *
  17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27  * SUCH DAMAGE.
  28  *
  29  */
  30 #ifndef __TOKENIZER_H__
  31 #define __TOKENIZER_H__
  32 
  33 typedef enum {
  34   TOKENIZER_ERROR,
  35   TOKENIZER_ENDOFINPUT,
  36   TOKENIZER_NUMBER,
  37   TOKENIZER_STRING,
  38   TOKENIZER_VARIABLE,
  39   TOKENIZER_LET,
  40   TOKENIZER_PRINT_SCREEN,
  41   TOKENIZER_PRINT,
  42   TOKENIZER_IF,
  43   TOKENIZER_THEN,
  44   TOKENIZER_ELSE,
  45   TOKENIZER_ENDIF,
  46   TOKENIZER_SELECT,
  47   TOKENIZER_CASE_ELSE,
  48   TOKENIZER_CASE,
  49   TOKENIZER_END_SELECT,
  50   TOKENIZER_FOR,
  51   TOKENIZER_TO,
  52   TOKENIZER_NEXT,
  53   TOKENIZER_STEP,
  54   TOKENIZER_GOTO,
  55   TOKENIZER_DO,
  56   TOKENIZER_UNTIL,
  57   TOKENIZER_WHILE,
  58   TOKENIZER_WEND,
  59   TOKENIZER_GOSUB,
  60   TOKENIZER_RETURN,
  61   TOKENIZER_REM,
  62   TOKENIZER_END,
  63   TOKENIZER_CLS,
  64   TOKENIZER_COMMA,
  65   TOKENIZER_SEMICOLON,
  66   TOKENIZER_PLUS,
  67   TOKENIZER_MINUS,
  68   TOKENIZER_AND,
  69   TOKENIZER_OR,
  70   TOKENIZER_XOR,
  71   TOKENIZER_ASTR,
  72   TOKENIZER_SLASH,
  73   TOKENIZER_MOD,
  74   TOKENIZER_LEFTPAREN,
  75   TOKENIZER_RIGHTPAREN,
  76   TOKENIZER_LT,
  77   TOKENIZER_GT,
  78   TOKENIZER_EQ,
  79   TOKENIZER_NE,
  80   TOKENIZER_LE,
  81   TOKENIZER_GE,
  82   TOKENIZER_LNOT,
  83   TOKENIZER_LAND,
  84   TOKENIZER_LOR,
  85   TOKENIZER_CR,
  86   TOKENIZER_LABEL,
  87   TOKENIZER_SLEEP,
  88   TOKENIZER_CLICK,
  89   TOKENIZER_PRESS,
  90   TOKENIZER_RELEASE,
  91   TOKENIZER_SHOOT,
  92   TOKENIZER_SET_CONSOLE_LAYOUT,
  93   TOKENIZER_SET_CONSOLE_AUTOREDRAW,
  94   TOKENIZER_CONSOLE_REDRAW,
  95   TOKENIZER_GET_TV96,
  96   TOKENIZER_GET_USER_TV96,
  97   TOKENIZER_GET_USER_TV_ID,
  98   TOKENIZER_SET_TV96_DIRECT,
  99   TOKENIZER_SET_TV96,
 100   //TOKENIZER_SET_SHUTTER_SPEED,
 101   TOKENIZER_SET_USER_TV96,
 102   TOKENIZER_SET_USER_TV_BY_ID,
 103   TOKENIZER_SET_USER_TV_BY_ID_REL,
 104   TOKENIZER_GET_AV96,
 105   TOKENIZER_GET_USER_AV96,
 106   TOKENIZER_GET_USER_AV_ID,
 107   TOKENIZER_SET_AV96_DIRECT,
 108   TOKENIZER_SET_AV96,
 109   TOKENIZER_SET_USER_AV96,
 110   TOKENIZER_SET_USER_AV_BY_ID,
 111   TOKENIZER_SET_USER_AV_BY_ID_REL,
 112   TOKENIZER_GET_DAY_SECONDS,
 113   TOKENIZER_GET_TICK_COUNT,
 114   TOKENIZER_GET_TIME,
 115   TOKENIZER_GET_ZOOM,
 116   TOKENIZER_SET_ZOOM,
 117   TOKENIZER_SET_ZOOM_REL,
 118   TOKENIZER_SET_ZOOM_SPEED,
 119   TOKENIZER_SET_RECORD,
 120   TOKENIZER_GET_FOCUS,
 121   TOKENIZER_SET_FOCUS,
 122   TOKENIZER_GET_NEAR_LIMIT,
 123   TOKENIZER_GET_FAR_LIMIT,
 124   TOKENIZER_GET_DOF,
 125   TOKENIZER_GET_HYPERFOCAL_DIST,
 126   TOKENIZER_GET_SD_OVER_MODES,
 127   TOKENIZER_GET_ISO_MARKET,
 128   TOKENIZER_GET_ISO_REAL,
 129   TOKENIZER_GET_BV96,
 130   TOKENIZER_GET_SV96,
 131   TOKENIZER_GET_ISO_MODE,
 132   //TOKENIZER_SET_ISO_DL_F_B,
 133   //TOKENIZER_SET_ISO_MARKET,
 134   TOKENIZER_SET_ISO_REAL,
 135   TOKENIZER_SET_ISO_MODE,
 136   TOKENIZER_SET_SV96,
 137   TOKENIZER_GET_PROP,
 138   TOKENIZER_SET_PROP,
 139   TOKENIZER_GET_VBATT,
 140   TOKENIZER_SET_LED,
 141   TOKENIZER_SET_ISO_DIRECT,
 142   TOKENIZER_WAIT_CLICK,
 143   TOKENIZER_IS_PRESSED,
 144   TOKENIZER_IS_KEY,
 145   TOKENIZER_SET_EXIT_KEY,
 146   TOKENIZER_WHEEL_LEFT,
 147   TOKENIZER_WHEEL_RIGHT,
 148   TOKENIZER_MD_DETECT_MOTION,
 149   TOKENIZER_MD_GET_CELL_DIFF,
 150   TOKENIZER_MD_GET_CELL_VAL,
 151   TOKENIZER_MD_AF_LED_CONTROL,
 152   TOKENIZER_MEM_DUMP,
 153   TOKENIZER_GET_RAW_SUPPORT,
 154   TOKENIZER_SET_RAW_NR,
 155   TOKENIZER_GET_RAW_NR,
 156   TOKENIZER_SET_RAW,
 157   TOKENIZER_GET_RAW,
 158   TOKENIZER_SCRIPT_AUTOSTARTED,
 159   TOKENIZER_GET_SCRIPT_AUTOSTART,
 160   TOKENIZER_SET_SCRIPT_AUTOSTART,
 161   TOKENIZER_GET_USB_POWER,
 162   TOKENIZER_SET_REMOTE_TIMING,
 163   TOKENIZER_FORCE_USB_PRESENT,
 164   TOKENIZER_USB_SYNC_WAIT,
 165   TOKENIZER_EXIT_ALT,
 166   TOKENIZER_ENTER_ALT,
 167   TOKENIZER_GET_ALT_MODE,
 168   TOKENIZER_SHUT_DOWN,
 169   TOKENIZER_SET_ND_FILTER,
 170   TOKENIZER_GET_DISK_SIZE,
 171   TOKENIZER_GET_FREE_DISK_SPACE,
 172   TOKENIZER_GET_JPG_COUNT,
 173   TOKENIZER_GET_RAW_COUNT,
 174   TOKENIZER_GET_VIDEO_BUTTON,
 175   TOKENIZER_RANDOM,
 176   TOKENIZER_GET_MOVIE_STATUS,
 177   TOKENIZER_GET_MODE,
 178   TOKENIZER_PLAY_SOUND,
 179   TOKENIZER_GET_DISPLAY_MODE,
 180   TOKENIZER_GET_EXP_COUNT,
 181   TOKENIZER_GET_DRIVE_MODE,
 182   TOKENIZER_GET_FOCUS_MODE,
 183   TOKENIZER_GET_FLASH_MODE,
 184   TOKENIZER_GET_SHOOTING,
 185   TOKENIZER_GET_FLASH_READY,
 186   TOKENIZER_GET_IS_MODE,
 187   TOKENIZER_SET_EV,
 188   TOKENIZER_GET_EV,
 189   TOKENIZER_GET_ORIENTATION_SENSOR,
 190   TOKENIZER_GET_ZOOM_STEPS,
 191   TOKENIZER_GET_ND_PRESENT,
 192   TOKENIZER_GET_PROPSET,
 193   TOKENIZER_SHOT_HISTO_ENABLE,
 194   TOKENIZER_GET_HISTO_RANGE,
 195   TOKENIZER_GET_TEMPERATURE,
 196   TOKENIZER_SET_MOVIE_STATUS,
 197   TOKENIZER_GET_RESOLUTION,
 198   TOKENIZER_GET_QUALITY,
 199   TOKENIZER_SET_RESOLUTION,
 200   TOKENIZER_SET_QUALITY,
 201   TOKENIZER_GET_PLATFORM_ID,
 202   TOKENIZER_SET_BACKLIGHT,
 203   TOKENIZER_SET_LCDDISPLAY,
 204   TOKENIZER_SET_DRAW_TITLE_LINE,
 205   TOKENIZER_GET_DRAW_TITLE_LINE,
 206   TOKENIZER_SET_AELOCK,
 207   TOKENIZER_SET_AFLOCK,
 208   TOKENIZER_SET_MF,
 209   TOKENIZER_GET_CAPTURE_MODE,
 210   TOKENIZER_SET_CAPTURE_MODE,
 211   TOKENIZER_SET_CAPTURE_MODE_CANON,
 212   TOKENIZER_IS_CAPTURE_MODE_VALID,
 213   TOKENIZER_REBOOT,
 214   TOKENIZER_GET_FOCAL_LENGTH,
 215   TOKENIZER_GET_FOCUS_STATE,
 216   TOKENIZER_GET_FOCUS_OK,
 217   TOKENIZER_GET_MIN_STACK_DIST,
 218   TOKENIZER_GET_CONFIG_VALUE,
 219   TOKENIZER_SET_CONFIG_VALUE,
 220   TOKENIZER_SET_YIELD,
 221   TOKENIZER_SWAP_PARTITIONS,
 222   TOKENIZER_ISO_TO_SV96,
 223   TOKENIZER_SV96_TO_ISO,
 224   TOKENIZER_ISO_REAL_TO_MARKET,
 225   TOKENIZER_ISO_MARKET_TO_REAL,
 226   TOKENIZER_SV96_REAL_TO_MARKET,
 227   TOKENIZER_SV96_MARKET_TO_REAL,
 228   TOKENIZER_APERTURE_TO_AV96,
 229   TOKENIZER_AV96_TO_APERTURE,
 230   TOKENIZER_USEC_TO_TV96,
 231   TOKENIZER_TV96_TO_USEC,
 232   TOKENIZER_SECONDS_TO_TV96,
 233   TOKENIZER_GET_VIDEO_RECORDING,
 234   TOKENIZER_GET_CURRENT_AV96,
 235   TOKENIZER_GET_CURRENT_TV96,
 236   TOKENIZER_GET_CURRENT_BASE_SV96,
 237   TOKENIZER_GET_CURRENT_DELTA_SV96,
 238   TOKENIZER_GET_IMAGER_ACTIVE,
 239   TOKENIZER_GET_MAX_AV96,
 240   TOKENIZER_GET_MIN_AV96,
 241   TOKENIZER_GET_ND_VALUE_EV96,
 242   TOKENIZER_GET_ND_CURRENT_EV96,
 243   TOKENIZER_GET_DIGIC,
 244   TOKENIZER_GET_CANON_IMAGE_FORMAT,
 245   TOKENIZER_GET_CANON_RAW_SUPPORT,
 246   TOKENIZER_SET_CANON_IMAGE_FORMAT,
 247   TOKENIZER_FORCE_ANALOG_AV,
 248 } ubasic_token;
 249 
 250 void tokenizer_init(const char *program);
 251 void tokenizer_next(void);
 252 int tokenizer_token(void);
 253 int tokenizer_num(void);
 254 int tokenizer_variable_num(void);
 255 void tokenizer_string(char *dest, int len);
 256 void tokenizer_label(char *dest, int len);
 257 
 258 int tokenizer_line_number(void);
 259 
 260 int tokenizer_finished(void);
 261 void tokenizer_error_print(void);
 262 
 263 #endif /* __TOKENIZER_H__ */

/* [<][>][^][v][top][bottom][index][help] */