| gclib 307 Communications API for Galil controllers and PLCs |

All Data Structures Files Functions Variables Typedefs Macros Pages

GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload | ( | GCon | g,
|  | GCStringIn | program,
|  | GCStringIn | preprocessor
| ) |  |

Downloads a program to the controller's program buffer.

Parameters

  g | Connection's handle.
  program | Null-terminated program for download.
  preprocessor | Options string for preprocessing the program before sending it to the controller. Null allows the library to use defaults for the download. Maximum compression, only if needed, to fit the program. Code downloads at start of buffer. Compression options `--max` n provides preprocessing up to and including level n. Only the necessary preprocessing will be performed up to level n, as listed below. Level 0 (mandatory) Remove lines starting with REM. Error on \ in buffer. Comment blank lines with '. Remove white space (space/tab) in front of # (label declarations). Remove white space after commands. Remove trailing semicolons. Line ends changed to carriage return. Replace leading tabs with double space. Replace non-leading tabs with single space. Level 1 Remove unnecessary spaces. Strings, comments ('), and no-ops (NO) are not changed. Level 2 Remove comments (') but not no-ops (NO). Level 3 Remove no-ops (NO) too. Level 4 Break apart compound lines that are too long. Compact lines of code to maximize line usage. Use backtick to support long lines where applicable. `--min` n will preprocess at least up to and including n. n defined as with `--max` above. Code insertion `--insert` arg invokes the insert option of the firmware's DL command. arg can be one of the following. Line number, e.g. `100`. Program insertion will occur on the line after the line specified. Variable name, e.g. `myvar`. Program insertion will occur on the line after the line equal to the value of the variable. Label callout, e.g. `#mylabel`. Program insertion will occur on the line after the label. A lone `#` symbol. Program insertion will occur on the line after the last line in the program buffer. Important Warning. It is the user's responsibility to ensure that the code will fit in the inserted location. The preprocessor will not check line numbers when executing the `--insert` option. Compression directives `--max` and `--min` are followed. All original code following the point of insertion is cleared. Not all products support the `--insert` operation, e.g. DMC-30010. See the DL command for support.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

See x_programs.cpp for an example.

Referenced by GProgramDownloadFile().