| | 1 | #charset "us-ascii" |
| | 2 | |
| | 3 | /* |
| | 4 | * Copyright (c) 1999, 2006 Michael J. Roberts |
| | 5 | * |
| | 6 | * This file is part of TADS 3 |
| | 7 | * |
| | 8 | * This header defines the tads-io intrinsic function set. |
| | 9 | * |
| | 10 | * The TADS input/output function set provides access to the user |
| | 11 | * interface. This lets you read input from the keyboard and display |
| | 12 | * output on the monitor or terminal. It also provides access to windowing |
| | 13 | * features (via the "banner" functions) on systems that support multiple |
| | 14 | * display windows (which doesn't necessarily mean GUI-type systems: many |
| | 15 | * character-mode systems support the banner operations as well, simply by |
| | 16 | * dividing up the character-mode screen into rectangular regions). |
| | 17 | */ |
| | 18 | |
| | 19 | |
| | 20 | #ifndef TADSIO_H |
| | 21 | #define TADSIO_H |
| | 22 | |
| | 23 | /* |
| | 24 | * tads-io - the TADS Input/Output intrinsic function set |
| | 25 | */ |
| | 26 | intrinsic 'tads-io/030007' |
| | 27 | { |
| | 28 | /* |
| | 29 | * Display values on the console. One or more values can be displayed. |
| | 30 | * Each value can be a string, in which case the string is displayed as |
| | 31 | * given (with HTML interpretation); an integer, in which case it's |
| | 32 | * converted to a string, using a decimal (base 10) radix and |
| | 33 | * displayed; a BigNumber, in which case it's converted to a string |
| | 34 | * using the default formatting; or nil, in which case nothing is |
| | 35 | * displayed. |
| | 36 | */ |
| | 37 | tadsSay(val, ...); |
| | 38 | |
| | 39 | /* |
| | 40 | * Set the output log file (which records the output transcript) or the |
| | 41 | * command log file (which records command lines the user enters). |
| | 42 | * 'fname' is the name of the file to open, and 'logType' gives the |
| | 43 | * type of log to open, as a LogTypeXxx value. |
| | 44 | */ |
| | 45 | setLogFile(fname, logType?); |
| | 46 | |
| | 47 | /* |
| | 48 | * Clear the display. This clears the main window. |
| | 49 | */ |
| | 50 | clearScreen(); |
| | 51 | |
| | 52 | /* |
| | 53 | * Show the "more" prompt, if supported on the platform. This causes a |
| | 54 | * "more" prompt to be displayed, according to local system |
| | 55 | * conventions, as though consecutive text output had exceeded the |
| | 56 | * screen/window height. |
| | 57 | */ |
| | 58 | morePrompt(); |
| | 59 | |
| | 60 | /* |
| | 61 | * Read a line of text from the keyboard. Pauses to let the user edit |
| | 62 | * and enter a command line, then returns the entered text as a string. |
| | 63 | */ |
| | 64 | inputLine(); |
| | 65 | |
| | 66 | /* |
| | 67 | * Read a single keystroke from the keyboard. Waits until the user |
| | 68 | * presses a key, then returns the keystroke as a string. |
| | 69 | */ |
| | 70 | inputKey(); |
| | 71 | |
| | 72 | /* |
| | 73 | * Read a single input event. Waits until an input event is available, |
| | 74 | * then returns the event as a list. The first element of the list is |
| | 75 | * an InEvtXxx value indicating the type of the event; the remainder of |
| | 76 | * the list varies according to the event type. If 'timeout' is |
| | 77 | * provided, it gives the maximum waiting interval in milliseconds; if |
| | 78 | * no input event occurs within this interval, the function returns an |
| | 79 | * InEvtTimeout event. |
| | 80 | */ |
| | 81 | inputEvent(timeout?); |
| | 82 | |
| | 83 | /* |
| | 84 | * Display a simple "message box" dialog (known on some systems as an |
| | 85 | * "alert" dialog). This displays a dialog that includes a short |
| | 86 | * message for the user to read, an icon indicating the general nature |
| | 87 | * of the condition that gave rise to the dialog (an error, a warning, |
| | 88 | * a choice for the user to make, etc.), and a set of push-buttons that |
| | 89 | * dismiss the dialog and (in some cases) let the user choose among |
| | 90 | * options. 'icon' is an InDlgIconXxx value giving the type of icon to |
| | 91 | * show, if any; 'prompt' is the message string to display; 'buttons' |
| | 92 | * gives the set of buttons to display; 'defaultButton' is the index |
| | 93 | * (starting at 1) among the buttons of the default button; and |
| | 94 | * 'cancelButton' is the index of the cancellation button. |
| | 95 | * |
| | 96 | * 'buttons' can be given as an InDlgXxx constant (InDlgOk, |
| | 97 | * InDlgOkCancel, etc.) to select one of the standard sets of buttons. |
| | 98 | * Or, it can be a list giving a custom set of buttons, in which case |
| | 99 | * each element of the list is either a string giving a custom label |
| | 100 | * for the button, or one of the InDlgLblXxx values to select a |
| | 101 | * standard label. The standard labels should be used when possible, |
| | 102 | * as these will be automatically localized; labels given explicitly as |
| | 103 | * strings will be used exactly as given. If a list of custom button |
| | 104 | * labels is given, the buttons are displayed in the dialog in the |
| | 105 | * order of the list (usually left to right, but this could vary |
| | 106 | * according to system conventions and localization). |
| | 107 | * |
| | 108 | * Each custom button label string can incorporate an ampersand ("&"). |
| | 109 | * The letter immediately following the ampersand, if provided, is used |
| | 110 | * as the keyboard shortcut for the button. This is particularly |
| | 111 | * important on character-mode systems, where the "dialog" is typically |
| | 112 | * shown merely as a text prompt, and the user responds by selecting |
| | 113 | * the letter of the desired option. Typically, you should use the |
| | 114 | * first character of a button label as its keyboard shortcut, but this |
| | 115 | * obviously won't work when two button labels have the same first |
| | 116 | * letter; in these cases, you should choose another letter from the |
| | 117 | * button label, preferably something like the first letter of the |
| | 118 | * second word of the button label, or the first letter of the stressed |
| | 119 | * syllable of the most important word of the label. |
| | 120 | * |
| | 121 | * The return value is the index among the buttons of the button that |
| | 122 | * the user selects to dismiss the dialog. The function doesn't return |
| | 123 | * until the user selects one of the buttons. |
| | 124 | */ |
| | 125 | inputDialog(icon, prompt, buttons, defaultButton, cancelButton); |
| | 126 | |
| | 127 | /* |
| | 128 | * Display a file selector dialog. This prompts the user to select a |
| | 129 | * file. On GUI systems, this will typically display the standard |
| | 130 | * system file selection dialog; on character-mode systems, it might |
| | 131 | * simply display the prompt string and let the user type the name of a |
| | 132 | * file directly. |
| | 133 | * |
| | 134 | * 'prompt' is the message string to display in the dialog to let the |
| | 135 | * user know what type of file is being requested. 'dialogType' is one |
| | 136 | * of the InFileXxx constants specifying whether the request is to |
| | 137 | * select an existing file or to specify the name for a new file. |
| | 138 | * 'fileType' is a FileTypeXxx constant giving the format of the file |
| | 139 | * being requested; this is used on some systems to filter the |
| | 140 | * displayed list of existing files so that only files of the same |
| | 141 | * format are included, to reduce clutter. 'flags' is reserved for |
| | 142 | * future use and should simply be set to zero. |
| | 143 | * |
| | 144 | * The return value is a list. The first element is an integer giving |
| | 145 | * the status: InFileSuccess indicates that the user successfully |
| | 146 | * selected a file, whose name is given as a string in the second |
| | 147 | * element of the result list; InFileFailure indicates a system error |
| | 148 | * of some kind showing the dialog; and InFileCancel indicates that the |
| | 149 | * user explicitly canceled the dialog. |
| | 150 | */ |
| | 151 | inputFile(prompt, dialogType, fileType, flags); |
| | 152 | |
| | 153 | /* |
| | 154 | * Pause for the given number of milliseconds. |
| | 155 | */ |
| | 156 | timeDelay(delayMilliseconds); |
| | 157 | |
| | 158 | /* |
| | 159 | * Retrieve local system information. 'infoType' is a SysInfoXxx |
| | 160 | * constant giving the type of information to retrieve. Additional |
| | 161 | * arguments and the return value vary according to the infoType value. |
| | 162 | */ |
| | 163 | systemInfo(infoType, ...); |
| | 164 | |
| | 165 | /* |
| | 166 | * Set the status-line display mode. This is meaningful only with |
| | 167 | * text-only interpreters that don't support banner windows; other |
| | 168 | * interpreters ignore this. 'mode' is a StatModeXxx constant giving |
| | 169 | * the new mode. |
| | 170 | */ |
| | 171 | statusMode(mode); |
| | 172 | |
| | 173 | /* |
| | 174 | * Write text on the right half of the status line. This is meaningful |
| | 175 | * only for text-only interpreters that don't support banner windows; |
| | 176 | * other interpreters ignore this. On non-banner interpreters, this |
| | 177 | * sets the right half of the status line to display the given text, |
| | 178 | * right-justified. |
| | 179 | */ |
| | 180 | statusRight(txt); |
| | 181 | |
| | 182 | /* |
| | 183 | * Determine if a multimedia resource exists. 'fname' is the name of a |
| | 184 | * resource (a JPEG image file, PNG image file, etc), given in |
| | 185 | * URL-style path notation. Returns true if the resource is available, |
| | 186 | * nil if not. |
| | 187 | */ |
| | 188 | resExists(fname); |
| | 189 | |
| | 190 | /* |
| | 191 | * Set the script input file. This opens the given file as the script |
| | 192 | * input file. 'filename' is a string giving the name of the file to |
| | 193 | * open, and 'flags' is a combination of ScriptFileXxx bit flags giving |
| | 194 | * the mode to use to read the file. When a script file is active, the |
| | 195 | * system reads command-line input from the file rather than from the |
| | 196 | * keyboard. This lets the program replay an input script. |
| | 197 | * |
| | 198 | * Note that the ScriptFileEvent flag is ignored if included in the |
| | 199 | * 'flags' parameter. The script reader automatically determines the |
| | 200 | * script type by examining the file's contents, so you can't set the |
| | 201 | * type using flags. This flag is used only in "get status" requests |
| | 202 | * (ScriptReqGetStatus) - it's included in the returned flags if |
| | 203 | * applicable. The purpose of this flag is to let you determine what |
| | 204 | * the script reader decided about the script, rather than telling the |
| | 205 | * script reader how to interpret the script. |
| | 206 | * |
| | 207 | * If 'filename' is nil, this cancels the current script. If the |
| | 208 | * script was invoked from an enclosing script, this resumes the |
| | 209 | * enclosing script, otherwise it resumes reading input from the |
| | 210 | * keyboard. The 'flags' argument is ignored in this case. |
| | 211 | * |
| | 212 | * New in 3.0.17: if 'filename' is one of the ScriptReqXxx constants, |
| | 213 | * this performs a special script request. See the ScriptReqXxx |
| | 214 | * constants for details. Note that calling this function with a |
| | 215 | * ScriptReqXxx constant on an VM prior to 3.0.17 will result in a |
| | 216 | * run-time error, so you can use try-catch to detect whether the |
| | 217 | * request is supported. |
| | 218 | */ |
| | 219 | setScriptFile(filename, flags?); |
| | 220 | |
| | 221 | /* |
| | 222 | * Get the local default character set. 'which' is a CharsetXxx value |
| | 223 | * giving which local character set to retrieve. Returns a string |
| | 224 | * giving the name of the given local character set. |
| | 225 | */ |
| | 226 | getLocalCharSet(which); |
| | 227 | |
| | 228 | /* |
| | 229 | * Flush text output and update the main display window. This ensures |
| | 230 | * that any text displayed with tadsSay() is actually displayed, for |
| | 231 | * the user to see (rather than being held in internal buffers). |
| | 232 | */ |
| | 233 | flushOutput(); |
| | 234 | |
| | 235 | /* |
| | 236 | * Read a line of text from the keyboard. Waits for the user to edit |
| | 237 | * and enter a command line. If a 'timeout' value is specified, it |
| | 238 | * gives the maximum interval to wait for the user to finish entering |
| | 239 | * the input, in milliseconds. If the timeout expires before the user |
| | 240 | * finishes entering the line, the function stops waiting and returns. |
| | 241 | * |
| | 242 | * The return value is a list. The first element is an InEvtXxx code |
| | 243 | * giving the status. If the status is InEvtLine, the second element |
| | 244 | * is a string giving the command line the user entered. If the status |
| | 245 | * is InEvtTimeout, the second element is a string giving the text of |
| | 246 | * the command line so far - that is, the text that the user had typed |
| | 247 | * up to the point when the timeout expired. Other status codes have |
| | 248 | * no additional list elements. |
| | 249 | * |
| | 250 | * When an InEvtTimeout status is returned, the caller must either |
| | 251 | * cancel the interrupted input line with inputLineCancel(), or must |
| | 252 | * make another call to inputLineTimeout() without any intervening call |
| | 253 | * to any output function that displays anything in the main window, or |
| | 254 | * any input function other than inputLineTimeout(). |
| | 255 | */ |
| | 256 | inputLineTimeout(timeout?); |
| | 257 | |
| | 258 | /* |
| | 259 | * Cancel an input line that was interrupted by timeout. This function |
| | 260 | * must be called after an inputLineTimeout() returns with an |
| | 261 | * InEvtTimeout status indication and before any subsequent output |
| | 262 | * function that displays anything in the main window, or any input |
| | 263 | * fucntion other than inputLineTimeout(). |
| | 264 | * |
| | 265 | * This function updates the UI to reflect that command line editing is |
| | 266 | * no longer in progress. If 'reset' is true, it also resets the |
| | 267 | * internal memory of the command editing session, so that a subsequent |
| | 268 | * call to inputLineTimeout() will start from scratch with an empty |
| | 269 | * command line. If 'reset' is nil, this function merely adjusts the |
| | 270 | * UI, but does not clear the internal memory; the next call to |
| | 271 | * inputLineTimeout() will automatically restore the editing status, |
| | 272 | * re-displaying what the user had typed so far on the interrupted |
| | 273 | * command line and restoring the cursor position to its position when |
| | 274 | * the timeout occurred. |
| | 275 | * |
| | 276 | * Note that it's not necessary (or desirable) to call this function |
| | 277 | * after a timed-out input line if the next input/output function that |
| | 278 | * affects the main window is simply another call to |
| | 279 | * inputLineTimeout(). In this case, inputLineTimeout() simply picks |
| | 280 | * up where it left off, without any indication to the user that the |
| | 281 | * input editing was ever interrupted. |
| | 282 | */ |
| | 283 | inputLineCancel(reset); |
| | 284 | |
| | 285 | /* |
| | 286 | * Create a banner window. Returns the "handle" of the new window, |
| | 287 | * which is used to identify the window in subsequent bannerXxx() |
| | 288 | * functions. Not all interpreters support banner windows; if the |
| | 289 | * interpreter does not support this feature, the return value is nil. |
| | 290 | * |
| | 291 | * 'parent' is the handle of the parent window; if this is nil, the |
| | 292 | * banner is split off from the main display window. 'where' is a |
| | 293 | * BannerXxx value giving the list position; if this is BannerBefore or |
| | 294 | * BannerAfter, 'other' is the handle of an existing banner window |
| | 295 | * child of the same parent. 'windowType' is a BannerTypeXxx value |
| | 296 | * giving the type of window to create. 'align' is a BannerAlignXxx |
| | 297 | * value giving the alignment - that is, the edge of the parent window |
| | 298 | * to which the new banner window attaches. 'size' is the size of the |
| | 299 | * window, in the units given by 'sizeUnits', which is a BannerSizeXxx |
| | 300 | * value. 'styleFlags' is a combination of BannerStyleXxx bit flags |
| | 301 | * that specifies the desired combination of visual styles and UI |
| | 302 | * behavior for the new window. |
| | 303 | */ |
| | 304 | bannerCreate(parent, where, other, windowType, align, |
| | 305 | size, sizeUnits, styleFlags); |
| | 306 | |
| | 307 | /* |
| | 308 | * Delete a banner window. 'handle' is the handle to the window to be |
| | 309 | * removed. |
| | 310 | */ |
| | 311 | bannerDelete(handle); |
| | 312 | |
| | 313 | /* |
| | 314 | * Clear the contents of a banner window. 'color' is the color to use |
| | 315 | * for the screen color after clearing the window, given as a ColorXxx |
| | 316 | * value (see below). |
| | 317 | */ |
| | 318 | bannerClear(handle); |
| | 319 | |
| | 320 | /* |
| | 321 | * Write text to a banner window. The text is displayed in the given |
| | 322 | * banner. For a BannerTypeText window, HTML tags in the text are |
| | 323 | * interpreted; for a BannerTypeTextGrid window, the text is written |
| | 324 | * exactly as given, without any HTML interpretation. |
| | 325 | * |
| | 326 | * The value list is handled the same way as the arguments to tadsSay() |
| | 327 | * in terms of type conversions. |
| | 328 | */ |
| | 329 | bannerSay(handle, ...); |
| | 330 | |
| | 331 | /* |
| | 332 | * Flush all buffers for a banner window. This ensures that any text |
| | 333 | * written with bannerSay() is actually displayed for the user to see |
| | 334 | * (rather than being held in internal buffers). |
| | 335 | */ |
| | 336 | bannerFlush(handle); |
| | 337 | |
| | 338 | /* |
| | 339 | * Size a banner to fit its contents. This resizes the banner such |
| | 340 | * that the contents just fit. In the case of a top- or bottom-aligned |
| | 341 | * banner, the height is set just high enough to hold all of the text |
| | 342 | * currently displayed. In the case of a left- or right-aligned |
| | 343 | * banner, the width is set just wide enough to hold the widest single |
| | 344 | * word that can't be broken across lines. In all cases, the size |
| | 345 | * includes any fixed margin space, to ensure that all of the text in |
| | 346 | * the window is actually visible without scrolling. |
| | 347 | * |
| | 348 | * Note that not all systems support this function. On systems where |
| | 349 | * the function is not supported, this call has no effect. Because of |
| | 350 | * this, you should always use this function in conjunction with an |
| | 351 | * "advisory" call to bannerSetSize(). |
| | 352 | */ |
| | 353 | bannerSizeToContents(handle); |
| | 354 | |
| | 355 | /* |
| | 356 | * Go to to an output position. This is meaningful only for |
| | 357 | * BannerTypeTextGrid windows. This sets the next text output position |
| | 358 | * to the given row and column in the text grid; the next call to |
| | 359 | * bannerSay() will display its output starting at this position. |
| | 360 | */ |
| | 361 | bannerGoTo(handle, row, col); |
| | 362 | |
| | 363 | /* |
| | 364 | * Set text foreground and background colors. This affects the color |
| | 365 | * of subsequently displayed text; text displayed previously is not |
| | 366 | * affected. The colors are given as ColorXxx values (see below). If |
| | 367 | * 'bg' is ColorTransparent, then text is shown with the current screen |
| | 368 | * color in the window. |
| | 369 | */ |
| | 370 | bannerSetTextColor(handle, fg, bg); |
| | 371 | |
| | 372 | /* |
| | 373 | * Set the "screen color" in the banner window. This is the color used |
| | 374 | * to fill parts of the window that aren't displaying any text, and as |
| | 375 | * the background color for all text displayed when the text background |
| | 376 | * color is ColorTransparent. Setting the screen color immediately |
| | 377 | * sets the color for the entire window - even text previously |
| | 378 | * displayed in the window is affected by this change. |
| | 379 | */ |
| | 380 | bannerSetScreenColor(handle, color); |
| | 381 | |
| | 382 | /* |
| | 383 | * Get information on the banner. This returns a list giving a |
| | 384 | * detailed set of information describing the banner. |
| | 385 | */ |
| | 386 | bannerGetInfo(handle); |
| | 387 | |
| | 388 | /* |
| | 389 | * Set the size of a banner. This explicitly sets the banner's height |
| | 390 | * (for a top or bottom banner) or width (for a left or right) banner |
| | 391 | * to the 'size', which is specified in units given by 'sizeUnits', |
| | 392 | * which is a BannerSizeXxx constant. If 'isAdvisory' is true, the |
| | 393 | * caller is indicating that this call will be followed soon by a call |
| | 394 | * to bannerSizeToContents(). On systems that support sizing to |
| | 395 | * contents, an "advisory" call to bannerSetSize() will simply be |
| | 396 | * ignored in anticipation of the upcoming call to |
| | 397 | * bannerSizeToContents(). On systems that don't support sizing to |
| | 398 | * contents, an advisory call will actually resize the window. |
| | 399 | */ |
| | 400 | bannerSetSize(handle, size, sizeUnits, isAdvisory); |
| | 401 | |
| | 402 | /* |
| | 403 | * Create a log file console. This creates a console that has no |
| | 404 | * display, but simply captures its output to the given log file. |
| | 405 | * Writing to a log console is different from writing to a regular text |
| | 406 | * file in that we apply all of the normal formatting (including |
| | 407 | * text-only-mode HTML interpretation) to the output sent to this |
| | 408 | * console. |
| | 409 | */ |
| | 410 | logConsoleCreate(filename, charset, width); |
| | 411 | |
| | 412 | /* |
| | 413 | * Close a log console. This closes the file associated with the log |
| | 414 | * console and deletes the console object. The given console handle is |
| | 415 | * no longer valid after this function is called. |
| | 416 | */ |
| | 417 | logConsoleClose(handle); |
| | 418 | |
| | 419 | /* |
| | 420 | * Write text to a log console. This works the same as tadsSay(), but |
| | 421 | * writes the output to the given log console rather than to the main |
| | 422 | * output window. |
| | 423 | */ |
| | 424 | logConsoleSay(handle, ...); |
| | 425 | } |
| | 426 | |
| | 427 | /* log file types */ |
| | 428 | #define LogTypeTranscript 1 /* log all input and output to a transcript */ |
| | 429 | #define LogTypeCommand 2 /* log only command-line input */ |
| | 430 | #define LogTypeScript 3 /* log all input events */ |
| | 431 | |
| | 432 | /* |
| | 433 | * The special log console handle for the main console window's transcript. |
| | 434 | * This can be used as the handle in logConsoleSay(), to write text |
| | 435 | * directly to the main console's log file, if any. Note that this console |
| | 436 | * cannot be closed via logConsoleClose(); use setLogFile(nil) instead. |
| | 437 | */ |
| | 438 | #define MainWindowLogHandle (-1) |
| | 439 | |
| | 440 | /* |
| | 441 | * constants for the event codes returned by the inputEvent() and |
| | 442 | * inputLineTimeout() intrinsic functions |
| | 443 | */ |
| | 444 | #define InEvtKey 1 |
| | 445 | #define InEvtTimeout 2 |
| | 446 | #define InEvtHref 3 |
| | 447 | #define InEvtNoTimeout 4 |
| | 448 | #define InEvtNotimeout 4 /* (note minor capitalization variation) */ |
| | 449 | #define InEvtEof 5 |
| | 450 | #define InEvtLine 6 |
| | 451 | #define InEvtSysCommand 0x100 |
| | 452 | #define InEvtEndQuietScript 10000 |
| | 453 | |
| | 454 | /* |
| | 455 | * Command codes for InEvtSysCommand |
| | 456 | */ |
| | 457 | #define SaveCommand 0x0001 /* SAVE the current position */ |
| | 458 | #define RestoreCommand 0x0002 /* RESTORE a saved position */ |
| | 459 | #define UndoCommand 0x0003 /* UNDO one turn */ |
| | 460 | #define QuitCommand 0x0004 /* QUIT the game */ |
| | 461 | #define CloseCommand 0x0005 /* close the game window */ |
| | 462 | #define HelpCommand 0x0006 /* show game HELP */ |
| | 463 | |
| | 464 | |
| | 465 | /* |
| | 466 | * constants for inputDialog() |
| | 467 | */ |
| | 468 | #define InDlgOk 1 |
| | 469 | #define InDlgOkCancel 2 |
| | 470 | #define InDlgYesNo 3 |
| | 471 | #define InDlgYesNoCancel 4 |
| | 472 | |
| | 473 | #define InDlgIconNone 0 |
| | 474 | #define InDlgIconWarning 1 |
| | 475 | #define InDlgIconInfo 2 |
| | 476 | #define InDlgIconQuestion 3 |
| | 477 | #define InDlgIconError 4 |
| | 478 | |
| | 479 | #define InDlgLblOk 1 |
| | 480 | #define InDlgLblCancel 2 |
| | 481 | #define InDlgLblYes 3 |
| | 482 | #define InDlgLblNo 4 |
| | 483 | |
| | 484 | /* |
| | 485 | * inputFile() dialog types |
| | 486 | */ |
| | 487 | #define InFileOpen 1 /* open an existing file for reading */ |
| | 488 | #define InFileSave 2 /* save to the file */ |
| | 489 | |
| | 490 | /* |
| | 491 | * inputFile() return codes - these are returned in the first element of |
| | 492 | * the list returned from inputFile() |
| | 493 | */ |
| | 494 | #define InFileSuccess 0 /* success - 2nd list element is filename */ |
| | 495 | #define InFileFailure 1 /* an error occurred asking for a file */ |
| | 496 | #define InFileCancel 2 /* player canceled the file selector */ |
| | 497 | |
| | 498 | /* |
| | 499 | * constants for inputFile() file type codes |
| | 500 | */ |
| | 501 | #define FileTypeLog 2 /* a transcript (log) file */ |
| | 502 | #define FileTypeData 4 /* arbitrary data file */ |
| | 503 | #define FileTypeCmd 5 /* command input file */ |
| | 504 | #define FileTypeText 7 /* text file */ |
| | 505 | #define FileTypeBin 8 /* binary data file */ |
| | 506 | #define FileTypeUnknown 11 /* unknown file type */ |
| | 507 | #define FileTypeT3Image 12 /* T3 executable image (game) file */ |
| | 508 | #define FileTypeT3Save 15 /* T3 saved state file */ |
| | 509 | |
| | 510 | /* |
| | 511 | * constants for systemInfo information type codes |
| | 512 | */ |
| | 513 | #define SysInfoVersion 2 |
| | 514 | #define SysInfoOsName 3 |
| | 515 | #define SysInfoJpeg 5 |
| | 516 | #define SysInfoPng 6 |
| | 517 | #define SysInfoWav 7 |
| | 518 | #define SysInfoMidi 8 |
| | 519 | #define SysInfoWavMidiOvl 9 |
| | 520 | #define SysInfoWavOvl 10 |
| | 521 | #define SysInfoPrefImages 11 |
| | 522 | #define SysInfoPrefSounds 12 |
| | 523 | #define SysInfoPrefMusic 13 |
| | 524 | #define SysInfoPrefLinks 14 |
| | 525 | #define SysInfoMpeg 15 |
| | 526 | #define SysInfoMpeg1 16 |
| | 527 | #define SysInfoMpeg2 17 |
| | 528 | #define SysInfoMpeg3 18 |
| | 529 | #define SysInfoLinksHttp 20 |
| | 530 | #define SysInfoLinksFtp 21 |
| | 531 | #define SysInfoLinksNews 22 |
| | 532 | #define SysInfoLinksMailto 23 |
| | 533 | #define SysInfoLinksTelnet 24 |
| | 534 | #define SysInfoPngTrans 25 |
| | 535 | #define SysInfoPngAlpha 26 |
| | 536 | #define SysInfoOgg 27 |
| | 537 | #define SysInfoMng 28 |
| | 538 | #define SysInfoMngTrans 29 |
| | 539 | #define SysInfoMngAlpha 30 |
| | 540 | #define SysInfoTextHilite 31 |
| | 541 | #define SysInfoTextColors 32 |
| | 542 | #define SysInfoBanners 33 |
| | 543 | #define SysInfoInterpClass 34 |
| | 544 | #define SysInfoAudioFade 35 |
| | 545 | #define SysInfoAudioCrossfade 36 |
| | 546 | |
| | 547 | /* SysInfoTextColors support level codes */ |
| | 548 | #define SysInfoTxcNone 0 |
| | 549 | #define SysInfoTxcParam 1 |
| | 550 | #define SysInfoTxcAnsiFg 2 |
| | 551 | #define SysInfoTxcAnsiFgBg 3 |
| | 552 | #define SysInfoTxcRGB 4 |
| | 553 | |
| | 554 | /* SysInfoInterpClass codes */ |
| | 555 | #define SysInfoIClassText 1 |
| | 556 | #define SysInfoIClassTextGUI 2 |
| | 557 | #define SysInfoIClassHTML 3 |
| | 558 | |
| | 559 | /* SysInfoAudioFade and SysInfoAudioCrossfade result codes */ |
| | 560 | #define SysInfoFadeMPEG 0x0001 |
| | 561 | #define SysInfoFadeOGG 0x0002 |
| | 562 | #define SysInfoFadeWAV 0x0004 |
| | 563 | #define SysInfoFadeMIDI 0x0008 |
| | 564 | |
| | 565 | /* |
| | 566 | * constants for statusMode |
| | 567 | */ |
| | 568 | #define StatModeNormal 0 /* displaying normal text */ |
| | 569 | #define StatModeStatus 1 /* display status line text */ |
| | 570 | |
| | 571 | /* |
| | 572 | * flags for setScriptFile |
| | 573 | */ |
| | 574 | #define ScriptFileQuiet 1 /* do not display output while reading script */ |
| | 575 | #define ScriptFileNonstop 2 /* turn off MORE prompt while reading script */ |
| | 576 | #define ScriptFileEvent 4 /* this is an event script (query only) */ |
| | 577 | |
| | 578 | /* |
| | 579 | * Script Request - get current script status. In 3.0.17+, passing this |
| | 580 | * constant as the 'filename' argument to getScriptFile() will perform a |
| | 581 | * "get script status" request. If there's no script file in progress, the |
| | 582 | * function returns nil. If a script file is being read, the function |
| | 583 | * returns an integer value giving a combination of ScriptFileXxx flag |
| | 584 | * values indicating the current script status. Note that a return value |
| | 585 | * of 0 (zero) means that a script is running but none of the ScriptFileXxx |
| | 586 | * flags are applicable. |
| | 587 | */ |
| | 588 | #define ScriptReqGetStatus 0x7000 |
| | 589 | |
| | 590 | /* |
| | 591 | * selectors for getLocalCharSet |
| | 592 | */ |
| | 593 | #define CharsetDisplay 1 /* the display/keyboard character set */ |
| | 594 | #define CharsetFileName 2 /* the file system character set */ |
| | 595 | #define CharsetFileCont 3 /* default file contents character set */ |
| | 596 | |
| | 597 | /* |
| | 598 | * banner insertion point specifies (for 'where' in bannerCreate) |
| | 599 | */ |
| | 600 | #define BannerFirst 1 |
| | 601 | #define BannerLast 2 |
| | 602 | #define BannerBefore 3 |
| | 603 | #define BannerAfter 4 |
| | 604 | |
| | 605 | /* |
| | 606 | * banner types |
| | 607 | */ |
| | 608 | #define BannerTypeText 1 /* ordinary text stream window */ |
| | 609 | #define BannerTypeTextGrid 2 /* text grid window */ |
| | 610 | |
| | 611 | /* |
| | 612 | * banner alignment types |
| | 613 | */ |
| | 614 | #define BannerAlignTop 0 |
| | 615 | #define BannerAlignBottom 1 |
| | 616 | #define BannerAlignLeft 2 |
| | 617 | #define BannerAlignRight 3 |
| | 618 | |
| | 619 | /* |
| | 620 | * banner size unit types |
| | 621 | */ |
| | 622 | #define BannerSizePercent 1 /* size is a percentage of available space */ |
| | 623 | #define BannerSizeAbsolute 2 /* size is in natural units of window type */ |
| | 624 | |
| | 625 | /* |
| | 626 | * banner style flags |
| | 627 | */ |
| | 628 | #define BannerStyleBorder 0x0001 /* banner has a visible border */ |
| | 629 | #define BannerStyleVScroll 0x0002 /* vertical scrollbar */ |
| | 630 | #define BannerStyleHScroll 0x0004 /* horizontal scrollbar */ |
| | 631 | #define BannerStyleAutoVScroll 0x0008 /* automatic vertical scrolling */ |
| | 632 | #define BannerStyleAutoHScroll 0x0010 /* automatic horizontal scrolling */ |
| | 633 | #define BannerStyleTabAlign 0x0020 /* <TAB> alignment support */ |
| | 634 | #define BannerStyleMoreMode 0x0040 /* use MORE mode */ |
| | 635 | #define BannerStyleHStrut 0x0080 /* include in parent's auto width */ |
| | 636 | #define BannerStyleVStrut 0x0100 /* include in parent's auto height */ |
| | 637 | |
| | 638 | /* |
| | 639 | * Color codes. A color can be specified with explicit RGB |
| | 640 | * (red-green-blue) component values, or can be "parameterized," which |
| | 641 | * means that the color uses a pre-defined color for a particular purpose. |
| | 642 | * |
| | 643 | * RGB colors are specified with each component given in the range 0 to |
| | 644 | * 255; the color (0,0,0) is pure black, and (255,255,255) is pure white. |
| | 645 | * |
| | 646 | * The special value "transparent" is not a color at all, but rather |
| | 647 | * specifies that the current screen color should be used. |
| | 648 | * |
| | 649 | * The "Text" and "TextBg" colors are the current default text and text |
| | 650 | * background colors. The actual colors displayed for these values depend |
| | 651 | * on the system, and on some systems these colors might be configurable by |
| | 652 | * the user through a preferences selection. These are the same colors |
| | 653 | * selected by the HTML parameterized color names 'text' and 'bgcolor'. |
| | 654 | * |
| | 655 | * The "StatusText" and "StatusBg" colors are the current default |
| | 656 | * statusline text and background colors, which depend on the system and |
| | 657 | * may be user-configurable on some systems. These are the same colors |
| | 658 | * selected by the HTML parameterized color names 'statustext' and |
| | 659 | * 'statusbg'. |
| | 660 | * |
| | 661 | * The "input" color is the current default input text color. |
| | 662 | */ |
| | 663 | #define ColorRGB(r, g, b) \ |
| | 664 | ((((r) & 0xff) << 16) + (((g) & 0xff) << 8) + ((b) & 0xff)) |
| | 665 | #define ColorTransparent 0x01000000 |
| | 666 | #define ColorText 0x02000000 |
| | 667 | #define ColorTextBg 0x03000000 |
| | 668 | #define ColorStatusText 0x04000000 |
| | 669 | #define ColorStatusBg 0x05000000 |
| | 670 | #define ColorInput 0x06000000 |
| | 671 | |
| | 672 | /* some specific colors by name, for convenience */ |
| | 673 | #define ColorBlack ColorRGB(0x00, 0x00, 0x00) |
| | 674 | #define ColorWhite ColorRGB(0xff, 0xff, 0xff) |
| | 675 | #define ColorRed ColorRGB(0xff, 0x00, 0x00) |
| | 676 | #define ColorBlue ColorRGB(0x00, 0x00, 0xFF) |
| | 677 | #define ColorGreen ColorRGB(0x00, 0x80, 0x00) |
| | 678 | #define ColorYellow ColorRGB(0xFF, 0xFF, 0x00) |
| | 679 | #define ColorCyan ColorRGB(0x00, 0xFF, 0xFF) |
| | 680 | #define ColorAqua ColorRGB(0x00, 0xFF, 0xFF) |
| | 681 | #define ColorMagenta ColorRGB(0xFF, 0x00, 0xFF) |
| | 682 | #define ColorSilver ColorRGB(0xC0, 0xC0, 0xC0) |
| | 683 | #define ColorGray ColorRGB(0x80, 0x80, 0x80) |
| | 684 | #define ColorMaroon ColorRGB(0x80, 0x00, 0x00) |
| | 685 | #define ColorPurple ColorRGB(0x80, 0x00, 0x80) |
| | 686 | #define ColorFuchsia ColorRGB(0xFF, 0x00, 0xFF) |
| | 687 | #define ColorLime ColorRGB(0x00, 0xFF, 0x00) |
| | 688 | #define ColorOlive ColorRGB(0x80, 0x80, 0x00) |
| | 689 | #define ColorNavy ColorRGB(0x00, 0x00, 0x80) |
| | 690 | #define ColorTeal ColorRGB(0x00, 0x80, 0x80) |
| | 691 | |
| | 692 | |
| | 693 | #endif /* TADSIO_H */ |