/* * HEADER:100:tosubmsg:output:1:convert GRIB message to submessage and write to file X */ int f_tosubmsg(ARG1) { struct submsg *save; if (mode == -1) { *local = save = (struct submsg *) malloc( sizeof(struct submsg)); if (save == NULL) fatal_error("memory allocation tosubmsg",""); init_tosubmsg(CALL_ARG1, save); } else if (mode >= 0) { save = *local; write_tosubmsg(CALL_ARG1, save); } else if (mode == -2) { save = *local; cleanup_tosubmsg(CALL_ARG1, save); } return 0; }
/* * HEADER:100:tosubmsg:output:1:convert GRIB message to submessage and write to file X */ int f_tosubmsg(ARG1) { struct submsg *save; if (flush_mode) fatal_error("Tosubmsg: requires random access I/O, incompatible with -flush" ,""); if (mode == -1) { *local = save = (struct submsg *) malloc( sizeof(struct submsg)); if (save == NULL) fatal_error("memory allocation tosubmsg",""); init_tosubmsg(call_ARG1(inv_out,local,arg1), save); } else if (mode >= 0) { save = (struct submsg *) *local; write_tosubmsg(call_ARG1(inv_out,local,arg1), save); } else if (mode == -2) { save = (struct submsg *) *local; cleanup_tosubmsg(call_ARG1(inv_out,local,arg1), save); } return 0; }