The R Project SVN R-packages

Rev

Rev 7747 | Rev 8301 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7747 Rev 7986
Line 91... Line 91...
91
	conf.callback = R_json_basicCallback;
91
	conf.callback = R_json_basicCallback;
92
	conf.callback_ctx = &info;
92
	conf.callback_ctx = &info;
93
    } else if(func == R_NilValue)
93
    } else if(func == R_NilValue)
94
	PROTECT(ans = NEW_LIST(1));
94
	PROTECT(ans = NEW_LIST(1));
95
    else { /* You what? */
95
    else { /* You what? */
96
	PROBLEM "unhandled type of R object as handler function %d", TYPEOF(func)
96
	Rf_error("unhandled type of R object as handler function %d", TYPEOF(func));
97
	    ERROR;
-
 
98
    }
97
    }
99
 
98
 
100
 
99
 
101
    parser = new_JSON_parser(&conf);
100
    parser = new_JSON_parser(&conf);
102
 
101
 
Line 143... Line 142...
143
        }
142
        }
144
	/* fprintf(stderr, "%d) %c %u\n", count, next_char, (unsigned int) next_char);fflush(stderr); */
143
	/* fprintf(stderr, "%d) %c %u\n", count, next_char, (unsigned int) next_char);fflush(stderr); */
145
        if (!JSON_parser_char(parser, next_char)) {
144
        if (!JSON_parser_char(parser, next_char)) {
146
            delete_JSON_parser(parser);
145
            delete_JSON_parser(parser);
147
	    if(ivals) {
146
	    if(ivals) {
148
		PROBLEM "JSON parser error: syntax error, int %d (%d)\n", count, ivals[count] ERROR;
147
		Rf_error("JSON parser error: syntax error, int %d (%d)\n", count, ivals[count]);
149
	    } else {
148
	    } else {
150
		PROBLEM "JSON parser error: syntax error, byte %d (%c)\n", count, input[count] ERROR;
149
		Rf_error("JSON parser error: syntax error, byte %d (%c)\n", count, input[count]);
151
	    }
150
	    }
152
        }
151
        }
153
    }
152
    }
154
    if (!JSON_parser_done(parser)) {
153
    if (!JSON_parser_done(parser)) {
155
        delete_JSON_parser(parser);
154
        delete_JSON_parser(parser);
156
	PROBLEM "JSON parser error: syntax error, byte %d\n", count
155
	Rf_error("JSON parser error: syntax error, byte %d\n", count);
157
	ERROR;
-
 
158
    }
156
    }
159
}
157
}
160
 
158
 
161
 
159
 
162
void
160
void
Line 193... Line 191...
193
	    if (next_char <= 0) {
191
	    if (next_char <= 0) {
194
		break;
192
		break;
195
	    }
193
	    }
196
	    if (!JSON_parser_char(parser, next_char)) {
194
	    if (!JSON_parser_char(parser, next_char)) {
197
		delete_JSON_parser(parser);
195
		delete_JSON_parser(parser);
198
		PROBLEM "JSON parser error: syntax error, byte %d (%c)", totalCount, input[count]
196
		Rf_error("JSON parser error: syntax error, byte %d (%c)", totalCount, input[count]
199
		    ERROR;
197
		   );
200
	    }
198
	    }
201
	}
199
	}
202
      }
200
      }
203
      UNPROTECT(1);
201
      UNPROTECT(1);
204
 
202
 
Line 207... Line 205...
207
    }
205
    }
208
 
206
 
209
    UNPROTECT(1);
207
    UNPROTECT(1);
210
    if (!JSON_parser_done(parser)) {
208
    if (!JSON_parser_done(parser)) {
211
	delete_JSON_parser(parser);
209
	delete_JSON_parser(parser);
212
	PROBLEM "JSON parser error: syntax error, incomplete content" 
210
	Rf_error("JSON parser error: syntax error, incomplete content");
213
	    ERROR;
-
 
214
    }
211
    }
215
}
212
}
216
 
213
 
217
 
214
 
218
 
215