* Prints the given arguments to stdout */
| 256 | * Prints the given arguments to stdout |
| 257 | */ |
| 258 | duk_ret_t Macro::internalPrintln(duk_context *context) { |
| 259 | std::string str; |
| 260 | duk_idx_t numArgs = duk_get_top(context); |
| 261 | for( int i = 0; i < numArgs; ++i ) { |
| 262 | if( duk_get_type(context, i) == DUK_TYPE_STRING ) { |
| 263 | str = duk_safe_to_string(context, i); |
| 264 | } else if( duk_get_type(context, i) == DUK_TYPE_NUMBER ) { |
| 265 | str = std::to_string(duk_to_number(context, i)); |
| 266 | str.erase(str.find_last_not_of("0")+1); |
| 267 | str.erase(str.find_last_not_of(".")+1); |
| 268 | } else { |
| 269 | str = ""; |
| 270 | } |
| 271 | printf("%s\n", str.c_str()); fflush(stdout); |
| 272 | } |
| 273 | return 0; |
| 274 | } |
| 275 | |
| 276 | |
| 277 | void Macro::fatalErrorHandler(void *, const char *) { |
nothing calls this directly
no test coverage detected