Exemple #1
0
void Pdb::Explorer()
{
	VectorMap<String, Value> prev = DataMap(explorer);
	explorer.Clear();
	try {
		String x = ~expexp;
		if(!IsNull(x)) {
			CParser p(x);
			Val v = Exp(p);
			Vis(explorer, "=", prev, Visualise(v));
			if(v.type >= 0 && v.ref == 0 && !v.rvalue)
				Explore(v, prev);
			if(v.ref > 0 && GetRVal(v).address)
				for(int i = 0; i < 20; i++)
					Vis(explorer, Format("[%d]", i), prev, Visualise(DeRef(Compute(v, RValue(i), '+'))));
		}
	}
	catch(CParser::Error e) {
		Visual v;
		v.Cat(e, LtRed);
		explorer.Add("", RawPickToValue(v));
	}
	exback.Enable(exprev.GetCount());
	exfw.Enable(exnext.GetCount());
}
Exemple #2
0
void Pdb::Locals()
{
	VectorMap<String, Value> prev = DataMap(locals);
	locals.Clear();
	int q = ~framelist;
	if(q >= 0 && q < frame.GetCount()) {
		Frame& f = frame[q];
		for(int i = 0; i < f.param.GetCount(); i++)
			Vis(locals, f.param.GetKey(i), prev, Visualise(f.param[i]));
		for(int i = 0; i < f.local.GetCount(); i++)
			Vis(locals, f.local.GetKey(i), prev, Visualise(f.local[i]));
	}
}
Exemple #3
0
void Pdb::Explore(const Val& val, const VectorMap<String, Value>& prev)
{
	const Type& t = GetType(val.type);
	for(int i = 0; i < t.base.GetCount(); i++) {
		Val b = t.base[i];
		b.address += val.address;
		Vis(explorer, ':' + GetType(b.type).name, prev, Visualise(b));
	}
	for(int i = 0; i < t.member.GetCount(); i++) {
		Val r = t.member[i];
		r.address += val.address;
		Vis(explorer, '.' + t.member.GetKey(i), prev, Visualise(r));
	}
	for(int i = 0; i < t.static_member.GetCount(); i++)
		Vis(explorer, "::" + t.static_member.GetKey(i), prev, Visualise(t.static_member[i]));
}
Exemple #4
0
void Pdb::Watches()
{
	VectorMap<String, Value> prev = DataMap(watches);
	for(int i = 0; i < watches.GetCount(); i++) {
		bool ch;
		watches.Set(i, 1, Vis((String)watches.Get(i, 0),
		            prev, Visualise((String)watches.Get(i, 0)), ch));
		if(ch)
			watches.SetDisplay(i, 0, Single<RedDisplay>());
		else
			watches.SetDisplay(i, 0, StdDisplay());
	}
}
Exemple #5
0
void Pdb::AddThis(const VectorMap<String, Val>& m, adr_t address, const VectorMap<String, Value>& prev)
{
	for(int i = 0; i < m.GetCount() && self.GetCount() < 2000; i++) {
		Val mv = m[i];
		mv.address += address;
		Visual vis;
		try {
			vis = Visualise(mv);
		}
		catch(CParser::Error e) {
			vis.Cat(e, SColorDisabled);
		}
		Vis(self, m.GetKey(i), prev, vis);
	}
}
Exemple #6
0
void Pdb::TryAuto(const String& exp, const VectorMap<String, Value>& prev)
{
	if(autos.Find(exp) < 0) {
		Visual r;
		try {
			CParser p(exp);
			Val v = Exp(p);
			Visualise(r, v, 2);
		}
		catch(CParser::Error) {
			r.Clear();
		}
		if(r.part.GetCount())
			Vis(autos, exp, prev, r);
	}
}
Exemple #7
0
int EBuffer::ShowRow(int Row) { /*FOLD00*/
  int V = RToVN(Row), GapSize;

  //    printf("Showing row %d\n", Row);

  assert(Row >= 0 && Row < RCount); // 0 cannot be hidden

  if (V + Vis(V) == Row) return 1;  // already visible

  assert(VCount <= VAllocated);

  if (VCount == VAllocated) {
    if (AllocVis(VCount ? (VCount * 2) : 1) == 0) return 0;

    memmove(VV + VAllocated - (VCount - VGap),
            VV + VGap,
            sizeof(int) * (VCount - VGap));
  }

  if (VGap != V + 1) if (MoveVGap(V + 1) == 0) return 0;

  VV[VGap] = Row - (VGap);
  VGap++;
  VCount++;

  GapSize = VAllocated - VCount;

  if (VGap != V + 2) if (MoveVGap(V + 2) == 0) return 0;

  for (int i = V + 2; i < VCount; i++) VV[i + GapSize]--;

  //        Vis(i, Vis(i) - 1);
  UpdateVisible(Row, 1);

  //    if (CP.Row > Row)
  //        if (SetPos(CP.Col, CP.Row + 1) == 0) return 0;
  Draw(Row, -1);
  return 1;
}
Exemple #8
0
void Pdb::Vis(ArrayCtrl& a, const String& key, const VectorMap<String, Value>& prev,
              Visual rval_ vis)
{
	bool ch;
	a.Add(key, Vis(key, prev, vis, ch));
}
Exemple #9
0
int
main(int argc, char *argv[])
{
    char *fname = argv[1] ;
    int y, i, j, c ;
    HalfImage halfimage ;

    if (ReadImage(fname, image))
	fprintf(stderr, "%s read successfully.\n", fname) ;

    /* downsample */
    for (j=0; j<HALFHEIGHT; j++) {
	for (i=0; i<HALFWIDTH; i++) {
	    for (c=0; c<3; c++)
		halfimage[j][i][c] = 
		    (image[2*j][2*i][c] +
		    image[2*j+1][2*i][c] +
		    image[2*j][2*i+1][c] +
		    image[2*j+1][2*i+1][c]) / 4.0 ;
	}
    }

    /* now, color space convert */
    for (j=0; j<HEIGHT; j++) {
	for (i=0; i<WIDTH; i++) {
	    image[j][i][0] = 0.30 * image[j][i][0] +
			     0.59 * image[j][i][1] +
			     0.11 * image[j][i][2] ;
	}
    }
    /* and the half image */
    for (j=0; j<HALFHEIGHT; j++) {
	for (i=0; i<HALFWIDTH; i++) {
	    float y = 0.30 * halfimage[j][i][0] +
		      0.59 * halfimage[j][i][1] +
		      0.11 * halfimage[j][i][2] ;
	    halfimage[j][i][1] = (halfimage[j][i][1] - y + 1.0) / 2.0 ; 
	    halfimage[j][i][2] = (halfimage[j][i][2] - y + 1.0) / 2.0 ;
	    halfimage[j][i][0] = y ;
	}
     }

    sfinfo.channels = 1 ;
    sfinfo.samplerate = FILESAMPLERATE ;
    sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16 ;

    sf = sf_open(argv[2], SFM_WRITE, &sfinfo) ;

    /* generate the "vis" code. */
    blank(500.0) ;
    Vis(128+8) ;

    for (y=0; y<HEIGHT; y += 2)
	ScanlinePair(image, halfimage, y) ;

    blank(500.0) ;

    BufferFlush() ;
    sf_close(sf) ;

    return 0 ;
}
Exemple #10
0
void EBuffer::DrawLine(TDrawBuffer B, int VRow, int C, int W, int& HilitX) {
  hlState State;
  int     StartPos, EndPos;

  HilitX = 0;
               MoveChar(B, 0, W, ' ', hcPlain_Background, W);

  //    if ((VRow == VCount - 1) && !BFI(this, BFI_ForceNewLine)) {
  // if (BFI(this, BFI_ShowMarkers))
  //     MoveChar(B, 0, W, EOF_MARKER, hcPlain_Markers, W);
  //    }
  if (VRow < VCount) {
    int Row     = VToR(VRow);
    PELine L    = RLine(Row);
    int    ECol = 0;

    if (Row > 0) State = RLine(Row - 1)->StateE;
    else State = 0;

    if ((BFI(this, BFI_HilitOn) == 1) && (HilitProc != 0)) HilitProc(this,
                                                                     Row,
                                                                     B,
                                                                     C,
                                                                     W,
                                                                     L,
                                                                     State,
                                                                     0,
                                                                     &ECol);
    else Hilit_Plain(this, Row, B, C, W, L, State, 0, &ECol);

    if (L->StateE != State) {
      HilitX    = 1;
      L->StateE = State;
    }

    if (BFI(this, BFI_ShowMarkers)) {
               MoveChar(B, ECol - C, W,
               ConGetDrawChar(
                 (Row == RCount - 1) ? DCH_EOF : DCH_EOL), hcPlain_Markers, 1);
      ECol += 1;
    }

    if (Row < RCount) {
      int f;
      int Folded = 0;
      static char fold[20];
      int l;

      f = FindFold(Row);

      if (f != -1) {
        int foldColor;

        if (FF[f].level < 5) foldColor = hcPlain_Folds[FF[f].level];
        else foldColor = hcPlain_Folds[4];

        if (FF[f].open == 1) {
          l = sprintf(fold, "[%d]", FF[f].level);
          MoveStr(B, ECol - C + 1, W, fold, foldColor, 10);
          ECol += l;
        } else {
          if (VRow < VCount - 1) {
            Folded = Vis(VRow + 1) - Vis(VRow) + 1;
          } else if (VRow < VCount) {
            Folded = RCount - (VRow + Vis(VRow));
          }
          l = sprintf(fold, "(%d:%d)", FF[f].level, Folded);
          MoveStr(B, ECol - C + 1, W, fold, foldColor, 10);
          ECol += l;
          MoveAttr(B, 0, W, foldColor, W);
        }
      }
    }

    if ((BB.Row != -1) && (BE.Row != -1) && (Row >= BB.Row) && (Row <= BE.Row)) {
      switch (BlockMode) {
      case bmLine:
        StartPos = 0;

        if (Row == BE.Row) EndPos = 0;
        else EndPos = W;
        break;

      case bmColumn:
        StartPos = BB.Col - C;

        if (Row == BE.Row) EndPos = BB.Col - C;
        else EndPos = BE.Col - C;
        break;

      case bmStream:

        if ((Row == BB.Row) && (Row == BE.Row)) {
          StartPos = BB.Col - C;
          EndPos   = BE.Col - C;
        } else if (Row == BB.Row) {
          StartPos = BB.Col - C;
          EndPos   = W;
        } else if (Row == BE.Row) {
          StartPos = 0;
          EndPos   = BE.Col - C;
        } else {
          StartPos = 0;
          EndPos   = W;
        }
        break;

      default:
        StartPos = EndPos = 0;
        break;
      }

      if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B,
                                                StartPos,
                                                W,
                                                hcPlain_Selected,
                                                EndPos - StartPos);
      else MoveAttr(B, StartPos, W, hcPlain_Selected, EndPos - StartPos);
    }

    if (BFI(this, BFI_ShowBookmarks)) {
      int i = 0;
      char  *Name;
      EPoint P;

      while ((i = GetBookmarkForLine(i, Row, Name, P)) != -1) {
        if (strncmp(Name, "_BMK", 4) == 0) {
          // User bookmark, hilite line
          if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B, 0, W, hcPlain_Bookmark, W);
          else MoveAttr(B, 0, W, hcPlain_Bookmark, W);
          break;
        }
      }
    }

    if ((Match.Row != -1) && (Match.Col != -1)) {
      if (Row == Match.Row) {
        if (BFI(this, BFI_SeeThruSel)) MoveBgAttr(B,
                                                  Match.Col - C,
                                                  W,
                                                  hcPlain_Found,
                                                  MatchLen);
        else MoveAttr(B, Match.Col - C, W, hcPlain_Found, MatchLen);
      }
    }
  } else if (VRow == VCount) {
    if (BFI(this, BFI_ShowMarkers)) MoveChar(B, 0, W, ConGetDrawChar(
                                               DCH_END), hcPlain_Markers, W);
  }
}