FAUST compiler  0.9.9.6b8
Defines | Functions | Variables
drawschema.cpp File Reference

Implement block-diagram schema generation in svg or postscript format. More...

#include <stdio.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <string.h>
#include <ostream>
#include <sstream>
#include <set>
#include <utility>
#include <map>
#include <stack>
#include <string>
#include "boxes.hh"
#include "ppbox.hh"
#include "prim2.hh"
#include <vector>
#include "devLib.h"
#include "xtended.hh"
#include "occurrences.hh"
#include "boxcomplexity.h"
#include "schema.h"
#include "drawschema.hh"
#include "compatibility.hh"
#include "names.hh"
#include "description.hh"
#include "property.hh"
Include dependency graph for drawschema.cpp:

Go to the source code of this file.

Defines

#define linkcolor   "#003366"
#define normalcolor   "#4B71A1"
#define uicolor   "#477881"
#define slotcolor   "#47945E"
#define numcolor   "#f44800"
#define invcolor   "#ffffff"

Functions

static void writeSchemaFile (Tree bd)
 Write a top level diagram.
static schemagenerateDiagramSchema (Tree t)
 Generate an appropriate schema according to the type of block diagram.
static schemagenerateInsideSchema (Tree t)
 Generate the inside schema of a block diagram according to its type.
static void scheduleDrawing (Tree t)
 Schedule a makeBlockSchema diagram to be drawn.
static bool pendingDrawing (Tree &t)
 Retrieve next block diagram that must be drawn.
static schemagenerateAbstractionSchema (schema *x, Tree t)
 Generate an abstraction schema by placing in sequence the input slots and the body.
static schemagenerateOutputSlotSchema (Tree a)
 Generate a 0->1 block schema for an output slot.
static schemagenerateInputSlotSchema (Tree a)
 Generate a 1->0 block schema for an input slot.
static schemagenerateBargraphSchema (Tree t)
 Generate a 1->1 block schema for a user interface bargraph.
static schemagenerateUserInterfaceSchema (Tree t)
 Generate a 0->1 block schema for a user interface element.
static char * legalFileName (Tree t, int n, char *dst)
 Transform the definition name property of tree <t> into a legal file name.
static int cholddir ()
 *Switch back to the previously stored current directory
static int mkchdir (const char *dirname)
 Create a new directory in the current one to store the diagrams.
void drawSchema (Tree bd, const char *projname, const char *dev)
 *The entry point to generate from a block diagram as a set of *svg files stored in the directory "<projname>-svg/" or "<projname>-ps/" depending of <dev>.
static bool isInverter (Tree t)
static bool isPureRouting (Tree t)
static void UserInterfaceDescription (Tree box, string &d)
 Convert User interface element into a textual representation.

Variables

int gFoldThreshold
static OccurrencesgOccurrences
static bool sFoldingFlag
static stack< TreegPendingExp
static set< TreegDrawnExp
static const char * gDevSuffix
static char gCurrentDir [512]
static string gSchemaFileName
static map< Tree, string > gBackLink
Tree gInverter [6]
 isInverter(t) returns true if t == '*(-1)'.
property< bool > gPureRoutingProperty
 Compute the Pure Routing property, that is expressions only made of cut, wires and slots.

Detailed Description

Implement block-diagram schema generation in svg or postscript format.

The result is a folder containing one or more schema files in svg or ps format. Complex block-diagrams are automatically splitted.

Definition in file drawschema.cpp.


Define Documentation

#define invcolor   "#ffffff"

Definition at line 120 of file drawschema.cpp.

Referenced by generateInsideSchema().

#define linkcolor   "#003366"

Definition at line 115 of file drawschema.cpp.

Referenced by generateDiagramSchema().

#define normalcolor   "#4B71A1"

Definition at line 116 of file drawschema.cpp.

Referenced by generateInsideSchema().

#define numcolor   "#f44800"

Definition at line 119 of file drawschema.cpp.

Referenced by generateInsideSchema().

#define slotcolor   "#47945E"

Definition at line 118 of file drawschema.cpp.

Referenced by generateInputSlotSchema(), and generateOutputSlotSchema().

#define uicolor   "#477881"

Definition at line 117 of file drawschema.cpp.

Referenced by generateBargraphSchema(), and generateUserInterfaceSchema().


Function Documentation

static int cholddir ( ) [static]

*Switch back to the previously stored current directory

Definition at line 289 of file drawschema.cpp.

References gCurrentDir.

Referenced by drawSchema().

{
    if (chdir(gCurrentDir) == 0) {
        return 0;
    } else {
        perror("cholddir");
        exit(errno);
    }
}

Here is the caller graph for this function:

void drawSchema ( Tree  bd,
const char *  projname,
const char *  dev 
)

*The entry point to generate from a block diagram as a set of *svg files stored in the directory "<projname>-svg/" or "<projname>-ps/" depending of <dev>.

Definition at line 162 of file drawschema.cpp.

References boxComplexity(), cholddir(), gDevSuffix, gFoldThreshold, mkchdir(), pendingDrawing(), scheduleDrawing(), sFoldingFlag, and writeSchemaFile().

Referenced by main(), and printDocDgm().

{
    gDevSuffix      = dev;
    sFoldingFlag    = boxComplexity(bd) > gFoldThreshold;

    mkchdir(projname);          // create a directory to store files

    scheduleDrawing(bd);        // schedule the initial drawing

    Tree t; while (pendingDrawing(t)) {
        writeSchemaFile(t);     // generate all the pending drawing
    }

    cholddir();                 // return to current directory
}

Here is the call graph for this function:

Here is the caller graph for this function:

static schema * generateAbstractionSchema ( schema x,
Tree  t 
) [static]

Generate an abstraction schema by placing in sequence the input slots and the body.

Definition at line 624 of file drawschema.cpp.

References generateDiagramSchema(), generateInputSlotSchema(), isBoxSymbolic(), makeParSchema(), and makeSeqSchema().

Referenced by generateInsideSchema().

{
    Tree    a,b;

    while (isBoxSymbolic(t,a,b)) {
        x = makeParSchema(x, generateInputSlotSchema(a));
        t = b;
    }
    return makeSeqSchema(x, generateDiagramSchema(t));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static schema * generateBargraphSchema ( Tree  t) [static]

Generate a 1->1 block schema for a user interface bargraph.

Definition at line 588 of file drawschema.cpp.

References makeBlockSchema(), uicolor, and UserInterfaceDescription().

Referenced by generateInsideSchema().

{
    string s; UserInterfaceDescription(t,s);
    return makeBlockSchema(1, 1, s, uicolor, "");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static schema * generateDiagramSchema ( Tree  t) [static]

Generate an appropriate schema according to the type of block diagram.

When folding is requiered, instead of going down block-diagrams with a name, schedule them for an individual file.

Definition at line 394 of file drawschema.cpp.

References boxComplexity(), gDevSuffix, generateInsideSchema(), getBoxType(), getDefNameProperty(), isPureRouting(), legalFileName(), linkcolor, makeBlockSchema(), makeDecorateSchema(), scheduleDrawing(), sFoldingFlag, and tree2str().

Referenced by generateAbstractionSchema(), and generateInsideSchema().

{
    Tree    id;
    int     ins, outs;

    //cerr << t << " generateDiagramSchema " << boxpp(t)<< endl;

    if (getDefNameProperty(t, id)) {
        stringstream    s; s << tree2str(id);
        //cerr << t << "\tNAMED : " << s.str() << endl;
    }

    if ( sFoldingFlag && /*(gOccurrences->getCount(t) > 0) &&*/
            (boxComplexity(t) > 2) && getDefNameProperty(t, id)) {
        char    temp[1024];
        getBoxType(t, &ins, &outs);
        stringstream s, l;
        s << tree2str(id);
        l << legalFileName(t,1024,temp) << "." << gDevSuffix;
        scheduleDrawing(t);
        return makeBlockSchema(ins, outs, s.str(), linkcolor, l.str());

    } else  if (getDefNameProperty(t, id) && ! isPureRouting(t)) {
        // named case : not a slot, with a name
        // draw a line around the object with its name
        stringstream    s; s << tree2str(id);
        return makeDecorateSchema(generateInsideSchema(t), 10, s.str());

    } else {
        // normal case
        return generateInsideSchema(t);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static schema * generateInputSlotSchema ( Tree  a) [static]

Generate a 1->0 block schema for an input slot.

Definition at line 599 of file drawschema.cpp.

References getDefNameProperty(), makeBlockSchema(), slotcolor, and tree2str().

Referenced by generateAbstractionSchema(), and generateInsideSchema().

{
    Tree id; assert(getDefNameProperty(a, id));
    stringstream s; s << tree2str(id);
    return makeBlockSchema(1, 0, s.str(), slotcolor, "");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static schema * generateInsideSchema ( Tree  t) [static]

Generate the inside schema of a block diagram according to its type.

Definition at line 434 of file drawschema.cpp.

References xtended::arity(), extractName(), ffarity(), ffname(), generateAbstractionSchema(), generateBargraphSchema(), generateDiagramSchema(), generateInputSlotSchema(), generateOutputSlotSchema(), generateUserInterfaceSchema(), getDefNameProperty(), getUserData(), invcolor, isBoxButton(), isBoxCheckbox(), isBoxCut(), isBoxFConst(), isBoxFFun(), isBoxFVar(), isBoxHBargraph(), isBoxHGroup(), isBoxHSlider(), isBoxInt(), isBoxMerge(), isBoxNumEntry(), isBoxPar(), isBoxPrim0(), isBoxPrim1(), isBoxPrim2(), isBoxPrim3(), isBoxPrim4(), isBoxPrim5(), isBoxReal(), isBoxRec(), isBoxSeq(), isBoxSlot(), isBoxSplit(), isBoxSymbolic(), isBoxTGroup(), isBoxVBargraph(), isBoxVGroup(), isBoxVSlider(), isBoxWire(), isInverter(), makeBlockSchema(), makeCableSchema(), makeCutSchema(), makeDecorateSchema(), makeInverterSchema(), makeMergeSchema(), makeParSchema(), makeRecSchema(), makeSeqSchema(), makeSplitSchema(), xtended::name(), name(), normalcolor, numcolor, prim0name(), prim1name(), prim2name(), prim3name(), prim4name(), prim5name(), print(), and tree2str().

Referenced by generateDiagramSchema(), and writeSchemaFile().

{
    Tree a, b, ff, l, type,name,file;
    int     i;
    double  r;
    prim0   p0;
    prim1   p1;
    prim2   p2;
    prim3   p3;
    prim4   p4;
    prim5   p5;


    xtended* xt = (xtended*)getUserData(t);

    if (xt)                         { return makeBlockSchema(xt->arity(), 1, xt->name(), normalcolor, ""); }

    else if (isInverter(t))         { return makeInverterSchema(invcolor); }

    else if (isBoxInt(t, &i))       { stringstream  s; s << i; return makeBlockSchema(0, 1, s.str(), numcolor, "" ); }
    else if (isBoxReal(t, &r))      { stringstream  s; s << r; return makeBlockSchema(0, 1, s.str(), numcolor, "" ); }
    else if (isBoxWire(t))          { return makeCableSchema(); }
    else if (isBoxCut(t))           { return makeCutSchema();  }

    else if (isBoxPrim0(t, &p0))    { return makeBlockSchema(0, 1, prim0name(p0), normalcolor, ""); }
    else if (isBoxPrim1(t, &p1))    { return makeBlockSchema(1, 1, prim1name(p1), normalcolor, ""); }
    else if (isBoxPrim2(t, &p2))    { return makeBlockSchema(2, 1, prim2name(p2), normalcolor, ""); }
    else if (isBoxPrim3(t, &p3))    { return makeBlockSchema(3, 1, prim3name(p3), normalcolor, ""); }
    else if (isBoxPrim4(t, &p4))    { return makeBlockSchema(4, 1, prim4name(p4), normalcolor, ""); }
    else if (isBoxPrim5(t, &p5))    { return makeBlockSchema(5, 1, prim5name(p5), normalcolor, ""); }

    else if (isBoxFFun(t, ff))                  { return makeBlockSchema(ffarity(ff), 1, ffname(ff), normalcolor, ""); }
    else if (isBoxFConst(t, type,name,file))    { return makeBlockSchema(0, 1, tree2str(name), normalcolor, ""); }
    else if (isBoxFVar (t, type, name,file))    { return makeBlockSchema(0, 1, tree2str(name), normalcolor, ""); }

    else if (isBoxButton(t))        { return generateUserInterfaceSchema(t); }
    else if (isBoxCheckbox(t))      { return generateUserInterfaceSchema(t); }
    else if (isBoxVSlider(t))       { return generateUserInterfaceSchema(t); }
    else if (isBoxHSlider(t))       { return generateUserInterfaceSchema(t); }
    else if (isBoxNumEntry(t))      { return generateUserInterfaceSchema(t); }
    else if (isBoxVBargraph(t))     { return generateBargraphSchema(t); }
    else if (isBoxHBargraph(t))     { return generateBargraphSchema(t); }

    // don't draw group rectangle when labels are empty (ie "")
    else if (isBoxVGroup(t,l,a))    {   stringstream s; s << "vgroup(" << extractName(l) << ")";
                                        schema* r = generateDiagramSchema(a);
                                        return makeDecorateSchema(r, 10, s.str()); }
    else if (isBoxHGroup(t,l,a))    {   stringstream s; s << "hgroup(" << extractName(l) << ")";
                                        schema* r = generateDiagramSchema(a);
                                        return makeDecorateSchema(r, 10, s.str()); }
    else if (isBoxTGroup(t,l,a))    {   stringstream s; s << "tgroup(" << extractName(l) << ")";
                                        schema* r = generateDiagramSchema(a);
                                        return makeDecorateSchema(r, 10, s.str()); }

    else if (isBoxSeq(t, a, b))     { return makeSeqSchema(generateDiagramSchema(a), generateDiagramSchema(b)); }
    else if (isBoxPar(t, a, b))     { return makeParSchema(generateDiagramSchema(a), generateDiagramSchema(b)); }
    else if (isBoxSplit(t, a, b))   { return makeSplitSchema(generateDiagramSchema(a), generateDiagramSchema(b)); }
    else if (isBoxMerge(t, a, b))   { return makeMergeSchema(generateDiagramSchema(a), generateDiagramSchema(b)); }
    else if (isBoxRec(t, a, b))     { return makeRecSchema(generateDiagramSchema(a), generateDiagramSchema(b)); }

    else if (isBoxSlot(t, &i))      { return generateOutputSlotSchema(t); }
    else if (isBoxSymbolic(t,a,b))  {
        Tree    id;
        if (getDefNameProperty(t, id)) {
            return generateAbstractionSchema(generateInputSlotSchema(a), b);
        } else {
            return makeDecorateSchema(generateAbstractionSchema(generateInputSlotSchema(a), b), 10, "Abstraction");
        }
    }

    else {

        fprintf(stderr, "Internal Error, box expression not recognized : "); print(t, stderr); fprintf(stderr, "\n");
        exit(1);

    }
}

Here is the caller graph for this function:

static schema * generateOutputSlotSchema ( Tree  a) [static]

Generate a 0->1 block schema for an output slot.

Definition at line 611 of file drawschema.cpp.

References getDefNameProperty(), makeBlockSchema(), slotcolor, and tree2str().

Referenced by generateInsideSchema().

{
    Tree id; assert(getDefNameProperty(a, id));
    stringstream s; s << tree2str(id);
    return makeBlockSchema(0, 1, s.str(), slotcolor, "");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static schema * generateUserInterfaceSchema ( Tree  t) [static]

Generate a 0->1 block schema for a user interface element.

Definition at line 578 of file drawschema.cpp.

References makeBlockSchema(), uicolor, and UserInterfaceDescription().

Referenced by generateInsideSchema().

{
    string s; UserInterfaceDescription(t,s);
    return makeBlockSchema(0, 1, s, uicolor, "");
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bool isInverter ( Tree  t) [static]

Definition at line 335 of file drawschema.cpp.

References boxInt(), boxPar(), boxPrim2(), boxReal(), boxSeq(), boxWire(), gInverter, sigMul(), and sigSub().

Referenced by generateInsideSchema(), and isPureRouting().

{
    // init gInverted table. For some reason doesn't work if done outside
    if (gInverter[0] == 0) {
        gInverter[0] = boxSeq(boxPar(boxWire(), boxInt(-1)),boxPrim2(sigMul));
        gInverter[1] = boxSeq(boxPar(boxInt(-1), boxWire()),boxPrim2(sigMul));
        gInverter[2] = boxSeq(boxPar(boxWire(), boxReal(-1.0)),boxPrim2(sigMul));
        gInverter[3] = boxSeq(boxPar(boxReal(-1.0), boxWire()),boxPrim2(sigMul));
        gInverter[4] = boxSeq(boxPar(boxInt(0), boxWire()),boxPrim2(sigSub));
        gInverter[5] = boxSeq(boxPar(boxReal(0.0), boxWire()),boxPrim2(sigSub));
    };

    //cerr << "isInverter " << t << '$' << boxpp(t) << endl;
    for (int i=0; i<6; i++) {
        if (t == gInverter[i]) return true;
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static bool isPureRouting ( Tree  t) [static]

Definition at line 362 of file drawschema.cpp.

References gPureRoutingProperty, isBoxCut(), isBoxMerge(), isBoxPar(), isBoxSeq(), isBoxSlot(), isBoxSplit(), isBoxWire(), and isInverter().

Referenced by generateDiagramSchema().

{
    bool    r;
    int     ID;
    Tree    x,y;

    if (gPureRoutingProperty.get(t,r)) {
        return r;
    } else if (    isBoxCut(t)
                || isBoxWire(t)
                || isInverter(t)
                || isBoxSlot(t, &ID)
                || (isBoxPar(t,x,y) && isPureRouting(x) && isPureRouting(y))
                || (isBoxSeq(t,x,y) && isPureRouting(x) && isPureRouting(y))
                || (isBoxSplit(t,x,y) && isPureRouting(x) && isPureRouting(y))
                || (isBoxMerge(t,x,y) && isPureRouting(x) && isPureRouting(y))
              ) {
        gPureRoutingProperty.set(t,true);
        return true;
    } else {
        gPureRoutingProperty.set(t,false);
        return false;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char * legalFileName ( Tree  t,
int  n,
char *  dst 
) [static]

Transform the definition name property of tree <t> into a legal file name.

The resulting file name is stored in <dst> a table of at least <n> chars. Returns the <dst> pointer for convenience.

Definition at line 306 of file drawschema.cpp.

References getDefNameProperty(), and tree2str().

Referenced by generateDiagramSchema(), and writeSchemaFile().

{
    Tree    id;
    int     i=0;
    if (getDefNameProperty(t, id)) {
        const char*     src = tree2str(id);
        for (i=0; isalnum(src[i]) && i<16; i++) {
            dst[i] = src[i];
        }
    }
    dst[i] = 0;
    if (strcmp(dst, "process") != 0) { 
        // if it is not process add the hex address to make the name unique
        snprintf(&dst[i], n-i, "-%p", t);
    }
    return dst;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int mkchdir ( const char *  dirname) [static]

Create a new directory in the current one to store the diagrams.

The current directory is saved to be later restaured.

Definition at line 269 of file drawschema.cpp.

References gCurrentDir.

Referenced by drawSchema().

{
    //cerr << "mkchdir of " << dirname << endl;
    if (getcwd(gCurrentDir, 512) != 0) {
        int status = mkdir(dirname, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
        if (status == 0 || errno == EEXIST) {
            if (chdir(dirname) == 0) {
                return 0;
            }
        }
    }
    perror("mkchdir");
    exit(errno);
    //return errno;
}

Here is the caller graph for this function:

static bool pendingDrawing ( Tree t) [static]

Retrieve next block diagram that must be drawn.

Definition at line 203 of file drawschema.cpp.

References gPendingExp.

Referenced by drawSchema().

{
    if (gPendingExp.empty()) return false;
    t = gPendingExp.top();
    gPendingExp.pop();
    return true;
}

Here is the caller graph for this function:

static void scheduleDrawing ( Tree  t) [static]

Schedule a makeBlockSchema diagram to be drawn.

Definition at line 191 of file drawschema.cpp.

References gBackLink, gDrawnExp, gPendingExp, and gSchemaFileName.

Referenced by drawSchema(), and generateDiagramSchema().

{
    if (gDrawnExp.find(t) == gDrawnExp.end()) {
        gDrawnExp.insert(t);
        gBackLink.insert(make_pair(t,gSchemaFileName)); // remember the enclosing filename
        gPendingExp.push(t);
    }
}

Here is the caller graph for this function:

static void UserInterfaceDescription ( Tree  box,
string &  d 
) [static]

Convert User interface element into a textual representation.

Definition at line 515 of file drawschema.cpp.

References extractName(), isBoxButton(), isBoxCheckbox(), isBoxHBargraph(), isBoxHGroup(), isBoxHSlider(), isBoxNumEntry(), isBoxTGroup(), isBoxVBargraph(), isBoxVGroup(), isBoxVSlider(), max(), and min().

Referenced by generateBargraphSchema(), and generateUserInterfaceSchema().

{
    Tree    t1, label, cur, min, max, step;
    stringstream    fout;
    // user interface
         if (isBoxButton(box, label))   fout << "button(" << extractName(label) << ')';
    else if (isBoxCheckbox(box, label)) fout << "checkbox(" << extractName(label) << ')';
    else if (isBoxVSlider(box, label, cur, min, max, step))     {
        fout << "vslider("
             << extractName(label) << ", "
             << boxpp(cur) << ", "
             << boxpp(min) << ", "
             << boxpp(max) << ", "
             << boxpp(step)<< ')';
    }
    else if (isBoxHSlider(box, label, cur, min, max, step))     {
        fout << "hslider("
             << extractName(label) << ", "
             << boxpp(cur) << ", "
             << boxpp(min) << ", "
             << boxpp(max) << ", "
             << boxpp(step)<< ')';
    }
    else if (isBoxVGroup(box, label, t1)) {
        fout << "vgroup(" << extractName(label) << ", " << boxpp(t1, 0) << ')';
    }
    else if (isBoxHGroup(box, label, t1)) {
        fout << "hgroup(" << extractName(label) << ", " << boxpp(t1, 0) << ')';
    }
    else if (isBoxTGroup(box, label, t1)) {
        fout << "tgroup(" << extractName(label) << ", " << boxpp(t1, 0) << ')';
    }
    else if (isBoxHBargraph(box, label, min, max))  {
        fout << "hbargraph("
             << extractName(label) << ", "
             << boxpp(min) << ", "
             << boxpp(max) << ')';
    }
    else if (isBoxVBargraph(box, label, min, max))  {
        fout << "vbargraph("
             << extractName(label) << ", "
             << boxpp(min) << ", "
             << boxpp(max) << ')';
    }
    else if (isBoxNumEntry(box, label, cur, min, max, step))    {
        fout << "nentry("
             << extractName(label) << ", "
             << boxpp(cur) << ", "
             << boxpp(min) << ", "
             << boxpp(max) << ", "
             << boxpp(step)<< ')';
    }
    else {
        cerr << "INTERNAL ERROR : unknow user interface element " << endl;
        exit(0);
    }
    d = fout.str();
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void writeSchemaFile ( Tree  bd) [static]

Write a top level diagram.

A top level diagram is decorated with its definition name property and is drawn in an individual file

Definition at line 220 of file drawschema.cpp.

References schema::collectTraits(), collector::draw(), schema::draw(), gBackLink, gDevSuffix, generateInsideSchema(), getDefNameProperty(), gOccurrences, gSchemaFileName, schema::height(), kLeftRight, legalFileName(), makeTopSchema(), schema::place(), tree(), tree2str(), unique(), and schema::width().

Referenced by drawSchema().

{
    Tree            id;
    schema*         ts;

    char            temp[1024];

    gOccurrences = new Occurrences(bd);

    bool hasname = getDefNameProperty(bd, id); 

    //assert(hasname);
    if (!hasname) {
        // create an arbitrary name 
        id = tree(Node(unique("diagram_")));
    }

    // generate legal file name for the schema
    stringstream s1; s1 << legalFileName(bd, 1024, temp) << "." << gDevSuffix;
    gSchemaFileName = s1.str();

    // generate the label of the schema
    stringstream s2; s2 << tree2str(id);
    string link = gBackLink[bd];
    ts = makeTopSchema(generateInsideSchema(bd), 20, s2.str(), link);
    // draw to the device defined by gDevSuffix
    if (strcmp(gDevSuffix, "svg") == 0) {
        SVGDev dev(s1.str().c_str(), ts->width(), ts->height());
        ts->place(0,0, kLeftRight);
        ts->draw(dev);
        { collector c; ts->collectTraits(c); c.draw(dev); }
    } else {
        PSDev dev(s1.str().c_str(), ts->width(), ts->height());
        ts->place(0,0, kLeftRight);
        ts->draw(dev);
        {
            collector c;
            ts->collectTraits(c);
            c.draw(dev);
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

map<Tree,string> gBackLink [static]

Definition at line 137 of file drawschema.cpp.

Referenced by scheduleDrawing(), and writeSchemaFile().

char gCurrentDir[512] [static]

Definition at line 135 of file drawschema.cpp.

Referenced by cholddir(), and mkchdir().

const char* gDevSuffix [static]

Definition at line 134 of file drawschema.cpp.

Referenced by drawSchema(), generateDiagramSchema(), and writeSchemaFile().

set<Tree> gDrawnExp [static]

Definition at line 133 of file drawschema.cpp.

Referenced by scheduleDrawing().

Definition at line 125 of file main.cpp.

Referenced by drawSchema(), and process_cmdline().

isInverter(t) returns true if t == '*(-1)'.

This test is used to simplify diagram by using a special symbol for inverters.

Definition at line 333 of file drawschema.cpp.

Referenced by isInverter().

Definition at line 130 of file drawschema.cpp.

Referenced by writeSchemaFile().

stack<Tree> gPendingExp [static]

Definition at line 132 of file drawschema.cpp.

Referenced by pendingDrawing(), and scheduleDrawing().

Compute the Pure Routing property, that is expressions only made of cut, wires and slots.

No labels will be dispayed for pure routing expressions.

Definition at line 360 of file drawschema.cpp.

Referenced by isPureRouting().

string gSchemaFileName [static]

Definition at line 136 of file drawschema.cpp.

Referenced by scheduleDrawing(), and writeSchemaFile().

bool sFoldingFlag [static]

Definition at line 131 of file drawschema.cpp.

Referenced by drawSchema(), and generateDiagramSchema().