Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Enhance the manifest parser to support parsing of Forum posts artifacts. At the same time, simplify the artifact syntax error detection logic using tables rather than straight code. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | forum-v2 |
Files: | files | file ages | folders |
SHA3-256: |
e893e9d01b8b217d8dccbf111e31e5e6 |
User & Date: | drh 2018-07-19 21:31:34.363 |
Context
2018-07-19
| ||
22:55 | Begin adding forum artifact parsing code. ... (check-in: a2b470f1 user: drh tags: forum-v2) | |
21:31 | Enhance the manifest parser to support parsing of Forum posts artifacts. At the same time, simplify the artifact syntax error detection logic using tables rather than straight code. ... (check-in: e893e9d0 user: drh tags: forum-v2) | |
19:43 | Proposed new design for the forum. Individual posts are stored as ordinary artifacts and thus participate in sync just like any other artifact. There is a new artifact type used to describe forum posts. This check-in defines the format of the new artifact type. Follow-up check-ins on this thread will attempt to flesh-out the idea in code. ... (check-in: 15fa6053 user: drh tags: forum-v2) | |
Changes
Changes to src/manifest.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #define CFTYPE_MANIFEST 1 #define CFTYPE_CLUSTER 2 #define CFTYPE_CONTROL 3 #define CFTYPE_WIKI 4 #define CFTYPE_TICKET 5 #define CFTYPE_ATTACHMENT 6 #define CFTYPE_EVENT 7 /* ** File permissions used by Fossil internally. */ #define PERM_REG 0 /* regular file */ #define PERM_EXE 1 /* executable */ #define PERM_LNK 2 /* symlink */ | > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #define CFTYPE_MANIFEST 1 #define CFTYPE_CLUSTER 2 #define CFTYPE_CONTROL 3 #define CFTYPE_WIKI 4 #define CFTYPE_TICKET 5 #define CFTYPE_ATTACHMENT 6 #define CFTYPE_EVENT 7 #define CFTYPE_FORUM 8 /* ** File permissions used by Fossil internally. */ #define PERM_REG 0 /* regular file */ #define PERM_EXE 1 /* executable */ #define PERM_LNK 2 /* symlink */ |
︙ | ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | char *zComment; /* Decoded comment. The C card. */ double rDate; /* Date and time from D card. 0.0 if no D card. */ char *zUser; /* Name of the user from the U card. */ char *zRepoCksum; /* MD5 checksum of the baseline content. R card. */ char *zWiki; /* Text of the wiki page. W card. */ char *zWikiTitle; /* Name of the wiki page. L card. */ char *zMimetype; /* Mime type of wiki or comment text. N card. */ double rEventDate; /* Date of an event. E card. */ char *zEventId; /* Artifact hash for an event. E card. */ char *zTicketUuid; /* UUID for a ticket. K card. */ char *zAttachName; /* Filename of an attachment. A card. */ char *zAttachSrc; /* Artifact hash for document being attached. A card. */ char *zAttachTarget; /* Ticket or wiki that attachment applies to. A card */ int nFile; /* Number of F cards */ int nFileAlloc; /* Slots allocated in aFile[] */ int iFile; /* Index of current file in iterator */ ManifestFile *aFile; /* One entry for each F-card */ int nParent; /* Number of parents. */ int nParentAlloc; /* Slots allocated in azParent[] */ char **azParent; /* Hashes of parents. One for each P card argument */ | > > > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | char *zComment; /* Decoded comment. The C card. */ double rDate; /* Date and time from D card. 0.0 if no D card. */ char *zUser; /* Name of the user from the U card. */ char *zRepoCksum; /* MD5 checksum of the baseline content. R card. */ char *zWiki; /* Text of the wiki page. W card. */ char *zWikiTitle; /* Name of the wiki page. L card. */ char *zMimetype; /* Mime type of wiki or comment text. N card. */ char *zThreadTitle; /* The forum thread title. H card */ double rEventDate; /* Date of an event. E card. */ char *zEventId; /* Artifact hash for an event. E card. */ char *zTicketUuid; /* UUID for a ticket. K card. */ char *zAttachName; /* Filename of an attachment. A card. */ char *zAttachSrc; /* Artifact hash for document being attached. A card. */ char *zAttachTarget; /* Ticket or wiki that attachment applies to. A card */ char *zThreadRoot; /* Thread root artifact. G card */ char *zInReplyTo; /* Forum in-reply-to artifact. I card */ int nFile; /* Number of F cards */ int nFileAlloc; /* Slots allocated in aFile[] */ int iFile; /* Index of current file in iterator */ ManifestFile *aFile; /* One entry for each F-card */ int nParent; /* Number of parents. */ int nParentAlloc; /* Slots allocated in azParent[] */ char **azParent; /* Hashes of parents. One for each P card argument */ |
︙ | ︙ | |||
110 111 112 113 114 115 116 117 118 119 120 121 122 123 | int nFieldAlloc; /* Slots allocated in aField[] */ struct { char *zName; /* Key or field name */ char *zValue; /* Value of the field */ } *aField; /* One for each J card */ }; #endif /* ** A cache of parsed manifests. This reduces the number of ** calls to manifest_parse() when doing a rebuild. */ #define MX_MANIFEST_CACHE 6 static struct { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | int nFieldAlloc; /* Slots allocated in aField[] */ struct { char *zName; /* Key or field name */ char *zValue; /* Value of the field */ } *aField; /* One for each J card */ }; #endif /* ** Allowed and required card types in each style of artifact */ static struct { const char *zAllowed; /* Allowed cards. Human-readable */ const char *zRequired; /* Required cards. Human-readable */ } manifestCardTypes[] = { /* Allowed Required */ /* CFTYPE_MANIFEST 1 */ { "BCDFNPQRTUZ", "CDUZ" }, /* CFTYPE_CLUSTER 2 */ { "MZ", "MZ" }, /* CFTYPE_CONTROL 3 */ { "DTUZ", "DTUZ" }, /* CFTYPE_WIKI 4 */ { "DLNPUWZ", "DLUWZ" }, /* CFTYPE_TICKET 5 */ { "DJKUZ", "DJKUZ" }, /* CFTYPE_ATTACHMENT 6 */ { "ACDNUZ", "ADZ" }, /* CFTYPE_EVENT 7 */ { "CDENPTUWZ", "DEWZ" }, /* CFTYPE_FORUM 8 */ { "DGHINPUWZ", "DUWZ" }, }; /* ** Names of manifest types */ static const char *azNameOfMType[] = { "manifest", "cluster", "tag", "wiki", "ticket", "attachment", "technote", "forum post" }; /* ** A cache of parsed manifests. This reduces the number of ** calls to manifest_parse() when doing a rebuild. */ #define MX_MANIFEST_CACHE 6 static struct { |
︙ | ︙ | |||
145 146 147 148 149 150 151 152 153 154 155 156 157 158 | fossil_free(p->aField); fossil_free(p->aCherrypick); if( p->pBaseline ) manifest_destroy(p->pBaseline); memset(p, 0, sizeof(*p)); fossil_free(p); } } /* ** Add an element to the manifest cache using LRU replacement. */ void manifest_cache_insert(Manifest *p){ while( p ){ int i; | > > > > > > > > > > > > > > > > > > > > > > > > > | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | fossil_free(p->aField); fossil_free(p->aCherrypick); if( p->pBaseline ) manifest_destroy(p->pBaseline); memset(p, 0, sizeof(*p)); fossil_free(p); } } /* ** Given a string of upper-case letters, compute a mask of the letters ** present. For example, "ABC" computes 0x0007. "DE" gives 0x0018". */ static unsigned int manifest_card_mask(const char *z){ unsigned int m = 0; char c; while( (c = *(z++))>='A' && c<='Z' ){ m |= 1 << (c - 'A'); } return m; } /* ** Given an integer mask representing letters A-Z, return the ** letter which is the first bit set in the mask. Example: ** 0x03520 gives 'F' since the F-bit is the lowest. */ static char maskToType(unsigned int x){ char c = 'A'; if( x==0 ) return '?'; while( (x&1)==0 ){ x >>= 1; c++; } return c; } /* ** Add an element to the manifest cache using LRU replacement. */ void manifest_cache_insert(Manifest *p){ while( p ){ int i; |
︙ | ︙ | |||
350 351 352 353 354 355 356 | ** Each card is divided into tokens by a single space character. ** The first token is a single upper-case letter which is the card type. ** The card type determines the other parameters to the card. ** Cards must occur in lexicographical order. */ Manifest *manifest_parse(Blob *pContent, int rid, Blob *pErr){ Manifest *p; | < > > > | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | ** Each card is divided into tokens by a single space character. ** The first token is a single upper-case letter which is the card type. ** The card type determines the other parameters to the card. ** Cards must occur in lexicographical order. */ Manifest *manifest_parse(Blob *pContent, int rid, Blob *pErr){ Manifest *p; int i, lineNo=0; ManifestText x; char cPrevType = 0; char cType; char *z; int n; char *zUuid; int sz = 0; int isRepeat, hasSelfRefTag = 0; static Bag seen; const char *zErr = 0; unsigned int m; unsigned int seenCard = 0; /* Which card types have been seen */ char zErrBuf[100]; /* Write error messages here */ if( rid==0 ){ isRepeat = 1; }else if( bag_find(&seen, rid) ){ isRepeat = 1; }else{ isRepeat = 0; |
︙ | ︙ | |||
420 421 422 423 424 425 426 427 428 429 430 431 432 433 | /* Begin parsing, card by card. */ x.z = z; x.zEnd = &z[n]; x.atEol = 1; while( (cType = next_card(&x))!=0 && cType>=cPrevType ){ lineNo++; switch( cType ){ /* ** A <filename> <target> ?<source>? ** ** Identifies an attachment to either a wiki page or a ticket. ** <source> is the artifact that is the attachment. <source> ** is omitted to delete an attachment. <target> is the name of | > > | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | /* Begin parsing, card by card. */ x.z = z; x.zEnd = &z[n]; x.atEol = 1; while( (cType = next_card(&x))!=0 && cType>=cPrevType ){ lineNo++; if( cType<'A' || cType>'Z' ) SYNTAX("bad card type"); seenCard |= 1 << (cType-'A'); switch( cType ){ /* ** A <filename> <target> ?<source>? ** ** Identifies an attachment to either a wiki page or a ticket. ** <source> is the artifact that is the attachment. <source> ** is omitted to delete an attachment. <target> is the name of |
︙ | ︙ | |||
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | } if( zSrc && !hname_validate(zSrc,nSrc) ){ SYNTAX("invalid source on A-card"); } p->zAttachName = (char*)file_tail(zName); p->zAttachSrc = zSrc; p->zAttachTarget = zTarget; break; } /* ** B <uuid> ** ** A B-line gives the artifact hash for the baseline of a delta-manifest. */ case 'B': { if( p->zBaseline ) SYNTAX("more than one B-card"); p->zBaseline = next_token(&x, &sz); if( p->zBaseline==0 ) SYNTAX("missing hash on B-card"); if( !hname_validate(p->zBaseline,sz) ){ SYNTAX("invalid hash on B-card"); } break; } /* ** C <comment> ** | > > | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | } if( zSrc && !hname_validate(zSrc,nSrc) ){ SYNTAX("invalid source on A-card"); } p->zAttachName = (char*)file_tail(zName); p->zAttachSrc = zSrc; p->zAttachTarget = zTarget; p->type = CFTYPE_ATTACHMENT; break; } /* ** B <uuid> ** ** A B-line gives the artifact hash for the baseline of a delta-manifest. */ case 'B': { if( p->zBaseline ) SYNTAX("more than one B-card"); p->zBaseline = next_token(&x, &sz); if( p->zBaseline==0 ) SYNTAX("missing hash on B-card"); if( !hname_validate(p->zBaseline,sz) ){ SYNTAX("invalid hash on B-card"); } p->type = CFTYPE_MANIFEST; break; } /* ** C <comment> ** |
︙ | ︙ | |||
518 519 520 521 522 523 524 525 526 527 528 529 530 531 | if( p->rEventDate>0.0 ) SYNTAX("more than one E-card"); p->rEventDate = db_double(0.0,"SELECT julianday(%Q)", next_token(&x,0)); if( p->rEventDate<=0.0 ) SYNTAX("malformed date on E-card"); p->zEventId = next_token(&x, &sz); if( !hname_validate(p->zEventId, sz) ){ SYNTAX("malformed hash on E-card"); } break; } /* ** F <filename> ?<uuid>? ?<permissions>? ?<old-name>? ** ** Identifies a file in a manifest. Multiple F lines are | > | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | if( p->rEventDate>0.0 ) SYNTAX("more than one E-card"); p->rEventDate = db_double(0.0,"SELECT julianday(%Q)", next_token(&x,0)); if( p->rEventDate<=0.0 ) SYNTAX("malformed date on E-card"); p->zEventId = next_token(&x, &sz); if( !hname_validate(p->zEventId, sz) ){ SYNTAX("malformed hash on E-card"); } p->type = CFTYPE_EVENT; break; } /* ** F <filename> ?<uuid>? ?<permissions>? ?<old-name>? ** ** Identifies a file in a manifest. Multiple F lines are |
︙ | ︙ | |||
563 564 565 566 567 568 569 570 571 572 573 574 575 576 | p->aFile[i].zName = zName; p->aFile[i].zUuid = zUuid; p->aFile[i].zPerm = zPerm; p->aFile[i].zPrior = zPriorName; if( i>0 && fossil_strcmp(p->aFile[i-1].zName, zName)>=0 ){ SYNTAX("incorrect F-card sort order"); } break; } /* ** J <name> ?<value>? ** ** Specifies a name value pair for ticket. If the first character | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | p->aFile[i].zName = zName; p->aFile[i].zUuid = zUuid; p->aFile[i].zPerm = zPerm; p->aFile[i].zPrior = zPriorName; if( i>0 && fossil_strcmp(p->aFile[i-1].zName, zName)>=0 ){ SYNTAX("incorrect F-card sort order"); } p->type = CFTYPE_MANIFEST; break; } /* ** G <hash> ** ** A G-card identifies the initial root forum post for the thread ** of which this post is a part. Forum posts only. */ case 'G': { if( p->zThreadRoot!=0 ) SYNTAX("more than one G-card"); p->zThreadRoot = next_token(&x, &sz); if( p->zThreadRoot==0 ) SYNTAX("missing hash on G-card"); if( !hname_validate(p->zThreadRoot,sz) ){ SYNTAX("Invalid hash on G-card"); } p->type = CFTYPE_FORUM; break; } /* ** H <threadtitle> ** ** The title for a forum thread. */ case 'H': { if( p->zThreadTitle!=0 ) SYNTAX("more than one H-card"); p->zThreadTitle = next_token(&x,0); if( p->zThreadTitle==0 ) SYNTAX("missing title on H-card"); defossilize(p->zThreadTitle); p->type = CFTYPE_FORUM; break; } /* ** I <hash> ** ** A I-card identifies another forum post that the current forum post ** is in reply to. */ case 'I': { if( p->zInReplyTo!=0 ) SYNTAX("more than one I-card"); p->zInReplyTo = next_token(&x, &sz); if( p->zInReplyTo==0 ) SYNTAX("missing hash on I-card"); if( !hname_validate(p->zInReplyTo,sz) ){ SYNTAX("Invalid hash on I-card"); } p->type = CFTYPE_FORUM; break; } /* ** J <name> ?<value>? ** ** Specifies a name value pair for ticket. If the first character |
︙ | ︙ | |||
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | } i = p->nField++; p->aField[i].zName = zName; p->aField[i].zValue = zValue; if( i>0 && fossil_strcmp(p->aField[i-1].zName, zName)>=0 ){ SYNTAX("incorrect J-card sort order"); } break; } /* ** K <uuid> ** ** A K-line gives the UUID for the ticket which this control file ** is amending. */ case 'K': { if( p->zTicketUuid!=0 ) SYNTAX("more than one K-card"); p->zTicketUuid = next_token(&x, &sz); if( sz!=HNAME_LEN_SHA1 ) SYNTAX("K-card UUID is the wrong size"); if( !validate16(p->zTicketUuid, sz) ){ SYNTAX("invalid K-card UUID"); } break; } /* ** L <wikititle> ** ** The wiki page title is fossil-encoded. There may be no more than ** one L line. */ case 'L': { if( p->zWikiTitle!=0 ) SYNTAX("more than one L-card"); p->zWikiTitle = next_token(&x,0); if( p->zWikiTitle==0 ) SYNTAX("missing title on L-card"); defossilize(p->zWikiTitle); if( !wiki_name_is_wellformed((const unsigned char *)p->zWikiTitle) ){ SYNTAX("L-card has malformed wiki name"); } break; } /* ** M <hash> ** ** An M-line identifies another artifact by its hash. M-lines | > > > | 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | } i = p->nField++; p->aField[i].zName = zName; p->aField[i].zValue = zValue; if( i>0 && fossil_strcmp(p->aField[i-1].zName, zName)>=0 ){ SYNTAX("incorrect J-card sort order"); } p->type = CFTYPE_TICKET; break; } /* ** K <uuid> ** ** A K-line gives the UUID for the ticket which this control file ** is amending. */ case 'K': { if( p->zTicketUuid!=0 ) SYNTAX("more than one K-card"); p->zTicketUuid = next_token(&x, &sz); if( sz!=HNAME_LEN_SHA1 ) SYNTAX("K-card UUID is the wrong size"); if( !validate16(p->zTicketUuid, sz) ){ SYNTAX("invalid K-card UUID"); } p->type = CFTYPE_TICKET; break; } /* ** L <wikititle> ** ** The wiki page title is fossil-encoded. There may be no more than ** one L line. */ case 'L': { if( p->zWikiTitle!=0 ) SYNTAX("more than one L-card"); p->zWikiTitle = next_token(&x,0); if( p->zWikiTitle==0 ) SYNTAX("missing title on L-card"); defossilize(p->zWikiTitle); if( !wiki_name_is_wellformed((const unsigned char *)p->zWikiTitle) ){ SYNTAX("L-card has malformed wiki name"); } p->type = CFTYPE_WIKI; break; } /* ** M <hash> ** ** An M-line identifies another artifact by its hash. M-lines |
︙ | ︙ | |||
651 652 653 654 655 656 657 658 659 660 661 662 663 664 | , p->nCChildAlloc*sizeof(p->azCChild[0]) ); } i = p->nCChild++; p->azCChild[i] = zUuid; if( i>0 && fossil_strcmp(p->azCChild[i-1], zUuid)>=0 ){ SYNTAX("M-card in the wrong order"); } break; } /* ** N <uuid> ** ** An N-line identifies the mimetype of wiki or comment text. | > | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | , p->nCChildAlloc*sizeof(p->azCChild[0]) ); } i = p->nCChild++; p->azCChild[i] = zUuid; if( i>0 && fossil_strcmp(p->azCChild[i-1], zUuid)>=0 ){ SYNTAX("M-card in the wrong order"); } p->type = CFTYPE_CLUSTER; break; } /* ** N <uuid> ** ** An N-line identifies the mimetype of wiki or comment text. |
︙ | ︙ | |||
715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | p->aCherrypick = fossil_realloc(p->aCherrypick, p->nCherrypick*sizeof(p->aCherrypick[0])); p->aCherrypick[n].zCPTarget = zUuid; p->aCherrypick[n].zCPBase = zUuid = next_token(&x, &sz); if( zUuid && !hname_validate(zUuid,sz) ){ SYNTAX("invalid second hash on Q-card"); } break; } /* ** R <md5sum> ** ** Specify the MD5 checksum over the name and content of all files ** in the manifest. */ case 'R': { if( p->zRepoCksum!=0 ) SYNTAX("more than one R-card"); p->zRepoCksum = next_token(&x, &sz); if( sz!=32 ) SYNTAX("wrong size cksum on R-card"); if( !validate16(p->zRepoCksum, 32) ) SYNTAX("malformed R-card cksum"); break; } /* ** T (+|*|-)<tagname> <uuid> ?<value>? ** ** Create or cancel a tag or property. The tagname is fossil-encoded. | > > | 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | p->aCherrypick = fossil_realloc(p->aCherrypick, p->nCherrypick*sizeof(p->aCherrypick[0])); p->aCherrypick[n].zCPTarget = zUuid; p->aCherrypick[n].zCPBase = zUuid = next_token(&x, &sz); if( zUuid && !hname_validate(zUuid,sz) ){ SYNTAX("invalid second hash on Q-card"); } p->type = CFTYPE_MANIFEST; break; } /* ** R <md5sum> ** ** Specify the MD5 checksum over the name and content of all files ** in the manifest. */ case 'R': { if( p->zRepoCksum!=0 ) SYNTAX("more than one R-card"); p->zRepoCksum = next_token(&x, &sz); if( sz!=32 ) SYNTAX("wrong size cksum on R-card"); if( !validate16(p->zRepoCksum, 32) ) SYNTAX("malformed R-card cksum"); p->type = CFTYPE_MANIFEST; break; } /* ** T (+|*|-)<tagname> <uuid> ?<value>? ** ** Create or cancel a tag or property. The tagname is fossil-encoded. |
︙ | ︙ | |||
757 758 759 760 761 762 763 | if( zName==0 ) SYNTAX("missing name on T-card"); zUuid = next_token(&x, &sz); if( zUuid==0 ) SYNTAX("missing artifact hash on T-card"); zValue = next_token(&x, 0); if( zValue ) defossilize(zValue); if( hname_validate(zUuid, sz) ){ /* A valid artifact hash */ | | | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | if( zName==0 ) SYNTAX("missing name on T-card"); zUuid = next_token(&x, &sz); if( zUuid==0 ) SYNTAX("missing artifact hash on T-card"); zValue = next_token(&x, 0); if( zValue ) defossilize(zValue); if( hname_validate(zUuid, sz) ){ /* A valid artifact hash */ if( p->zEventId ) SYNTAX("non-self-referential T-card in technote"); }else if( sz==1 && zUuid[0]=='*' ){ zUuid = 0; hasSelfRefTag = 1; if( p->zEventId && zName[0]!='+' ){ SYNTAX("propagating T-card in event"); } }else{ |
︙ | ︙ | |||
856 857 858 859 860 861 862 | ** Manifest. It is not required for manifest only for historical ** compatibility reasons. */ case 'Z': { zUuid = next_token(&x, &sz); if( sz!=32 ) SYNTAX("wrong size for Z-card cksum"); if( !validate16(zUuid, 32) ) SYNTAX("malformed Z-card cksum"); | < | > | < | < < < < < < < < < < < < < < < | | > | | | < < | < < < < < < | < < < > > > | | | | | < | < < | < < < < > | > | > | < < < < < < < < < | | | > | < < | < < < < | > > | | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | ** Manifest. It is not required for manifest only for historical ** compatibility reasons. */ case 'Z': { zUuid = next_token(&x, &sz); if( sz!=32 ) SYNTAX("wrong size for Z-card cksum"); if( !validate16(zUuid, 32) ) SYNTAX("malformed Z-card cksum"); break; } default: { SYNTAX("unrecognized card"); } } } if( x.z<x.zEnd ) SYNTAX("extra characters at end of card"); /* If the artifact type has not yet been determined, then compute ** it now. */ if( p->type==0 ){ p->type = p->zComment!=0 ? CFTYPE_MANIFEST : CFTYPE_CONTROL; } /* Verify that no disallowed cards are present for this artifact type */ m = manifest_card_mask(manifestCardTypes[p->type-1].zAllowed); if( seenCard & ~m ){ sqlite3_snprintf(sizeof(zErrBuf), zErrBuf, "%c-card in %s", maskToType(seenCard & ~m), azNameOfMType[p->type-1]); zErr = zErrBuf; goto manifest_syntax_error; } /* Verify that all required cards are present for this artifact type */ m = manifest_card_mask(manifestCardTypes[p->type-1].zRequired); if( ~seenCard & m ){ sqlite3_snprintf(sizeof(zErrBuf), zErrBuf, "%c-card missing in %s", maskToType(~seenCard & m), azNameOfMType[p->type-1]); zErr = zErrBuf; goto manifest_syntax_error; } /* Additional checks based on artifact type */ switch( p->type ){ case CFTYPE_FORUM: { if( p->zThreadTitle && p->zInReplyTo ){ SYNTAX("cannot have I-card and H-card in a forum post"); } if( p->nParent>1 ) SYNTAX("too many arguments to P-card"); break; } } md5sum_init(); if( !isRepeat ) g.parseCnt[p->type]++; return p; manifest_syntax_error: { char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); if( zUuid ){ blob_appendf(pErr, "artifact [%s] ", zUuid); fossil_free(zUuid); } } if( zErr ){ blob_appendf(pErr, "line %d: %s", lineNo, zErr); }else{ blob_appendf(pErr, "unknown error on line %d", lineNo); |
︙ | ︙ |
Changes to www/fileformat.wiki.
︙ | ︙ | |||
690 691 692 693 694 695 696 697 698 699 700 701 702 703 | <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td><b>H</b> <i>thread-title</i></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> | > > > > > > > > > > > | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td><b>G</b> <i>thread-root</i></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align=center><b>0-1</b></td> </tr> <tr> <td><b>H</b> <i>thread-title</i></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> |
︙ | ︙ |