Changeset 117
- Timestamp:
- Nov 24, 2001, 2:54:10 PM (24 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/configsys.h
r113 r117 119 119 PXSTRING pstrChanged); 120 120 #endif 121 122 /* ****************************************************************** 123 * 124 * Swappath 125 * 126 ********************************************************************/ 127 128 BOOL XWPENTRY csysParseSwapPath(const char *pcszConfigSys, 129 PSZ pszSwapPath, 130 PULONG pulMinFree, 131 PULONG pulMinSize); 132 typedef BOOL XWPENTRY CSYSPARSESWAPPATH(const char *pcszConfigSys, 133 PSZ pszSwapPath, 134 PULONG pulMinFree, 135 PULONG pulMinSize); 136 typedef CSYSPARSESWAPPATH *PCSYSPARSESWAPPATH; 137 138 ULONG XWPENTRY csysQuerySwapperSize(VOID); 139 typedef ULONG XWPENTRY CSYSQUERYSWAPPERSIZE(VOID); 140 typedef CSYSQUERYSWAPPERSIZE *PCSYSQUERYSWAPPERSIZE; 141 121 142 #endif 122 143 -
trunk/include/helpers/dialog.h
r111 r117 197 197 WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK, \ 198 198 id, CTL_COMMON_FONT, 0, {cx, -1}, COMMON_SPACING } 199 200 #define CONTROLDEF_ICON(hptr, id) { WC_STATIC, (PCSZ)(hptr), \ 201 WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \ 202 id, CTL_COMMON_FONT, 0, {-1, -1}, COMMON_SPACING } 203 204 #define CONTROLDEF_BITMAP(hbm, id) { WC_STATIC, (PCSZ)(hbm), \ 205 WS_VISIBLE | SS_BITMAP | DT_LEFT | DT_VCENTER, \ 206 id, CTL_COMMON_FONT, 0, {-1, -1}, COMMON_SPACING } 199 207 200 208 #define CONTROLDEF_DEFPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \ -
trunk/src/helpers/configsys.c
r91 r117 1058 1058 } 1059 1059 1060 /* ****************************************************************** 1061 * 1062 * Swappath 1063 * 1064 ********************************************************************/ 1065 1066 extern CHAR G_szSwapperFilename[CCHMAXPATH] = ""; 1067 1068 /* 1069 *@@ csysParseSwapPath: 1070 * 1071 *@@added V0.9.9 (2001-02-08) [umoeller] 1072 *@@changed V0.9.16 (2001-11-10) [umoeller]: moved to helpers 1073 */ 1074 1075 BOOL csysParseSwapPath(const char *pcszConfigSys, // in: if NULL, this gets loaded 1076 PSZ pszSwapPath, // out: swapper directory 1077 PULONG pulMinFree, // out: min free 1078 PULONG pulMinSize) // out: min size 1079 { 1080 BOOL brc = FALSE; 1081 1082 PSZ pszConfigSysTemp = 0; 1083 1084 if (!pcszConfigSys) 1085 { 1086 // not specified: load it 1087 if (csysLoadConfigSys(NULL, &pszConfigSysTemp) == NO_ERROR) 1088 pcszConfigSys = pszConfigSysTemp; 1089 } 1090 1091 if (pcszConfigSys) 1092 { 1093 // parse SWAPPATH command 1094 PSZ p; 1095 if (p = csysGetParameter(pcszConfigSys, "SWAPPATH=", NULL, 0)) 1096 { 1097 CHAR szSwap[CCHMAXPATH]; 1098 ULONG ulMinFree = 2048, ulMinSize = 2048; 1099 // int iScanned; 1100 sscanf(p, 1101 "%s %d %d", 1102 &szSwap, &ulMinFree, &ulMinSize); 1103 1104 if (pszSwapPath) 1105 strcpy(pszSwapPath, szSwap); 1106 if (pulMinFree) 1107 *pulMinFree = ulMinFree; 1108 if (pulMinSize) 1109 *pulMinSize = ulMinSize; 1110 1111 if (G_szSwapperFilename[0] == '\0') 1112 { 1113 // first call: copy to global so that the swapper 1114 // monitors will always use the old one, in case 1115 // the user changes this 1116 strcpy(G_szSwapperFilename, szSwap); 1117 if (G_szSwapperFilename[strlen(G_szSwapperFilename)-1] != '\\') 1118 strcat(G_szSwapperFilename, "\\"); 1119 strcat(G_szSwapperFilename, "swapper.dat"); 1120 } 1121 1122 brc = TRUE; 1123 } 1124 } 1125 1126 if (pszConfigSysTemp) 1127 free(pszConfigSysTemp); 1128 1129 return (brc); 1130 } 1131 1132 /* 1133 *@@ csysQuerySwapperSize: 1134 * returns the current size of the swap file 1135 * in bytes. 1136 * 1137 *@@added V0.9.9 (2001-02-08) [umoeller] 1138 *@@changed V0.9.16 (2001-11-10) [umoeller]: moved to helpers 1139 */ 1140 1141 ULONG csysQuerySwapperSize(VOID) 1142 { 1143 ULONG ulrc = 0; 1144 1145 if (G_szSwapperFilename[0] == '\0') 1146 { 1147 // first call: compose the path 1148 csysParseSwapPath(NULL, 1149 NULL, 1150 NULL, 1151 NULL); 1152 } 1153 1154 if (G_szSwapperFilename[0]) 1155 doshQueryPathSize(G_szSwapperFilename, &ulrc); 1156 1157 return (ulrc); 1158 } 1159 1060 1160 // testcase 1061 1161 -
trunk/src/helpers/except.c
r81 r117 613 613 } 614 614 615 if (DosGetInfoBlocks(&ptib, &ppib) == NO_ERROR) 615 // V0.9.16 (2001-11-02) [pr]: We already got this info. above - this overwrites the 616 // original values before the priority change, which is rather confusing. 617 // if (DosGetInfoBlocks(&ptib, &ppib) == NO_ERROR) 616 618 { 617 619 /* … … 647 649 "\n Process module: 0x%lX (%s)" 648 650 "\n Trapping module: 0x%lX (%s)" 649 "\n Object: %l u\n",651 "\n Object: %ld\n", // V0.9.16 (2001-11-02) [pr]: make this display signed 650 652 ppib->pib_ulpid, 651 653 hMod1, szMod1, -
trunk/src/helpers/xml.c
r113 r117 680 680 { 681 681 PDOMNODE pNew = NULL; 682 APIRET arc = xmlCreateDomNode(pParent,683 DOMNODE_ELEMENT, 684 pcszElement,685 0,686 &pNew);687 688 if (arc == NO_ERROR)682 APIRET arc; 683 684 if (!(arc = xmlCreateDomNode(pParent, 685 DOMNODE_ELEMENT, 686 pcszElement, 687 0, 688 &pNew))) 689 689 *ppNew = pNew; 690 690 … … 717 717 APIRET arc = NO_ERROR; 718 718 719 if ( !pElement720 || pElement->NodeBase.ulNodeType != DOMNODE_ELEMENT719 if ( (!pElement) 720 || (pElement->NodeBase.ulNodeType != DOMNODE_ELEMENT) 721 721 ) 722 722 arc = ERROR_DOM_NO_ELEMENT; … … 724 724 { 725 725 PDOMNODE pNew = NULL; 726 arc = xmlCreateDomNode(pElement, // this takes care of adding to the list 727 DOMNODE_ATTRIBUTE, 728 pcszName, 729 0, 730 &pNew); 731 if (arc == NO_ERROR) 726 if (!(arc = xmlCreateDomNode(pElement, // this takes care of adding to the list 727 DOMNODE_ATTRIBUTE, 728 pcszName, 729 0, 730 &pNew))) 732 731 { 733 732 pNew->pstrNodeValue = xstrCreate(0); … … 758 757 { 759 758 PDOMNODE pNew = NULL; 760 APIRET arc = xmlCreateDomNode(pParent, 761 DOMNODE_TEXT, 762 NULL, 763 0, 764 &pNew); 765 if (arc == NO_ERROR) 766 { 767 PSZ pszNodeValue = (PSZ)malloc(ulLength + 1); 768 if (!pszNodeValue) 769 { 770 arc = ERROR_NOT_ENOUGH_MEMORY; 771 xmlDeleteNode((PNODEBASE)pNew); 772 } 773 else 759 APIRET arc; 760 761 if (!(arc = xmlCreateDomNode(pParent, 762 DOMNODE_TEXT, 763 NULL, 764 0, 765 &pNew))) 766 { 767 PSZ pszNodeValue; 768 if (pszNodeValue = (PSZ)malloc(ulLength + 1)) 774 769 { 775 770 memcpy(pszNodeValue, pcszText, ulLength); … … 780 775 *ppNew = pNew; 781 776 } 777 else 778 { 779 arc = ERROR_NOT_ENOUGH_MEMORY; 780 xmlDeleteNode((PNODEBASE)pNew); 781 } 782 782 } 783 783 … … 798 798 { 799 799 PDOMNODE pNew = NULL; 800 APIRET arc = xmlCreateDomNode(pParent,801 DOMNODE_COMMENT,802 NULL,803 0,804 &pNew);805 if (arc == NO_ERROR)800 APIRET arc; 801 if (!(arc = xmlCreateDomNode(pParent, 802 DOMNODE_COMMENT, 803 NULL, 804 0, 805 &pNew))) 806 806 { 807 807 pNew->pstrNodeValue = xstrCreate(0); … … 827 827 { 828 828 PDOMNODE pNew = NULL; 829 APIRET arc = xmlCreateDomNode(pParent, 830 DOMNODE_PROCESSING_INSTRUCTION, 831 pcszTarget, 832 0, 833 &pNew); 834 if (arc == NO_ERROR) 829 APIRET arc; 830 831 if (!(arc = xmlCreateDomNode(pParent, 832 DOMNODE_PROCESSING_INSTRUCTION, 833 pcszTarget, 834 0, 835 &pNew))) 835 836 { 836 837 pNew->pstrNodeValue = xstrCreate(0); … … 867 868 // create doctype node 868 869 PDOMDOCTYPENODE pNew = NULL; 869 arc = xmlCreateDomNode((PDOMNODE)pDocumentNode, 870 DOMNODE_DOCUMENT_TYPE, 871 pcszDoctypeName, 872 0, 873 (PDOMNODE*)&pNew); 874 875 if (!arc) 870 if (!(arc = xmlCreateDomNode((PDOMNODE)pDocumentNode, 871 DOMNODE_DOCUMENT_TYPE, 872 pcszDoctypeName, 873 0, 874 (PDOMNODE*)&pNew))) 876 875 { 877 876 // the node has already been added to the children … … 963 962 PXMLCONTENT pSubModel = &pModel->children[ul]; 964 963 PCMELEMENTPARTICLE pSubNew = NULL; 965 arc = xmlCreateNodeBase(TYPE_UNKNOWN, // node type... for now 966 sizeof(CMELEMENTPARTICLE), 967 0, 968 0, 969 (PNODEBASE*)&pSubNew); 970 if (!arc) 964 if (!(arc = xmlCreateNodeBase(TYPE_UNKNOWN, // node type... for now 965 sizeof(CMELEMENTPARTICLE), 966 0, 967 0, 968 (PNODEBASE*)&pSubNew))) 971 969 { 972 arc = SetupParticleAndSubs(pSubNew, 973 pSubModel, 974 ppElementNamesTree); 975 976 if (!arc) 970 if (!(arc = SetupParticleAndSubs(pSubNew, 971 pSubModel, 972 ppElementNamesTree))) 977 973 { 978 974 // no error: append sub-particle to this particle's … … 1015 1011 PCMELEMENTDECLNODE pNew = NULL; 1016 1012 1017 arc = xmlCreateNodeBase(TYPE_UNKNOWN, // for now 1018 sizeof(CMELEMENTDECLNODE), 1019 pcszName, 1020 0, 1021 (PNODEBASE*)&pNew); 1022 1023 if (!arc) 1013 if (!(arc = xmlCreateNodeBase(TYPE_UNKNOWN, // for now 1014 sizeof(CMELEMENTDECLNODE), 1015 pcszName, 1016 0, 1017 (PNODEBASE*)&pNew))) 1024 1018 { 1025 1019 treeInit(&pNew->ParticleNamesTree, NULL); 1026 1020 1027 1021 // set up the "particle" member and recurse into sub-particles 1028 arc = SetupParticleAndSubs(&pNew->Particle, 1029 pModel, 1030 &pNew->ParticleNamesTree); 1031 1032 if (!arc) 1022 if (!(arc = SetupParticleAndSubs(&pNew->Particle, 1023 pModel, 1024 &pNew->ParticleNamesTree))) 1033 1025 *ppNew = pNew; 1034 1026 else … … 1521 1513 pNew = NULL; 1522 1514 1523 pDom->arcDOM = xmlCreateElementNode(pParent, 1524 pcszElement, 1525 &pNew); 1526 1527 if (!pDom->arcDOM) 1515 if (!(pDom->arcDOM = xmlCreateElementNode(pParent, 1516 pcszElement, 1517 &pNew))) 1528 1518 // OK, node is valid: 1529 1519 // push this on the stack so we can add child elements … … 1556 1546 { 1557 1547 PDOMNODE pAttrib; 1558 pDom->arcDOM = xmlCreateAttributeNode(pNew, // element, 1559 papcszAttribs[i], // attr name 1560 papcszAttribs[i + 1], // attr value 1561 &pAttrib); 1562 1563 if (pDom->arcDOM) 1564 xmlSetError(pDom, 1565 pDom->arcDOM, 1566 papcszAttribs[i], 1567 TRUE); // validation 1568 else 1548 if (!(pDom->arcDOM = xmlCreateAttributeNode(pNew, // element, 1549 papcszAttribs[i], // attr name 1550 papcszAttribs[i + 1], // attr value 1551 &pAttrib))) 1569 1552 // shall we validate? 1570 1553 if (pDom->pDocTypeNode) … … 1572 1555 pAttrib, 1573 1556 &pAttribDeclBase); 1557 else 1558 { 1559 xmlSetError(pDom, 1560 pDom->arcDOM, 1561 papcszAttribs[i], 1562 TRUE); // validation 1563 break; 1564 } 1574 1565 } 1575 1566 … … 1640 1631 1641 1632 // continue parsing only if we had no errors so far 1642 if (!pDom->arcDOM) 1643 { 1644 if (len) 1645 { 1646 // we need a new text node: 1647 PDOMSTACKITEM pSI = PopElementStack(pDom, 1648 NULL); // no free 1649 if (!pDom->arcDOM) 1633 if ( (!pDom->arcDOM) 1634 && (len) 1635 ) 1636 { 1637 // we need a new text node: 1638 PDOMSTACKITEM pSI = PopElementStack(pDom, 1639 NULL); // no free 1640 if (!pDom->arcDOM) 1641 { 1642 PDOMNODE pParent = pSI->pDomNode; 1643 // pNew = NULL; 1644 1645 BOOL fIsWhitespace = FALSE; 1646 1647 // shall we validate? 1648 if (pDom->pDocTypeNode) 1650 1649 { 1651 PDOMNODE pParent = pSI->pDomNode; 1652 // pNew = NULL; 1653 1654 BOOL fIsWhitespace = FALSE; 1655 1656 // shall we validate? 1657 if (pDom->pDocTypeNode) 1650 // yes: check if the parent element allows 1651 // for content at all (must be "mixed" model) 1652 1653 // get the element decl from the tree 1654 PCMELEMENTDECLNODE pElementDecl; 1655 if (pElementDecl = pSI->pElementDecl) 1658 1656 { 1659 // yes: check if the parent element allows 1660 // for content at all (must be "mixed" model) 1661 1662 // get the element decl from the tree 1663 PCMELEMENTDECLNODE pElementDecl = pSI->pElementDecl; 1664 1665 if (pElementDecl) 1657 switch (pElementDecl->Particle.NodeBase.ulNodeType) 1666 1658 { 1667 switch (pElementDecl->Particle.NodeBase.ulNodeType) 1659 case ELEMENTPARTICLE_ANY: 1660 case ELEMENTPARTICLE_MIXED: 1661 // those two are okay 1662 break; 1663 1664 case ELEMENTPARTICLE_EMPTY: 1665 // that's an error for sure 1666 pDom->arcDOM = ERROR_ELEMENT_CANNOT_HAVE_CONTENT; 1667 break; 1668 1669 default: 1668 1670 { 1669 case ELEMENTPARTICLE_ANY: 1670 case ELEMENTPARTICLE_MIXED: 1671 // those two are okay 1672 break; 1673 1674 case ELEMENTPARTICLE_EMPTY: 1675 // that's an error for sure 1676 pDom->arcDOM = ERROR_ELEMENT_CANNOT_HAVE_CONTENT; 1677 break; 1678 1679 default: 1680 { 1681 // ELEMENTPARTICLE_CHOICE: 1682 // ELEMENTPARTICLE_SEQ: 1683 // with these two, we accept whitespace, but nothing 1684 // else... so if we have characters other than 1685 // whitespace, terminate 1686 ULONG ul; 1687 const char *p = s; 1688 1689 if (pDom->flParserFlags & DF_DROP_WHITESPACE) 1690 fIsWhitespace = TRUE; 1691 1692 for (ul = 0; 1693 ul < len; 1694 ul++, p++) 1695 if (!strchr("\r\n\t ", *p)) 1696 { 1697 // other character: 1698 xmlSetError(pDom, 1699 ERROR_ELEMENT_CANNOT_HAVE_CONTENT, 1700 pParent->NodeBase.strNodeName.psz, 1701 TRUE); 1702 fIsWhitespace = FALSE; 1703 break; 1704 } 1705 } 1671 // ELEMENTPARTICLE_CHOICE: 1672 // ELEMENTPARTICLE_SEQ: 1673 // with these two, we accept whitespace, but nothing 1674 // else... so if we have characters other than 1675 // whitespace, terminate 1676 ULONG ul; 1677 const char *p = s; 1678 1679 if (pDom->flParserFlags & DF_DROP_WHITESPACE) 1680 fIsWhitespace = TRUE; 1681 1682 for (ul = 0; 1683 ul < len; 1684 ul++, p++) 1685 if (!strchr("\r\n\t ", *p)) 1686 { 1687 // other character: 1688 xmlSetError(pDom, 1689 ERROR_ELEMENT_CANNOT_HAVE_CONTENT, 1690 pParent->NodeBase.strNodeName.psz, 1691 TRUE); 1692 fIsWhitespace = FALSE; 1693 break; 1694 } 1706 1695 } 1707 1696 } 1708 1709 } // end if (pDom->pDocTypeNode)1710 1711 if (!fIsWhitespace)1712 // this is false if any of the following1713 // is true:1714 // -- we are not validating at all1715 // -- we are validating, but the the element1716 // can have mixed content1717 // -- we are validating and the element does1718 // _not_ have mixed content and DF_DROP_WHITESPACE1719 // is set, but the string is whitespace only1720 // --> drop it then1721 1722 if (pDom->pLastWasTextNode)1723 {1724 // we had a text node, and no elements or other1725 // stuff in between:1726 xstrcat(pDom->pLastWasTextNode->pstrNodeValue,1727 s,1728 len);1729 1697 } 1730 else 1731 { 1732 pDom->arcDOM = xmlCreateTextNode(pParent, 1733 s, 1734 len, 1735 &pDom->pLastWasTextNode); 1736 } 1737 } 1698 1699 } // end if (pDom->pDocTypeNode) 1700 1701 if (!fIsWhitespace) 1702 // this is false if any of the following 1703 // is true: 1704 // -- we are not validating at all 1705 // -- we are validating, but the the element 1706 // can have mixed content 1707 // -- we are validating and the element does 1708 // _not_ have mixed content and DF_DROP_WHITESPACE 1709 // is set, but the string is whitespace only 1710 // --> drop it then 1711 1712 if (pDom->pLastWasTextNode) 1713 // we had a text node, and no elements or other 1714 // stuff in between: 1715 xstrcat(pDom->pLastWasTextNode->pstrNodeValue, 1716 s, 1717 len); 1718 else 1719 pDom->arcDOM = xmlCreateTextNode(pParent, 1720 s, 1721 len, 1722 &pDom->pLastWasTextNode); 1738 1723 } 1739 1724 } … … 1806 1791 pDom->arcDOM = ERROR_DOM_DUPLICATE_DOCTYPE; 1807 1792 else 1808 {1809 1793 pDom->arcDOM = xmlCreateDocumentTypeNode(pDocumentNode, 1810 1794 pcszDoctypeName, … … 1813 1797 fHasInternalSubset, 1814 1798 &pDom->pDocTypeNode); 1815 }1816 1799 } 1817 1800 } … … 2021 2004 // declarations tree 2022 2005 PCMELEMENTDECLNODE pNew = NULL; 2023 pDom->arcDOM = xmlCreateElementDecl(pcszName,2024 pModel,2025 &pNew);2006 if (!(pDom->arcDOM = xmlCreateElementDecl(pcszName, 2007 pModel, 2008 &pNew))) 2026 2009 // this recurses!! 2027 2010 // after this, pModel is invalid 2028 2029 if (pDom->arcDOM == NO_ERROR)2030 2011 { 2031 2012 // add this to the doctype's declarations tree … … 2058 2039 // PSZ pszType = strhSubstr(p, pNext); 2059 2040 PNODEBASE pNew = NULL; 2060 APIRET arc = xmlCreateNodeBase(ATTRIBUTE_DECLARATION_ENUM, 2061 sizeof(NODEBASE), 2062 p, 2063 (pNext - p), 2064 &pNew); 2065 if (!arc) 2041 APIRET arc; 2042 2043 if (!(arc = xmlCreateNodeBase(ATTRIBUTE_DECLARATION_ENUM, 2044 sizeof(NODEBASE), 2045 p, 2046 (pNext - p), 2047 &pNew))) 2066 2048 treeInsert(&pDecl->ValuesTree, 2067 2049 NULL, … … 2175 2157 // add a new attribute def (CMATTRIBUTEDEDECL) to that 2176 2158 PCMATTRIBUTEDECL pNew = NULL; 2177 pDom->arcDOM = xmlCreateNodeBase(ATTRIBUTE_DECLARATION, 2178 sizeof(CMATTRIBUTEDECL), 2179 pcszAttribName, 2180 0, 2181 (PNODEBASE*)&pNew); 2182 if (!pDom->arcDOM) 2159 if (!(pDom->arcDOM = xmlCreateNodeBase(ATTRIBUTE_DECLARATION, 2160 sizeof(CMATTRIBUTEDECL), 2161 pcszAttribName, 2162 0, 2163 (PNODEBASE*)&pNew))) 2183 2164 { 2184 2165 treeInit(&pNew->ValuesTree, NULL); … … 2368 2349 * document if the "encoding" attribute of the 2369 2350 * XML @text_declaration starts with "cp" (e.g. 2370 * "cp850") and will then receive sthe following2351 * "cp850") and will then receive the following 2371 2352 * parameters: 2372 2353 *
Note:
See TracChangeset
for help on using the changeset viewer.