/** * Calculates contributions to partial derivatives of LL function wrt * each of the model parameters for current data bin. Contributions are * added to totals in provided deriv argument. */ static void calc_deriv(BkgdEvoMdlParam *ll_deriv, BkgdEvoMdlConfig *conf, const BkgdEvoMdlParam *param, const BkgdBin *bin) { Branch *br; ColType *cltype; int i; double coef; /* calculate branch length and branch substitution probability * partial derivatives */ for(i = 0; i < conf->n_branch; i++) { br = &conf->branches[i]; br->set_dlen(br, bin, param); branch_set_dprob(br, bin, param, conf); } /* calculate column probability partial derivatives */ for(i = 0; i < conf->n_cltype; i++) { cltype = conf->cltypes[i]; if(cltype->subst_type == SUBST_TYPE_CONSERVED) { /* only do columns with substitutions in first step */ continue; } cltype_set_dprob(cltype, param, conf); if(cltype->n > 0) { /* add contribution to LL partial derivs */ coef = cltype->n / cltype->prob; if(isnan(coef)) { fprintf(stderr, "nan coef, cltype->name=%s, cltype->n=%ld, " "cltype->prob=%g\n",cltype->name, cltype->n, cltype->prob); } param_add(&cltype->dprob, coef, ll_deriv); } } /* now conserved column */ if(conf->cons_cltype != NULL) { cltype = conf->cons_cltype; cltype_cons_set_dprob(cltype, param, conf); if(cltype->n) { /* add contribution to LL partial derivs */ coef = cltype->n / cltype->prob; param_add(&cltype->dprob, coef, ll_deriv); } } return; }
static pjsip_uri *create_uri17(pj_pool_t *pool) { /* "sip:host;user=ip;" PARAM_CHAR "%21=" PARAM_CHAR "%21;lr;other=1;transport=sctp;other2" */ pjsip_sip_uri *url; url = pjsip_sip_uri_create(pool, 0); pj_strdup2(pool, &url->host, "host"); pj_strdup2(pool, &url->user_param, "ip"); pj_strdup2(pool, &url->transport_param, "sctp"); param_add(url->other_param, PARAM_CHAR "!", PARAM_CHAR "!"); param_add(url->other_param, "other", "1"); param_add(url->other_param, "other2", ""); url->lr_param = 1; return (pjsip_uri*)url; }
static pjsip_uri *create_uri13(pj_pool_t *pool) { /* "sip:localhost;pvalue=\"hello world\"" */ pjsip_sip_uri *url; url = pjsip_sip_uri_create(pool, 0); pj_strdup2(pool, &url->host, "localhost"); //pj_strdup2(pool, &url->other_param, ";pvalue=\"hello world\""); param_add(url->other_param, "pvalue", "\"hello world\""); return (pjsip_uri*)url; }
static pjsip_uri *create_uri5(pj_pool_t *pool) { /* "sip:localhost;pickup=hurry;user=phone;message=I%20am%20sorry" "?Subject=Hello%20There&Server=SIP%20Server" */ pjsip_sip_uri *url = pjsip_sip_uri_create(pool, 0); pj_strdup2(pool, &url->host, "localhost"); pj_strdup2(pool, &url->user_param, "phone"); //pj_strdup2(pool, &url->other_param, ";pickup=hurry;message=I%20am%20sorry"); param_add(url->other_param, "pickup", "hurry"); param_add(url->other_param, "message", "I am sorry"); //pj_strdup2(pool, &url->header_param, "?Subject=Hello%20There&Server=SIP%20Server"); param_add(url->header_param, "Subject", "Hello There"); param_add(url->header_param, "Server", "SIP Server"); return (pjsip_uri*)url; }
static void st_Param_Pre(TreeNode* Param){ base_record r = search_the_symtab(cur_symtab, Param->child[0]->attr.name); if(r==NULL){ r = symtab_push_record(Param,"parameter"); param_add(r); }else{ Error=TRUE; printf("Line %d : %s is already declared in this scope\n",Param->lineno,Param->child[0]->attr.name); } TreeNode* IdK = Param->child[0]; IdK->IdK_exception=1; }
int main(int argc, char *argv[]) { int rc = 0; volatile int disassemble = 0; volatile int flags = 0; volatile int opened = 0; char outfname[1044]; FILE * volatile out = stdout; struct param_state *params = NULL; param_init(¶ms); if ((rc = setjmp(errbuf))) { if (rc == DISPLAY_USAGE) usage(argv[0]); if (opened && out) // Technically there is a race condition here ; we would like to be // able to remove a file by a stream connected to it, but there is // apparently no portable way to do this. remove(outfname); return EXIT_FAILURE; } const struct format *f = &tenyr_asm_formats[0]; int ch; while ((ch = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) { switch (ch) { case 'd': disassemble = 1; break; case 'f': if (find_format(optarg, &f)) usage(argv[0]), exit(EXIT_FAILURE); break; case 'o': out = fopen(strncpy(outfname, optarg, sizeof outfname - 1), "wb"); opened = 1; break; case 'p': param_add(params, optarg); break; case 'q': flags |= ASM_QUIET; break; case 'v': flags |= ASM_VERBOSE; break; case 'V': puts(version()); return EXIT_SUCCESS; case 'h': usage(argv[0]); return EXIT_FAILURE; default: usage(argv[0]); return EXIT_FAILURE; } } if (optind >= argc) fatal(DISPLAY_USAGE, "No input files specified on the command line"); #if _WIN32 if (!disassemble) // ensure we are in binary mode on Windows if (out == stdout && setmode(1, O_BINARY) == -1) fatal(0, "Failed to set binary mode on stdout ; use -ofilename to avoid corrupted binaries."); #endif for (int i = optind; i < argc; i++) { FILE *in = NULL; if (!out) fatal(PRINT_ERRNO, "Failed to open output file"); if (!strcmp(argv[i], "-")) { in = stdin; } else { in = fopen(argv[i], "rb"); if (!in) fatal(PRINT_ERRNO, "Failed to open input file `%s'", argv[i]); } param_set(params, "assembling", (int[]){ !disassemble }, 1, false, false); void *ud = NULL; FILE *stream = disassemble ? in : out; if (f->init) if (f->init(stream, params, &ud)) fatal(0, "Error during initialisation for format '%s'", f->name); if (disassemble) { // This output might be consumed by a tool that needs a line at a time setvbuf(out, NULL, _IOLBF, 0); if (f->in) { rc = do_disassembly(in, out, f, ud, flags); } else { fatal(0, "Format `%s' does not support disassembly", f->name); } } else { if (f->out) { rc = do_assembly(in, out, f, ud); } else { fatal(0, "Format `%s' does not support assembly", f->name); } } if (!rc && f->emit) rc |= f->emit(stream, &ud); else if (rc) remove(outfname); // race condition ? if (f->fini) rc |= f->fini(stream, &ud); fflush(out); fclose(in); }