⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calc.c

📁 a very popular packet of cryptography tools,it encloses the most common used algorithm and protocols
💻 C
📖 第 1 页 / 共 4 页
字号:
#line 204 "calc.y"{ CHECK_UI ("Exponent", sp);                     sp--; mpz_pow_ui (sp, sp, mpz_get_ui (sp+1)); }    break;case 20:#line 206 "calc.y"{ CHECK_UI ("Shift count", sp);                     sp--; mpz_mul_2exp (sp, sp, mpz_get_ui (sp+1)); }    break;case 21:#line 208 "calc.y"{ CHECK_UI ("Shift count", sp);                     sp--; mpz_fdiv_q_2exp (sp, sp, mpz_get_ui (sp+1)); }    break;case 22:#line 210 "calc.y"{ CHECK_UI ("Factorial", sp);                     mpz_fac_ui (sp, mpz_get_ui (sp)); }    break;case 23:#line 212 "calc.y"{ mpz_neg (sp, sp); }    break;case 24:#line 214 "calc.y"{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <  0); }    break;case 25:#line 215 "calc.y"{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <= 0); }    break;case 26:#line 216 "calc.y"{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) == 0); }    break;case 27:#line 217 "calc.y"{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) != 0); }    break;case 28:#line 218 "calc.y"{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >= 0); }    break;case 29:#line 219 "calc.y"{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >  0); }    break;case 30:#line 221 "calc.y"{ sp--; mpz_set_ui (sp, mpz_sgn (sp) && mpz_sgn (sp+1)); }    break;case 31:#line 222 "calc.y"{ sp--; mpz_set_ui (sp, mpz_sgn (sp) || mpz_sgn (sp+1)); }    break;case 32:#line 224 "calc.y"{ mpz_abs (sp, sp); }    break;case 33:#line 225 "calc.y"{ sp--; CHECK_UI ("Binomial base", sp+1);                                    mpz_bin_ui (sp, sp, mpz_get_ui (sp+1)); }    break;case 34:#line 227 "calc.y"{ CHECK_UI ("Fibonacci", sp);                                    mpz_fib_ui (sp, mpz_get_ui (sp)); }    break;case 36:#line 230 "calc.y"{ sp--; mpz_set_si (sp,                                          mpz_kronecker (sp, sp+1)); }    break;case 38:#line 233 "calc.y"{ CHECK_UI ("Lucas number", sp);                                    mpz_lucnum_ui (sp, mpz_get_ui (sp)); }    break;case 39:#line 235 "calc.y"{ mpz_nextprime (sp, sp); }    break;case 40:#line 236 "calc.y"{ sp -= 2; mpz_powm (sp, sp, sp+1, sp+2); }    break;case 41:#line 237 "calc.y"{ sp--; CHECK_UI ("Nth-root", sp+1);                                    mpz_root (sp, sp, mpz_get_ui (sp+1)); }    break;case 42:#line 239 "calc.y"{ mpz_sqrt (sp, sp); }    break;case 43:#line 241 "calc.y"{        sp++;        CHECK_OVERFLOW ();        CHECK_VARIABLE (yyvsp[0].var);        mpz_set (sp, variable[yyvsp[0].var]);      }    break;case 44:#line 247 "calc.y"{        sp++;        CHECK_OVERFLOW ();        if (mpz_set_str (sp, yyvsp[0].str, ibase) != 0)          {            fprintf (stderr, "Invalid number: %s\n", yyvsp[0].str);            YYERROR;          }      }    break;case 46:#line 259 "calc.y"{ sp--; mpz_gcd (sp, sp, sp+1); }    break;case 48:#line 263 "calc.y"{ sp--; mpz_lcm (sp, sp, sp+1); }    break;}#line 705 "/usr/share/bison/bison.simple"  yyvsp -= yylen;  yyssp -= yylen;#if YYLSP_NEEDED  yylsp -= yylen;#endif#if YYDEBUG  if (yydebug)    {      short *yyssp1 = yyss - 1;      YYFPRINTF (stderr, "state stack now");      while (yyssp1 != yyssp)	YYFPRINTF (stderr, " %d", *++yyssp1);      YYFPRINTF (stderr, "\n");    }#endif  *++yyvsp = yyval;#if YYLSP_NEEDED  *++yylsp = yyloc;#endif  /* Now `shift' the result of the reduction.  Determine what state     that goes to, based on the state we popped back to and the rule     number reduced by.  */  yyn = yyr1[yyn];  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)    yystate = yytable[yystate];  else    yystate = yydefgoto[yyn - YYNTBASE];  goto yynewstate;/*------------------------------------.| yyerrlab -- here on detecting error |`------------------------------------*/yyerrlab:  /* If not already recovering from an error, report this error.  */  if (!yyerrstatus)    {      ++yynerrs;#ifdef YYERROR_VERBOSE      yyn = yypact[yystate];      if (yyn > YYFLAG && yyn < YYLAST)	{	  YYSIZE_T yysize = 0;	  char *yymsg;	  int yyx, yycount;	  yycount = 0;	  /* Start YYX at -YYN if negative to avoid negative indexes in	     YYCHECK.  */	  for (yyx = yyn < 0 ? -yyn : 0;	       yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)	    if (yycheck[yyx + yyn] == yyx)	      yysize += yystrlen (yytname[yyx]) + 15, yycount++;	  yysize += yystrlen ("parse error, unexpected ") + 1;	  yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);	  yymsg = (char *) YYSTACK_ALLOC (yysize);	  if (yymsg != 0)	    {	      char *yyp = yystpcpy (yymsg, "parse error, unexpected ");	      yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);	      if (yycount < 5)		{		  yycount = 0;		  for (yyx = yyn < 0 ? -yyn : 0;		       yyx < (int) (sizeof (yytname) / sizeof (char *));		       yyx++)		    if (yycheck[yyx + yyn] == yyx)		      {			const char *yyq = ! yycount ? ", expecting " : " or ";			yyp = yystpcpy (yyp, yyq);			yyp = yystpcpy (yyp, yytname[yyx]);			yycount++;		      }		}	      yyerror (yymsg);	      YYSTACK_FREE (yymsg);	    }	  else	    yyerror ("parse error; also virtual memory exhausted");	}      else#endif /* defined (YYERROR_VERBOSE) */	yyerror ("parse error");    }  goto yyerrlab1;/*--------------------------------------------------.| yyerrlab1 -- error raised explicitly by an action |`--------------------------------------------------*/yyerrlab1:  if (yyerrstatus == 3)    {      /* If just tried and failed to reuse lookahead token after an	 error, discard it.  */      /* return failure if at end of input */      if (yychar == YYEOF)	YYABORT;      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",		  yychar, yytname[yychar1]));      yychar = YYEMPTY;    }  /* Else will try to reuse lookahead token after shifting the error     token.  */  yyerrstatus = 3;		/* Each real token shifted decrements this */  goto yyerrhandle;/*-------------------------------------------------------------------.| yyerrdefault -- current state does not do anything special for the || error token.                                                       |`-------------------------------------------------------------------*/yyerrdefault:#if 0  /* This is wrong; only states that explicitly want error tokens     should shift them.  */  /* If its default is to accept any token, ok.  Otherwise pop it.  */  yyn = yydefact[yystate];  if (yyn)    goto yydefault;#endif/*---------------------------------------------------------------.| yyerrpop -- pop the current state because it cannot handle the || error token                                                    |`---------------------------------------------------------------*/yyerrpop:  if (yyssp == yyss)    YYABORT;  yyvsp--;  yystate = *--yyssp;#if YYLSP_NEEDED  yylsp--;#endif#if YYDEBUG  if (yydebug)    {      short *yyssp1 = yyss - 1;      YYFPRINTF (stderr, "Error: state stack now");      while (yyssp1 != yyssp)	YYFPRINTF (stderr, " %d", *++yyssp1);      YYFPRINTF (stderr, "\n");    }#endif/*--------------.| yyerrhandle.  |`--------------*/yyerrhandle:  yyn = yypact[yystate];  if (yyn == YYFLAG)    goto yyerrdefault;  yyn += YYTERROR;  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)    goto yyerrdefault;  yyn = yytable[yyn];  if (yyn < 0)    {      if (yyn == YYFLAG)	goto yyerrpop;      yyn = -yyn;      goto yyreduce;    }  else if (yyn == 0)    goto yyerrpop;  if (yyn == YYFINAL)    YYACCEPT;  YYDPRINTF ((stderr, "Shifting error token, "));  *++yyvsp = yylval;#if YYLSP_NEEDED  *++yylsp = yylloc;#endif  yystate = yyn;  goto yynewstate;/*-------------------------------------.| yyacceptlab -- YYACCEPT comes here.  |`-------------------------------------*/yyacceptlab:  yyresult = 0;  goto yyreturn;/*-----------------------------------.| yyabortlab -- YYABORT comes here.  |`-----------------------------------*/yyabortlab:  yyresult = 1;  goto yyreturn;/*---------------------------------------------.| yyoverflowab -- parser overflow comes here.  |`---------------------------------------------*/yyoverflowlab:  yyerror ("parser stack overflow");  yyresult = 2;  /* Fall through.  */yyreturn:#ifndef yyoverflow  if (yyss != yyssa)    YYSTACK_FREE (yyss);#endif  return yyresult;}#line 265 "calc.y"yyerror (char *s){  fprintf (stderr, "%s\n", s);}int calc_option_readline = -1;intmain (int argc, char *argv[]){  int  i;  for (i = 1; i < argc; i++)    {      if (strcmp (argv[i], "--readline") == 0)        calc_option_readline = 1;      else if (strcmp (argv[i], "--noreadline") == 0)        calc_option_readline = 0;      else if (strcmp (argv[i], "--help") == 0)        {          printf ("Usage: calc [--option]...\n");          printf ("  --readline    use readline\n");          printf ("  --noreadline  don't use readline\n");          printf ("  --help        this message\n");          printf ("Readline is only available when compiled in,\n");          printf ("and in that case it's the default on a tty.\n");          exit (0);        }      else        {          fprintf (stderr, "Unrecognised option: %s\n", argv[i]);          exit (1);        }    }#if WITH_READLINE  calc_init_readline ();#else  if (calc_option_readline == 1)    {      fprintf (stderr, "Readline support not available\n");      exit (1);    }#endif  for (i = 0; i < numberof (variable); i++)    mpz_init (variable[i]);  for (i = 0; i < numberof (stack); i++)    mpz_init (stack[i]);  return yyparse ();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -