Exemple #1
0
//************************************************************************
BOOL CCreditsParser::HandleKey(LPSTR lpEntry, LPSTR lpKey, LPSTR lpValues, int nValues, int nIndex, DWORD dwUserData)
//************************************************************************
{
	static POINT ptStartDefault = {0,0}, ptEndDefault = {0,480};
	static DWORD dwDelayTimeDefault= 500L;
	static int iSpeedDefault = 50, iTypeDefault = 0;

	LPCREDITSSCENE lpScene = (LPCREDITSSCENE)dwUserData;
	if (nIndex == 0)
	{
		if (!lstrcmpi(lpKey, "face1"))
			GetString(lpScene->m_szFaceName[0], lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "face2"))
			GetString(lpScene->m_szFaceName[1], lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "size1"))
			GetInt(&lpScene->m_ptSize[0], lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "size2"))
			GetInt(&lpScene->m_ptSize[1], lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "italic1"))
			GetInt(&lpScene->m_fItalic[0], lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "italic2"))
			GetInt(&lpScene->m_fItalic[1], lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "color1"))
			GetColor(&lpScene->m_Color[0], lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "color2"))
			GetColor(&lpScene->m_Color[1], lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "bgcolor"))
			GetColor(&lpScene->m_BackgrndColor, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "center"))
			GetInt(&lpScene->m_fCenter, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "cliprect") || !lstrcmpi(lpKey, "gamearea"))
			GetRect(&lpScene->m_rGameArea, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "soundtrack"))
			GetFilename(lpScene->m_szSoundTrack, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "start"))
			GetPoint(&ptStartDefault, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "end"))
			GetPoint(&ptEndDefault, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "delay"))
		{
			STRING szTime;
			GetString(szTime, lpEntry, lpValues, nValues);
			dwDelayTimeDefault = latol(szTime);
		}
		else
		if (!lstrcmpi(lpKey, "speed"))
			GetInt(&iSpeedDefault, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "type"))
		{
			GetInt(&iTypeDefault, lpEntry, lpValues, nValues);
			--iTypeDefault; // make zero relative
			if (iTypeDefault <= 0)
				iTypeDefault = 0;
			else
				iTypeDefault = 1;
		}
		else
			Print("'%ls'\n Unknown key '%s'", lpEntry, lpKey);
	}
	else
	{
		LPCONTRIBUTOR pContributor = lpScene->GetContributor(nIndex-1);;

		if (!lstrcmpi(lpKey, "start"))
			GetPoint(&pContributor->m_ptStart, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "end"))
			GetPoint(&pContributor->m_ptEnd, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "name"))
		{
			GetString(pContributor->m_szName, lpEntry, lpValues, nValues);
			LPSTR lp;
			while (lp = FindString(pContributor->m_szName, "]"))
				*lp = ',';
			pContributor->m_ptStart     = ptStartDefault;
			pContributor->m_ptEnd       = ptEndDefault;
			pContributor->m_dwDelayTime = dwDelayTimeDefault;
			pContributor->m_iSpeed      = iSpeedDefault;
			pContributor->m_iType       = iTypeDefault;
		}
		else
		if (!lstrcmpi(lpKey, "delay"))
		{
			STRING szTime;
			GetString(szTime, lpEntry, lpValues, nValues);
			pContributor->m_dwDelayTime = latol(szTime);
		}
		else
		if (!lstrcmpi(lpKey, "speed"))
			GetInt(&pContributor->m_iSpeed, lpEntry, lpValues, nValues);
		else
		if (!lstrcmpi(lpKey, "type"))
		{
			GetInt(&pContributor->m_iType, lpEntry, lpValues, nValues);
			--pContributor->m_iType; // make zero relative
			if (pContributor->m_iType <= 0)
				pContributor->m_iType = 0;
			else
				pContributor->m_iType = 1;
		}
		else
			Print("'%ls'\n Unknown key '%s'", lpEntry, lpKey);
	}
		
	return(TRUE);
}
Exemple #2
0
/*
 *******************************************************************************
 *                                                                             *
 *   Interrupt() is used to read in a move when the operator types something   *
 *   while a search is in progress (during pondering as one example.)  This    *
 *   routine reads in a command (move) and then makes two attempts to use this *
 *   input:  (1) call Option() to see if the command can be executed;  (2) try *
 *   InputMove() to see if this input is a legal move;  If so, and we are      *
 *   pondering see if it matches the move we are pondering.                    *
 *                                                                             *
 *******************************************************************************
 */
void Interrupt(int ply) {
  int temp, i, left = 0, readstat, result, time_used;
  int save_move_number;
  TREE *const tree = block[0];

/*
 ************************************************************
 *                                                          *
 *   If trying to find a move to ponder, and the operator   *
 *   types a command, exit a.s.a.p.                         *
 *                                                          *
 ************************************************************
 */
  if (puzzling)
    abort_search = 1;
/*
 ************************************************************
 *                                                          *
 *   First check to see if this is a command by calling     *
 *   Option().  Option() will return a 0 if it didn't       *
 *   recognize the command; otherwise it returns a 1 if     *
 *   the command was executed, or a 2 if we need to abort   *
 *   the search to execute the command.                     *
 *                                                          *
 ************************************************************
 */
  else
    do {
      readstat = Read(0, buffer);
      if (readstat <= 0)
        break;
      nargs = ReadParse(buffer, args, " 	;");
      if (nargs == 0) {
        Print(128, "ok.\n");
        break;
      }
      if (strcmp(args[0], ".")) {
        save_move_number = move_number;
        if (!wtm)
          move_number--;
        if (root_wtm)
          Print(128, "Black(%d): %s\n", move_number, buffer);
        else
          Print(128, "White(%d): %s\n", move_number, buffer);
        move_number = save_move_number;
      }
/*
 ************************************************************
 *                                                          *
 *   "." command displays status of current search.         *
 *                                                          *
 ************************************************************
 */
      if (!strcmp(args[0], ".")) {
        if (xboard) {
          end_time = ReadClock();
          time_used = (end_time - start_time);
          printf("stat01: %d ", time_used);
          printf(BMF " ", tree->nodes_searched);
          printf("%d ", iteration_depth);
          for (i = 0; i < n_root_moves; i++)
            if (!(root_moves[i].status & 128))
              left++;
          printf("%d %d\n", left, n_root_moves);
          fflush(stdout);
          break;
        } else {
          end_time = ReadClock();
          time_used = (end_time - start_time);
          printf("time:%s ", DisplayTime(time_used));
          printf("nodes:" BMF "\n", tree->nodes_searched);
          DisplayTreeState(block[0], 1, 0, ply);
        }
      }
/*
 ************************************************************
 *                                                          *
 *   "mn" command is used to set the move number to a       *
 *   specific value...                                      *
 *                                                          *
 ************************************************************
 */
      else if (!strcmp("mn", args[0])) {
        if (nargs == 2) {
          move_number = atoi(args[1]);
          Print(128, "move number set to %d\n", move_number);
        }
      }
/*
 ************************************************************
 *                                                          *
 *   "?" command says "move now!"                           *
 *                                                          *
 ************************************************************
 */
      else if (!strcmp(args[0], "?")) {
        if (thinking) {
          time_abort = 1;
          abort_search = 1;
        }
      }
/*
 ************************************************************
 *                                                          *
 *   Next see if Option() recognizes this as a command.     *
 *                                                          *
 ************************************************************
 */
      else {
        save_move_number = move_number;
        if (!analyze_mode && !wtm)
          move_number--;
        result = Option(tree);
        move_number = save_move_number;
        if (result >= 2) {
          if (thinking && result != 3)
            Print(128, "command not legal now.\n");
          else {
            abort_search = 1;
            input_status = 2;
            break;
          }
        } else if ((result != 1) && analyze_mode) {
          abort_search = 1;
          input_status = 2;
          break;
        }
/*
 ************************************************************
 *                                                          *
 *   Now, check to see if the operator typed a move.  If    *
 *   so, and it matched the predicted move, switch from     *
 *   pondering to thinking to start the timer.  If this     *
 *   is a move, but not the predicted move, abort the       *
 *   search, and start over with the right move.            *
 *                                                          *
 ************************************************************
 */
        else if (!result) {
          if (pondering) {
            nargs = ReadParse(buffer, args, " 	;");
            temp = InputMove(tree, args[0], 0, Flip(root_wtm), 1, 1);
            if (temp) {
              if ((From(temp) == From(ponder_move)) &&
                  (To(temp) == To(ponder_move)) &&
                  (Piece(temp) == Piece(ponder_move)) &&
                  (Captured(temp) == Captured(ponder_move)) &&
                  (Promote(temp) == Promote(ponder_move))) {
                predicted++;
                input_status = 1;
                pondering = 0;
                thinking = 1;
                opponent_end_time = ReadClock();
                program_start_time = ReadClock();
                Print(128, "predicted move made.\n");
              } else {
                input_status = 2;
                abort_search = 1;
                break;
              }
            } else if (!strcmp(args[0], "go") || !strcmp(args[0], "move") ||
                !strcmp(args[0], "SP")) {
              abort_search = 1;
              break;
            } else
              Print(4095, "Illegal move: %s\n", args[0]);
          } else
            Print(4095, "unrecognized/illegal command: %s\n", args[0]);
        }
      }
    } while (1);
  if (log_file)
    fflush(log_file);
}
Exemple #3
0
void ActBalance::Zone_Report (void)
{
	int i, zone, num_zone, num_group;
	double factor;

	Factor_Group *group;

	double average [MAX_PURPOSE], maximum [MAX_PURPOSE], minimum [MAX_PURPOSE];

	Show_Message ("Zone Factor Summary");

	num_zone = 0;
	num_group = factor_group.Num_Records ();

	for (i=1; i <= num_group; i++) {
		average [i] = 0.0;
		maximum [i] = 0.0;
		minimum [i] = 10000000.0;
	}

	//---- print the report ----

	Header_Number (ZONE_SUM);

	if (!Break_Check (max_zone + 7)) {
		Print (1);
		Zone_Header ();
	}		
	for (zone = 1; zone <= max_zone; zone++) {
		Print (1, "%5d ", zone);
		num_zone++;

		for (i=1; i <= num_group; i++) {
			group = (Factor_Group *) factor_group [i];

			if (group->current [zone] > 0.0 && group->target [0] > 0.0) {
				factor = (group->target [zone] * group->current [0]) / (group->current [zone] * group->target [0]);
			} else {
				factor = 1.0;
			}
			Print (0, "  %10.5lf", factor);

			average [i] += factor;
			if (factor > maximum [i]) maximum [i] = factor;
			if (factor < minimum [i]) minimum [i] = factor;
		}
	}
	if (num_zone > 0) {
		Break_Check (4);

		Print (2, "Average");
		for (i=1; i <= num_group; i++) {
			Print (0, " %10.5lf ", average [i] / num_zone);
		}
		Print (1, "Maximum");
		for (i=1; i <= num_group; i++) {
			Print (0, " %10.5lf ", maximum [i]);
		}
		Print (1, "Minimum");
		for (i=1; i <= num_group; i++) {
			Print (0, " %10.5lf ", minimum [i]);
		}
	}
	Header_Number (0);
}
Exemple #4
0
static void PVExit (CPURegs* Regs)
{
    Print (stderr, 1, "PVExit ($%02X)\n", Regs->AC);

    exit (Regs->AC);
}
	XMLError XMLDocument::SaveFile(FILE* fp, bool compact)
	{
		XMLPrinter stream(fp, compact);
		Print(&stream);
		return _errorID;
	}
Exemple #6
0
static void ShowDistribution(char *args)
{
    Print(0, distribution);
    Print(0, warranty);
}
void main(){
	char *str;
	str=Input();
	//printf("%c",str);//加了这句就报错! 
	Print(str);
}
Exemple #8
0
EFI_STATUS fsw_efi_dnode_getinfo(IN FSW_FILE_DATA *File,
                                 IN EFI_GUID *InformationType,
                                 IN OUT UINTN *BufferSize,
                                 OUT VOID *Buffer)
{
    EFI_STATUS          Status;
    FSW_VOLUME_DATA     *Volume = (FSW_VOLUME_DATA *)File->shand.dnode->vol->host_data;
    EFI_FILE_SYSTEM_INFO *FSInfo;
    UINTN               RequiredSize;
    struct fsw_volume_stat vsb;

    if (CompareGuid(InformationType, &GUID_NAME(FileInfo))) {
#if DEBUG_LEVEL
        Print(L"fsw_efi_dnode_getinfo: FILE_INFO\n");
#endif

        Status = fsw_efi_dnode_fill_FileInfo(Volume, File->shand.dnode, BufferSize, Buffer);

    } else if (CompareGuid(InformationType, &GUID_NAME(FileSystemInfo)) == 0) {
#if DEBUG_LEVEL
        Print(L"fsw_efi_dnode_getinfo: FILE_SYSTEM_INFO\n");
#endif

        // check buffer size
        RequiredSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + fsw_efi_strsize(&Volume->vol->label);
        if (*BufferSize < RequiredSize) {
            *BufferSize = RequiredSize;
            return EFI_BUFFER_TOO_SMALL;
        }

        // fill structure
        FSInfo = (EFI_FILE_SYSTEM_INFO *)Buffer;
        FSInfo->Size        = RequiredSize;
        FSInfo->ReadOnly    = TRUE;
        FSInfo->BlockSize   = Volume->vol->log_blocksize;
        fsw_efi_strcpy(FSInfo->VolumeLabel, &Volume->vol->label);

        // get the missing info from the fs driver
        ZeroMem(&vsb, sizeof(struct fsw_volume_stat));
        Status = fsw_efi_map_status(fsw_volume_stat(Volume->vol, &vsb), Volume);
        if (EFI_ERROR(Status))
            return Status;
        FSInfo->VolumeSize  = vsb.total_bytes;
        FSInfo->FreeSpace   = vsb.free_bytes;

        // prepare for return
        *BufferSize = RequiredSize;
        Status = EFI_SUCCESS;

    } else if (CompareGuid(InformationType, &GUID_NAME(FileSystemVolumeLabelInfoId))) {
#if DEBUG_LEVEL
        Print(L"fsw_efi_dnode_getinfo: FILE_SYSTEM_VOLUME_LABEL\n");
#endif

        // check buffer size
        RequiredSize = SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO + fsw_efi_strsize(&Volume->vol->label);
        if (*BufferSize < RequiredSize) {
            *BufferSize = RequiredSize;
            return EFI_BUFFER_TOO_SMALL;
        }

        // copy volume label
        fsw_efi_strcpy(((EFI_FILE_SYSTEM_VOLUME_LABEL_INFO *)Buffer)->VolumeLabel, &Volume->vol->label);

        // prepare for return
        *BufferSize = RequiredSize;
        Status = EFI_SUCCESS;

    } else {
        Status = EFI_UNSUPPORTED;
    }

    return Status;
}
Exemple #9
0
int main(int argc, char *argv[]){
    HREinitBegin(argv[0]);
    HREaddOptions(options,"Tool for signature minimization\n\nOptions");
    char *files[2];
    lts_lib_setup();
    HREinitStart(&argc,&argv,1,2,files,"<input> [<output>]");
    if (task==Undefined){
        Abort("Please select the reduction to apply.");
    }
    lts_t lts=lts_create();
    Debug("reading %s",files[0]);
    lts_read(files[0],lts);
    Print(infoShort,"input has %u states and %u transitions",
                          lts->states,lts->transitions);
    switch(task){
        case Strong:{
            lowmem_strong_reduce(lts);
            break;
        }
        case Branching:{
            bitset_t divergence=NULL;
            if (divergence_sensitive){
                divergence=bitset_create(256,256);
                lts_find_divergent(lts,tau_step,NULL,divergence);
            }
            lowmem_branching_reduce(lts,divergence);
            break;
        }
        case Weak:{
            setbased_weak_reduce(lts);
            break;
        }
        case Lumping:{
            lowmem_lumping_reduce(lts);
            break;
        }
        case Copy:{
            break;
        }
        case Silent:{
            silent_compression(lts);
            break;
        }
        case Determinize:{
            lts_mkdet(lts);
            break;
        }
        case Cycle:{
            lts_cycle_elim(lts);
            break;
        }
        case Merge:{
            lts_merge_hyperedges(lts);
            break;
        }
        default: Abort("missing case");
    }    
    Print(infoShort,"reduced LTS has %u states and %u transitions",
                          lts->states,lts->transitions);
    if (files[1]){
        Debug("writing %s",files[1]);
        lts_write(files[1],lts,NULL,segments);
        Debug("output written");
    } else {
        Debug("no output");
    }
    HREexit(LTSMIN_EXIT_SUCCESS);
}
Exemple #10
0
void StringHash::Print()
{
    Print(stdout);
}
Exemple #11
0
static int Integrate(creal epsrel, creal epsabs,
  cint flags, cnumber mineval, cnumber maxeval,
  int key1, int key2, int key3, ccount maxpass, 
  creal maxchisq, creal mindeviation,
  real *integral, real *error, real *prob)
{
  TYPEDEFREGION;

  Region anchor, *region;
  Totals totals[NCOMP];
  real nneed, weight;
  count dim, comp, iter, nregions, pass = 0, err;
  number nwant, nmin = INT_MAX;
  int fail = -1;

  if( VERBOSE > 1 ) {
    char s[512];
    sprintf(s, "Divonne input parameters:\n"
      "  ndim " COUNT "\n  ncomp " COUNT "\n"
      "  epsrel " REAL "\n  epsabs " REAL "\n"
      "  flags %d\n  mineval " NUMBER "\n  maxeval " NUMBER "\n"
      "  key1 %d\n  key2 %d\n  key3 %d\n  maxpass " COUNT "\n"
      "  border " REAL "\n  maxchisq " REAL "\n  mindeviation " REAL "\n"
      "  ngiven " NUMBER "\n  nextra " NUMBER "\n",
      ndim_, ncomp_,
      epsrel, epsabs,
      flags, mineval, maxeval,
      key1, key2, key3, maxpass,
      border_.lower, maxchisq, mindeviation,
      ngiven_, nextra_);
    Print(s);
  }

  anchor.next = NULL;
  for( dim = 0; dim < ndim_; ++dim ) {
    Bounds *b = &anchor.bounds[dim];
    b->lower = 0;
    b->upper = 1;
  }

  RuleIni(&rule7_);
  RuleIni(&rule9_);
  RuleIni(&rule11_);
  RuleIni(&rule13_);
  SamplesIni(&samples_[0]);
  SamplesIni(&samples_[1]);
  SamplesIni(&samples_[2]);

#ifdef MLVERSION
  if( setjmp(abort_) ) goto abort;
#endif

  /* Step 1: partition the integration region */

  if( VERBOSE ) Print("Partitioning phase:");

  if( IsSobol(key1) || IsSobol(key2) || IsSobol(key3) )
    IniRandom(2*maxeval, flags);

  SamplesLookup(&samples_[0], key1,
    (number)47, (number)INT_MAX, (number)0);
  SamplesAlloc(&samples_[0]);

  totals_ = totals;
  Zap(totals);
  phase_ = 1;

  Explore(&anchor, &samples_[0], INIDEPTH, 1);

  for( iter = 1; ; ++iter ) {
    Totals *maxtot;

    for( comp = 0; comp < ncomp_; ++comp ) {
      Totals *tot = &totals[comp];
      tot->avg = tot->spreadsq = 0;
      tot->spread = tot->secondspread = -INFTY;
    }

    nregions = 0;
    for( region = anchor.next; region; region = region->next ) {
      ++nregions;
      for( comp = 0; comp < ncomp_; ++comp ) {
        cResult *r = &region->result[comp];
        Totals *tot = &totals[comp];
        tot->avg += r->avg;
        tot->spreadsq += Sq(r->spread);
        if( r->spread > tot->spread ) {
          tot->secondspread = tot->spread;
          tot->spread = r->spread;
          tot->region = region;
        }
        else if( r->spread > tot->secondspread )
          tot->secondspread = r->spread;
      }
    }

    maxtot = totals;
    for( comp = 0; comp < ncomp_; ++comp ) {
      Totals *tot = &totals[comp];
      integral[comp] = tot->avg;
      if( tot->spreadsq > maxtot->spreadsq ) maxtot = tot;
      tot->spread = sqrt(tot->spreadsq);
      error[comp] = tot->spread*samples_[0].weight;
    }

    if( VERBOSE ) {
      char s[128 + 64*NCOMP], *p = s;

      p += sprintf(p, "\n"
        "Iteration " COUNT " (pass " COUNT "):  " COUNT " regions\n"
        NUMBER7 " integrand evaluations so far,\n"
        NUMBER7 " in optimizing regions,\n"
        NUMBER7 " in finding cuts",
        iter, pass, nregions, neval_, neval_opt_, neval_cut_);

      for( comp = 0; comp < ncomp_; ++comp )
        p += sprintf(p, "\n[" COUNT "] "
          REAL " +- " REAL,
          comp + 1, integral[comp], error[comp]);

      Print(s);
    }

    if( neval_ > maxeval ) break;

    nneed = maxtot->spread/MaxErr(maxtot->avg);
    if( nneed < MAXPRIME ) {
      cnumber n = neval_ + nregions*(number)ceil(nneed);
      if( n < nmin ) {
        nmin = n;
        pass = 0;
      }
      else if( ++pass > maxpass && n >= mineval ) break;
    }

    Split(maxtot->region, DEPTH);
  }

  /* Step 2: do a "full" integration on each region */

/* nneed = samples_[0].neff + 1; */
  nneed = 2*samples_[0].neff;
  for( comp = 0; comp < ncomp_; ++comp ) {
    Totals *tot = &totals[comp];
    creal maxerr = MaxErr(tot->avg);
    tot->nneed = tot->spread/maxerr;
    nneed = Max(nneed, tot->nneed);
    tot->maxerrsq = Sq(maxerr);
    tot->mindevsq = tot->maxerrsq*Sq(mindeviation);
  }
  nwant = (number)Min(ceil(nneed), MARKMASK/40.);

  err = SamplesLookup(&samples_[1], key2, nwant,
    (maxeval - neval_)/nregions + 1, samples_[0].n + 1);

  /* the number of points needed to reach the desired accuracy */
  fail = Unmark(err)*nregions;

  if( Marked(err) ) {
    if( VERBOSE ) Print("\nNot enough samples left for main integration.");
    for( comp = 0; comp < ncomp_; ++comp )
      prob[comp] = -999;
    weight = samples_[0].weight;
    nregions_ = nregions;
  }
  else {
    bool can_adjust = (key3 == 1 && samples_[1].sampler != SampleRule &&
      (key2 < 0 || samples_[1].neff < MAXPRIME));
    count df, nlimit;

    SamplesAlloc(&samples_[1]);

    if( VERBOSE ) {
      char s[128];
      sprintf(s, "\nMain integration on " COUNT
        " regions with " NUMBER " samples per region.",
        nregions, samples_[1].neff);
      Print(s);
    }

    ResClear(integral);
    ResClear(error);
    ResClear(prob);

    nlimit = maxeval - nregions*samples_[1].n;
    df = nregions_ = 0;

    for( region = anchor.next; region; region = region->next ) {
      char s[64*NDIM + 256*NCOMP], *p = s;
      int todo;

refine:
      phase_ = 2;
      samples_[1].sampler(&samples_[1], region->bounds, region->vol);

      if( can_adjust ) {
        --nregions;
        for( comp = 0; comp < ncomp_; ++comp )
          totals[comp].spreadsq -= Sq(region->result[comp].spread);
      }

      nlimit += samples_[1].n;
      todo = 0;

      for( comp = 0; comp < ncomp_; ++comp ) {
        cResult *r = &region->result[comp];
        Totals *tot = &totals[comp];

        samples_[0].avg[comp] = r->avg;
        samples_[0].err[comp] = r->err;

        if( neval_ < nlimit ) {
          creal avg2 = samples_[1].avg[comp];
          creal err2 = samples_[1].err[comp];
          creal diffsq = Sq(avg2 - r->avg);

#define Var(s) Sq((s.err[comp] == 0) ? r->spread*s.weight : s.err[comp])

          if( err2*tot->nneed > r->spread ||
              diffsq > Max(maxchisq*(Var(samples_[0]) + Var(samples_[1])),
                           EPS*Sq(avg2)) ) {
            if( key3 && diffsq > tot->mindevsq ) {
              if( key3 == 1 ) {
                const Region *next = region->next;

                if( VERBOSE > 2 ) Print("\nSplit");

                phase_ = 1;
                Explore(region, &samples_[1], POSTDEPTH, 2);

                if( can_adjust ) {
                  number nnew;
                  Region *child;

                  for( child = region; child != next; child = child->next ) {
                    count c;
                    for( c = 0; c < ncomp_; ++c )
                      totals[c].spreadsq += Sq(child->result[c].spread);
                    ++nregions;
                  }

                  nnew = (tot->spreadsq/Sq(MARKMASK) > tot->maxerrsq) ?
                    MARKMASK :
                    (number)ceil(sqrt(tot->spreadsq/tot->maxerrsq));
                  if( nnew > nwant + nwant/64 ) {
                    ccount err = SamplesLookup(&samples_[1], key2, nnew,
                      (maxeval - neval_)/nregions + 1, samples_[1].n);
                    fail += Unmark(err)*nregions;
                    nwant = nnew;
                    SamplesFree(&samples_[1]);
                    SamplesAlloc(&samples_[1]);

                    if( key2 > 0 && samples_[1].neff >= MAXPRIME )
                      can_adjust = false;

                    if( VERBOSE > 2 ) {
                      char s[128];
                      sprintf(s, "Sampling remaining " COUNT
                        " regions with " NUMBER " points per region.",
                        nregions, samples_[1].neff);
                      Print(s);
                    }
                  }
                }

                goto refine;
              }
              todo |= 3;
            }
            todo |= 1;
          }
        }
      }

      if( can_adjust ) {
        for( comp = 0; comp < ncomp_; ++comp )
          totals[comp].maxerrsq -=
            Sq(region->result[comp].spread*samples_[1].weight);
      }

      switch( todo ) {
      case 1:	/* get spread right */
        Explore(region, &samples_[1], 0, 2);
        break;

      case 3:	/* sample region again with more points */
        if( MEM(&samples_[2]) == NULL ) {
          SamplesLookup(&samples_[2], key3,
            nwant, (number)INT_MAX, (number)0);
          SamplesAlloc(&samples_[2]);
        }
        phase_ = 3;
        samples_[2].sampler(&samples_[2], region->bounds, region->vol);
        Explore(region, &samples_[2], 0, 2);
        ++region->depth;	/* misused for df here */
        ++df;
      }

      ++region->depth;	/* misused for df here */
      ++nregions_;

      if( VERBOSE > 2 ) {
        for( dim = 0; dim < ndim_; ++dim ) {
          cBounds *b = &region->bounds[dim];
          p += sprintf(p,
            (dim == 0) ? "\nRegion (" REALF ") - (" REALF ")" :
                         "\n       (" REALF ") - (" REALF ")",
            b->lower, b->upper);
        }
      }

      for( comp = 0; comp < ncomp_; ++comp ) {
        Result *r = &region->result[comp];

        creal x1 = samples_[0].avg[comp];
        creal s1 = Var(samples_[0]);
        creal x2 = samples_[1].avg[comp];
        creal s2 = Var(samples_[1]);
        creal r2 = (s1 == 0) ? Sq(samples_[1].neff*samples_[0].weight) : s2/s1;

        real norm = 1 + r2;
        real avg = x2 + r2*x1;
        real sigsq = s2;
        real chisq = Sq(x2 - x1);
        real chiden = s1 + s2;

        if( todo == 3 ) {
          creal x3 = samples_[2].avg[comp];
          creal s3 = Var(samples_[2]);
          creal r3 = (s2 == 0) ? Sq(samples_[2].neff*samples_[1].weight) : s3/s2;

          norm = 1 + r3*norm;
          avg = x3 + r3*avg;
          sigsq = s3;
          chisq = s1*Sq(x3 - x2) + s2*Sq(x3 - x1) + s3*chisq;
          chiden = s1*s2 + s3*chiden;
        }

        avg = LAST ? r->avg : (sigsq *= norm = 1/norm, avg*norm);
        if( chisq > EPS ) chisq /= Max(chiden, NOTZERO);

#define Out(s) s.avg[comp], r->spread*s.weight, s.err[comp]

        if( VERBOSE > 2 ) {
          p += sprintf(p, "\n[" COUNT "] "
            REAL " +- " REAL "(" REAL ")\n    "
            REAL " +- " REAL "(" REAL ")",
            comp + 1, Out(samples_[0]), Out(samples_[1]));
          if( todo == 3 ) p += sprintf(p, "\n    "
            REAL " +- " REAL "(" REAL ")",
            Out(samples_[2]));
          p += sprintf(p, "  \tchisq " REAL, chisq);
        }

        integral[comp] += avg;
        error[comp] += sigsq;
        prob[comp] += chisq;

        r->avg = avg;
        r->spread = sqrt(sigsq);
        r->chisq = chisq;
      }

      if( VERBOSE > 2 ) Print(s);
    }

    for( comp = 0; comp < ncomp_; ++comp )
      error[comp] = sqrt(error[comp]);

    df += nregions_;

    if( VERBOSE > 2 ) {
      char s[16 + 128*NCOMP], *p = s;

      p += sprintf(p, "\nTotals:");

      for( comp = 0; comp < ncomp_; ++comp )
        p += sprintf(p, "\n[" COUNT "] "
          REAL " +- " REAL "  \tchisq " REAL " (" COUNT " df)",
          comp + 1, integral[comp], error[comp], prob[comp], df);

      Print(s);
    }

    for( comp = 0; comp < ncomp_; ++comp )
      prob[comp] = ChiSquare(prob[comp], df);

    weight = 1;
  }

#ifdef MLVERSION
  if( REGIONS ) {
    MLPutFunction(stdlink, "List", 2);
    MLPutFunction(stdlink, "List", nregions_);
    for( region = anchor.next; region; region = region->next ) {
      cBounds *b = region->bounds;
      real lower[NDIM], upper[NDIM];

      for( dim = 0; dim < ndim_; ++dim ) {
        lower[dim] = b[dim].lower;
        upper[dim] = b[dim].upper;
      }

      MLPutFunction(stdlink, "Cuba`Divonne`region", 4);

      MLPutRealList(stdlink, lower, ndim_);
      MLPutRealList(stdlink, upper, ndim_);

      MLPutFunction(stdlink, "List", ncomp_);
      for( comp = 0; comp < ncomp_; ++comp ) {
        cResult *r = &region->result[comp];
        real res[] = {r->avg, r->spread*weight, r->chisq};
        MLPutRealList(stdlink, res, Elements(res));
      }

      MLPutInteger(stdlink, region->depth);  /* misused for df */
    }
  }
#endif

#ifdef MLVERSION
abort:
#endif

  SamplesFree(&samples_[2]);
  SamplesFree(&samples_[1]);
  SamplesFree(&samples_[0]);
  RuleFree(&rule13_);
  RuleFree(&rule11_);
  RuleFree(&rule9_);
  RuleFree(&rule7_);

  for( region = anchor.next; region; ) {
    Region *next = region->next;
    free(region);
    region = next;
  }

  return fail;
}
Exemple #12
0
static void Sample(This *t, Region *region)
{
  csize_t setsize = SetSize;
  creal vol = ldexp(1., -region->div);

  real *x = t->frame, *f = x + t->rule.n*t->ndim;
  Set *first = t->rule.first, *last = t->rule.last, *s;
  Bounds *b, *B = region->bounds + t->ndim;
  Result *result = RegionResult(region), *res, *Res = result + t->ncomp;
  creal *errcoeff = t->rule.errcoeff;
  creal ratio = Sq(IndexSet(first,2)->gen[0]/
                   IndexSet(first,1)->gen[0]);

  ccount offset = 2*t->ndim*t->ncomp;
  count dim, rul, n, maxdim = 0;
  real maxrange = 0;

  for( b = region->bounds, dim = 0; b < B; ++b, ++dim ) {
    creal range = b->upper - b->lower;
    if( range > maxrange ) {
      maxrange = range;
      maxdim = dim;
    }
  }

  for( s = first; s <= last; NextSet(s) )
    if( s->n ) x = ExpandFS(t, region->bounds, s->gen, x);

  DoSample(t, t->rule.n, t->frame, f);

  for( res = result; res < Res; ++res ) {
    real sum[nrules];
    creal *f1 = f;
    creal base = *f1*2*(1 - ratio);
    real maxdiff = 0;
    count bisectdim = maxdim;

    for( dim = 0; dim < t->ndim; ++dim ) {
      creal *fp = f1 + t->ncomp;
      creal *fm = fp + t->ncomp;
      creal fourthdiff = fabs(base +
        ratio*(fp[0] + fm[0]) - (fp[offset] + fm[offset]));
      f1 = fm;
      if( fourthdiff > maxdiff ) {
        maxdiff = fourthdiff;
        bisectdim = dim;
      }
    }
    res->bisectdim = bisectdim;

    f1 = f++;
    Zap(sum);
    for( s = first; s <= last; NextSet(s) )
      for( n = s->n; n; --n ) {
        creal fun = *f1;
        f1 += t->ncomp;
        for( rul = 0; rul < nrules; ++rul )
          sum[rul] += fun*s->weight[rul];
      }

    /* Search for the null rule, in the linear space spanned by two
       successive null rules in our sequence, which gives the greatest
       error estimate among all normalized (1-norm) null rules in this
       space. */

    for( rul = 1; rul < nrules - 1; ++rul ) {
      real maxerr = 0;
      for( s = first; s <= last; NextSet(s) )
        maxerr = Max(maxerr,
          fabs(sum[rul + 1] + s->scale[rul]*sum[rul])*s->norm[rul]);
      sum[rul] = maxerr;
    }

    res->avg = vol*sum[0];
    res->err = vol*(
      (errcoeff[0]*sum[1] <= sum[2] && errcoeff[0]*sum[2] <= sum[3]) ?
        errcoeff[1]*sum[1] :
        errcoeff[2]*Max(Max(sum[1], sum[2]), sum[3]) );
  }

  if( VERBOSE > 2 ) {
    Vector(char, out, 64*NDIM + 128*NCOMP);
    char *oe = out;
    count comp;
    cchar *msg = "\nRegion (" REALF ") - (" REALF ")";

    for( b = region->bounds; b < B; ++b ) {
      oe += sprintf(oe, msg, b->lower, b->upper);
      msg = "\n       (" REALF ") - (" REALF ")";
    }

    for( res = result, comp = 0; res < Res; ++res )
      oe += sprintf(oe, "\n[" COUNT "] "
        REAL " +- " REAL, ++comp, res->avg, res->err);

    Print(out);
  }
int main( int argc, char* argv[] ) {
	
	Stream*				stream = NULL;
	Dictionary*			dictionary;
	Dictionary_Entry_Value*		tmpVal0;
	Dictionary_Entry_Value*		tmpVal1; 
	
	MPI_Init( &argc, &argv );
	BaseFoundation_Init( &argc, &argv );
	BaseIO_Init( &argc, &argv );
	stream = Journal_Register (Info_Type, "myStream");

	dictionary = Dictionary_New();

	tmpVal0 = Dictionary_Entry_Value_NewStruct();
	tmpVal1 = Dictionary_Entry_Value_NewStruct();
	Dictionary_Entry_Value_AddMember( tmpVal1, "name", Dictionary_Entry_Value_FromString( "bill" ) );
	Dictionary_Entry_Value_AddMember( tmpVal1, "value", Dictionary_Entry_Value_FromDouble( 1.0f ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "inside", tmpVal1 );
	tmpVal1 = Dictionary_Entry_Value_NewList();
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "bottom" ) );
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "top" ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "list_one", tmpVal1 );
	Dictionary_Add( dictionary, "one", tmpVal0 );
	
	tmpVal0 = Dictionary_Entry_Value_NewStruct();
	tmpVal1 = Dictionary_Entry_Value_NewStruct();
	Dictionary_Entry_Value_AddMember( tmpVal1, "new_name", Dictionary_Entry_Value_FromString( "frank" ) );
	Dictionary_Entry_Value_AddMember( tmpVal1, "value", Dictionary_Entry_Value_FromDouble( 2.0f ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "inside", tmpVal1 );
	tmpVal1 = Dictionary_Entry_Value_NewList();
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "left" ) );
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "right" ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "list_one", tmpVal1 );
	Dictionary_AddMerge( dictionary, "one", tmpVal0, Dictionary_MergeType_Append );
	
	Print( dictionary, stream );
	Stg_Class_Delete( dictionary );
	
	dictionary = Dictionary_New();
	
	tmpVal0 = Dictionary_Entry_Value_NewStruct();
	tmpVal1 = Dictionary_Entry_Value_NewStruct();
	Dictionary_Entry_Value_AddMember( tmpVal1, "name", Dictionary_Entry_Value_FromString( "bill" ) );
	Dictionary_Entry_Value_AddMember( tmpVal1, "value", Dictionary_Entry_Value_FromDouble( 1.0f ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "inside", tmpVal1 );
	tmpVal1 = Dictionary_Entry_Value_NewList();
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "bottom" ) );
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "top" ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "list_one", tmpVal1 );
	Dictionary_Add( dictionary, "one", tmpVal0 );
	
	tmpVal0 = Dictionary_Entry_Value_NewStruct();
	tmpVal1 = Dictionary_Entry_Value_NewStruct();
	Dictionary_Entry_Value_AddMember( tmpVal1, "new_name", Dictionary_Entry_Value_FromString( "frank" ) );
	Dictionary_Entry_Value_AddMember( tmpVal1, "value", Dictionary_Entry_Value_FromDouble( 2.0f ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "inside", tmpVal1 );
	tmpVal1 = Dictionary_Entry_Value_NewList();
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "left" ) );
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "right" ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "list_one", tmpVal1 );
	Dictionary_AddMerge( dictionary, "one", tmpVal0, Dictionary_MergeType_Merge );
	
	Print( dictionary, stream );
	Stg_Class_Delete( dictionary );
	
	dictionary = Dictionary_New();
	
	tmpVal0 = Dictionary_Entry_Value_NewStruct();
	tmpVal1 = Dictionary_Entry_Value_NewStruct();
	Dictionary_Entry_Value_AddMember( tmpVal1, "name", Dictionary_Entry_Value_FromString( "bill" ) );
	Dictionary_Entry_Value_AddMember( tmpVal1, "value", Dictionary_Entry_Value_FromDouble( 1.0f ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "inside", tmpVal1 );
	tmpVal1 = Dictionary_Entry_Value_NewList();
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "bottom" ) );
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "top" ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "list_one", tmpVal1 );
	Dictionary_Add( dictionary, "one", tmpVal0 );
	
	tmpVal0 = Dictionary_Entry_Value_NewStruct();
	tmpVal1 = Dictionary_Entry_Value_NewStruct();
	Dictionary_Entry_Value_AddMember( tmpVal1, "new_name", Dictionary_Entry_Value_FromString( "frank" ) );
	Dictionary_Entry_Value_AddMember( tmpVal1, "value", Dictionary_Entry_Value_FromDouble( 2.0f ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "inside", tmpVal1 );
	tmpVal1 = Dictionary_Entry_Value_NewList();
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "left" ) );
	Dictionary_Entry_Value_AddElement( tmpVal1, Dictionary_Entry_Value_FromString( "right" ) );
	Dictionary_Entry_Value_AddMember( tmpVal0, "list_one", tmpVal1 );
	Dictionary_AddMerge( dictionary, "one", tmpVal0, Dictionary_MergeType_Replace );
	
	Print( dictionary, stream );
	Stg_Class_Delete( dictionary );
	
	BaseIO_Finalise();
	BaseFoundation_Finalise();
	MPI_Finalize();
	
	return EXIT_SUCCESS;
}
Exemple #14
0
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
        EFI_LOADED_IMAGE *loaded_image;
        CHAR8 *b;
        UINTN size;
        BOOLEAN secure = FALSE;
        CHAR8 *sections[] = {
                (UINT8 *)".cmdline",
                (UINT8 *)".linux",
                (UINT8 *)".initrd",
                (UINT8 *)".splash",
                NULL
        };
        UINTN addrs[ELEMENTSOF(sections)-1] = {};
        UINTN offs[ELEMENTSOF(sections)-1] = {};
        UINTN szs[ELEMENTSOF(sections)-1] = {};
        CHAR8 *cmdline = NULL;
        UINTN cmdline_len;
        CHAR16 uuid[37];
        EFI_STATUS err;

        InitializeLib(image, sys_table);

        err = uefi_call_wrapper(BS->OpenProtocol, 6, image, &LoadedImageProtocol, (VOID **)&loaded_image,
                                image, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
        if (EFI_ERROR(err)) {
                Print(L"Error getting a LoadedImageProtocol handle: %r ", err);
                uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);
                return err;
        }

        if (efivar_get_raw(&global_guid, L"SecureBoot", &b, &size) == EFI_SUCCESS) {
                if (*b > 0)
                        secure = TRUE;
                FreePool(b);
        }
        err = pe_memory_locate_sections(loaded_image->ImageBase, sections, addrs, offs, szs);
        if (EFI_ERROR(err)) {
                Print(L"Unable to locate embedded .linux section: %r ", err);
                uefi_call_wrapper(BS->Stall, 1, 3 * 1000 * 1000);
                return err;
        }

        if (szs[0] > 0)
                cmdline = (CHAR8 *)(loaded_image->ImageBase + addrs[0]);

        cmdline_len = szs[0];

        /* if we are not in secure boot mode, accept a custom command line and replace the built-in one */
        if (!secure && loaded_image->LoadOptionsSize > 0 && *(CHAR16 *)loaded_image->LoadOptions != 0) {
                CHAR16 *options;
                CHAR8 *line;
                UINTN i;

                options = (CHAR16 *)loaded_image->LoadOptions;
                cmdline_len = (loaded_image->LoadOptionsSize / sizeof(CHAR16)) * sizeof(CHAR8);
                line = AllocatePool(cmdline_len);
                for (i = 0; i < cmdline_len; i++)
                        line[i] = options[i];
                cmdline = line;

#if ENABLE_TPM
                /* Try to log any options to the TPM, especially manually edited options */
                err = tpm_log_event(SD_TPM_PCR,
                                    (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions,
                                    loaded_image->LoadOptionsSize, loaded_image->LoadOptions);
                if (EFI_ERROR(err)) {
                        Print(L"Unable to add image options measurement: %r", err);
                        uefi_call_wrapper(BS->Stall, 1, 200 * 1000);
                }
#endif
        }

        /* export the device path this image is started from */
        if (disk_get_part_uuid(loaded_image->DeviceHandle, uuid) == EFI_SUCCESS)
                efivar_set(L"LoaderDevicePartUUID", uuid, FALSE);

        /* if LoaderImageIdentifier is not set, assume the image with this stub was loaded directly from UEFI */
        if (efivar_get_raw(&global_guid, L"LoaderImageIdentifier", &b, &size) != EFI_SUCCESS) {
                CHAR16 *loaded_image_path = DevicePathToStr(loaded_image->FilePath);
                efivar_set(L"LoaderImageIdentifier", loaded_image_path, FALSE);
                FreePool(loaded_image_path);
        }

        /* if LoaderFirmwareInfo is not set, let's set it */
        if (efivar_get_raw(&global_guid, L"LoaderFirmwareInfo", &b, &size) != EFI_SUCCESS) {
                CHAR16 *loader_firmware_info = PoolPrint(L"%s %d.%02d", ST->FirmwareVendor, ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
                efivar_set(L"LoaderFirmwareInfo", loader_firmware_info, FALSE);
                FreePool(loader_firmware_info);
        }
Exemple #15
0
static void SetTime(char *arg)
{
    int ttmoves, ttime, tminutes, tseconds, inc = 0;
    char *x, *colon;
    char *args[3];

    args[0] = strtok(arg, " \t");
    args[1] = strtok(NULL, " \t");
    args[2] = strtok(NULL, " \t");

    if(XBoardMode) {
        sscanf(args[0], "%d", &ttmoves);
        colon = strchr(args[1], ':');           /* check for time in xx:yy format */
        if(colon) {
            sscanf(args[1], "%d:%d", &tminutes, &tseconds);
            ttime = (tminutes * 60) + tseconds;
        } else {
            sscanf(args[1], "%d", &tminutes);
            ttime = tminutes * 60;
        }
        sscanf(args[2], "%d", &inc);

        TwoTimeControls = FALSE;
        TMoves = ttmoves;
        TTime  = ttime;
        Increment = inc;

        Moves[White] = Moves[Black] = TMoves;
        Time[White]  = Time[Black]  = TTime;
    }
    else {
        x = strtok(args[0], "/+ \t\n\r");
        if(x) {
            if(!strcmp(x, "sd")) ttmoves = 0;
            else if(!strcmp(x, "fixed")) ttmoves = -1;
            else sscanf(x, "%d", &ttmoves);
            x = strtok(NULL, "/ \t\n\r");
            if(x) {
                sscanf(x, "%d", &ttime);
                for(x++; *x; x++) {
                    if(*x == '+') {
                        sscanf(x+1, "%d", &inc);
                        break;
                    }
                }
                if(args[1] != NULL) {
                    x = strtok(args[1], " /\n\t\r");
                    TMoves2 = -1;
                    if(!strcmp(x, "sd")) TMoves2 = 0;
                    else sscanf(x, "%d", &TMoves2);
                    x = strtok(NULL, " /\n\t\r");
                    if(x) {
                        TTime2 = -1;
                        sscanf(x, "%d", &TTime2);
                        if(TMoves2 >= 0 && TTime2 > 0) 
                        TwoTimeControls = TRUE;
                    }
                }
                Print(0, "Timecontrol is ");
                if(ttmoves >= 0) {
                    if(ttmoves == 0) Print(0, "all ");
                    else             Print(0, "%d ", ttmoves);
                    if(inc) {
                        Print(0, "moves in %d mins + %d secs Increment\n", 
                              ttime, inc);
                    } else {
                        Print(0, "moves in %d mins\n", ttime);
                    }
                    TMoves = ttmoves;
                    TTime  = ttime*60;
                    Increment = inc;

                    Moves[White] = Moves[Black] = TMoves;
                    Time[White]  = Time[Black]  = TTime;
                }
                else {
                    Print(0, "%d seconds/move fixed time\n", ttime);
                    TMoves = -1;
                    TTime = ttime;
                }
                if(TwoTimeControls) {
                        Print(0, "Second Timecontrol is ");
                        if(TMoves2 == 0) Print(0, "all ");
                        else             Print(0, "%d ", TMoves2);
                        Print(0, "moves in %d mins\n", TTime2);
                        TTime2 *= 60;
                }
            }
        }
    }
}
Exemple #16
0
int FixUsersCommand::Execute() {
    std::cout << "Runnning FixUsersCommand::Execute" << std::endl;
    	File userFile(syscfg.datadir, USER_LST);
	if (!userFile.Exists()) {
		Print(NOK, true, "%s does not exist.", userFile.full_pathname().c_str());
		giveUp();
	}

	WUserManager userMgr;
	userMgr.InitializeUserManager(syscfg.datadir, sizeof(userrec), syscfg.maxusers);
	Print(OK, true, "Checking USER.LST... found %d user records.", userMgr.GetNumberOfUserRecords());

	Print(OK, true, "TBD: Check for trashed user recs.");
	if (userMgr.GetNumberOfUserRecords() > syscfg.maxusers) {
		Print(OK, true, "Might be too many.");
			maybeGiveUp();
	} else {
		Print(OK, true, "Reasonable number.");
	}

	std::vector<smalrec> smallrecords;
	std::set<std::string> names;

  const int num_user_records = userMgr.GetNumberOfUserRecords();
	for(int i = 1; i <= num_user_records; i++) {
		WUser user;
		userMgr.ReadUser(&user, i);
		user.FixUp();
		userMgr.WriteUser(&user, i);
		if (!user.IsUserDeleted() && !user.IsUserInactive()) {
			smalrec sr = { 0 };
			strcpy((char*) sr.name, user.GetName());
			sr.number = static_cast<unsigned short>(i);
			std::string namestring((char*) sr.name);
			if (names.find(namestring) == names.end()) {
				smallrecords.push_back(sr);
				names.insert(namestring);
        const std::string msg = StringPrintf("Keeping user: %s #%d", sr.name, sr.number);
        Print(OK, true, msg.c_str());
			}
			else {
				std::cout << "[skipping duplicate user: "******" #" << sr.number << "]";
			}
		}
	};

	std::sort(smallrecords.begin(), smallrecords.end(), [](const smalrec& a, const smalrec& b) -> bool {
		int equal = strcmp((char*)a.name, (char*)b.name);

		// Sort by user number if names match.
		if (equal == 0) {
			return a.number < b.number;
		}

		// Otherwise sort by name comparison.
		return equal < 0;
	});

	printf("size=%lu %lu\n", smallrecords.size(), sizeof(smalrec) * smallrecords.size());

	Print(OK, true, "Checking NAMES.LST");
	File nameFile(syscfg.datadir, NAMES_LST);
	if (!nameFile.Exists()) {
		Print(NOK, true, "%s does not exist, regenerating with %d names", nameFile.full_pathname().c_str(),
			smallrecords.size());
		nameFile.Close();
		nameFile.Open(File::modeCreateFile | File::modeBinary | File::modeWriteOnly);
		nameFile.Write(&smallrecords[0], sizeof(smalrec) * smallrecords.size());
		nameFile.Close();

	} else {
		if (nameFile.Open(File::modeReadOnly | File::modeBinary)) {
			unsigned long size = nameFile.GetLength();
			unsigned short recs = static_cast<unsigned short>(size / sizeof(smalrec));
			if (recs != status.users) {
				status.users = recs;
				Print(NOK, true, "STATUS.DAT contained an incorrect user count.");
			} else {
				Print(OK, true, "STATUS.DAT matches expected user count of %d users.", status.users);
			}
		}
		nameFile.Close();
	}
    return 0;
}
Exemple #17
0
static void ShowWarranty(char *args)
{
    Print(0, warranty);
}
VOS_UINT32 VOS_EventRead( VOS_UINT32 ulEvents,
                          VOS_UINT32 ulFlags,
                          VOS_UINT32 ulTimeOutInMillSec,
                          VOS_UINT32 *pulRetEvents )
{
    /* the functin should be full later */
    VOS_UINT32     ulTaskSelf;       /*Self task ID*/
    VOS_UINT32     ulTempQueue;
    VOS_SEM        ulTempSem;
    int            intLockLevel;
    VOS_UINT32     ulTempEvent;

    ulTaskSelf = VOS_GetCurrentTaskID();

    if ( 0xffffffff == ulTaskSelf )
    {
        return VOS_ERR;
    }

    if( VOS_EVENT_NOWAIT & ulFlags )
    {
        /*lint -e534*/
        LogPrint("# OSA don't support VOS_EVENT_NOWAIT.\r\n");
        /*lint +e534*/

        VOS_SuspendTask(ulTaskSelf);

        return VOS_ERR;
    }

    if( !(VOS_EVENT_ANY & ulFlags) )
    {
        /*lint -e534*/
        LogPrint("# OSA don't support VOS_EVENT_ALL.\r\n");
        /*lint +e534*/

        VOS_SuspendTask(ulTaskSelf);

        return VOS_ERR;
    }

    if( 0 == ulEvents )
    {
        /*lint -e534*/
        LogPrint("# OSA don't support event = 0.\r\n");
        /*lint +e534*/

        VOS_SuspendTask(ulTaskSelf);

        return VOS_ERR;
    }

    if ( VOS_OK != VOS_CheckEvent(ulTaskSelf) )
    {
        /*lint -e534*/
        LogPrint("# VOS_EventRead EVENT not exist.\r\n");
        /*lint +e534*/

        VOS_SuspendTask(ulTaskSelf);

        return VOS_ERR;
    }

    ulTempQueue = VOS_GetQueueIDFromFid(vos_TaskCtrlBlk[ulTaskSelf].ulFid);
    if ( 0xffffffff == ulTempQueue )
    {
        return VOS_ERR;
    }

    ulTempSem = VOS_GetSemIDFromQueue(ulTempQueue);
    if ( 0xffffffff == ulTempSem )
    {
        return VOS_ERR;
    }

    if( VOS_OK != VOS_SmP( ulTempSem, ulTimeOutInMillSec ) )
    {
        Print("# VOS_EventRead error.\r\n");
        return VOS_ERR;
    }

    intLockLevel = VOS_SplIMP();

    ulTempEvent = vos_TaskCtrlBlk[ulTaskSelf].ulEvents & ulEvents;

    if (  ulTempEvent )
    {
        vos_TaskCtrlBlk[ulTaskSelf].ulEvents &= ~ulTempEvent;
        *pulRetEvents  = ulTempEvent;
    }
    else
    {
        *pulRetEvents = VOS_MSG_SYNC_EVENT;
    }

    VOS_Splx( intLockLevel );

    return VOS_OK;
}
Exemple #19
0
void PerfPrep::Program_Control (void)
{
	String key;
	Strings list;
	Str_Itr str_itr;

	//---- open network files ----

	Data_Service::Program_Control ();
	
	Read_Select_Keys ();
	Read_Flow_Time_Keys ();

	Print (2, String ("%s Control Keys:") % Program ());

	new_file_flag = System_File_Flag (NEW_PERFORMANCE);

	//---- open the merge performance ----
	
	key = Get_Control_String (MERGE_PERFORMANCE_FILE);

	if (!key.empty ()) {
		merge_file.File_Type ("Merge Performance File");
		Print (1);

		if (Check_Control_Key (MERGE_PERFORMANCE_FORMAT)) {
			merge_file.Dbase_Format (Get_Control_String (MERGE_PERFORMANCE_FORMAT));
		}
		merge_file.Open (Project_Filename (key));
		merge_flag = true;

		if (!new_file_flag) {
			Error ("A New Performance File is required for Merge Processing");
		}
	}

	//---- open the base performance ----
	
	key = Get_Control_String (BASE_PERFORMANCE_FILE);

	if (!key.empty ()) {
		base_file.File_Type ("Base Performance File");
		Print (1);

		if (Check_Control_Key (BASE_PERFORMANCE_FORMAT)) {
			base_file.Dbase_Format (Get_Control_String (BASE_PERFORMANCE_FORMAT));
		}
		base_file.Open (Project_Filename (key));
		base_flag = true;

		if (!new_file_flag) {
			Error ("A New Performance File is required for Base Processing");
		}
	}

	//---- open the merge turn delay ----

	turn_flag = System_File_Flag (TURN_DELAY);

	if (turn_flag) {
		key = Get_Control_String (MERGE_TURN_DELAY_FILE);

		if (!key.empty ()) {
			turn_file.File_Type ("Merge Turn Delay File");
			Print (1);

			if (Check_Control_Key (MERGE_TURN_DELAY_FORMAT)) {
				turn_file.Dbase_Format (Get_Control_String (MERGE_TURN_DELAY_FORMAT));
			}
			turn_file.Open (Project_Filename (key));
			turn_merge_flag = true;

			if (!System_File_Flag (NEW_TURN_DELAY)) {
				Error ("A New Turn Delay File is required for Merge Processing");
			}
		}
	}

	//---- processing method ----

	Print (1);
	key = Get_Control_Text (PROCESSING_METHOD);

	if (!key.empty ()) {
		method = Combine_Code (key);

		if (method != UPDATE_TIMES) {
			if (merge_flag || turn_merge_flag) {
				if (method == WEIGHTED_LINK_AVG || method == REPLACE_AVERAGE) {

					//---- merge weighting factor ----

					factor = Get_Control_Double (MERGE_WEIGHTING_FACTOR);
				}
			} else {
				//Error (String ("Processing Method %s requires Merge Files") % key);
			}
		}
	}

	//---- read the smoothing parameters ----

	smooth_flag = smooth_data.Read_Control ();

	if (smooth_flag) {
		if (!smooth_data.Num_Input (time_periods.Num_Periods ())) {
			Error ("Smooth Parameters are Illogical");
		}
		if (!new_file_flag) {
			Error ("A New Performance File is required for Data Smoothing");
		}
	}

	//---- set min travel time ----

	min_time_flag = Get_Control_Flag (SET_MIN_TRAVEL_TIME);

	if (min_time_flag && !new_file_flag) {
		Error ("A New Performance File is required for Minimum Travel Times");
	}

	//---- set merge transit data ----

	key = Get_Control_Text (MERGE_TRANSIT_DATA);

	if (!key.empty ()) {
		transit_flag = true;

		if (!System_File_Flag (TRANSIT_STOP) || !System_File_Flag (TRANSIT_ROUTE) ||
			!System_File_Flag (TRANSIT_SCHEDULE) || !System_File_Flag (TRANSIT_DRIVER)) {

			Error ("Transit Network Files are Required for Transit Loading");
		}
		if (!new_file_flag) {
			Error ("A New Performance File is required to Merge Transit Data");
		}
		key.Parse (list);
		for (str_itr = list.begin (); str_itr != list.end (); str_itr++) {
			if (str_itr->Starts_With ("VEH")) {
				transit_veh_flag = true;
			} else if (str_itr->Starts_With ("PER")) {
				transit_person_flag = true;
			} else if (str_itr->Starts_With ("PCE") || str_itr->Starts_With ("CAR_EQ")) {
				transit_pce_flag = true;
			}
		}
		if (!System_File_Flag (VEHICLE_TYPE) && transit_pce_flag) {
			Warning ("Vehicle Type File is Required for Transit PCE Loading");
		}
		if (!System_File_Flag (RIDERSHIP) && transit_person_flag) {
			Warning ("Ridership File is Required for Transit Person Loading");
		}
		if (!merge_flag) {
			method = Combine_Code (Get_Control_Text (PROCESSING_METHOD));
		}
	}

	//---- open the time constraint file ----
	
	key = Get_Control_String (TIME_CONSTRAINT_FILE);

	if (!key.empty ()) {
		constraint_file.File_Type ("Time Constraint File");
		Print (1);

		if (Check_Control_Key (TIME_CONSTRAINT_FORMAT)) {
			constraint_file.Dbase_Format (Get_Control_String (TIME_CONSTRAINT_FORMAT));
		}
		constraint_file.Open (Project_Filename (key));
		constraint_flag = true;
	}

	//---- open the time ratio file ----
	
	key = Get_Control_String (NEW_TIME_RATIO_FILE);

	if (!key.empty ()) {
		time_ratio_file.File_Type ("New Time Ratio File");

		time_ratio_file.Create (Project_Filename (key));
		time_ratio_flag = true;
	}

	//---- open the deleted record file ----
	
	key = Get_Control_String (NEW_DELETED_RECORD_FILE);

	if (!key.empty ()) {
		deleted_file.File_Type ("New Deleted Record File");
		Print (1);

		if (Check_Control_Key (NEW_DELETED_RECORD_FORMAT)) {
			deleted_file.Dbase_Format (Get_Control_String (NEW_DELETED_RECORD_FORMAT));
		}
		deleted_file.Create (Project_Filename (key));
		del_file_flag = true;
	}

	List_Reports ();

	first_delete = deleted_flag = (Report_Flag (DELETED_RECORDS) || del_file_flag);
}
Exemple #20
0
StrBuf* GenVic2Sprite (const Bitmap* B, const Collection* A)
/* Generate binary output in VICII sprite format for the bitmap B. The output
** is stored in a string buffer (which is actually a dynamic char array) and
** returned.
*/
{
    enum Mode M;
    StrBuf* D;
    unsigned X, Y;


    /* Output the image properties */
    Print (stdout, 1, "Image is %ux%u with %u colors%s\n",
           GetBitmapWidth (B), GetBitmapHeight (B), GetBitmapColors (B),
           BitmapIsIndexed (B)? " (indexed)" : "");

    /* Get the sprite mode */
    M = GetMode (A);

    /* Check the height of the bitmap */
    if (GetBitmapHeight (B) != HEIGHT) {
        Error ("Invalid bitmap height (%u) for conversion to vic2 sprite",
               GetBitmapHeight (B));
    }

    /* If the mode wasn't given, determine it from the image properties */
    if (M == smAuto) {
        switch (GetBitmapWidth (B)) {
            case WIDTH_HR:
                M = smHighRes;
                break;
            case WIDTH_MC:
                M = smMultiColor;
                break;
            default:
                Error ("Cannot determine mode from image properties");
        }
    }

    /* Now check if mode and the image properties match */
    if (M == smMultiColor) {
        if (GetBitmapWidth (B) != WIDTH_MC || GetBitmapColors (B) > 4) {
            Error ("Invalid image properties for multicolor sprite");
        }
    } else {
        if (GetBitmapWidth (B) != WIDTH_HR || GetBitmapColors (B) > 2) {
            Error ("Invalid image properties for highres sprite");
        }
    }

    /* Create the output buffer and resize it to the required size. */
    D = NewStrBuf ();
    SB_Realloc (D, 63);

    /* Convert the image */
    for (Y = 0; Y < HEIGHT; ++Y) {
        unsigned char V = 0;
        if (M == smHighRes) {
            for (X = 0; X < WIDTH_HR; ++X) {

                /* Fetch next bit into byte buffer */
                V = (V << 1) | (GetPixel (B, X, Y).Index & 0x01);

                /* Store full bytes into the output buffer */
                if ((X & 0x07) == 0x07) {
                    SB_AppendChar (D, V);
                    V = 0;
                }
            }
        } else {
            for (X = 0; X < WIDTH_MC; ++X) {

                /* Fetch next bit into byte buffer */
                V = (V << 2) | (GetPixel (B, X, Y).Index & 0x03);

                /* Store full bytes into the output buffer */
                if ((X & 0x03) == 0x03) {
                    SB_AppendChar (D, V);
                    V = 0;
                }
            }
        }
    }

    /* Return the converted bitmap */
    return D;
}
int main(int argc, char **argv) {
	fork();
	Print();

	return 0;
}
Exemple #22
0
void LinkSum::Write_Link_Data (Data_Group *group)
{
	int i, j, k, num, nrec, tod_list, tod, lanes;
	bool save, ab_flag;	
	double data, cap, capacity;

	Performance_Data *perf_ptr;
	Link_Data *link_ptr;
	Link_Use_Data *use_ptr;
	Range_Data *range_ptr;

	nrec = 0;

	Show_Message ("Writing %s -- Record", group->file->File_Type ());
	Set_Progress ();

	//---- process each link in sorted order ----

    for (link_ptr = link_data.First_Key (); link_ptr; link_ptr = link_data.Next_Key ()) {
		Show_Progress ();

		if (select_flag && link_ptr->Use () == 0) continue;

		save = false;
		group->file->Zero_Fields ();

		//---- process each direction ----

		for (i=0; i < 2; i++) {

			if (i) {
				if (link_ptr->Use () == -1) continue;
				perf_ptr = performance_data [link_ptr->BA_Dir ()];
				ab_flag = false;
			} else {
				if (link_ptr->Use () == -2) continue;
				perf_ptr = performance_data [link_ptr->AB_Dir ()];
				ab_flag = true;
			}

			if (perf_ptr != NULL) {
				num = perf_ptr->Periods ();

				if (num == 0) continue;

				//---- get the capacity data ----

				if (group->field == VC_DATA) {
					capacity = perf_ptr->Capacity ();

					if (capacity < 20) capacity = 1000.0;
					cap = capacity *= cap_factor;

					tod_list = perf_ptr->TOD_List ();

					lanes = perf_ptr->Thru ();
					if (lanes < 1) lanes = 1;
				}

				//---- process each time period ----

				for (j=1; j <= num; j++) {
					switch (group->field) {
						case VOLUME_DATA:
							data = perf_ptr->Volume (j);
							break;
						case TTIME_DATA:
							data = perf_ptr->TTime (j);
							break;
						case VC_DATA:
							data = perf_ptr->Volume (j);

							if (data > 0.0) {
								if (tod_list > 0) {
									range_ptr = time_periods [j];

									tod = Round ((range_ptr->High () + range_ptr->Low () + 1) / 2);
									cap = capacity;

									for (k = tod_list; k; k = use_ptr->TOD_List ()) {
										use_ptr = link_use_data [k]; 

										if (use_ptr->Start () <= tod && tod < use_ptr->End ()) {
											cap = capacity * use_ptr->Lanes () / lanes;
											break;
										}
									}
								}
								if (cap > 0.0) {
									data = data / cap;
								} else {
									data = 0.0;
								}
							}
							break;
						case RATIO_DATA:
							data = perf_ptr->Time_Ratio (j);
							break;
						case SPEED_DATA:
							data = perf_ptr->Avg_Speed (j);
							break;
						case ENTER_DATA:
							data = perf_ptr->Enter (j);
							break;
						case EXIT_DATA:
							data = perf_ptr->Exit (j);
							break;
						case DELAY_DATA:
							data = perf_ptr->Delay (j);
							break;
						case DENSITY_DATA:
							data = perf_ptr->Density (j);
							break;
						case MAX_DENSITY_DATA:
							data = perf_ptr->Max_Density (j);
							break;
						case QUEUE_DATA:
							data = perf_ptr->Queue (j);
							break;
						case MAX_QUEUE_DATA:
							data = perf_ptr->Max_Queue (j);
							break;
						case FAILURE_DATA:
							data = perf_ptr->Failure (j);
							break;
						case VMT_DATA:
							data = perf_ptr->Distance (j);
							break;
						case VHT_DATA:
							data = perf_ptr->Time (j);
							break;
						case CONG_VMT_DATA:
							data = perf_ptr->Ratio_VMT (j);
							break;
						case CONG_VHT_DATA:
							data = perf_ptr->Ratio_VHT (j);
							break;
						case CONG_TIME_DATA:
							data = perf_ptr->Count (j);
							if (data <= 0.0) data = 1.0;
							data = 100.0 * perf_ptr->Ratio_Count (j) / data;
							break;
					}
					if (data != 0.0) {
						if (ab_flag) {
							group->file->Data_AB (j, data);
						} else {
							group->file->Data_BA (j, data);
						}
						save = true;
					}
				}
			}
		}

		//---- save non-zero records ----

		if (save) {
			nrec++;

			group->file->Link (link_ptr->Link ());
			group->file->Anode (link_ptr->Anode ());
			group->file->Bnode (link_ptr->Bnode ());

			if (!group->file->Write ()) {
				Error ("Writing %s", group->file->File_Type ());
			}
		}
	}
	End_Progress ();

	Print (2, "Number of %s Records = %d", group->file->File_Type (), nrec);

	group->file->Close ();
}
void XMLPrinter::PrintSpace( int depth )
{
    for( int i=0; i<depth; ++i ) {
        Print( "    " );
    }
}
Exemple #24
0
/* Main Routine */
void radonSINC(double *v, double *u, double *setpar)
{
  int m,n, M;
  int r, R;
  int t, T;
  // int mmin,mmax,nmin,nmax,adr;
  // double dx_isintheta,dx_icostheta,x,y
  double sum,x_min,Delta_x,Delta_rho,rho_min,Delta_theta;
  double costheta,sintheta,theta;
  double rho,rhooffset;
  double theta_min;
  double idx,mintrig,psi;
  double *xar,scal;

  M            = setpar[0];
  x_min        = setpar[1];
  Delta_x      = setpar[2];
  T            = setpar[3];
  Delta_theta  = setpar[4];
  R            = setpar[5];
  rho_min      = setpar[6];
  Delta_rho    = setpar[7];
  theta_min    = setpar[8];

  scal=M_PI/Delta_x;
  xar=(double *)R_alloc(M, sizeof(double));

  for ( m = 0 ; m < M ; m++ ) 
    xar[m]=m*Delta_x+x_min;

  idx=1.0/Delta_x;
  for(t=0; t<T;t++)
  {
    Print(_DNormal,"t=%i (%i)\n",t,T);
    theta=t*Delta_theta+theta_min;
    sintheta=sin(theta);
    costheta=cos(theta);
    rhooffset=x_min*(costheta+sintheta);
    if (sintheta>sqrt(0.5))
      mintrig=1.0/sintheta;
    else
      mintrig=1.0/fabs(costheta);

    for(r=0; r<R; r++ )
    {
      rho=r*Delta_rho+rho_min;
      sum=0.0;
      for (m=0;m<M;m++)
      {
        rhooffset=rho-xar[m]*costheta;
        for (n=0;n<M;n++)
        {
          psi=scal*(rhooffset-xar[n]*sintheta);
          sum+=sinc(mintrig*psi)*u[m+n*M];
	  /* sum+=psi*u[m+n*M];*/
        }
      }
      v[t+T*r]+=sum*mintrig*Delta_x;
    }
  }
}
	void XMLPrinter::SealElement()
	{
		_elementJustOpened = false;
		Print(">");
	}
Exemple #26
0
int main()
 {
	Print("\nIn main thread");
	Fork(sort);
	Exit(0);   
}
Exemple #27
0
static void
Print(const OrderedTask &task)
{
  Print(task.GetStats());
}
Exemple #28
0
static void Test(char *fname)
{
    struct Position *p;
    int solved = 0, total = 0;
    FILE *fin, *fout;
    int i;
    int btav = 0;
    int btval;
    int bsval;
    int lctval = 1900;
    char line[256];

    if(!fname) {
        Print(0, "Usage: test <filename>\n");
        return;
    }

    fin = fopen(fname, "r");
    if(!fin) {
        Print(0, "Couldn't open %s for input.\n", fname);
        return;
    }

    fout = fopen("nsolved.epd", "w");

    for(i=1; ; i++) {
        int move, j;
        int correct = FALSE;

        if(fgets(line, 256, fin) == NULL) break;
        Print(0, "Problem %d:\n", i);
        p = CreatePositionFromEPD(line);
        ShowPosition(p);

        /* TestSwap(); */

        move = Iterate(p);
        for(j=0; goodmove[j] != M_NONE; j++) 
            if(move == goodmove[j]) correct = TRUE;

        if(!correct && badmove[0] != M_NONE) {
            correct = TRUE;

            for(j=0; badmove[j] != M_NONE; j++) 
                if(move == badmove[j]) correct = FALSE;
        }

        total++;
        if(correct) {
            Print(0, "solved!\n");
            solved++;

            btav += (FHTime < 900) ? FHTime : 900;

            if(FHTime <10)         lctval += 30;
            else if(FHTime < 30)   lctval += 25;
            else if(FHTime < 90)   lctval += 20;
            else if(FHTime < 180)  lctval += 15;
            else if(FHTime < 390)  lctval += 10;
            else if(FHTime <= 600) lctval += 5;
        }
        else {
            Print(0, "not solved!\n");
            btav += 900;
            if(fout) fprintf(fout, "%s", line);
        }

        btval = 2630 - (btav/total);
        bsval = (btav/(17*60));
        bsval = 2830 - bsval*bsval;

        Print(0, "solved %d out of %d  (BT2630 = %d, LCT2 = %d, BS2830 = %d)\n", 
            solved, total, btval, lctval, bsval);
        Print(0, "-----------------------------------------------\n\n");

        FreePosition(p);
    }

    if(fin) fclose(fin);
    if(fout) fclose(fout);
}
Exemple #29
0
/*static*/ int BIOS::LCD::Print (const CPoint& cp, unsigned short clrf, char *str)
{
	return Print(cp.x, cp.y, clrf, RGBTRANS, str);
}
Exemple #30
0
/*tej funkcji jest wskaznik do napisu (char (*i)[])*/
static void get_string (char (*i)[]){
  Print (("otrzymany tekst: %s\n", *i));
  ala = 1;
}