Exemple #1
0
void VMsgLog::editRequest( WMenuItem* )
{
    int index = _batcher->selected();
    if( index >= 0 ) {
        const char* text = *(WString*)_data[index];
        char file[101]; int line, offset; char help[51];
        if( matchLine( index, file, line, offset, help ) ) {
            WSystemHelp *sh;
            const char *hf;
            if( findHelpFile( file, &sh, 0 ) == 0 ) {
                hf = "";
            } else {
                hf = sh->getHelpFile();
            }
            WString msg;
            int resId = atoi( help ) + 1;
            WFileName filename( file );
            if( filename.needQuotes() ) {
                msg.printf( "EditFileAtPos -f\"%s\" %d %d 0 %d",
                            file, line, offset, resId );
            } else {
                msg.printf( "EditFileAtPos -f%s %d %d 0 %d",
                            file, line, offset, resId );
            }
            msg.concat( " \"" );
            msg.concat( text ); // error message
            msg.concat( "\" " );
            msg.concat( hf ); // help file
            _parent->executeCommand( msg, EXECUTE_EDITOR, "LogEdit" );
        } else {
            WMessageDialog::info( this, "Can't find a filename in '%s'", text );
        }
    }
}
Exemple #2
0
bool MComponent::addFromMask( WFileName& search, WString& err )
{
    bool ok = true;
    WFileName asearch( search );
    asearch.absoluteTo( _filename );
    DIR* dir = opendir( asearch );
    if( !dir ) {
        err.printf( "no files found for '%s'", (const char*)search );
        ok = false;
    } else {
        for(;;) {
            struct dirent* ent = readdir( dir );
            if( !ent ) break;
            WFileName newfile( ent->d_name );
            newfile.setDrive( search.drive() );
            newfile.setDir( search.dir() );
//            newfile.toLower();
            if( !addFromFilename( newfile, err ) ) {
                ok = false;
                break;
            }
        }
        closedir( dir );
    }
    return( ok );
}
Exemple #3
0
void VCompDialog::updateCurOs( void )
{
    MTarget     *curtarg;
    int         pos;
    WString     curname;
    int         i;

    WPickList&  targets = _config->targets();
    int icount = _imagelist->count();
    for( i=0; i < icount; i++ ) {
        _imagelist->deleteString( 0 );
    }
    pos = 0;
    icount = targets.count();
    _tgList.reset();
    for( i=0; i< icount; i++ ) {
        curtarg = (MTarget *)targets[i];
        if( _cur_os == curtarg->targetOS() ) {
            curname.printf( "%s [%s]", curtarg->imageName().gets(),
                                       curtarg->tgtMask().ext() );
            _imagelist->insertString( curname.gets(), pos );
            _tgList.insertAt( pos, curtarg );
            pos++;
        }
    }
}
char * ScanStreamFile::name( void )
//---------------------------------
{
    WString val;

    val.printf( "file \"%s\" (line %d)", _fileName, _line );
    return WBRStrDup( val );
}
void EdModule::initialize()
//-------------------------
{
    WString s;
    s.printf( "Modules for %s", _name );
    setText( s.gets() );

    EditModuleList::initialize();
}
void DTViewClass::load()
//----------------------
{
    WVList          dataMembers;
    WVList          methods;
    WVList          friends;
    int             i;
    WString         str;
    ClassType *     cls = (ClassType *) _symbol;
    Symbol *        s;

    _members->clearAndDestroy();

    cls->dataMembers( dataMembers );
    cls->memberFunctions( methods );
    cls->friendFunctions( friends );

    for( i = 0; i < friends.count(); i += 1 ) {
        s = (Symbol *) friends[ i ];
        str.printf( "    friend %s;", s->scopedName( FALSE ) );
        _members->insert( new ClassMember( s, str.gets() ) );
    }

    for( i = 0; i < dataMembers.count(); i += 1 ) {
        s = (Symbol *) dataMembers[ i ];

        str.printf( "    %s;", s->scopedName( FALSE ) );
        _members->insert( new ClassMember( s, str.gets() ) );
    }

    for( i = 0; i < methods.count(); i += 1 ) {
        s = (Symbol *) methods[ i ];

        str.printf( "    %s;", s->scopedName( FALSE ) );
        _members->insert( new ClassMember( s, str.gets() ) );
    }

    addDescriptions();
    fillBox();
}
Exemple #7
0
void Browse::postTitle()
//----------------------
{
    const char * titleText = "Open Watcom Source Browser";
    WString      title;

    title.printf( "%s -- (%s%s), (%s)", titleText,
                  optManager()->fileName(),
                  (optManager()->isModified()) ? "*" : "",
                  dbManager()->fileName() );

    setText( title );
}
Exemple #8
0
bool Scanner::error( const char * err )
/*************************************/
{
    WString msg;
    WString title;
    char *  name = _scanStream->name();
    msgRetType ret;

    msg.printf( "%s near '%s'\n\nContinue?", err, _buffer );
    title.printf( "Syntax error in %s", name );

    ret = WMessageDialog::message( browseTop, MsgError, MsgOkCancel,
                                    msg, title );

    WBRFree( name );

    if( ret == MsgRetCancel ) {
        return true;
    } else {
        return false;
    }
}
QueryConfig::QueryConfig( WWindow * prt, const char * txt )
        : QueryConfigDlg( this )
        , WDialog( prt, frame().r, txt  )
        , _filter( NULL )
//----------------------------------------------------------------------
{
    WString filttxt;

    _searchStrings = new WVList;

   filttxt.printf( "%s Filters", txt );
    _queryFilter = new QueryFilter( this, txt );
}
Exemple #10
0
QueryConfig::QueryConfig( KeySymbol * key, WWindow * prt, const char * txt )
        : QueryConfigDlg( this )
        , WDialog( prt, frame().r, txt )
        , _filter( key )
//----------------------------------------------------------------------
{
    WString filttxt;

    _searchStrings = new WVList;
    _searchStrings->add( new WString( key->name() ) );

    filttxt.printf( "%s Filters", txt );
    _queryFilter = new QueryFilter( this, filttxt );
}
Exemple #11
0
static bool searchHook( dr_sym_context * symctxt, void *data )
//------------------------------------------------------------
{
    FindSymData * info;
    bool          accept;
    Symbol *      sym;

    info = (FindSymData *) data;
    if( symctxt->name == NULL ) {
        symctxt->name = DRGetName( symctxt->handle );
    }
    accept = info->keysym->matches( symctxt );

    if( accept ) {
        if( info->numItems == 0 ) {
            WBRFree( symctxt->name );
            symctxt->name = NULL;
            info->context = new SearchContext( *symctxt->context );
            return false;   // <----- early return -- stop search
        }

        if( info->numItems > 0 ) {
            info->numItems -= 1;
        }

        sym = Symbol::defineSymbol( symctxt->type, symctxt->handle,
                                    symctxt->context->classhdl,
                                    info->call_module,
                                    symctxt->name );
        info->data->add( sym );

#if DEBUG
        if( !(info->data->count() % 10) ) {
            WString stat;
            stat.printf( "Loading - %d found", info->data->count() );
            browseTop->statusText( stat.gets() );
        }
#endif
    } else {
        WBRFree( symctxt->name );
    }

    return true;    // continue searching
}
Exemple #12
0
bool MComponent::addFromFilename( WFileName& filename, WString& err )
{
    if( filename.isMask() ) {
        return( addFromMask( filename, err ) );
    }

    MRule* rule = _config->findMatchingRule( filename, _target->rule(), _mask );
    if( rule ) {
        if( rule == _config->nilRule() ) {
            unsigned    cnt;

            cnt = _items.count();
            for( ; cnt > 0; cnt-- ) {
                if( *(MItem *)_items[cnt - 1] == filename ) break;
            }
            if( cnt == 0 ) {
                MItem* item = new MItem( filename, this, rule );
                newItem( item );
            } else {
                return( false );
            }
        } else {
            MItem* item = new MItem( filename, this, rule );
            MComponent* comp = NULL;
            MItem* m = _project->findSameResult( item, &comp );
            if( !m ) {
                newItem( item );
            } else {
                delete item;
                if( comp != this ) {
                    err.printf( "Conflicting file '%s' found in target '%s'",
                        (const char*)*m, (const char*)*comp->target() );
                    return( false );
                }
            }
        }
        return( true );
    }
    return( false );
}
Exemple #13
0
void TreeNode::debugInfo( TreeRoot * root )
//-----------------------------------------
{
    WString boundLine;
    WString descendLine;
    char *  enabled;
    char *  placed;
    WString statLine;
    WString refLine;
    WString rootLine;

    TreeCoord   ox, oy;
    TreeRect rootRect;

    ox = _parent->getXOff();
    oy = _parent->getYOff();

    root->getBound( rootRect );

    rootLine.printf( "_rootNode = %s, bounding(%ld,%ld,%ld,%ld) ",
                     root->node()->name(), rootRect.x(), rootRect.y(),
                     rootRect.w(), rootRect.h() );
    boundLine.printf( "_bounding [%s] = (%ld,%ld,%ld,%ld), offset = (%ld,%ld) ",
                        (_flags.boundSet) ? "set" : "unset",
                        _bounding.x(), _bounding.y(),
                        _bounding.w(), _bounding.h(),
                        ox, oy );
    descendLine.printf( "_sibWidth = %ld, _descend = (%ld,%ld,%ld,%ld) ",
                        _sibWidth, _descend.x(), _descend.y(),
                        _descend.w(), _descend.h() );

    switch( _flags.enabled ) {
    case Hidden:
        enabled = "Hidden";
        break;
    default:
        enabled = "Visible";
        break;
    }

    switch( _flags.placed ) {
    case NotPlaced:
        placed = "NotPlaced";
        break;
    case PartiallyPlaced:
        placed = "PartiallyPlaced";
        break;
    case Arranging:
        placed = "Arranging";
        break;
    default:
        placed = "Placed";
    }
    statLine.printf( " enabled = %s, placed = %s, selected = %s, _level = %d\n",
                        enabled, placed, (_flags.selected) ? "true" : "false",
                        getLevel() );

    refLine.printf( "hasReference() = %s, isReference() = %s",
                    hasReference() ? "true" : "false",
                    isReference() ? "true" : "false" );

    WMessageDialog::messagef( _parent, MsgPlain, MsgOk, name(), "%s%s%s%s%s",
                            (const char *)rootLine, (const char *)boundLine,
                            (const char *)descendLine, (const char *)statLine,
                            (const char *)refLine );
}
Exemple #14
0
bool TreeFuncNode::TreeFuncHook( drmem_hdl owner, dr_ref_info * ref,
                                 char* ownerName, void * info )
//------------------------------------------------------------------
// this function really needs to be split up
{
    int             parentIndex;
    int             parentRoot;
    TreeFuncNode *  parent = NULL;
    int             childIndex;
    int             childRoot;
    TreeFuncNode *  child = NULL;
    FuncSearchData* data = (FuncSearchData *) info;
    char *          depName;
    bool            accept;

    #if DEBUG
    data->funcsFound += 1;

    if( !(data->funcsFound % 10) ) {
        WString stat;
        stat.printf( "Loading - %d found", data->funcsFound );
        browseTop->statusText( stat.gets() );
    }
    #endif

    // find if the symbol matches the filter

    depName = DRGetName( ref->dependent );
    accept = data->key->matches( ref->dependent, depName );
    WBRFree( depName ); // OPTIMIZE -- could use this later

    if( !accept ) {
        return true;    // <---- early return -- discard symbol, keep looking
    }


    for( int i = data->roots->count(); i > 0; i -= 1 ) {
        TreeFuncNode * rt = (TreeFuncNode*) (*data->roots)[ i - 1 ];
        parentIndex = rt->findNode( owner );
        if( !parent ) {
            if( parentIndex >= 0 ) {
                parent = (TreeFuncNode *)(*rt->_flatNodes)[ parentIndex ];
                parentRoot = i - 1;
            }
        }

        if( !child ) {
            childIndex = rt->findNode( ref->dependent );
            if( childIndex >= 0 ) {
                child = (TreeFuncNode *)(*rt->_flatNodes)[ childIndex ];
                childRoot = i - 1;
            }
        }

        if( child != NULL && parent != NULL ) {
            break;
        }
    }

    if( child != NULL && parent != NULL ) {
        WBRFree( ownerName );

        if( parentRoot == childRoot ) {
            int prtIdx = child->findParent( parent );
            if( prtIdx < 0 ) {
                if( ref->dependent == owner ) {     // direct recursion -- a->a
                    bool inReferences = false;

                    for( int refIdx = 0; refIdx < child->_flatReferences->count(); refIdx += 1 ) {
                        if( (*child->_flatReferences)[ refIdx ]->getHandle() == owner ) {
                            TreeNode * node = (*child->_flatReferences)[ refIdx ];
                            for( int ref2idx = 0; ref2idx < node->getCount( ParentList ); ref2idx += 1 ) {
                                if( node->getNode( ParentList, ref2idx )->getHandle() == owner ) {
                                    TreePtr * ptr = node->getPtr( ParentList, ref2idx );
                                    ((TreeRefPtr*)ptr)->incRefs();
                                    inReferences = true;
                                    break;
                                }
                            }
                        }
                        if( inReferences ) {
                            break;
                        }
                    }

                    if( !inReferences ) {
                        TreeRefNode * newRef;
                        newRef = new TreeRefNode( data->parentWin, parent, parent );
                        parent->_children.add( newRef );
                        parent->_hasRef = true;

                        parent->_flatReferences->add( newRef );
                    }
                } else {
                    parent->_children.add( child );
                    child->_parents.add(
                        new TreeFuncPtr( data->parentWin, child, parent, *ref ) );
                }
            } else {
                TreePtr * ptr = child->getPtr( ParentList, prtIdx );
                ((TreeFuncPtr *)ptr)->incRefs();
            }
        } else {
            int     i;

            for( i = child->_flatNodes->count(); i > 0; i -= 1 ) {
                parent->_flatNodes->add( (*child->_flatNodes)[ i - 1 ] );
            }

            data->roots->removeAt( childRoot );
            parent->_children.add( child );
            child->_parents.add(
                    new TreeFuncPtr( data->parentWin, child, parent, *ref ) );

            TreeCycleList * fList = child->_flatNodes;
            TreeRefList * rList = child->_flatReferences;

            for( i = fList->count(); i > 0; i -= 1 ) {
                TreeFuncNode * node = (TreeFuncNode *) (*fList)[ i - 1 ];
                node->_flatNodes = parent->_flatNodes;
                node->_flatReferences = parent->_flatReferences;
            }

            for( i = rList->count(); i > 0; i -= 1 ) {
                parent->_flatReferences->add( (*rList)[ i - 1 ] );
            }

            delete fList;
            delete rList;
        }
    } else {
        if( child != NULL ) {
            parent = new TreeFuncNode( data->parentWin, DRGetSymType( owner ),
                                       owner, data->mod, ownerName,
                                       child->_flatNodes,
                                       child->_flatReferences );

            parent->_children.add( child );
            child->_parents.add(
                    new TreeFuncPtr( data->parentWin, child, parent, *ref ) );
        } else {
            if( parent != NULL ) {
                WBRFree( ownerName );

                child = new TreeFuncNode( data->parentWin,
                                          DRGetSymType( ref->dependent ),
                                          ref->dependent, data->mod,
                                          DRGetName( ref->dependent ),
                                          parent->_flatNodes,
                                          parent->_flatReferences );
                parent->_children.add( child );
                child->_parents.add(
                    new TreeFuncPtr( data->parentWin, child, parent, *ref ) );

            } else {    // child == parent == NULL

                parent = new TreeFuncNode( data->parentWin,
                                           DRGetSymType( owner ),
                                           owner, data->mod, ownerName );

                if( ref->dependent == owner ) {
                    TreeRefNode * newRef;
                    newRef = new TreeRefNode( data->parentWin, parent, parent );
                    parent->_children.add( newRef );
                    parent->_hasRef = true;

                    parent->_flatReferences->add( newRef );
                } else {
                    child = new TreeFuncNode( data->parentWin,
                                              DRGetSymType( ref->dependent ),
                                              ref->dependent, data->mod,
                                              DRGetName( ref->dependent ),
                                              parent->_flatNodes,
                                              parent->_flatReferences );

                    child->_parents.add(
                        new TreeFuncPtr( data->parentWin, child, parent, *ref ) );
                    parent->_children.add( child );
                }

                data->roots->add( parent );
            }
        }
    }

    return true;
}
Exemple #15
0
int Scanner::getToken( YYSTYPE & lval )
/*************************************/
{
    int         c;
    int         count;
    int         fnd;
    bool        flush = false;
    bool        inquoted = false;
    bool        escaped = false;

    if( _stutter ) {
        _stutter = false;
        return _lastToken;
    }

    c = _scanStream->get();
    for(;;) {
        if( isspace( c ) ) {
            c = _scanStream->get();
        } else if( strchr( StartComments, c ) ) {
            do {
                c = _scanStream->get();
            } while( c != EOF && !strchr( EndComments, c ) );
            c = _scanStream->get();
        } else {
            break;
        }
    }
    if( c == '"' ) {
        inquoted = true;
        c = _scanStream->get();         // skip the quote
    }
    for( count = 0; ; count += 1 ) {

        if(( c == '\\' ) && ( _lookFor == LF_MagicString )) {
            c = _scanStream->get();
            if( isspace( c )) {
                _scanStream->unget( c );
                c = '\\';
            } else {
                escaped = true;
            }
        }

        if( c == EOF ) {
            if( count == 0 ) {
                if( CurrentScanner > 0 ) {
                    if( _lastToken == T_FileSync || _lastToken == EOF ) {
                        delete this;
                        return yylex();
                    } else {
                        _lastToken = T_FileSync;
                        return T_FileSync;
                    }
                } else {
                    return 0;       // done
                }
            } else {
                flush = true;
            }
        } else if( inquoted && !escaped ) {
            if( c == '"' ) {
                c = _scanStream->get();         // skip the quote
                flush = true;
            }
        } else if( isspace( c ) || strchr( StartComments, c ) ) {
            flush = true;
        } else if( strchr( Special, c ) && !escaped ) {
            if( count == 0 ) {
                _lastToken = c;
                return c;
            } else {
                flush = true;
            }
        }

        if( count >= BufSize - 1 ) {
            flush = true;
        }

        if( flush ) {
            _scanStream->unget( c );
            _buffer[ count ] = '\0';

            if(( _lookFor != LF_String ) && ( _lookFor != LF_MagicString )) {
                fnd = tryToken( _lookFor, _buffer );

                if( fnd > 0 ) {
                    lval = fnd;
                    return fnd;
                } else {
                    if( _recovering ) {
                        flush = false;
                        count = -1;
                    } else {
                        WString msg;
                        char * ambigs;
                        ambigs = tryAmbig( _lookFor, _buffer );

                        if( ambigs != NULL ) {
                            msg.printf( "[%s] is ambiguous -- try %s --",
                                        _buffer, ambigs );
                            WBRFree( ambigs );
                        } else {
                            msg.printf( "Unrecognized symbol [%s]", _buffer );
                        }
                        if( error( msg ) ) {
                            return 0;
                        }

                        _recovering = true;
                        flush = false;
                        count = -1;
                    }
                }
            } else {
                _stringTable.add( strdup( _buffer ));
                lval = _stringTable.count() - 1;
                if( _lookFor == LF_String ) {
                    _lastToken = T_String;
                } else {
                    _lastToken = T_MagicString;
                }
                return _lastToken;
            }
        } else {
            _buffer[ count ] = (char) c;
        }
        escaped = false;
        c = _scanStream->get();
    }
}
Exemple #16
0
void DTViewSymbol::initialize()
//-----------------------------
// create the detail view of the symbol and size it.
{
    WString         titleText;
    WRect           tmpRect;
    char            fName[_MAX_PATH];
    int             width;
    int             tmpWidth;
    int             height;

    rescale();

    //----------------- "Function initialize" title ----------------

    titleText.printf( "%s %s", SymbolTitleText[ _symbol->symtype() ],
                _symbol->name() );
    setText( titleText.gets() );
    width = getTextExtentX( titleText.gets() ) + CaptionGadgetSize;

    //----------  "Defined: D:\dev\browser\cpp\dtvsym.cpp" line ----------

    if( _symbol->defSourceFile( fName ) ) {
        _fileText.printf( "%s: %s", (_symbol->isDefined()) ? Defined : Declared, fName );
        height = _symbolLineR.r.y();
    } else {
        height = _fileNameR.r.y();
    }
    tmpWidth = _fileNameR.r.x() + abs( _fileNameR.r.w() ) +
                getTextExtentX( _fileText.gets() );

    width = maxInt( width, tmpWidth );

    //------- "void DTViewSymbol::initialize()" line -------

    tmpRect = _symbolLineR.r;
    tmpRect.y( height );

    _descPaint = new DescriptionPaint( this, tmpRect, _symbol );

    height += _symbolBoxR.r.y() - _symbolLineR.r.y();
    tmpWidth = _symbolLineR.r.x() + _descPaint->rect().w() + abs( _symbolLineR.r.w() );
    width = maxInt( width, tmpWidth );

    //------------------ member listbox --------------------
    if( _useBox ) {
        tmpRect = _symbolBoxR.r;
        tmpRect.y( height );

        _symbolBox = new WListBox( this, tmpRect,
                        LStyleNoIntegral | WStyleHScroll | WStyleVScroll );
        _symbolBox->show();
        _symbolBox->setFocus();

        height += __frame.r.h() - _symbolBoxR.r.y();    // this include 2 * dialogFrameHeight
    }


    width += 2 * WSystemMetrics::dialogFrameWidth();
    height += WSystemMetrics::captionSize();

    size( width, height );
    show();
}