Changeset 6770 for branches


Ignore:
Timestamp:
Sep 20, 2001, 5:55:27 AM (24 years ago)
Author:
bird
Message:

corrected a few flaws and started adding documentation stuff from SDS/Karl Trygve.

Location:
branches/stage2/tools/database/occ
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/stage2/tools/database/occ/Makefile

    r6768 r6770  
    1 # $Id: Makefile,v 1.1.2.1 2001-09-20 03:12:05 bird Exp $
     1# $Id: Makefile,v 1.1.2.2 2001-09-20 03:55:26 bird Exp $
    22
    33#
     
    4242CINCLUDES = -Igc
    4343!ifdef DEBUG
    44 CDEFINES = -DOS2 -DOPERATOR_NEW_ARRAY -DDEBUG
     44CDEFINES = -DOS2 -DOPERATOR_NEW_ARRAY -DSDS -DDEBUG
    4545!else
    46 CDEFINES = -DOS2 -DOPERATOR_NEW_ARRAY
     46CDEFINES = -DOS2 -DOPERATOR_NEW_ARRAY -DSDS
    4747!endif
    4848!if "$(VAC3)" == "1" || "$(VAC36)" == "1"
  • branches/stage2/tools/database/occ/buffer.cpp

    r6768 r6770  
    22  Copyright (C) 1997-2001 Shigeru Chiba, Tokyo Institute of Technology.
    33
    4   Permission to use, copy, distribute and modify this software and   
    5   its documentation for any purpose is hereby granted without fee,       
    6   provided that the above copyright notice appear in all copies and that 
    7   both that copyright notice and this permission notice appear in 
     4  Permission to use, copy, distribute and modify this software and
     5  its documentation for any purpose is hereby granted without fee,
     6  provided that the above copyright notice appear in all copies and that
     7  both that copyright notice and this permission notice appear in
    88  supporting documentation.
    99
    10   Shigeru Chiba makes no representations about the suitability of this 
     10  Shigeru Chiba makes no representations about the suitability of this
    1111  software for any purpose.  It is provided "as is" without express or
    1212  implied warranty.
     
    155155}
    156156
     157#ifdef SDS
     158uint Program::LineNumber(char* ptr, char*& filename, int& filename_length)
     159{
     160   int col_num, abs_pos;
     161   return LineNumber(ptr, filename, filename_length, col_num, abs_pos);
     162}
     163#endif
     164
    157165/*
    158166  LineNumber() returns the line number of the line pointed to by PTR.
    159167*/
     168#ifdef SDS
     169uint Program::LineNumber(char* ptr, char*& filename, int& filename_length,
     170                                     int &col_num, int &abs_pos)
     171#else
    160172uint Program::LineNumber(char* ptr, char*& filename, int& filename_length)
     173#endif
    161174{
    162175    sint n;
     
    166179    int nline = 0;
    167180    uint pos = uint(ptr - buf);
     181
     182    #ifdef SDS
     183    int column = -1;
     184    uint start = pos;
     185    #endif
     186
    168187    if(pos > size){
    169188        // error?
     
    173192    }
    174193
     194    #ifdef SDS
     195    abs_pos = pos;
     196    #endif
     197
    175198    sint line_number = -1;
    176199    filename_length = 0;
     
    179202        switch(Ref(--pos)){
    180203        case '\n' :
    181             ++nline;
     204            #ifdef SDS
     205            if (column == -1)
     206                column = start - pos;
     207            #endif
     208            ++nline;
    182209            break;
    183210        case '#' :
     
    197224
    198225        if(line_number >= 0 && filename_length > 0)
     226        #ifdef SDS
     227        {
     228            col_num = column;
     229            return line_number;
     230        }
     231        #else
    199232            return line_number;
     233        #endif
    200234    }
    201235
     
    207241    if(line_number < 0)
    208242        line_number = nline + 1;
     243
     244    #ifdef SDS
     245    col_num = column;
     246    #endif
    209247
    210248    return line_number;
     
    256294        }
    257295
    258 #if defined(_MSC_VER) || defined(IRIX_CC)
     296#if defined(_MSC_VER) || defined(IRIX_CC) || defined(__IBMCPP__)
    259297        out << "#line " << nlines + 1 << " \"" << file_name << "\"\n";
    260298#else
     
    287325        }
    288326
    289 #if defined(_MSC_VER) || defined(IRIX_CC)
     327#if defined(_MSC_VER) || defined(IRIX_CC) || defined(__IBMCPP__)
    290328        out << "\n#line " << line_number << ' ';
    291329#else
     
    309347    }
    310348
    311 #if defined(_MSC_VER) || defined(IRIX_CC)
     349#if defined(_MSC_VER) || defined(IRIX_CC) || defined(OS2)
    312350    out << "\n#line " << nlines + 2 << " \"" << file_name << "\"\n";
    313351#else
  • branches/stage2/tools/database/occ/buffer.h

    r6768 r6770  
    22  Copyright (C) 1997-2001 Shigeru Chiba, Tokyo Institute of Technology.
    33
    4   Permission to use, copy, distribute and modify this software and   
    5   its documentation for any purpose is hereby granted without fee,       
    6   provided that the above copyright notice appear in all copies and that 
    7   both that copyright notice and this permission notice appear in 
     4  Permission to use, copy, distribute and modify this software and
     5  its documentation for any purpose is hereby granted without fee,
     6  provided that the above copyright notice appear in all copies and that
     7  both that copyright notice and this permission notice appear in
    88  supporting documentation.
    99
    10   Shigeru Chiba makes no representations about the suitability of this 
     10  Shigeru Chiba makes no representations about the suitability of this
    1111  software for any purpose.  It is provided "as is" without express or
    1212  implied warranty.
     
    7676
    7777    uint LineNumber(char*, char*&, int&);
     78    #ifdef SDS
     79    uint LineNumber(char*, char*&, int&, int &, int &);
     80    #endif
    7881
    7982    void Write(ostream&, const char*);
  • branches/stage2/tools/database/occ/driver.cpp

    r6768 r6770  
    147147        char* cppfile = RunPreprocessor(src);
    148148        occfile = RunOpencxx(cppfile);
    149         unlink(cppfile);
     149        //unlink(cppfile);
    150150        delete cppfile;
    151151    }
  • branches/stage2/tools/database/occ/driver2.cpp

    r6768 r6770  
    148148    AddCppOption("-P");                 /* preprocess the file. */
    149149    AddCppOption("-Pe+");               /* #line */
    150     AddCppOption("-Tp"); // Consider source file as C++ file,
     150    AddCppOption("-Tdp");               /* Consider source file as C++ file. */
     151
     152    #ifdef SDS
     153    AddCppOption("-Pc+");               /* Preserve comments. */
     154    #endif
    151155
    152156    #else
     
    200204void RunCompiler(const char* org_src, const char *file_in)
    201205{
     206    #ifdef OS2
     207    AddCcOption("-Q+");
     208    #else
    202209    AddCcOption("-nologo");
     210    #endif
    203211    if(!makeExecutable)
    204212        AddCcOption("-c");
    205213
     214    #ifdef OS2
     215    AddCcOption("-Tdp");
     216    #else
    206217    AddCcOption("-Tp");
     218    #endif
    207219    AddCcOption(file_in);
    208220    if (makeExecutable && makeSharedLibrary) {
  • branches/stage2/tools/database/occ/token.cpp

    r6768 r6770  
    7070HashTable* Lex::user_keywords = nil;
    7171Ptree* Lex::comments = nil;
     72#ifdef SDS
     73Ptree* Lex::all_comments = nil;
     74#endif
    7275
    7376Lex::Lex(Program* prog) : fifo(this)
     
    111114    return file->LineNumber(pos, ptr, len);
    112115}
     116
     117#ifdef SDS
     118uint Lex::LineNumber(char* pos, char*& ptr, int& len, int& col_num, int& abs_pos)
     119{
     120    return file->LineNumber(pos, ptr, len, col_num, abs_pos);
     121}
     122#endif
    113123
    114124int Lex::GetToken(Token& t)
     
    767777    { "asm",            token(ATTRIBUTE) },
    768778    { "auto",           token(AUTO) },
    769 #if !defined(_MSC_VER) || (_MSC_VER >= 1100)
     779#if (!defined(_MSC_VER) || (_MSC_VER >= 1100)) && !defined(__IBMCPP__)
    770780    { "bool",           token(BOOLEAN) },
    771781#endif
     
    876886    fRc = Lex::RecordKeyword("_Seg16", Ignore);  assert(fRc);   //kso
    877887    fRc = Lex::RecordKeyword("_System", Ignore); assert(fRc);   //kso
     888    #ifdef __IBMCPP__
     889    fRc = Lex::RecordKeyword("_Builtin", Ignore); assert(fRc);  //kso
     890    #endif
    878891#endif                                                          //kso
    879892}
     
    10131026int Lex::ReadComment(char c, uint top) {
    10141027    uint len = 0;
     1028    #ifdef SDS
     1029    bool foneliner = false;
     1030    #endif
    10151031    if (c == '*')       // a nested C-style comment is prohibited.
    10161032        do {
     
    10271043        }while(c != '\0');
    10281044    else /* if (c == '/') */
     1045    #ifdef SDS
     1046    {
     1047        foneliner = true;
     1048        do
     1049        {
     1050            c = file->Get();
     1051        } while (c && c != '\n');
     1052    }
     1053    #else
    10291054        do {
    10301055            c = file->Get();
    10311056        }while(c != '\n' && c != '\0');
     1057    #endif
    10321058
    10331059    len += file->GetCurPos() - top;
     1060    #ifdef SDS
     1061    if (foneliner)
     1062        file->Unget();
     1063    #endif
    10341064    token_len = int(len);
    10351065    Leaf* node = new Leaf((char*)file->Read(top), int(len));
    10361066    comments = Ptree::Snoc(comments, node);
     1067    #ifdef SDS
     1068    all_comments = Ptree::Snoc(all_comments, node);
     1069    #endif
    10371070    return Ignore;
    10381071}
     
    10431076    return c;
    10441077}
     1078
     1079#ifdef SDS
     1080Ptree *Lex::GetAllComments() {
     1081   return all_comments;
     1082}
     1083#endif
    10451084
    10461085Ptree* Lex::GetComments2() {
  • branches/stage2/tools/database/occ/token.h

    r6768 r6770  
    7070    Ptree* GetComments();
    7171    Ptree* GetComments2();
     72    #ifdef SDS
     73    Ptree* GetAllComments();
     74    #endif
    7275
    7376    uint LineNumber(char*, char*&, int&);
     77    #ifdef SDS
     78    uint LineNumber(char*, char*&, int&, int&, int&);
     79    #endif
    7480
    7581    static bool RecordKeyword(char*, int);
     
    139145    static HashTable* user_keywords;
    140146    static Ptree* comments;
     147    #ifdef SDS
     148    static Ptree* all_comments;
     149    #endif
    141150};
    142151
  • branches/stage2/tools/database/occ/types.h

    r6768 r6770  
    5353#endif
    5454
    55 #if defined(OS2) && defined(__IBMCPP__)
     55#if defined(OS2) && defined(__IBMCPP__)// && !defined(__opencxx)
    5656typedef int bool;
    5757#define true  TRUE
Note: See TracChangeset for help on using the changeset viewer.