Changeset 40a3e1a in tol
- Timestamp:
- May 27, 2009, 7:28:05 PM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 1308348
- Parents:
- 830be0c
- File:
-
- 1 edited
-
tol/bbasic/txtalgeb.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/bbasic/txtalgeb.cpp
r830be0c r40a3e1a 1521 1521 } 1522 1522 1523 #define READ_CRLF_AS_LF 1524 1523 1525 1524 1526 //-------------------------------------------------------------------- … … 1543 1545 length_ = 0; 1544 1546 BChar ch = ' '; 1547 bool untilIsLF = until=='\n'; 1545 1548 for(;(length_<=maxChars)&&(ch!=until)&&(ch!='\0')&&(!is.eof()); length_++) 1546 1549 { 1547 1550 is.get(ch); 1551 # ifdef READ_CRLF_AS_LF 1552 if(untilIsLF && (ch == '\r')&&(!is.eof())) 1553 { 1554 is.get(ch); 1555 if(ch!='\n') { is.unget(); ch = '\r'; } 1556 } 1557 # endif 1548 1558 buffer_[length_] = ch; 1549 1559 } … … 1574 1584 } 1575 1585 length_ = 0; 1576 BChar ch = ' '; 1586 BChar ch = ' ', c; 1587 bool untilIsLF = until=='\n'; 1577 1588 for(;(length_<=maxChars)&&(ch!=until)&&(ch!='\0')&&(!feof(file)); length_++) 1578 1589 { 1579 1590 ch = fgetc(file); 1591 # ifdef READ_CRLF_AS_LF 1592 if(untilIsLF && (ch == '\r')&&(!feof(file))) 1593 { 1594 ch = fgetc(file); 1595 if(ch!='\n') { ungetc(c, file); ch = '\r'; } 1596 } 1597 # endif 1580 1598 buffer_[length_] = ch; 1581 1599 } … … 1583 1601 if(ch=='\0') { length_--; } 1584 1602 buffer_[length_] = '\0'; 1585 1586 1603 } 1587 1604 … … 1663 1680 txt.ReallocateBuffer(size); 1664 1681 BInt n=-1; 1682 char ch; 1665 1683 do 1666 1684 { … … 1672 1690 txt.ReallocateBuffer(size); 1673 1691 } 1674 txt.PutChar(n,(BChar)is.get()); 1692 ch = (BChar)is.get(); 1693 # ifdef READ_CRLF_AS_LF 1694 if((ch == '\r')&&(!is.eof())) 1695 { 1696 ch = is.get(); 1697 if(ch!='\n') { is.unget(); ch = '\r'; } 1698 } 1699 # endif 1700 txt.PutChar(n,ch); 1675 1701 } 1676 1702 while(!(is.eof()) && (txt.String()[n]!=end));
Note: See TracChangeset
for help on using the changeset viewer.
