Changeset 3922 for trunk/src/riched32


Ignore:
Timestamp:
Aug 2, 2000, 4:58:40 PM (25 years ago)
Author:
bird
Message:

Added the CVS Id keyword.

Location:
trunk/src/riched32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/riched32/charlist.c

    r3515 r3922  
     1/* $Id: charlist.c,v 1.2 2000-08-02 14:58:40 bird Exp $ */
    12/*
    2  * 
     3 *
    34 *  Character List
    4  * 
     5 *
    56 *  Copyright (c) 2000 by Jean-Claude Batista
    6  * 
     7 *
    78 */
    89
     
    1819
    1920void CHARLIST_Enqueue( CHARLIST* pCharList, char myChar )
    20 {   
     21{
    2122    CHARLISTENTRY* pNewEntry = HeapAlloc(RICHED32_hHeap, 0,sizeof(CHARLISTENTRY));
    2223    pNewEntry->pNext = NULL;
    2324    pNewEntry->myChar = myChar;
    24    
     25
    2526    if(pCharList->pTail == NULL)
    2627    {
     
    2930    else
    3031    {
    31          CHARLISTENTRY* pCurrent = pCharList->pTail;         
     32         CHARLISTENTRY* pCurrent = pCharList->pTail;
    3233         pCharList->pTail = pCurrent->pNext = pNewEntry;
    3334    }
     
    3738
    3839void CHARLIST_Push( CHARLIST* pCharList, char myChar)
    39 {   
     40{
    4041    CHARLISTENTRY* pNewEntry = malloc(sizeof(CHARLISTENTRY));
    41    
     42
    4243    pNewEntry->myChar = myChar;
    43    
     44
    4445    if(pCharList->pHead == NULL)
    4546    {
     
    6263    char myChar;
    6364
    64     if(pCharList->nCount == 0) 
     65    if(pCharList->nCount == 0)
    6566      return 0;
    66    
     67
    6768    pCharList->nCount--;
    6869    myChar = pCharList->pHead->myChar;
    6970    pCurrent = pCharList->pHead->pNext;
    7071    HeapFree(RICHED32_hHeap, 0,pCharList->pHead);
    71  
     72
    7273    if(pCharList->nCount == 0)
    7374    {
     
    7980    }
    8081
    81     return myChar;   
     82    return myChar;
    8283}
    8384
     
    8990void CHARLIST_FreeList(CHARLIST* pCharList){
    9091    while(pCharList->nCount)
    91         CHARLIST_Dequeue(pCharList);       
     92        CHARLIST_Dequeue(pCharList);
    9293}
    9394
     
    9798    CHARLISTENTRY *pCurrent;
    9899    int nCount = 0;
    99    
     100
    100101    for(pCurrent =pCharList->pHead ;pCurrent;pCurrent=pCurrent->pNext)
    101102        if(pCurrent->myChar == myChar)
    102103            nCount++;
    103    
     104
    104105    return nCount;
    105106}
     
    107108int CHARLIST_toBuffer(CHARLIST* pCharList, char* pBuffer, int nBufferSize)
    108109{
    109    
     110
    110111   /* we add one to store a NULL caracter */
    111    if(nBufferSize < pCharList->nCount + 1) 
     112   if(nBufferSize < pCharList->nCount + 1)
    112113        return pCharList->nCount;
    113  
     114
    114115   for(;pCharList->nCount;pBuffer++)
    115116       *pBuffer = CHARLIST_Dequeue(pCharList);
    116    
     117
    117118   *pBuffer = '\0';
    118119
  • trunk/src/riched32/reader.c

    r3515 r3922  
     1/* $Id: reader.c,v 1.2 2000-08-02 14:58:40 bird Exp $ */
    12/*
    23 * - Need to document error code meanings.
     
    6768 *  include hard coded charsets
    6869 */
    69  
     70
    7071#include "ansi_gen.h"
    7172#include "ansi_sym.h"
     
    210211 * Get a char from the charlist. The charlist is used to store characters
    211212 * from the editstream.
    212  * 
    213  */
    214 
    215 int 
     213 *
     214 */
     215
     216int
    216217_RTFGetChar()
    217218{
     
    267268        RTFFree (outputName);
    268269        inputName = outputName = (char *) NULL;
    269                        
     270
    270271        /* initialize lookup table */
    271272        LookupInit ();
     
    829830 */
    830831
    831  
     832
    832833static int
    833834GetChar ()
     
    953954/*
    954955 * Do auto-charset-file reading.
    955  * will always use the ansi charset no mater what the value 
     956 * will always use the ansi charset no mater what the value
    956957 * of the rtfTextBuf is.
    957958 *
    958959 * TODO: add support for other charset in the future.
    959  * 
     960 *
    960961 */
    961962
     
    982983
    983984/*
    984  * Convert a CaracterSetMap (caracter_name, caracter) into 
     985 * Convert a CaracterSetMap (caracter_name, caracter) into
    985986 * this form : array[caracter_ident] = caracter;
    986987 */
     
    997998                return (0);     /* illegal charset id */
    998999        case rtfCSGeneral:
    999        
     1000
    10001001                haveGenCharSet = 1;
    10011002                stdCodeArray = genCharCode;
     
    10101011                }
    10111012                break;
    1012                
     1013
    10131014        case rtfCSSymbol:
    10141015
     
    10231024                {
    10241025                    stdCodeArray[ ansi_sym[i+1] ] = ansi_sym[i];
    1025                 }               
     1026                }
    10261027                break;
    10271028        }
     
    12031204                fp->rtfFCodePage = 0;
    12041205
    1205                 while (rtfClass != rtfEOF 
     1206                while (rtfClass != rtfEOF
    12061207                       && !RTFCheckCM (rtfText, ';')
    12071208                       && !RTFCheckCM (rtfGroup, rtfEndGroup))
     
    12641265                                        (void) RTFGetToken ();
    12651266                                }
    1266                                
     1267
    12671268                                /* FIX: in some cases the <fontinfo> isn't finished with a semi-column */
    12681269                                if(RTFCheckCM (rtfGroup, rtfEndGroup))
    12691270                                {
    12701271                                  RTFUngetToken ();
    1271                                 }                               
     1272                                }
    12721273                                *bp = '\0';
    12731274                                fp->rtfFName = RTFStrSave (buf);
     
    27362737 *      char *outMap[rtfSC_MaxChar];
    27372738 *
    2738  * reinit should be non-zero if outMap should be initialized 
     2739 * reinit should be non-zero if outMap should be initialized
    27392740 * zero otherwise.
    27402741 *
  • trunk/src/riched32/richedit.c

    r3787 r3922  
     1/* $Id: richedit.c,v 1.3 2000-08-02 14:58:40 bird Exp $ */
    12/*
    23 * RichEdit32  functions
    34 *
    45 * This module is a simple wrap-arround the edit controls.
    5  * At the point, it is good only for application who use the RICHEDIT control to 
     6 * At the point, it is good only for application who use the RICHEDIT control to
    67 * display RTF text.
    78 *
    89 * Copyright 2000 by Jean-Claude Batista
    9  * 
    10  */
    11  
     10 *
     11 */
     12
    1213#include "windows.h"
    1314#include "winbase.h"
     
    4748RICHED32_LibMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
    4849{
    49        
     50
    5051    switch (fdwReason) {
    5152            case DLL_PROCESS_ATTACH:
     
    6061
    6162                }
    62                
     63
    6364                /* register the Rich Edit class */
    6465                RICHED32_Register ();
     
    7071                RICHED32_dwProcessesAttached--;
    7172
    72                 /* unregister all common control classes */     
     73                /* unregister all common control classes */
    7374                RICHED32_Unregister ();
    7475
     
    7778                    RICHED32_hHeap = (HANDLE)NULL;
    7879                }
    79                 break;     
     80                break;
    8081    }
    8182
     
    9495    int RTFToBuffer(char* pBuffer, int nBufferSize);
    9596    LONG newstyle = 0;
    96     LONG style = 0; 
     97    LONG style = 0;
    9798
    9899    static HWND hwndEdit;
    99100    static char* rtfBuffer;
    100101    int rtfBufferSize;
    101    
     102
    102103    switch (uMsg)
    103104    {
    104  
    105     case WM_CREATE :           
    106            
     105
     106    case WM_CREATE :
     107
    107108            /* remove SCROLLBARS from the current window style */
    108109            newstyle = style = ((LPCREATESTRUCTA) lParam)->style;
     
    113114
    114115#ifdef __WIN32OS2__
    115             style |= WS_CHILD;                                 
     116            style |= WS_CHILD;
    116117#endif
    117118            hwndEdit = CreateWindowA ("edit", ((LPCREATESTRUCTA) lParam)->lpszName,
     
    119120                                   hwnd, (HMENU) ID_EDIT,
    120121                                   ((LPCREATESTRUCTA) lParam)->hInstance, NULL) ;
    121        
    122             SetWindowLongA(hwnd,GWL_STYLE, newstyle);             
    123             return 0 ;
    124          
    125     case WM_SETFOCUS :           
     122
     123            SetWindowLongA(hwnd,GWL_STYLE, newstyle);
     124            return 0 ;
     125
     126    case WM_SETFOCUS :
    126127            SetFocus (hwndEdit) ;
    127128            return 0 ;
    128          
    129     case WM_SIZE :             
     129
     130    case WM_SIZE :
    130131            MoveWindow (hwndEdit, 0, 0, LOWORD (lParam), HIWORD (lParam), TRUE) ;
    131132            return 0 ;
    132          
     133
    133134    case WM_COMMAND :
    134135            if (LOWORD (wParam) == ID_EDIT)
    135                  if (HIWORD (wParam) == EN_ERRSPACE || 
     136                 if (HIWORD (wParam) == EN_ERRSPACE ||
    136137                           HIWORD (wParam) == EN_MAXTEXT)
    137138
     
    139140                                  "ERROR", MB_OK | MB_ICONSTOP) ;
    140141            return 0 ;
    141      
    142     case EM_STREAMIN:                               
    143            
     142
     143    case EM_STREAMIN:
     144
    144145            /* setup the RTF parser */
    145146            RTFSetEditStream(( EDITSTREAM*)lParam);
    146147            WriterInit();
    147148            RTFInit ();
    148             BeginFile();           
     149            BeginFile();
    149150
    150151            /* do the parsing */
    151152            RTFRead ();
    152            
     153
    153154            rtfBufferSize = RTFToBuffer(NULL, 0);
    154155            rtfBuffer = HeapAlloc(RICHED32_hHeap, 0,rtfBufferSize*sizeof(char));
     
    161162            else
    162163                WARN("Not enough memory for a allocating rtfBuffer\n");
    163                
    164             return 0;   
     164
     165            return 0;
    165166    }
    166167    /*return SendMessageA( hwndEdit,uMsg,wParam,lParam);*/
     
    188189{
    189190    if (pdvi->cbSize != sizeof(DLLVERSIONINFO)) {
    190  
     191
    191192        return E_INVALIDARG;
    192193    }
     
    203204 * DESCRIPTION:
    204205 * Registers the window class.
    205  * 
     206 *
    206207 * PARAMETER(S):
    207208 * None
     
    212213VOID RICHED32_Register(void)
    213214{
    214     WNDCLASSA wndClass; 
     215    WNDCLASSA wndClass;
    215216
    216217    ZeroMemory(&wndClass, sizeof(WNDCLASSA));
     
    229230 * DESCRIPTION:
    230231 * Unregisters the window class.
    231  * 
     232 *
    232233 * PARAMETER(S):
    233234 * None
  • trunk/src/riched32/text-writer.c

    r3515 r3922  
     1/* $Id: text-writer.c,v 1.2 2000-08-02 14:58:40 bird Exp $ */
    12/*
    23 * text-writer -- RTF-to-text translation writer code.
     
    5859int RTFToBuffer(char* pBuffer, int nBufferSize)
    5960{
    60    
    61    /* check if the buffer is big enough to hold all characters  */   
     61
     62   /* check if the buffer is big enough to hold all characters  */
    6263   /* we require one more for the '\0'                          */
    63    
    64    
     64
     65
    6566   if(nBufferSize < charlist.nCount + 1) {
    6667        return charlist.nCount + CHARLIST_CountChar(&charlist, '\n') + 1;
    6768   }
    68  
     69
    6970   while(charlist.nCount)
    7071   {
     
    7475         *pBuffer = '\r';
    7576         pBuffer++;
    76          *pBuffer = '\n'; 
     77         *pBuffer = '\n';
    7778       }
    7879       pBuffer++;
     
    8081   *pBuffer = '\0';
    8182
    82    return 0;   
     83   return 0;
    8384}
    8485
     
    243244void PutStdChar (int stdCode)
    244245{
    245  
     246
    246247  char  *oStr = (char *) NULL;
    247248  char  buf[rtfBufSiz];
    248  
     249
    249250/*      if (stdCode == rtfSC_nothing)
    250251                RTFPanic ("Unknown character code, logic error\n");
    251 */             
     252*/
    252253        oStr = outMap[stdCode];
    253254        if (oStr == (char *) NULL)      /* no output sequence in map */
Note: See TracChangeset for help on using the changeset viewer.