15#ifndef G_OMIT_GSETUPDDOWNLOADFILE
81 if (
node == 0)
return;
165 if (
head->count == 0)
216 while ((
node->data[
node->index] !=
'\r')
281 if (
c ==
',' ||
c ==
'\r')
309 if ((
c ==
',') || (
c ==
'\r'))
346 if (
c > 31 &&
c < 127)
373 if ((
int)
arr[
i] == index)
445 if ((
c !=
' ') && (
c !=
'\r') && (
c !=
'\n') && !
bracket)
450 if ((
c ==
' ') || (
c ==
'\r') || (
i ==
bytes - 1))
475#ifndef G_OMIT_GSETUPDDOWNLOADFILE
535 for (
i = 1;
i < 7;
i++)
537 if (
i == 1 ||
i == 3)
545 rc += (1 << (
i - 1));
558 for (
i = 0;
i < len;
i++)
GReturn H_DownloadArraysFromList(GCon g, ArrayNode *head, int fail)
Walks through the array linked list, downloading each.
void H_InitArrayNode(ArrayNode *node)
Function to initialize the memory of a new node.
GReturn H_ArrayDownloadFromMemory(GCon g, const char *array_data, int fail)
Helper function to download a block of arrays to the controller.
void H_FreeArrays(ArrayNode *node)
Frees all memory downstream of node. After passing list head to this function, all memory is freed an...
GReturn H_WriteArrayCsv(ArrayNode *head, GCStringIn file_path)
After filling the array list, this function is called to write out the CSV.
GReturn H_CreateArrayNode(ArrayNode *head, char *name)
Creates a buffer on the heap to write data, and adds it to the linked list.
char * H_FindSector(char *arr, int arr_size, int index)
Function that returns a pointer to the start of the specified sector in the GCB data.
GReturn H_AddArray(ArrayNode *head, char *name, char *data)
Add an ArrayData node to the linked list.
GReturn H_DownloadData(GCon g, const char *data, int fail)
Helper function to send a string of commands to the controller, one at at time.
GReturn H_UploadArrayToList(GCon g, ArrayNode *head, char *name)
Uploads a particular array and adds it to the linked list.
GReturn H_ArrayAddElement(ArrayNode *node, GCStringIn element)
Adds an array element to an array node.
#define G_BAD_RESPONSE_QUESTION_MARK
Operation received a ?, indicating controller has a TC error.
GCLIB_DLL_EXPORTED GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response, GSize response_len, GCStringOut *front)
Wrapper around GCommand that trims the response.
#define G_CR
For GArrayUpload(), use this value in the delim field to delimit with carriage returns.
GReturn GCALL GArrayDownloadFile(GCon g, GCStringIn file_path)
Array download from file.
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
GReturn GCALL GArrayUploadFile(GCon g, GCStringIn file_path, GCStringIn names)
Array upload to file.
int GOption
Option integer for various formatting, etc.
GReturn GCALL GSetupDownloadFile(GCon g, GCStringIn file_path, GOption options, GCStringOut info, GSize info_len)
Download a saved controller configuration from a file.
#define G_NO_ERROR
Return value if function succeeded.
#define G_BOUNDS
For functions that take range options, e.g. GArrayUpload(), use this value for full range.
#define G_BAD_FULL_MEMORY
Not enough memory for an operation, e.g. all connections allowed for a process already taken.
unsigned int GSize
Size of buffers, etc.
#define GCALL
Specify calling convention for Windows.
GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownload(GCon g, const GCStringIn array_name, GOption first, GOption last, GCStringIn buffer)
Downloads array data to a pre-dimensioned array in the controller's array table.
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
#define G_BAD_FILE
Bad file path, bad file contents, or bad write.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload(GCon g, GCStringIn program, GCStringIn preprocessor)
Downloads a program to the controller's program buffer.
char * GCStringOut
C-string output from the library. Implies null-termination.
const char * GCStringIn
C-string input to the library. Implies null-termination.
GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
GCLIB_DLL_EXPORTED GReturn GCALL GArrayUpload(GCon g, const GCStringIn array_name, GOption first, GOption last, GOption delim, GBufOut buffer, GSize buffer_len)
Uploads array data from the controller's array table.
#define MAXARRAY
Maximum size for an array table upload.
void e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.
GReturn vector(GCon g, char *file)
Puts controller into Vector Mode and accepts a file defining vector points.
Structure to create a linked list for array data.