Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add support for the "pikchr-background" detail.txt skin setting used to specify an alternative background color value for Pikchr diagrams. Set this value appropriately for the eagle and ardoise skins. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
557f51b34bc6cdde6b8cc5d1669e070e |
| User & Date: | drh 2021-01-25 20:19:36.384 |
Context
|
2021-01-26
| ||
| 00:40 | Update the customskin.md document to explain the latest practices. check-in: 48a4be5058 user: drh tags: trunk | |
|
2021-01-25
| ||
| 20:19 | Add support for the "pikchr-background" detail.txt skin setting used to specify an alternative background color value for Pikchr diagrams. Set this value appropriately for the eagle and ardoise skins. check-in: 557f51b34b user: drh tags: trunk | |
| 19:11 | Add the hamburger menu to the ardoise skin. check-in: b20654662e user: drh tags: trunk | |
Changes
Changes to skins/ardoise/details.txt.
1 2 3 4 | timeline-arrowheads: 0 timeline-circle-nodes: 1 timeline-color-graph-lines: 1 white-foreground: 1 | > | 1 2 3 4 5 | timeline-arrowheads: 0 timeline-circle-nodes: 1 timeline-color-graph-lines: 1 white-foreground: 1 pikchr-background: 0x1d2021 |
Changes to skins/eagle/details.txt.
1 2 3 4 | timeline-arrowheads: 1 timeline-circle-nodes: 0 timeline-color-graph-lines: 0 white-foreground: 1 | > | 1 2 3 4 5 | timeline-arrowheads: 1 timeline-circle-nodes: 0 timeline-color-graph-lines: 0 white-foreground: 1 pikchr-background: 0x485d7b |
Changes to src/markdown_html.c.
| ︙ | ︙ | |||
377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
if( skin_detail_boolean("white-foreground") ){
pikFlags |= 0x02; /* PIKCHR_DARK_MODE */
}
zPikVar = skin_detail("pikchr-foreground");
if( zPikVar && zPikVar[0] ){
blob_appendf(&bSrc, "fgcolor = %s\n", zPikVar);
}
zPikVar = skin_detail("pikchr-scale");
if( zPikVar
&& (rPikVar = atof(zPikVar))>=0.1
&& rPikVar<10.0
){
blob_appendf(&bSrc, "scale = %.13g\n", rPikVar);
}
| > > > > | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
if( skin_detail_boolean("white-foreground") ){
pikFlags |= 0x02; /* PIKCHR_DARK_MODE */
}
zPikVar = skin_detail("pikchr-foreground");
if( zPikVar && zPikVar[0] ){
blob_appendf(&bSrc, "fgcolor = %s\n", zPikVar);
}
zPikVar = skin_detail("pikchr-background");
if( zPikVar && zPikVar[0] ){
blob_appendf(&bSrc, "bgcolor = %s\n", zPikVar);
}
zPikVar = skin_detail("pikchr-scale");
if( zPikVar
&& (rPikVar = atof(zPikVar))>=0.1
&& rPikVar<10.0
){
blob_appendf(&bSrc, "scale = %.13g\n", rPikVar);
}
|
| ︙ | ︙ |
Changes to src/pikchr.c.
| ︙ | ︙ | |||
361 362 363 364 365 366 367 | PNum wArrow; /* Width of arrowhead at the fat end */ PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */ char bLayoutVars; /* True if cache is valid */ char thenFlag; /* True if "then" seen */ char samePath; /* aTPath copied by "same" */ const char *zClass; /* Class name for the <svg> */ int wSVG, hSVG; /* Width and height of the <svg> */ | | > | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | PNum wArrow; /* Width of arrowhead at the fat end */ PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */ char bLayoutVars; /* True if cache is valid */ char thenFlag; /* True if "then" seen */ char samePath; /* aTPath copied by "same" */ const char *zClass; /* Class name for the <svg> */ int wSVG, hSVG; /* Width and height of the <svg> */ int fgcolor; /* foreground color value, or -1 for none */ int bgcolor; /* background color value, or -1 for none */ /* Paths for lines are constructed here first, then transferred into ** the PObj object at the end: */ int nTPath; /* Number of entries on aTPath[] */ int mTPath; /* For last entry, 1: x set, 2: y set */ PPoint aTPath[1000]; /* Path under construction */ /* Error contexts */ unsigned int nCtx; /* Number of error contexts */ |
| ︙ | ︙ | |||
471 472 473 474 475 476 477 | static void pik_behind(Pik*,PObj*); static PObj *pik_assert(Pik*,PNum,PToken*,PNum); static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*); static PNum pik_dist(PPoint*,PPoint*); static void pik_add_macro(Pik*,PToken *pId,PToken *pCode); | | | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | static void pik_behind(Pik*,PObj*); static PObj *pik_assert(Pik*,PNum,PToken*,PNum); static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*); static PNum pik_dist(PPoint*,PPoint*); static void pik_add_macro(Pik*,PToken *pId,PToken *pCode); #line 505 "pikchr.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ #ifndef T_ID #define T_ID 1 #define T_EDGEPT 2 #define T_OF 3 |
| ︙ | ︙ | |||
640 641 642 643 644 645 646 647 |
#define YYACTIONTYPE unsigned short int
#define pik_parserTOKENTYPE PToken
typedef union {
int yyinit;
pik_parserTOKENTYPE yy0;
PObj* yy38;
PPoint yy43;
PList* yy119;
| > < | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 |
#define YYACTIONTYPE unsigned short int
#define pik_parserTOKENTYPE PToken
typedef union {
int yyinit;
pik_parserTOKENTYPE yy0;
PObj* yy38;
PPoint yy43;
short int yy44;
PList* yy119;
PRel yy200;
PNum yy265;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#endif
#define pik_parserARG_SDECL
|
| ︙ | ︙ | |||
1688 1689 1690 1691 1692 1693 1694 |
** Note: during a reduce, the only symbols destroyed are those
** which appear on the RHS of the rule, but which are *not* used
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
case 98: /* statement_list */
{
| | | | | | 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 |
** Note: during a reduce, the only symbols destroyed are those
** which appear on the RHS of the rule, but which are *not* used
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
case 98: /* statement_list */
{
#line 494 "pikchr.y"
pik_elist_free(p,(yypminor->yy119));
#line 1723 "pikchr.c"
}
break;
case 99: /* statement */
case 100: /* unnamed_statement */
case 101: /* basetype */
{
#line 496 "pikchr.y"
pik_elem_free(p,(yypminor->yy38));
#line 1732 "pikchr.c"
}
break;
/********* End destructor definitions *****************************************/
default: break; /* If no destructor action specified: do nothing */
}
}
|
| ︙ | ︙ | |||
1917 1918 1919 1920 1921 1922 1923 |
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
}
#endif
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
| | | | 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 |
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
}
#endif
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
#line 528 "pikchr.y"
pik_error(p, 0, "parser stack overflow");
#line 1953 "pikchr.c"
/******** End %stack_overflow code ********************************************/
pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
pik_parserCTX_STORE
}
/*
** Print tracing information for a SHIFT action
|
| ︙ | ︙ | |||
2398 2399 2400 2401 2402 2403 2404 |
** { ... } // User supplied code
** #line <lineno> <thisfile>
** break;
*/
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* document ::= statement_list */
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 |
** { ... } // User supplied code
** #line <lineno> <thisfile>
** break;
*/
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* document ::= statement_list */
#line 532 "pikchr.y"
{pik_render(p,yymsp[0].minor.yy119);}
#line 2433 "pikchr.c"
break;
case 1: /* statement_list ::= statement */
#line 535 "pikchr.y"
{ yylhsminor.yy119 = pik_elist_append(p,0,yymsp[0].minor.yy38); }
#line 2438 "pikchr.c"
yymsp[0].minor.yy119 = yylhsminor.yy119;
break;
case 2: /* statement_list ::= statement_list EOL statement */
#line 537 "pikchr.y"
{ yylhsminor.yy119 = pik_elist_append(p,yymsp[-2].minor.yy119,yymsp[0].minor.yy38); }
#line 2444 "pikchr.c"
yymsp[-2].minor.yy119 = yylhsminor.yy119;
break;
case 3: /* statement ::= */
#line 540 "pikchr.y"
{ yymsp[1].minor.yy38 = 0; }
#line 2450 "pikchr.c"
break;
case 4: /* statement ::= direction */
#line 541 "pikchr.y"
{ pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy38=0; }
#line 2455 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 5: /* statement ::= lvalue ASSIGN rvalue */
#line 542 "pikchr.y"
{pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy265,&yymsp[-1].minor.yy0); yylhsminor.yy38=0;}
#line 2461 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 6: /* statement ::= PLACENAME COLON unnamed_statement */
#line 544 "pikchr.y"
{ yylhsminor.yy38 = yymsp[0].minor.yy38; pik_elem_setname(p,yymsp[0].minor.yy38,&yymsp[-2].minor.yy0); }
#line 2467 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 7: /* statement ::= PLACENAME COLON position */
#line 546 "pikchr.y"
{ yylhsminor.yy38 = pik_elem_new(p,0,0,0);
if(yylhsminor.yy38){ yylhsminor.yy38->ptAt = yymsp[0].minor.yy43; pik_elem_setname(p,yylhsminor.yy38,&yymsp[-2].minor.yy0); }}
#line 2474 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 8: /* statement ::= unnamed_statement */
#line 548 "pikchr.y"
{yylhsminor.yy38 = yymsp[0].minor.yy38;}
#line 2480 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 9: /* statement ::= print prlist */
#line 549 "pikchr.y"
{pik_append(p,"<br>\n",5); yymsp[-1].minor.yy38=0;}
#line 2486 "pikchr.c"
break;
case 10: /* statement ::= ASSERT LP expr EQ expr RP */
#line 554 "pikchr.y"
{yymsp[-5].minor.yy38=pik_assert(p,yymsp[-3].minor.yy265,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy265);}
#line 2491 "pikchr.c"
break;
case 11: /* statement ::= ASSERT LP position EQ position RP */
#line 556 "pikchr.y"
{yymsp[-5].minor.yy38=pik_position_assert(p,&yymsp[-3].minor.yy43,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy43);}
#line 2496 "pikchr.c"
break;
case 12: /* statement ::= DEFINE ID CODEBLOCK */
#line 557 "pikchr.y"
{yymsp[-2].minor.yy38=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
#line 2501 "pikchr.c"
break;
case 13: /* rvalue ::= PLACENAME */
#line 568 "pikchr.y"
{yylhsminor.yy265 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
#line 2506 "pikchr.c"
yymsp[0].minor.yy265 = yylhsminor.yy265;
break;
case 14: /* pritem ::= FILL */
case 15: /* pritem ::= COLOR */ yytestcase(yyruleno==15);
case 16: /* pritem ::= THICKNESS */ yytestcase(yyruleno==16);
#line 573 "pikchr.y"
{pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
#line 2514 "pikchr.c"
break;
case 17: /* pritem ::= rvalue */
#line 576 "pikchr.y"
{pik_append_num(p,"",yymsp[0].minor.yy265);}
#line 2519 "pikchr.c"
break;
case 18: /* pritem ::= STRING */
#line 577 "pikchr.y"
{pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
#line 2524 "pikchr.c"
break;
case 19: /* prsep ::= COMMA */
#line 578 "pikchr.y"
{pik_append(p, " ", 1);}
#line 2529 "pikchr.c"
break;
case 20: /* unnamed_statement ::= basetype attribute_list */
#line 581 "pikchr.y"
{yylhsminor.yy38 = yymsp[-1].minor.yy38; pik_after_adding_attributes(p,yylhsminor.yy38);}
#line 2534 "pikchr.c"
yymsp[-1].minor.yy38 = yylhsminor.yy38;
break;
case 21: /* basetype ::= CLASSNAME */
#line 583 "pikchr.y"
{yylhsminor.yy38 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
#line 2540 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 22: /* basetype ::= STRING textposition */
#line 585 "pikchr.y"
{yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy44; yylhsminor.yy38 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
#line 2546 "pikchr.c"
yymsp[-1].minor.yy38 = yylhsminor.yy38;
break;
case 23: /* basetype ::= LB savelist statement_list RB */
#line 587 "pikchr.y"
{ p->list = yymsp[-2].minor.yy119; yymsp[-3].minor.yy38 = pik_elem_new(p,0,0,yymsp[-1].minor.yy119); if(yymsp[-3].minor.yy38) yymsp[-3].minor.yy38->errTok = yymsp[0].minor.yy0; }
#line 2552 "pikchr.c"
break;
case 24: /* savelist ::= */
#line 592 "pikchr.y"
{yymsp[1].minor.yy119 = p->list; p->list = 0;}
#line 2557 "pikchr.c"
break;
case 25: /* relexpr ::= expr */
#line 599 "pikchr.y"
{yylhsminor.yy200.rAbs = yymsp[0].minor.yy265; yylhsminor.yy200.rRel = 0;}
#line 2562 "pikchr.c"
yymsp[0].minor.yy200 = yylhsminor.yy200;
break;
case 26: /* relexpr ::= expr PERCENT */
#line 600 "pikchr.y"
{yylhsminor.yy200.rAbs = 0; yylhsminor.yy200.rRel = yymsp[-1].minor.yy265/100;}
#line 2568 "pikchr.c"
yymsp[-1].minor.yy200 = yylhsminor.yy200;
break;
case 27: /* optrelexpr ::= */
#line 602 "pikchr.y"
{yymsp[1].minor.yy200.rAbs = 0; yymsp[1].minor.yy200.rRel = 1.0;}
#line 2574 "pikchr.c"
break;
case 28: /* attribute_list ::= relexpr alist */
#line 604 "pikchr.y"
{pik_add_direction(p,0,&yymsp[-1].minor.yy200);}
#line 2579 "pikchr.c"
break;
case 29: /* attribute ::= numproperty relexpr */
#line 608 "pikchr.y"
{ pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy200); }
#line 2584 "pikchr.c"
break;
case 30: /* attribute ::= dashproperty expr */
#line 609 "pikchr.y"
{ pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy265); }
#line 2589 "pikchr.c"
break;
case 31: /* attribute ::= dashproperty */
#line 610 "pikchr.y"
{ pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
#line 2594 "pikchr.c"
break;
case 32: /* attribute ::= colorproperty rvalue */
#line 611 "pikchr.y"
{ pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy265); }
#line 2599 "pikchr.c"
break;
case 33: /* attribute ::= go direction optrelexpr */
#line 612 "pikchr.y"
{ pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy200);}
#line 2604 "pikchr.c"
break;
case 34: /* attribute ::= go direction even position */
#line 613 "pikchr.y"
{pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy43);}
#line 2609 "pikchr.c"
break;
case 35: /* attribute ::= CLOSE */
#line 614 "pikchr.y"
{ pik_close_path(p,&yymsp[0].minor.yy0); }
#line 2614 "pikchr.c"
break;
case 36: /* attribute ::= CHOP */
#line 615 "pikchr.y"
{ p->cur->bChop = 1; }
#line 2619 "pikchr.c"
break;
case 37: /* attribute ::= FROM position */
#line 616 "pikchr.y"
{ pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy43); }
#line 2624 "pikchr.c"
break;
case 38: /* attribute ::= TO position */
#line 617 "pikchr.y"
{ pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy43); }
#line 2629 "pikchr.c"
break;
case 39: /* attribute ::= THEN */
#line 618 "pikchr.y"
{ pik_then(p, &yymsp[0].minor.yy0, p->cur); }
#line 2634 "pikchr.c"
break;
case 40: /* attribute ::= THEN optrelexpr HEADING expr */
case 42: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==42);
#line 620 "pikchr.y"
{pik_move_hdg(p,&yymsp[-2].minor.yy200,&yymsp[-1].minor.yy0,yymsp[0].minor.yy265,0,&yymsp[-3].minor.yy0);}
#line 2640 "pikchr.c"
break;
case 41: /* attribute ::= THEN optrelexpr EDGEPT */
case 43: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==43);
#line 621 "pikchr.y"
{pik_move_hdg(p,&yymsp[-1].minor.yy200,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
#line 2646 "pikchr.c"
break;
case 44: /* attribute ::= AT position */
#line 626 "pikchr.y"
{ pik_set_at(p,0,&yymsp[0].minor.yy43,&yymsp[-1].minor.yy0); }
#line 2651 "pikchr.c"
break;
case 45: /* attribute ::= SAME */
#line 628 "pikchr.y"
{pik_same(p,0,&yymsp[0].minor.yy0);}
#line 2656 "pikchr.c"
break;
case 46: /* attribute ::= SAME AS object */
#line 629 "pikchr.y"
{pik_same(p,yymsp[0].minor.yy38,&yymsp[-2].minor.yy0);}
#line 2661 "pikchr.c"
break;
case 47: /* attribute ::= STRING textposition */
#line 630 "pikchr.y"
{pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy44);}
#line 2666 "pikchr.c"
break;
case 48: /* attribute ::= FIT */
#line 631 "pikchr.y"
{pik_size_to_fit(p,&yymsp[0].minor.yy0,3); }
#line 2671 "pikchr.c"
break;
case 49: /* attribute ::= BEHIND object */
#line 632 "pikchr.y"
{pik_behind(p,yymsp[0].minor.yy38);}
#line 2676 "pikchr.c"
break;
case 50: /* withclause ::= DOT_E edge AT position */
case 51: /* withclause ::= edge AT position */ yytestcase(yyruleno==51);
#line 640 "pikchr.y"
{ pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy43,&yymsp[-1].minor.yy0); }
#line 2682 "pikchr.c"
break;
case 52: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
#line 644 "pikchr.y"
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
#line 2687 "pikchr.c"
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 53: /* boolproperty ::= CW */
#line 655 "pikchr.y"
{p->cur->cw = 1;}
#line 2693 "pikchr.c"
break;
case 54: /* boolproperty ::= CCW */
#line 656 "pikchr.y"
{p->cur->cw = 0;}
#line 2698 "pikchr.c"
break;
case 55: /* boolproperty ::= LARROW */
#line 657 "pikchr.y"
{p->cur->larrow=1; p->cur->rarrow=0; }
#line 2703 "pikchr.c"
break;
case 56: /* boolproperty ::= RARROW */
#line 658 "pikchr.y"
{p->cur->larrow=0; p->cur->rarrow=1; }
#line 2708 "pikchr.c"
break;
case 57: /* boolproperty ::= LRARROW */
#line 659 "pikchr.y"
{p->cur->larrow=1; p->cur->rarrow=1; }
#line 2713 "pikchr.c"
break;
case 58: /* boolproperty ::= INVIS */
#line 660 "pikchr.y"
{p->cur->sw = 0.0;}
#line 2718 "pikchr.c"
break;
case 59: /* boolproperty ::= THICK */
#line 661 "pikchr.y"
{p->cur->sw *= 1.5;}
#line 2723 "pikchr.c"
break;
case 60: /* boolproperty ::= THIN */
#line 662 "pikchr.y"
{p->cur->sw *= 0.67;}
#line 2728 "pikchr.c"
break;
case 61: /* boolproperty ::= SOLID */
#line 663 "pikchr.y"
{p->cur->sw = pik_value(p,"thickness",9,0);
p->cur->dotted = p->cur->dashed = 0.0;}
#line 2734 "pikchr.c"
break;
case 62: /* textposition ::= */
#line 666 "pikchr.y"
{yymsp[1].minor.yy44 = 0;}
#line 2739 "pikchr.c"
break;
case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
#line 669 "pikchr.y"
{yylhsminor.yy44 = (short int)pik_text_position(yymsp[-1].minor.yy44,&yymsp[0].minor.yy0);}
#line 2744 "pikchr.c"
yymsp[-1].minor.yy44 = yylhsminor.yy44;
break;
case 64: /* position ::= expr COMMA expr */
#line 672 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-2].minor.yy265; yylhsminor.yy43.y=yymsp[0].minor.yy265;}
#line 2750 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 65: /* position ::= place PLUS expr COMMA expr */
#line 674 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-4].minor.yy43.x+yymsp[-2].minor.yy265; yylhsminor.yy43.y=yymsp[-4].minor.yy43.y+yymsp[0].minor.yy265;}
#line 2756 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 66: /* position ::= place MINUS expr COMMA expr */
#line 675 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-4].minor.yy43.x-yymsp[-2].minor.yy265; yylhsminor.yy43.y=yymsp[-4].minor.yy43.y-yymsp[0].minor.yy265;}
#line 2762 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 67: /* position ::= place PLUS LP expr COMMA expr RP */
#line 677 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-6].minor.yy43.x+yymsp[-3].minor.yy265; yylhsminor.yy43.y=yymsp[-6].minor.yy43.y+yymsp[-1].minor.yy265;}
#line 2768 "pikchr.c"
yymsp[-6].minor.yy43 = yylhsminor.yy43;
break;
case 68: /* position ::= place MINUS LP expr COMMA expr RP */
#line 679 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-6].minor.yy43.x-yymsp[-3].minor.yy265; yylhsminor.yy43.y=yymsp[-6].minor.yy43.y-yymsp[-1].minor.yy265;}
#line 2774 "pikchr.c"
yymsp[-6].minor.yy43 = yylhsminor.yy43;
break;
case 69: /* position ::= LP position COMMA position RP */
#line 680 "pikchr.y"
{yymsp[-4].minor.yy43.x=yymsp[-3].minor.yy43.x; yymsp[-4].minor.yy43.y=yymsp[-1].minor.yy43.y;}
#line 2780 "pikchr.c"
break;
case 70: /* position ::= LP position RP */
#line 681 "pikchr.y"
{yymsp[-2].minor.yy43=yymsp[-1].minor.yy43;}
#line 2785 "pikchr.c"
break;
case 71: /* position ::= expr between position AND position */
#line 683 "pikchr.y"
{yylhsminor.yy43 = pik_position_between(yymsp[-4].minor.yy265,yymsp[-2].minor.yy43,yymsp[0].minor.yy43);}
#line 2790 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 72: /* position ::= expr LT position COMMA position GT */
#line 685 "pikchr.y"
{yylhsminor.yy43 = pik_position_between(yymsp[-5].minor.yy265,yymsp[-3].minor.yy43,yymsp[-1].minor.yy43);}
#line 2796 "pikchr.c"
yymsp[-5].minor.yy43 = yylhsminor.yy43;
break;
case 73: /* position ::= expr ABOVE position */
#line 686 "pikchr.y"
{yylhsminor.yy43=yymsp[0].minor.yy43; yylhsminor.yy43.y += yymsp[-2].minor.yy265;}
#line 2802 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 74: /* position ::= expr BELOW position */
#line 687 "pikchr.y"
{yylhsminor.yy43=yymsp[0].minor.yy43; yylhsminor.yy43.y -= yymsp[-2].minor.yy265;}
#line 2808 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 75: /* position ::= expr LEFT OF position */
#line 688 "pikchr.y"
{yylhsminor.yy43=yymsp[0].minor.yy43; yylhsminor.yy43.x -= yymsp[-3].minor.yy265;}
#line 2814 "pikchr.c"
yymsp[-3].minor.yy43 = yylhsminor.yy43;
break;
case 76: /* position ::= expr RIGHT OF position */
#line 689 "pikchr.y"
{yylhsminor.yy43=yymsp[0].minor.yy43; yylhsminor.yy43.x += yymsp[-3].minor.yy265;}
#line 2820 "pikchr.c"
yymsp[-3].minor.yy43 = yylhsminor.yy43;
break;
case 77: /* position ::= expr ON HEADING EDGEPT OF position */
#line 691 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_hdg(yymsp[-5].minor.yy265,&yymsp[-2].minor.yy0,yymsp[0].minor.yy43);}
#line 2826 "pikchr.c"
yymsp[-5].minor.yy43 = yylhsminor.yy43;
break;
case 78: /* position ::= expr HEADING EDGEPT OF position */
#line 693 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_hdg(yymsp[-4].minor.yy265,&yymsp[-2].minor.yy0,yymsp[0].minor.yy43);}
#line 2832 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 79: /* position ::= expr EDGEPT OF position */
#line 695 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_hdg(yymsp[-3].minor.yy265,&yymsp[-2].minor.yy0,yymsp[0].minor.yy43);}
#line 2838 "pikchr.c"
yymsp[-3].minor.yy43 = yylhsminor.yy43;
break;
case 80: /* position ::= expr ON HEADING expr FROM position */
#line 697 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_angle(yymsp[-5].minor.yy265,yymsp[-2].minor.yy265,yymsp[0].minor.yy43);}
#line 2844 "pikchr.c"
yymsp[-5].minor.yy43 = yylhsminor.yy43;
break;
case 81: /* position ::= expr HEADING expr FROM position */
#line 699 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_angle(yymsp[-4].minor.yy265,yymsp[-2].minor.yy265,yymsp[0].minor.yy43);}
#line 2850 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 82: /* place ::= edge OF object */
#line 711 "pikchr.y"
{yylhsminor.yy43 = pik_place_of_elem(p,yymsp[0].minor.yy38,&yymsp[-2].minor.yy0);}
#line 2856 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 83: /* place2 ::= object */
#line 712 "pikchr.y"
{yylhsminor.yy43 = pik_place_of_elem(p,yymsp[0].minor.yy38,0);}
#line 2862 "pikchr.c"
yymsp[0].minor.yy43 = yylhsminor.yy43;
break;
case 84: /* place2 ::= object DOT_E edge */
#line 713 "pikchr.y"
{yylhsminor.yy43 = pik_place_of_elem(p,yymsp[-2].minor.yy38,&yymsp[0].minor.yy0);}
#line 2868 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 85: /* place2 ::= NTH VERTEX OF object */
#line 714 "pikchr.y"
{yylhsminor.yy43 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy38);}
#line 2874 "pikchr.c"
yymsp[-3].minor.yy43 = yylhsminor.yy43;
break;
case 86: /* object ::= nth */
#line 726 "pikchr.y"
{yylhsminor.yy38 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
#line 2880 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 87: /* object ::= nth OF|IN object */
#line 727 "pikchr.y"
{yylhsminor.yy38 = pik_find_nth(p,yymsp[0].minor.yy38,&yymsp[-2].minor.yy0);}
#line 2886 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 88: /* objectname ::= PLACENAME */
#line 729 "pikchr.y"
{yylhsminor.yy38 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
#line 2892 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 89: /* objectname ::= objectname DOT_U PLACENAME */
#line 731 "pikchr.y"
{yylhsminor.yy38 = pik_find_byname(p,yymsp[-2].minor.yy38,&yymsp[0].minor.yy0);}
#line 2898 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 90: /* nth ::= NTH CLASSNAME */
#line 733 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
#line 2904 "pikchr.c"
yymsp[-1].minor.yy0 = yylhsminor.yy0;
break;
case 91: /* nth ::= NTH LAST CLASSNAME */
#line 734 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
#line 2910 "pikchr.c"
yymsp[-2].minor.yy0 = yylhsminor.yy0;
break;
case 92: /* nth ::= LAST CLASSNAME */
#line 735 "pikchr.y"
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
#line 2916 "pikchr.c"
break;
case 93: /* nth ::= LAST */
#line 736 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
#line 2921 "pikchr.c"
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 94: /* nth ::= NTH LB RB */
#line 737 "pikchr.y"
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
#line 2927 "pikchr.c"
yymsp[-2].minor.yy0 = yylhsminor.yy0;
break;
case 95: /* nth ::= NTH LAST LB RB */
#line 738 "pikchr.y"
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
#line 2933 "pikchr.c"
yymsp[-3].minor.yy0 = yylhsminor.yy0;
break;
case 96: /* nth ::= LAST LB RB */
#line 739 "pikchr.y"
{yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
#line 2939 "pikchr.c"
break;
case 97: /* expr ::= expr PLUS expr */
#line 741 "pikchr.y"
{yylhsminor.yy265=yymsp[-2].minor.yy265+yymsp[0].minor.yy265;}
#line 2944 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 98: /* expr ::= expr MINUS expr */
#line 742 "pikchr.y"
{yylhsminor.yy265=yymsp[-2].minor.yy265-yymsp[0].minor.yy265;}
#line 2950 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 99: /* expr ::= expr STAR expr */
#line 743 "pikchr.y"
{yylhsminor.yy265=yymsp[-2].minor.yy265*yymsp[0].minor.yy265;}
#line 2956 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 100: /* expr ::= expr SLASH expr */
#line 744 "pikchr.y"
{
if( yymsp[0].minor.yy265==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy265 = 0.0; }
else{ yylhsminor.yy265 = yymsp[-2].minor.yy265/yymsp[0].minor.yy265; }
}
#line 2965 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 101: /* expr ::= MINUS expr */
#line 748 "pikchr.y"
{yymsp[-1].minor.yy265=-yymsp[0].minor.yy265;}
#line 2971 "pikchr.c"
break;
case 102: /* expr ::= PLUS expr */
#line 749 "pikchr.y"
{yymsp[-1].minor.yy265=yymsp[0].minor.yy265;}
#line 2976 "pikchr.c"
break;
case 103: /* expr ::= LP expr RP */
#line 750 "pikchr.y"
{yymsp[-2].minor.yy265=yymsp[-1].minor.yy265;}
#line 2981 "pikchr.c"
break;
case 104: /* expr ::= LP FILL|COLOR|THICKNESS RP */
#line 751 "pikchr.y"
{yymsp[-2].minor.yy265=pik_get_var(p,&yymsp[-1].minor.yy0);}
#line 2986 "pikchr.c"
break;
case 105: /* expr ::= NUMBER */
#line 752 "pikchr.y"
{yylhsminor.yy265=pik_atof(&yymsp[0].minor.yy0);}
#line 2991 "pikchr.c"
yymsp[0].minor.yy265 = yylhsminor.yy265;
break;
case 106: /* expr ::= ID */
#line 753 "pikchr.y"
{yylhsminor.yy265=pik_get_var(p,&yymsp[0].minor.yy0);}
#line 2997 "pikchr.c"
yymsp[0].minor.yy265 = yylhsminor.yy265;
break;
case 107: /* expr ::= FUNC1 LP expr RP */
#line 754 "pikchr.y"
{yylhsminor.yy265 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy265,0.0);}
#line 3003 "pikchr.c"
yymsp[-3].minor.yy265 = yylhsminor.yy265;
break;
case 108: /* expr ::= FUNC2 LP expr COMMA expr RP */
#line 755 "pikchr.y"
{yylhsminor.yy265 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy265,yymsp[-1].minor.yy265);}
#line 3009 "pikchr.c"
yymsp[-5].minor.yy265 = yylhsminor.yy265;
break;
case 109: /* expr ::= DIST LP position COMMA position RP */
#line 756 "pikchr.y"
{yymsp[-5].minor.yy265 = pik_dist(&yymsp[-3].minor.yy43,&yymsp[-1].minor.yy43);}
#line 3015 "pikchr.c"
break;
case 110: /* expr ::= place2 DOT_XY X */
#line 757 "pikchr.y"
{yylhsminor.yy265 = yymsp[-2].minor.yy43.x;}
#line 3020 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 111: /* expr ::= place2 DOT_XY Y */
#line 758 "pikchr.y"
{yylhsminor.yy265 = yymsp[-2].minor.yy43.y;}
#line 3026 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 112: /* expr ::= object DOT_L numproperty */
case 113: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==113);
case 114: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==114);
#line 759 "pikchr.y"
{yylhsminor.yy265=pik_property_of(yymsp[-2].minor.yy38,&yymsp[0].minor.yy0);}
#line 3034 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
default:
/* (115) lvalue ::= ID */ yytestcase(yyruleno==115);
/* (116) lvalue ::= FILL */ yytestcase(yyruleno==116);
/* (117) lvalue ::= COLOR */ yytestcase(yyruleno==117);
/* (118) lvalue ::= THICKNESS */ yytestcase(yyruleno==118);
|
| ︙ | ︙ | |||
3104 3105 3106 3107 3108 3109 3110 |
int yymajor, /* The major type of the error token */
pik_parserTOKENTYPE yyminor /* The minor type of the error token */
){
pik_parserARG_FETCH
pik_parserCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
| | | | 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 |
int yymajor, /* The major type of the error token */
pik_parserTOKENTYPE yyminor /* The minor type of the error token */
){
pik_parserARG_FETCH
pik_parserCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
#line 520 "pikchr.y"
if( TOKEN.z && TOKEN.z[0] ){
pik_error(p, &TOKEN, "syntax error");
}else{
pik_error(p, 0, "syntax error");
}
UNUSED_PARAMETER(yymajor);
#line 3145 "pikchr.c"
/************ End %syntax_error code ******************************************/
pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
pik_parserCTX_STORE
}
/*
** The following is executed when the parser accepts
|
| ︙ | ︙ | |||
3345 3346 3347 3348 3349 3350 3351 | assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; #else (void)iToken; return 0; #endif } | | | 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 | assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; #else (void)iToken; return 0; #endif } #line 764 "pikchr.y" /* Chart of the 148 official CSS color names with their ** corresponding RGB values thru Color Module Level 4: ** https://developer.mozilla.org/en-US/docs/Web/CSS/color_value ** |
| ︙ | ︙ | |||
4505 4506 4507 4508 4509 4510 4511 |
** * The "&" character is changed into "&" if mFlags has the
** 0x02 bit set. This is needed when generating error message text.
**
** * Except for the above, only "<" and ">" are escaped.
*/
static void pik_append_text(Pik *p, const char *zText, int n, int mFlags){
int i;
| | | 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 |
** * The "&" character is changed into "&" if mFlags has the
** 0x02 bit set. This is needed when generating error message text.
**
** * Except for the above, only "<" and ">" are escaped.
*/
static void pik_append_text(Pik *p, const char *zText, int n, int mFlags){
int i;
char c = 0;
int bQSpace = mFlags & 1;
int bQAmp = mFlags & 2;
if( n<0 ) n = (int)strlen(zText);
while( n>0 ){
for(i=0; i<n; i++){
c = zText[i];
if( c=='<' || c=='>' ) break;
|
| ︙ | ︙ | |||
4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 |
*/
static void pik_append_clr(Pik *p,const char *z1,PNum v,const char *z2,int bg){
char buf[200];
int x = (int)v;
int r, g, b;
if( x==0 && p->fgcolor>0 && !bg ){
x = p->fgcolor;
}else if( p->mFlags & PIKCHR_DARK_MODE ){
x = pik_color_to_dark_mode(x,bg);
}
r = (x>>16) & 0xff;
g = (x>>8) & 0xff;
b = x & 0xff;
snprintf(buf, sizeof(buf)-1, "%srgb(%d,%d,%d)%s", z1, r, g, b, z2);
| > > | 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 |
*/
static void pik_append_clr(Pik *p,const char *z1,PNum v,const char *z2,int bg){
char buf[200];
int x = (int)v;
int r, g, b;
if( x==0 && p->fgcolor>0 && !bg ){
x = p->fgcolor;
}else if( bg && x>=0xffffff && p->bgcolor>0 ){
x = p->bgcolor;
}else if( p->mFlags & PIKCHR_DARK_MODE ){
x = pik_color_to_dark_mode(x,bg);
}
r = (x>>16) & 0xff;
g = (x>>8) & 0xff;
b = x & 0xff;
snprintf(buf, sizeof(buf)-1, "%srgb(%d,%d,%d)%s", z1, r, g, b, z2);
|
| ︙ | ︙ | |||
4926 4927 4928 4929 4930 4931 4932 |
}else{
x0 = nx+cw/2;
y0 = y+ch;
x1 = nx-cw/2;
y1 = y-ch;
}
if( (t->eCode & TP_ALIGN)!=0 && pObj->nPath>=2 ){
| | | | | | | | | | 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 |
}else{
x0 = nx+cw/2;
y0 = y+ch;
x1 = nx-cw/2;
y1 = y-ch;
}
if( (t->eCode & TP_ALIGN)!=0 && pObj->nPath>=2 ){
int nn = pObj->nPath;
PNum dx = pObj->aPath[nn-1].x - pObj->aPath[0].x;
PNum dy = pObj->aPath[nn-1].y - pObj->aPath[0].y;
if( dx!=0 || dy!=0 ){
PNum dist = hypot(dx,dy);
PNum tt;
dx /= dist;
dy /= dist;
tt = dx*x0 - dy*y0;
y0 = dy*x0 - dx*y0;
x0 = tt;
tt = dx*x1 - dy*y1;
y1 = dy*x1 - dx*y1;
x1 = tt;
}
}
pik_bbox_add_xy(pBox, x+x0, orig_y+y0);
pik_bbox_add_xy(pBox, x+x1, orig_y+y1);
continue;
}
nx += x;
|
| ︙ | ︙ | |||
4973 4974 4975 4976 4977 4978 4979 |
}
xtraFontScale *= p->fontScale;
if( xtraFontScale<=0.99 || xtraFontScale>=1.01 ){
pik_append_num(p, " font-size=\"", xtraFontScale*100.0);
pik_append(p, "%\"", 2);
}
if( (t->eCode & TP_ALIGN)!=0 && pObj->nPath>=2 ){
| | | | | 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 |
}
xtraFontScale *= p->fontScale;
if( xtraFontScale<=0.99 || xtraFontScale>=1.01 ){
pik_append_num(p, " font-size=\"", xtraFontScale*100.0);
pik_append(p, "%\"", 2);
}
if( (t->eCode & TP_ALIGN)!=0 && pObj->nPath>=2 ){
int nn = pObj->nPath;
PNum dx = pObj->aPath[nn-1].x - pObj->aPath[0].x;
PNum dy = pObj->aPath[nn-1].y - pObj->aPath[0].y;
if( dx!=0 || dy!=0 ){
PNum ang = atan2(dy,dx)*-180/M_PI;
pik_append_num(p, " transform=\"rotate(", ang);
pik_append_xy(p, " ", x, orig_y);
pik_append(p,")\"",2);
}
}
|
| ︙ | ︙ | |||
5454 5455 5456 5457 5458 5459 5460 |
}
}
/* Change the layout direction.
*/
static void pik_set_direction(Pik *p, int eDir){
assert( ValidDir(eDir) );
| | | 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 |
}
}
/* Change the layout direction.
*/
static void pik_set_direction(Pik *p, int eDir){
assert( ValidDir(eDir) );
p->eDir = (unsigned char)eDir;
/* It seems to make sense to reach back into the last object and
** change its exit point (its ".end") to correspond to the new
** direction. Things just seem to work better this way. However,
** legacy PIC does *not* do this.
**
** The difference can be seen in a script like this:
|
| ︙ | ︙ | |||
5910 5911 5912 5913 5914 5915 5916 |
PToken *pT;
if( pObj->nTxt >= count(pObj->aTxt) ){
pik_error(p, pTxt, "too many text terms");
return;
}
pT = &pObj->aTxt[pObj->nTxt++];
*pT = *pTxt;
| | | 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 |
PToken *pT;
if( pObj->nTxt >= count(pObj->aTxt) ){
pik_error(p, pTxt, "too many text terms");
return;
}
pT = &pObj->aTxt[pObj->nTxt++];
*pT = *pTxt;
pT->eCode = (short)iPos;
}
/* Merge "text-position" flags
*/
static int pik_text_position(int iPrev, PToken *pFlag){
int iRes = iPrev;
switch( pFlag->eType ){
|
| ︙ | ︙ | |||
6291 6292 6293 6294 6295 6296 6297 |
static short int pik_nth_value(Pik *p, PToken *pNth){
int i = atoi(pNth->z);
if( i>1000 ){
pik_error(p, pNth, "value too big - max '1000th'");
i = 1;
}
if( i==0 && pik_token_eq(pNth,"first")==0 ) i = 1;
| | | 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 |
static short int pik_nth_value(Pik *p, PToken *pNth){
int i = atoi(pNth->z);
if( i>1000 ){
pik_error(p, pNth, "value too big - max '1000th'");
i = 1;
}
if( i==0 && pik_token_eq(pNth,"first")==0 ) i = 1;
return (short int)i;
}
/* Search for the NTH object.
**
** If pBasis is not NULL then it should be a [] object. Use the
** sublist of that [] object for the search. If pBasis is not a []
** object, then throw an error.
|
| ︙ | ︙ | |||
6499 6500 6501 6502 6503 6504 6505 |
static PPoint pik_position_at_hdg(PNum dist, PToken *pD, PPoint pt){
return pik_position_at_angle(dist, pik_hdg_angle[pD->eEdge], pt);
}
/* Return the coordinates for the n-th vertex of a line.
*/
static PPoint pik_nth_vertex(Pik *p, PToken *pNth, PToken *pErr, PObj *pObj){
| | | 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 |
static PPoint pik_position_at_hdg(PNum dist, PToken *pD, PPoint pt){
return pik_position_at_angle(dist, pik_hdg_angle[pD->eEdge], pt);
}
/* Return the coordinates for the n-th vertex of a line.
*/
static PPoint pik_nth_vertex(Pik *p, PToken *pNth, PToken *pErr, PObj *pObj){
static const PPoint zero = {0, 0};
int n;
if( p->nErr || pObj==0 ) return p->aTPath[0];
if( !pObj->type->isLine ){
pik_error(p, pErr, "object is not a line");
return zero;
}
n = atoi(pNth->z);
|
| ︙ | ︙ | |||
6666 6667 6668 6669 6670 6671 6672 |
switch( pObj->inDir ){
default: p->aTPath[1].x += pObj->w; break;
case DIR_DOWN: p->aTPath[1].y -= pObj->h; break;
case DIR_LEFT: p->aTPath[1].x -= pObj->w; break;
case DIR_UP: p->aTPath[1].y += pObj->h; break;
}
if( pObj->type->xInit==arcInit ){
| | > | 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 |
switch( pObj->inDir ){
default: p->aTPath[1].x += pObj->w; break;
case DIR_DOWN: p->aTPath[1].y -= pObj->h; break;
case DIR_LEFT: p->aTPath[1].x -= pObj->w; break;
case DIR_UP: p->aTPath[1].y += pObj->h; break;
}
if( pObj->type->xInit==arcInit ){
pObj->outDir = (pObj->inDir + (pObj->cw ? 1 : 3))%4;
p->eDir = (unsigned char)pObj->outDir;
switch( pObj->outDir ){
default: p->aTPath[1].x += pObj->w; break;
case DIR_DOWN: p->aTPath[1].y -= pObj->h; break;
case DIR_LEFT: p->aTPath[1].x -= pObj->w; break;
case DIR_UP: p->aTPath[1].y += pObj->h; break;
}
}
|
| ︙ | ︙ | |||
6757 6758 6759 6760 6761 6762 6763 |
case DIR_LEFT: pObj->ptExit.x -= w2; break;
case DIR_UP: pObj->ptExit.y += h2; break;
case DIR_DOWN: pObj->ptExit.y -= h2; break;
}
pik_bbox_add_xy(&pObj->bbox, pObj->ptAt.x - w2, pObj->ptAt.y - h2);
pik_bbox_add_xy(&pObj->bbox, pObj->ptAt.x + w2, pObj->ptAt.y + h2);
}
| | | 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 |
case DIR_LEFT: pObj->ptExit.x -= w2; break;
case DIR_UP: pObj->ptExit.y += h2; break;
case DIR_DOWN: pObj->ptExit.y -= h2; break;
}
pik_bbox_add_xy(&pObj->bbox, pObj->ptAt.x - w2, pObj->ptAt.y - h2);
pik_bbox_add_xy(&pObj->bbox, pObj->ptAt.x + w2, pObj->ptAt.y + h2);
}
p->eDir = (unsigned char)pObj->outDir;
}
/* Show basic information about each object as a comment in the
** generated HTML. Used for testing and debugging. Activated
** by the (undocumented) "debug = 1;"
** command.
*/
|
| ︙ | ︙ | |||
6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 |
/* Set up rendering parameters */
pik_compute_layout_settings(p);
thickness = pik_value(p,"thickness",9,0);
if( thickness<=0.01 ) thickness = 0.01;
margin = pik_value(p,"margin",6,0);
margin += thickness;
wArrow = p->wArrow*thickness;
p->fgcolor = (int)pik_value(p,"fgcolor",7,&miss);
if( miss ){
PToken t;
t.z = "fgcolor";
t.n = 7;
p->fgcolor = (int)pik_lookup_color(0, &t);
}
/* Compute a bounding box over all objects so that we can know
** how big to declare the SVG canvas */
pik_bbox_init(&p->bbox);
pik_bbox_add_elist(p, pList, wArrow);
/* Expand the bounding box slightly to account for line thickness
| > > > > > > > > > | 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 |
/* Set up rendering parameters */
pik_compute_layout_settings(p);
thickness = pik_value(p,"thickness",9,0);
if( thickness<=0.01 ) thickness = 0.01;
margin = pik_value(p,"margin",6,0);
margin += thickness;
wArrow = p->wArrow*thickness;
miss = 0;
p->fgcolor = (int)pik_value(p,"fgcolor",7,&miss);
if( miss ){
PToken t;
t.z = "fgcolor";
t.n = 7;
p->fgcolor = (int)pik_lookup_color(0, &t);
}
miss = 0;
p->bgcolor = (int)pik_value(p,"bgcolor",7,&miss);
if( miss ){
PToken t;
t.z = "bgcolor";
t.n = 7;
p->bgcolor = (int)pik_lookup_color(0, &t);
}
/* Compute a bounding box over all objects so that we can know
** how big to declare the SVG canvas */
pik_bbox_init(&p->bbox);
pik_bbox_add_elist(p, pList, wArrow);
/* Expand the bounding box slightly to account for line thickness
|
| ︙ | ︙ | |||
6951 6952 6953 6954 6955 6956 6957 |
pik_append(p, "\"", 1);
}
w = p->bbox.ne.x - p->bbox.sw.x;
h = p->bbox.ne.y - p->bbox.sw.y;
p->wSVG = (int)(p->rScale*w);
p->hSVG = (int)(p->rScale*h);
pikScale = pik_value(p,"scale",5,0);
| > | > | | | 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 |
pik_append(p, "\"", 1);
}
w = p->bbox.ne.x - p->bbox.sw.x;
h = p->bbox.ne.y - p->bbox.sw.y;
p->wSVG = (int)(p->rScale*w);
p->hSVG = (int)(p->rScale*h);
pikScale = pik_value(p,"scale",5,0);
if( pikScale>=0.001 && pikScale<=1000.0
&& (pikScale<0.99 || pikScale>1.01)
){
p->wSVG = (int)(p->wSVG*pikScale);
p->hSVG = (int)(p->hSVG*pikScale);
pik_append_num(p, " width=\"", p->wSVG);
pik_append_num(p, "\" height=\"", p->hSVG);
pik_append(p, "\"", 1);
}
pik_append_dis(p, " viewBox=\"0 0 ",w,"");
pik_append_dis(p, " ",h,"\">\n");
pik_elist_render(p, pList);
|
| ︙ | ︙ | |||
7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 |
for(i=2; (c = z[i])!=0 && isxdigit(c); i++){}
pToken->eType = T_NUMBER;
return i;
}
}else{
isInt = 0;
nDigit = 0;
}
if( c=='.' ){
isInt = 0;
for(i++; (c = z[i])>='0' && c<='9'; i++){ nDigit++; }
}
if( nDigit==0 ){
pToken->eType = T_ERROR;
| > | 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 |
for(i=2; (c = z[i])!=0 && isxdigit(c); i++){}
pToken->eType = T_NUMBER;
return i;
}
}else{
isInt = 0;
nDigit = 0;
i = 0;
}
if( c=='.' ){
isInt = 0;
for(i++; (c = z[i])>='0' && c<='9'; i++){ nDigit++; }
}
if( nDigit==0 ){
pToken->eType = T_ERROR;
|
| ︙ | ︙ | |||
7670 7671 7672 7673 7674 7675 7676 |
#endif /* PIKCHR_FUZZ */
#if defined(PIKCHR_SHELL)
/* Print a usage comment for the shell and exit. */
static void usage(const char *argv0){
fprintf(stderr, "usage: %s [OPTIONS] FILE ...\n", argv0);
fprintf(stderr,
| | | 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 |
#endif /* PIKCHR_FUZZ */
#if defined(PIKCHR_SHELL)
/* Print a usage comment for the shell and exit. */
static void usage(const char *argv0){
fprintf(stderr, "usage: %s [OPTIONS] FILE ...\n", argv0);
fprintf(stderr,
"Convert Pikchr input files into SVG. Filename \"-\" means stdin.\n"
"Options:\n"
" --dont-stop Process all files even if earlier files have errors\n"
" --svg-only Omit raw SVG without the HTML wrapper\n"
);
exit(1);
}
|
| ︙ | ︙ | |||
7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 |
}else if( c=='&' ){
printf("&");
}else if( c==0 ){
break;
}
}
}
/* Testing interface
**
** Generate HTML on standard output that displays both the original
** input text and the rendered SVG for all files named on the command
** line.
*/
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 |
}else if( c=='&' ){
printf("&");
}else if( c==0 ){
break;
}
}
}
/* Read the content of file zFilename into memory obtained from malloc()
** Return the memory. If something goes wrong (ex: the file does not exist
** or cannot be opened) put an error message on stderr and return NULL.
**
** If the filename is "-" read stdin.
*/
static char *readFile(const char *zFilename){
FILE *in;
size_t n;
size_t nUsed = 0;
size_t nAlloc = 0;
char *z = 0, *zNew;
in = strcmp(zFilename,"-")==0 ? stdin : fopen(zFilename, "rb");
if( in==0 ){
fprintf(stderr, "cannot open \"%s\" for reading\n", zFilename);
return 0;
}
while(1){
if( nUsed+2>=nAlloc ){
nAlloc = nAlloc*2 + 4000;
zNew = realloc(z, nAlloc);
}
if( zNew==0 ){
free(z);
fprintf(stderr, "out of memory trying to allocate %lld bytes\n",
(long long int)nAlloc);
exit(1);
}
z = zNew;
n = fread(z+nUsed, 1, nAlloc-nUsed-1, in);
if( n<=0 ){
break;
}
nUsed += n;
}
if( in!=stderr ) fclose(in);
z[nUsed] = 0;
return z;
}
/* Testing interface
**
** Generate HTML on standard output that displays both the original
** input text and the rendered SVG for all files named on the command
** line.
*/
|
| ︙ | ︙ | |||
7737 7738 7739 7740 7741 7742 7743 |
"</script>\n"
"<meta charset=\"utf-8\">\n"
"</head>\n"
"<body>\n"
;
if( argc<2 ) usage(argv[0]);
for(i=1; i<argc; i++){
| < < | | 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 |
"</script>\n"
"<meta charset=\"utf-8\">\n"
"</head>\n"
"<body>\n"
;
if( argc<2 ) usage(argv[0]);
for(i=1; i<argc; i++){
char *zIn;
char *zOut;
int w, h;
if( argv[i][0]=='-' && argv[i][1]!=0 ){
char *z = argv[i];
z++;
if( z[0]=='-' ) z++;
if( strcmp(z,"dont-stop")==0 ){
bDontStop = 1;
}else
if( strcmp(z,"dark-mode")==0 ){
|
| ︙ | ︙ | |||
7768 7769 7770 7771 7772 7773 7774 |
}else
{
fprintf(stderr,"unknown option: \"%s\"\n", argv[i]);
usage(argv[0]);
}
continue;
}
| | < < < < < < < < | < < < < < < < | 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 |
}else
{
fprintf(stderr,"unknown option: \"%s\"\n", argv[i]);
usage(argv[0]);
}
continue;
}
zIn = readFile(argv[i]);
if( zIn==0 ) continue;
zOut = pikchr(zIn, "pikchr", mFlags, &w, &h);
if( w<0 ) exitCode = 1;
if( zOut==0 ){
fprintf(stderr, "pikchr() returns NULL. Out of memory?\n");
if( !bDontStop ) exit(1);
}else if( bSvgOnly ){
printf("%s\n", zOut);
|
| ︙ | ︙ | |||
7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 |
Tcl_Obj *CONST objv[] /* Command arguments */
){
int w, h; /* Width and height of the pikchr */
const char *zIn; /* Source text input */
char *zOut; /* SVG output text */
Tcl_Obj *pRes; /* The result TCL object */
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "PIKCHR_SOURCE_TEXT");
return TCL_ERROR;
}
zIn = Tcl_GetString(objv[1]);
w = h = 0;
zOut = pikchr(zIn, "pikchr", 0, &w, &h);
| > | 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 |
Tcl_Obj *CONST objv[] /* Command arguments */
){
int w, h; /* Width and height of the pikchr */
const char *zIn; /* Source text input */
char *zOut; /* SVG output text */
Tcl_Obj *pRes; /* The result TCL object */
(void)clientData;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "PIKCHR_SOURCE_TEXT");
return TCL_ERROR;
}
zIn = Tcl_GetString(objv[1]);
w = h = 0;
zOut = pikchr(zIn, "pikchr", 0, &w, &h);
|
| ︙ | ︙ | |||
7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 |
return TCL_OK;
}
/* Invoke this routine to register the "pikchr" command with the interpreter
** given in the argument */
int Pikchr_Init(Tcl_Interp *interp){
Tcl_CreateObjCommand(interp, "pikchr", pik_tcl_command, 0, 0);
return TCL_OK;
}
#endif /* PIKCHR_TCL */
| > | | 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 |
return TCL_OK;
}
/* Invoke this routine to register the "pikchr" command with the interpreter
** given in the argument */
int Pikchr_Init(Tcl_Interp *interp){
Tcl_CreateObjCommand(interp, "pikchr", pik_tcl_command, 0, 0);
Tcl_PkgProvide (interp, PACKAGE_NAME, PACKAGE_VERSION);
return TCL_OK;
}
#endif /* PIKCHR_TCL */
#line 7954 "pikchr.c"
|
Changes to src/skins.c.
| ︙ | ︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
**
** The following array holds the value for all known skin details.
*/
static struct SkinDetail {
const char *zName; /* Name of the detail */
const char *zValue; /* Value of the detail */
} aSkinDetail[] = {
{ "pikchr-fontscale", "" },
{ "pikchr-foreground", "" },
{ "pikchr-scale", "" },
{ "timeline-arrowheads", "1" },
{ "timeline-circle-nodes", "0" },
{ "timeline-color-graph-lines", "0" },
{ "white-foreground", "0" },
| > | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
**
** The following array holds the value for all known skin details.
*/
static struct SkinDetail {
const char *zName; /* Name of the detail */
const char *zValue; /* Value of the detail */
} aSkinDetail[] = {
{ "pikchr-background", "" },
{ "pikchr-fontscale", "" },
{ "pikchr-foreground", "" },
{ "pikchr-scale", "" },
{ "timeline-arrowheads", "1" },
{ "timeline-circle-nodes", "0" },
{ "timeline-color-graph-lines", "0" },
{ "white-foreground", "0" },
|
| ︙ | ︙ |