| 142 | } |
| 143 | |
| 144 | int loadSymbol(symbolObj *s, char *symbolpath) |
| 145 | { |
| 146 | int done=MS_FALSE; |
| 147 | FILE *stream; |
| 148 | char szPath[MS_MAXPATHLEN]; |
| 149 | int file_len = 0; |
| 150 | |
| 151 | initSymbol(s); |
| 152 | |
| 153 | for(;;) { |
| 154 | switch(msyylex()) { |
| 155 | case(ANTIALIAS): |
| 156 | if((s->antialias = getSymbol(2,MS_TRUE,MS_FALSE)) == -1) |
| 157 | return(-1); |
| 158 | break; |
| 159 | case(CHARACTER): |
| 160 | if(getString(&s->character) == MS_FAILURE) return(-1); |
| 161 | break; |
| 162 | case(END): /* do some error checking */ |
| 163 | if((s->type == MS_SYMBOL_SVG) && (s->imagepath == NULL)) { |
| 164 | msSetError(MS_SYMERR, "Symbol of type SVG has no file path specified.", "loadSymbol()"); |
| 165 | return(-1); |
| 166 | } |
| 167 | if((s->type == MS_SYMBOL_PIXMAP) && (s->full_pixmap_path == NULL)) { |
| 168 | msSetError(MS_SYMERR, "Symbol of type PIXMAP has no image data.", "loadSymbol()"); |
| 169 | return(-1); |
| 170 | } |
| 171 | if(((s->type == MS_SYMBOL_ELLIPSE) || (s->type == MS_SYMBOL_VECTOR)) && (s->numpoints == 0)) { |
| 172 | msSetError(MS_SYMERR, "Symbol of type VECTOR or ELLIPSE has no point data.", "loadSymbol()"); |
| 173 | return(-1); |
| 174 | } |
| 175 | |
| 176 | return(0); |
| 177 | break; |
| 178 | case(EOF): |
| 179 | msSetError(MS_EOFERR, NULL, "loadSymbol()"); |
| 180 | return(-1); |
| 181 | break; |
| 182 | case(FILLED): |
| 183 | if((s->filled = getSymbol(2,MS_TRUE,MS_FALSE)) == -1) |
| 184 | return(-1); |
| 185 | break; |
| 186 | case(FONT): |
| 187 | if(getString(&s->font) == MS_FAILURE) return(-1); |
| 188 | break; |
| 189 | case(IMAGE): |
| 190 | if(msyylex() != MS_STRING) { /* get image location from next token */ |
| 191 | msSetError(MS_TYPEERR, "Parsing error near (%s):(line %d)", "loadSymbol()", msyystring_buffer, msyylineno); |
| 192 | return(-1); |
| 193 | } |
| 194 | s->full_pixmap_path = msStrdup(msBuildPath(szPath, symbolpath, msyystring_buffer)); |
| 195 | |
| 196 | /* Set imagepath */ |
| 197 | s->imagepath = msStrdup(msyystring_buffer); |
| 198 | |
| 199 | /* if this is SVG, load the SVG and |
| 200 | punt if this is for a SVG symbol */ |
| 201 | if(s->type == MS_SYMBOL_SVG) { |
no test coverage detected