int CLuaTaskDefs::getTaskParameter ( lua_State* luaVM ) { // string getTaskParameter ( taskinstance task, string key ) // returns a string or false on failure // Verify types if ( argtype ( 1, LUA_TTABLE ) && argtype ( 2, LUA_TSTRING ) ) { // Read out the task data CClientTask Task ( m_pManager ); if ( Task.Read ( luaVM, 1, true ) ) { // Read out the key string const char* szKey = lua_tostring ( luaVM, 2 ); // Grab the parameter CLuaArgument* pValue = Task.GetParameter ( szKey ); if ( pValue ) { // Return it pValue->Push ( luaVM ); return 1; } } } // Failed lua_pushboolean ( luaVM, false ); return 1; }
int CLuaTaskDefs::createTaskInstance ( lua_State* luaVM ) { // taskinstance createTaskInstance ( string taskname, table parameters ) // returns taskinstance or false on failure // Verify types if ( argtype ( 1, LUA_TSTRING ) && argtype ( 2, LUA_TTABLE ) ) { // Grab the task name CClientTask Task ( m_pManager ); const char* szTaskName = lua_tostring ( luaVM, 1 ); Task.SetTaskName ( szTaskName ); // Generate an unique identifier Task.SetUniqueIdentifier ( CClientTask::GenerateUniqueIdentifier () ); // Read out the task parameters if ( Task.ReadParameters ( luaVM, 2, true ) ) { // Just return the task data as a table lua_newtable ( luaVM ); Task.Write ( luaVM, -1 ); return 1; } } // Failed lua_pushboolean ( luaVM, false ); return 1; }
int CLuaTaskDefs::setTaskParameters ( lua_State* luaVM ) { // bool setTaskParameters ( taskinstance task, table newparameters ) // returns true on success or false on failure // Verify types if ( argtype ( 1, LUA_TTABLE ) && argtype ( 2, LUA_TTABLE ) ) { // Read out the task data CClientTask Task ( m_pManager ); if ( Task.Read ( luaVM, 1, true ) ) { // Read the new parameters into it in addition to the old Task.ReadParameters ( luaVM, 2, false ); // Write them back to the table Task.Write ( luaVM, 1 ); // Success lua_pushboolean ( luaVM, true ); return 1; } } // Failed lua_pushboolean ( luaVM, false ); return 1; }
int CLuaTaskDefs::setPlayerTask ( lua_State* luaVM ) { // bool setPlayerTask ( ped thePed, taskinstance task ) // returns true on success or false on failure // Verify types if ( argtype ( 1, LUA_TLIGHTUSERDATA ) && argtype ( 2, LUA_TTABLE ) ) { // Grab the player // TODO: Support peds too CClientEntity* pEntity = lua_toelement ( luaVM, 1 ); if ( pEntity ) { // Player? if ( pEntity->GetType () == CCLIENTPLAYER ) { // Grab the player CClientPlayer* pPlayer = static_cast < CClientPlayer* > ( pEntity ); // Read out the task data CClientTask Task ( m_pManager ); if ( Task.Read ( luaVM, 2, true ) ) { // Apply it on the player bool bSuccess = Task.ApplyTask ( *pPlayer ); // Success lua_pushboolean ( luaVM, bSuccess ); return 1; } } } } // Failed lua_pushboolean ( luaVM, false ); return 1; }
int CLuaTaskDefs::getTaskName ( lua_State* luaVM ) { // string getTaskName ( taskinstance task ) // returns a string or false on failure // Verify types if ( argtype ( 1, LUA_TTABLE ) ) { // Read out the task data CClientTask Task ( m_pManager ); if ( Task.Read ( luaVM, 1, true ) ) { // Return it lua_pushstring ( luaVM, Task.GetTaskName () ); return 1; } } // Failed lua_pushboolean ( luaVM, false ); return 1; }
int CLuaTaskDefs::getTaskParameters ( lua_State* luaVM ) { // table getTaskParameters ( taskinstance task ) // returns a table or false on failure // Verify types if ( argtype ( 1, LUA_TTABLE ) ) { // Read out the task data CClientTask Task ( m_pManager ); if ( Task.Read ( luaVM, 1, true ) ) { // Write the parameters and return lua_newtable ( luaVM ); Task.WriteParameters ( luaVM, -1 ); return 1; } } // Failed lua_pushboolean ( luaVM, false ); return 1; }
int main(){ FILE* file=NULL; FILE* file2=NULL; file=fopen(INPUT_FILE,"r+"); if (file==NULL){ printf("ERROR: unexistant file\n"); exit(1); } //totalline = nombre de lignes int totalline = countLines(file); //creation du tableau Label* label_tab = createLabelTab(totalline); fclose(file); //remplissage du tableau des etiquettes file=fopen(INPUT_FILE,"r+"); fillLabelTab(file, label_tab); fclose(file); //creation fichier a exporter file=fopen(INPUT_FILE,"r+"); file2=fopen("out.txt","w"); char str[T_MAX]; char *word; //mot a transformer en nombre avec la fonction instrucstions char *arg; //argument de type chaine de caracteres char *useless; //pour ignorer les etiquettes lors de la traduction int argint; //argument de type entier while(fgets(str,T_MAX,file)) { line_n++; //Evite l'etiquette a la traduction et met l'instruction dans word if (strstr(str, ":") != NULL) { useless = strtok(str, " \t\r\n:"); //met l'etiquette de cote word = strtok(NULL, " \t\r\n"); //prend la suite (jusqu'a " \t\r\n") et le met dans word } else { word = strtok(str, " \t\r\n"); } //Met l'argument dans arg arg = strtok(NULL, " \t\r\n:"); //Teste les types d'arguments attendus et le change en entier //On attend aucun argument if (argtype(word) == 0) { if(arg != NULL) { printf("ERROR: too many arguments to function ‘%s’ at line %d\n", word, line_n); exit(1); } argint = 0; } //On attend un nombre else if (argtype(word) == 1) { if (arg == NULL) { printf("ERROR: too few arguments to function ‘%s’ at line %d\n", word, line_n); exit(1); } else if (is_int(arg) == 0) { printf("ERROR: expected ‘int’ argument to function ‘%s’ at line %d\n", word, line_n); exit(1); } else if (strtok(NULL, " \t\r\n") != NULL) { printf("ERROR: too many arguments to function ‘%s’ at line %d\n", word, line_n); exit(1); } argint = atoi(arg); } //On attend une etiquette else if (argtype(word) == 2) { if (arg == NULL) { printf("ERROR: too few arguments to function ‘%s’ at line %d\n", word, line_n); exit(1); } else if (is_int(arg) == 1) { printf("ERROR: expected ‘char *’ but argument is of type ‘int’ at line %d\n", line_n); exit(1); } else if (strtok(NULL, " \t\r\n") != NULL) { printf("ERROR: too many arguments to function ‘%s’ at line %d\n", word, line_n); exit(1); } argint = findLabel(arg, label_tab) - line_n; //difference entre la position actuelle et de l'etiquette } //printf de verification //printf("instruction : %s // argument : %s\n", word, arg); //printf("code intruction : %02X // arg = %08X \n\n",instructions(word), argint); //ecriture sur le fichier de sortie file2 fprintf(file2,"%02X %08X\n",instructions(word), argint); } fclose(file); fclose(file2); free(label_tab); //Liberation de la memoire printf("It's OKAY !! :D"); return 0; }
/* * convert switch of the form * switch v := i.(type) { case t1: ..; case t2: ..; } * into if statements */ static void typeswitch(Node *sw) { Node *def; NodeList *cas, *hash; Node *a, *n; Case *c, *c0, *c1; int ncase; Type *t; Val v; if(sw->ntest == nil) return; if(sw->ntest->right == nil) { setlineno(sw); yyerror("type switch must have an assignment"); return; } walkexpr(&sw->ntest->right, &sw->ninit); if(!istype(sw->ntest->right->type, TINTER)) { yyerror("type switch must be on an interface"); return; } cas = nil; /* * predeclare temporary variables * and the boolean var */ facename = temp(sw->ntest->right->type); a = nod(OAS, facename, sw->ntest->right); typecheck(&a, Etop); cas = list(cas, a); casebody(sw, facename); boolname = temp(types[TBOOL]); typecheck(&boolname, Erv); hashname = temp(types[TUINT32]); typecheck(&hashname, Erv); t = sw->ntest->right->type; if(isnilinter(t)) a = syslook("efacethash", 1); else a = syslook("ifacethash", 1); argtype(a, t); a = nod(OCALL, a, N); a->list = list1(facename); a = nod(OAS, hashname, a); typecheck(&a, Etop); cas = list(cas, a); c0 = mkcaselist(sw, Stype); if(c0 != C && c0->type == Tdefault) { def = c0->node->right; c0 = c0->link; } else { def = nod(OBREAK, N, N); } /* * insert if statement into each case block */ for(c=c0; c!=C; c=c->link) { n = c->node; switch(c->type) { case Ttypenil: v.ctype = CTNIL; a = nod(OIF, N, N); a->ntest = nod(OEQ, facename, nodlit(v)); typecheck(&a->ntest, Erv); a->nbody = list1(n->right); // if i==nil { goto l } n->right = a; break; case Ttypevar: case Ttypeconst: n->right = typeone(n); break; } } /* * generate list of if statements, binary search for constant sequences */ while(c0 != C) { if(c0->type != Ttypeconst) { n = c0->node; cas = list(cas, n->right); c0=c0->link; continue; } // identify run of constants c1 = c = c0; while(c->link!=C && c->link->type==Ttypeconst) c = c->link; c0 = c->link; c->link = nil; // sort by hash c1 = csort(c1, typecmp); // for debugging: linear search if(0) { for(c=c1; c!=C; c=c->link) { n = c->node; cas = list(cas, n->right); } continue; } // combine adjacent cases with the same hash ncase = 0; for(c=c1; c!=C; c=c->link) { ncase++; hash = list1(c->node->right); while(c->link != C && c->link->hash == c->hash) { hash = list(hash, c->link->node->right); c->link = c->link->link; } c->node->right = liststmt(hash); } // binary search among cases to narrow by hash cas = list(cas, typebsw(c1, ncase)); } if(nerrors == 0) { cas = list(cas, def); sw->nbody = concat(cas, sw->nbody); sw->list = nil; walkstmtlist(sw->nbody); } }
/* * convert switch of the form * switch v := i.(type) { case t1: ..; case t2: ..; } * into if statements */ void typeswitch(Node *sw) { Node *def; NodeList *cas; Node *a; Case *c, *c0, *c1; int ncase; Type *t; if(sw->ntest == nil) return; if(sw->ntest->right == nil) { setlineno(sw); yyerror("type switch must have an assignment"); return; } walkexpr(&sw->ntest->right, &sw->ninit); if(!istype(sw->ntest->right->type, TINTER)) { yyerror("type switch must be on an interface"); return; } cas = nil; /* * predeclare temporary variables * and the boolean var */ facename = nod(OXXX, N, N); tempname(facename, sw->ntest->right->type); a = nod(OAS, facename, sw->ntest->right); typecheck(&a, Etop); cas = list(cas, a); casebody(sw, facename); boolname = nod(OXXX, N, N); tempname(boolname, types[TBOOL]); typecheck(&boolname, Erv); hashname = nod(OXXX, N, N); tempname(hashname, types[TUINT32]); typecheck(&hashname, Erv); t = sw->ntest->right->type; if(isnilinter(t)) a = syslook("efacethash", 1); else a = syslook("ifacethash", 1); argtype(a, t); a = nod(OCALL, a, N); a->list = list1(facename); a = nod(OAS, hashname, a); typecheck(&a, Etop); cas = list(cas, a); c0 = mkcaselist(sw, Stype); if(c0 != C && c0->type == Tdefault) { def = c0->node->right; c0 = c0->link; } else { def = nod(OBREAK, N, N); } loop: if(c0 == C) { cas = list(cas, def); sw->nbody = concat(cas, sw->nbody); sw->list = nil; walkstmtlist(sw->nbody); return; } // deal with the variables one-at-a-time if(c0->type != Ttypeconst) { a = typebsw(c0, 1); cas = list(cas, a); c0 = c0->link; goto loop; } // do binary search on run of constants ncase = 1; for(c=c0; c->link!=C; c=c->link) { if(c->link->type != Ttypeconst) break; ncase++; } // break the chain at the count c1 = c->link; c->link = C; // sort and compile constants c0 = csort(c0, typecmp); a = typebsw(c0, ncase); cas = list(cas, a); c0 = c1; goto loop; }
void walkrange(Node *n) { Node *ohv1, *hv1, *hv2; // hidden (old) val 1, 2 Node *ha, *hit; // hidden aggregate, iterator Node *hn, *hp; // hidden len, pointer Node *hb; // hidden bool Node *a, *v1, *v2; // not hidden aggregate, val 1, 2 Node *fn, *tmp; NodeList *body, *init; Type *th, *t; int lno; t = n->type; init = nil; a = n->right; lno = setlineno(a); if(t->etype == TSTRING && !eqtype(t, types[TSTRING])) { a = nod(OCONV, n->right, N); a->type = types[TSTRING]; } v1 = n->list->n; v2 = N; if(n->list->next) v2 = n->list->next->n; hv2 = N; if(v2 == N && t->etype == TARRAY) { // will have just one reference to argument. // no need to make a potentially expensive copy. ha = a; } else { ha = temp(a->type); init = list(init, nod(OAS, ha, a)); } switch(t->etype) { default: fatal("walkrange"); case TARRAY: hv1 = temp(types[TINT]); hn = temp(types[TINT]); hp = nil; init = list(init, nod(OAS, hv1, N)); init = list(init, nod(OAS, hn, nod(OLEN, ha, N))); if(v2) { hp = temp(ptrto(n->type->type)); tmp = nod(OINDEX, ha, nodintconst(0)); tmp->etype = 1; // no bounds check init = list(init, nod(OAS, hp, nod(OADDR, tmp, N))); } n->ntest = nod(OLT, hv1, hn); n->nincr = nod(OASOP, hv1, nodintconst(1)); n->nincr->etype = OADD; if(v2 == N) body = list1(nod(OAS, v1, hv1)); else { a = nod(OAS2, N, N); a->list = list(list1(v1), v2); a->rlist = list(list1(hv1), nod(OIND, hp, N)); body = list1(a); tmp = nod(OADD, hp, nodintconst(t->type->width)); tmp->type = hp->type; tmp->typecheck = 1; tmp->right->type = types[tptr]; tmp->right->typecheck = 1; body = list(body, nod(OAS, hp, tmp)); } break; case TMAP: th = typ(TARRAY); th->type = ptrto(types[TUINT8]); // see ../../pkg/runtime/hashmap.h:/hash_iter // Size in words. th->bound = 5 + 4*3 + 4*4/widthptr; hit = temp(th); fn = syslook("mapiterinit", 1); argtype(fn, t->down); argtype(fn, t->type); argtype(fn, th); init = list(init, mkcall1(fn, T, nil, typename(t), ha, nod(OADDR, hit, N))); n->ntest = nod(ONE, nod(OINDEX, hit, nodintconst(0)), nodnil()); fn = syslook("mapiternext", 1); argtype(fn, th); n->nincr = mkcall1(fn, T, nil, nod(OADDR, hit, N)); if(v2 == N) { fn = syslook("mapiter1", 1); argtype(fn, th); argtype(fn, t->down); a = nod(OAS, v1, mkcall1(fn, t->down, nil, nod(OADDR, hit, N))); } else { fn = syslook("mapiter2", 1); argtype(fn, th); argtype(fn, t->down); argtype(fn, t->type); a = nod(OAS2, N, N); a->list = list(list1(v1), v2); a->rlist = list1(mkcall1(fn, getoutargx(fn->type), nil, nod(OADDR, hit, N))); } body = list1(a); break; case TCHAN: hv1 = temp(t->type); hb = temp(types[TBOOL]); n->ntest = nod(ONE, hb, nodbool(0)); a = nod(OAS2RECV, N, N); a->typecheck = 1; a->list = list(list1(hv1), hb); a->rlist = list1(nod(ORECV, ha, N)); n->ntest->ninit = list1(a); body = list1(nod(OAS, v1, hv1)); break; case TSTRING: ohv1 = temp(types[TINT]); hv1 = temp(types[TINT]); init = list(init, nod(OAS, hv1, N)); if(v2 == N) a = nod(OAS, hv1, mkcall("stringiter", types[TINT], nil, ha, hv1)); else { hv2 = temp(runetype); a = nod(OAS2, N, N); a->list = list(list1(hv1), hv2); fn = syslook("stringiter2", 0); a->rlist = list1(mkcall1(fn, getoutargx(fn->type), nil, ha, hv1)); } n->ntest = nod(ONE, hv1, nodintconst(0)); n->ntest->ninit = list(list1(nod(OAS, ohv1, hv1)), a); body = list1(nod(OAS, v1, ohv1)); if(v2 != N) body = list(body, nod(OAS, v2, hv2)); break; } n->op = OFOR; typechecklist(init, Etop); n->ninit = concat(n->ninit, init); typechecklist(n->ntest->ninit, Etop); typecheck(&n->ntest, Erv); typecheck(&n->nincr, Etop); typechecklist(body, Etop); n->nbody = concat(body, n->nbody); walkstmt(&n); lineno = lno; }
parameters loadparam(int argc, char **arg) { int i; parameters params; params.loadfile = -1; params.savedfile = -1; params.exportfile = -1; params.method = 0; params.inputfile = -1; params.debug = 0; params.errorcnt = 0; params.queryid = 0; params.timeout = 0; params.sigmoid_slope = 1.0; params.online = 0; params.maxbufsize = 0; params.ppid = NULL; params.error = (int *)malloc(argc * sizeof(int)); for (i = 1; i < argc; i++) { switch (argtype(arg[i])) { case 0: if (argc > i + 1) { i++; params.loadfile = i; } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 2: if (argc > i + 1) { i++; params.exportfile = i; } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 3: if (argc > i + 1) { i++; params.method = i; } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 4: if (argc > i + 1) { i++; params.inputfile = i; } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 5: printhelp(argc, arg); break; case 6: params.debug = 1; break; case 7: if (argc > i + 1) { i++; params.queryid = i; } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 8: if ((argc > i + 1) && (IsPosNumber(arg[i + 1]))) { i++; params.timeout = atoi(arg[i]); } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 9: if (argc > i + 1) { i++; params.savedfile = i; } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 10: if ((argc > i + 1) && (IsRealNumber(arg[i + 1]))) { i++; params.sigmoid_slope = atof(arg[i]); } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 11: params.online = 1; break; case 12: if ((argc > i + 1) && (IsPosNumber(arg[i + 1]))) { i++; params.maxbufsize = atoi(arg[i]); } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; case 13: if ((argc > i + 1) && (IsPosNumber(arg[i + 1]))) { i++; params.ppid = (char *)malloc(sizeof(char) * (strlen(arg[i]) + 1)); strcpy(params.ppid, arg[i]); } else { params.error[params.errorcnt] = i; params.errorcnt++; } break; default: params.error[params.errorcnt] = i; params.errorcnt++; break; } } return params; }
void walkrange(Node *n) { Node *ohv1, *hv1, *hv2; // hidden (old) val 1, 2 Node *ha, *hit; // hidden aggregate, iterator Node *a, *v1, *v2; // not hidden aggregate, val 1, 2 Node *fn; NodeList *body, *init; Type *th, *t; t = n->type; init = nil; a = n->right; if(t->etype == TSTRING && !eqtype(t, types[TSTRING])) { a = nod(OCONV, n->right, N); a->type = types[TSTRING]; } ha = nod(OXXX, N, N); tempname(ha, a->type); init = list(init, nod(OAS, ha, a)); v1 = n->list->n; hv1 = N; v2 = N; if(n->list->next) v2 = n->list->next->n; hv2 = N; switch(t->etype) { default: fatal("walkrange"); case TARRAY: hv1 = nod(OXXX, N, n); tempname(hv1, types[TINT]); init = list(init, nod(OAS, hv1, N)); n->ntest = nod(OLT, hv1, nod(OLEN, ha, N)); n->nincr = nod(OASOP, hv1, nodintconst(1)); n->nincr->etype = OADD; body = list1(nod(OAS, v1, hv1)); if(v2) body = list(body, nod(OAS, v2, nod(OINDEX, ha, hv1))); break; case TMAP: th = typ(TARRAY); th->type = ptrto(types[TUINT8]); th->bound = (sizeof(struct Hiter) + widthptr - 1) / widthptr; hit = nod(OXXX, N, N); tempname(hit, th); fn = syslook("mapiterinit", 1); argtype(fn, t->down); argtype(fn, t->type); argtype(fn, th); init = list(init, mkcall1(fn, T, nil, ha, nod(OADDR, hit, N))); n->ntest = nod(ONE, nod(OINDEX, hit, nodintconst(0)), nodnil()); fn = syslook("mapiternext", 1); argtype(fn, th); n->nincr = mkcall1(fn, T, nil, nod(OADDR, hit, N)); if(v2 == N) { fn = syslook("mapiter1", 1); argtype(fn, th); argtype(fn, t->down); a = nod(OAS, v1, mkcall1(fn, t->down, nil, nod(OADDR, hit, N))); } else { fn = syslook("mapiter2", 1); argtype(fn, th); argtype(fn, t->down); argtype(fn, t->type); a = nod(OAS2, N, N); a->list = list(list1(v1), v2); a->rlist = list1(mkcall1(fn, getoutargx(fn->type), nil, nod(OADDR, hit, N))); } body = list1(a); break; case TCHAN: hv1 = nod(OXXX, N, n); tempname(hv1, t->type); n->ntest = nod(ONOT, nod(OCLOSED, ha, N), N); n->ntest->ninit = list1(nod(OAS, hv1, nod(ORECV, ha, N))); body = list1(nod(OAS, v1, hv1)); break; case TSTRING: ohv1 = nod(OXXX, N, N); tempname(ohv1, types[TINT]); hv1 = nod(OXXX, N, N); tempname(hv1, types[TINT]); init = list(init, nod(OAS, hv1, N)); if(v2 == N) a = nod(OAS, hv1, mkcall("stringiter", types[TINT], nil, ha, hv1)); else { hv2 = nod(OXXX, N, N); tempname(hv2, types[TINT]); a = nod(OAS2, N, N); a->list = list(list1(hv1), hv2); fn = syslook("stringiter2", 0); a->rlist = list1(mkcall1(fn, getoutargx(fn->type), nil, ha, hv1)); } n->ntest = nod(ONE, hv1, nodintconst(0)); n->ntest->ninit = list(list1(nod(OAS, ohv1, hv1)), a); body = list1(nod(OAS, v1, ohv1)); if(v2 != N) body = list(body, nod(OAS, v2, hv2)); break; } n->op = OFOR; typechecklist(init, Etop); n->ninit = concat(n->ninit, init); typechecklist(n->ntest->ninit, Etop); typecheck(&n->ntest, Erv); typecheck(&n->nincr, Etop); typechecklist(body, Etop); n->nbody = concat(body, n->nbody); walkstmt(&n); }
int optparse(struct optparse *options, const char *optstring) { options->errmsg[0] = '\0'; options->optopt = 0; options->optarg = 0; char *option = options->argv[options->optind]; if (option == 0) { return -1; } else if (is_dashdash(option)) { options->optind++; /* consume "--" */ return -1; } else if (!is_shortopt(option)) { if (options->permute) { int index = options->optind; options->optind++; int r = optparse(options, optstring); permute(options, index); options->optind--; return r; } else { return -1; } } option += options->subopt + 1; options->optopt = option[0]; int type = argtype(optstring, option[0]); char *next = options->argv[options->optind + 1]; switch (type) { case -1: { options->optind++; char str[2] = {option[0]}; return opterror(options, MSG_INVALID, str); } case OPTPARSE_NONE: if (option[1]) { options->subopt++; } else { options->subopt = 0; options->optind++; } return option[0]; case OPTPARSE_REQUIRED: options->subopt = 0; options->optind++; if (option[1]) { options->optarg = option + 1; } else if (next != 0) { options->optarg = next; options->optind++; } else { options->optarg = 0; char str[2] = {option[0]}; return opterror(options, MSG_MISSING, str); } return option[0]; case OPTPARSE_OPTIONAL: options->subopt = 0; options->optind++; if (option[1]) options->optarg = option + 1; else options->optarg = 0; return option[0]; } return 0; }