eudora-mac/rich.c

1 line
52 KiB
C
Raw Permalink Normal View History

2018-05-23 09:59:15 +00:00
/* Copyright (c) 2017, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ //depot/projects/eudora/mac/Current/rich.c#24 - edit change 4405 (text) #include "rich.h" /* Copyright (c) 1995 by QUALCOMM Incorporated */ #define FILE_NUM 76 OSErr UnwindRich(short *counters,StackHandle openStack,StackHandle redoStack,AccuPtr enriched); OSErr RewindRich(StackHandle openStack,StackHandle redoStack,AccuPtr enriched); OSErr BuildEnrichedDirectives(PETETextStylePtr oldStyle,PETETextStylePtr newStyle, PETEParaInfoPtr oldInfo,PETEParaInfoPtr newInfo, StackHandle openStack,StackHandle redoStack, AccuPtr enriched); PStr BuildRichParaParam(PStr directive,PSMPtr marg); PStr BuildRichFontParam(PStr directive,short fontID); PStr BuildRichColorParam(PStr directive,RGBColor *color); void AddToStyle(EnrichedEnum cmd,Boolean neg,long offset,OffsetAndStyleHandle *styles,uLong valid); OSErr EnrichedToken(UHandle enriched,long maxLen,Boolean headers,short *cmdId,Boolean *neg,long *tStart,long *tStop); OSErr InsertEnriched(UHandle text, long *textOffset, long textLen, long *offset, Boolean unwrap, PETEHandle pte); OSErr InsertEnrichedLo(UHandle text, long *textOffset, long textLen, long *inOffset, Boolean unwrap, PETEHandle pte, TextEncoding encoding); OSErr InsertFlowed(UHandle text, long *textOffset, long textLen, long *inOffset, PETEHandle pte, Boolean delSP); OSErr InsertFlowedLo(UHandle text, long *textOffset, long textLen, long *inOffset, PETEHandle pte, Boolean delSP, TextEncoding encoding); OSErr InsertFixed(UHandle text, long *textOffset, long textLen, long *inOffset, PETEHandle pte, TextEncoding encoding); #define FlushIntlText(pte, offset, converter) PeteInsertIntlText(pte, offset, nil, 0L, 0L, converter, kTextEncodingUnknown, false, true); Boolean PartIsReferenced(uLong cID,uLong baseID,uLong sourceID,StackHandle partRefStack); OSErr FakeAttachment(PETEHandle pte,uLong *offset,FSSpecPtr spec); #pragma segment Enriched /********************************************************************** * Text/Enriched building **********************************************************************/ typedef struct { EnrichedEnum directive; union { RGBColor color; PeteSaneMargin marg; short fontID; } param; } DirectiveType,*DTPtr, **DTHandle; #define ISSUE_DIRECTIVE \ do { \ ComposeRString(directive,MIME_RICH_ON,EnrichedStrn+pushMe.directive); \ if (err=AccuAddStr(enriche