GRASS Programmer's Manual
6.4.2(2012)
|
00001 00028 #include <stdio.h> 00029 #include <grass/vask.h> 00030 00031 00051 int V_const(void *src, int var_type, int row, int col, int length) 00052 { 00053 union target targetptr; 00054 00055 targetptr.i = src; 00056 00057 if (V__.NUM_CONST >= MAX_CONST) { 00058 V_error("Too many constants in call to V_const"); 00059 return (-1); 00060 } 00061 if ((row < 0) || (row >= MAX_LINE)) { 00062 V_error("Illegal row (%d) in call to V_const", row); 00063 return (-1); 00064 } 00065 if ((col < 0) || (col > 80)) { 00066 V_error("Illegal column (%d) in call to V_const", col); 00067 return (-1); 00068 } 00069 if ((length < 0) || ((length + col) > 80)) { 00070 V_error("Length out of bounds in call to V_const"); 00071 return (-1); 00072 } 00073 00074 if ((var_type == 's') || (var_type == 'i') || (var_type == 'f') 00075 || (var_type == 'l') || (var_type == 'd')) { 00076 V__.constant[V__.NUM_CONST].targetptr = targetptr; 00077 V__.constant[V__.NUM_CONST].var_type = var_type; 00078 V__.constant[V__.NUM_CONST].row = row; 00079 V__.constant[V__.NUM_CONST].col = col; 00080 V__.constant[V__.NUM_CONST].length = length; 00081 V__.constant[V__.NUM_CONST].decimal_places = V__.decimal_places; 00082 00083 V__.NUM_CONST++; 00084 return (0); 00085 } 00086 else { 00087 V_error("Illegal variable type in call to V_const"); 00088 return (-1); 00089 } 00090 }