Example #1
0
/* Retourne l'adresse logique à partir d'une position MSF en ASCII */
long toc_address( const char * txt )
{
  int m, s, f;
  char val[ 3 ];
  strncpy( val, txt, 2 );
  m = atoi( val );
  strncpy( val, txt+2, 2 );
  s = atoi( val );
  strncpy( val, txt+4, 2 );
  f = atoi( val );
  return logical( m, s, f );
}
Example #2
0
void CMPolynomial::level1(double& result)    // logical
{
	register int op;
	double hold;

	level2(result);
	while (islogical(token)) {
		op = token;
		get_token();
		level2(hold);
		logical(op,result,hold);
	}
}
Example #3
0
Directory::Ptr Directory::make_new_subdir(const ACE_TString& t_name)
{
  if (files_.find(t_name) != files_.end()) {
    throw std::runtime_error("Can't create a directory with the same "
                             "name as an existing file.");
  }

  ACE_TString logical(t_name.c_str(),
                      (std::min)(FSS_MAX_FILE_NAME, t_name.length()));
  ACE_TString phys_prefix = add_entry();
  ACE_TString phys_base = b32h_encode(logical.c_str());

  if (t_name.length() >= FSS_MAX_FILE_NAME) {
    unsigned int& counter = long_names_[phys_prefix + phys_base];

    if (counter == 99999) {
      throw std::runtime_error("Long directory name out of range");
    }

    phys_base += ACE_TEXT(".     X"); // snprintf will clobber the X with a 0
    ACE_TCHAR* buf = &phys_base[0] + phys_base.length() - 6;
    ACE_OS::snprintf(buf, 6, ACE_TEXT("%05u"), counter++);
    phys_base = phys_base.substr(0, phys_base.length() - 1); // trim the 0
  }

  ACE_TString phys = phys_prefix + phys_base;
  dirs_[t_name] = phys;
  {
    CwdGuard cg(physical_dirname_);

    if (dds_mkdir(phys.c_str()) == -1) {
      throw std::runtime_error("Can't create directory");
    }

    if ((phys_prefix.length() > 0 && dds_chdir(phys_prefix.c_str()) == -1)
        || dds_chdir(phys_base.c_str()) == -1) {
      dds_rmdir(phys.c_str());
      throw std::runtime_error("Can't change to newly created directory");
    }

    std::ofstream fn("_fullname");
    fn << t_name << '\n';
  }
  return new Directory(physical_dirname_ + phys, t_name, this);
}
Example #4
0
void main(){
   logical(1,2);
}
Example #5
0
int main (void) {

	  bool allFalse[3] = {false, false, false};
	  bool oneTrue[3]  = {true, false, false};
	  bool someTrue[3] = {true, true, false};
	  bool allTrue[3]  = {true, true, true};
	logical test = logical();
	std::cout << "Output sentence";
	std::cout <<("Variables:\n");
	std::cout <<("bool allFalse[3] = {false, false, false};\n");
	std::cout <<("bool oneTrue[3]  = {true, false, false};\n");
	std::cout <<("bool someTrue[3] = {true, true, false};\n");
	std::cout <<("bool allTrue[3]  = {true, true, true};\n\n\n");

	std::cout <<("AND:\n");
	// test.logical_and() example
	std::cout <<"logical_and(sizeof(allFalse), allFalse)): "<< test.logical_and(sizeof(allFalse), allFalse)<<"\n";
	std::cout <<"logical_and(sizeof(oneTrue), oneTrue)): "<< test.logical_and(sizeof(oneTrue), oneTrue)<<"\n";
	std::cout <<"logical_and(sizeof(someTrue), someTrue)): "<< test.logical_and(sizeof(someTrue), someTrue)<<"\n";
	std::cout <<"logical_and(sizeof(allTrue), allTrue)): "<< test.logical_and(sizeof(allTrue), allTrue)<<"\n";
	  // AND example
	std::cout <<"false AND false AND false: " << (false AND false AND false);
	std::cout <<"\ntrue AND false AND false: " << (true AND false AND false);
	std::cout <<"\ntrue AND true AND false: " << (true AND true AND false);
	std::cout <<"\ntrue AND true AND true: " << (true AND true AND true)<<"\n";

	std::cout <<("OR:\n");
	// test.logical_or() example
	std::cout <<"logical_or(sizeof(allFalse), allFalse)): "<< test.logical_or(sizeof(allFalse), allFalse)<<"\n";
	std::cout <<"logical_or(sizeof(oneTrue), oneTrue)): "<< test.logical_or(sizeof(oneTrue), oneTrue)<<"\n";
	std::cout <<"logical_or(sizeof(someTrue), someTrue)): "<< test.logical_or(sizeof(someTrue), someTrue)<<"\n";
	std::cout <<"logical_or(sizeof(allTrue), allTrue)): "<< test.logical_or(sizeof(allTrue), allTrue)<<"\n";
	  // XOR example
	std::cout <<"true XOR false: "<< (true XOR false);
	std::cout <<"\nfalse XOR false XOR false: "<< (false XOR false XOR false);
	std::cout <<"\ntrue XOR false XOR false: "<< (true XOR false XOR false);
	std::cout <<"\ntrue XOR true XOR false: "<< (true XOR true XOR false);
	std::cout <<"\ntrue XOR true XOR true XOR false: "<< (true XOR true XOR true XOR false)<<"\n";
	// OR example
	std::cout <<"false OR false OR false: " << (false OR false OR false);
	std::cout <<"\ntrue OR false OR false: " << (true OR false OR false);
	std::cout <<"\ntrue OR true OR false: " << (true OR true OR false)<<"\n";

	std::cout <<("XOR:\n");
	// test.logical_xor() example
	std::cout <<"logical_xor(sizeof(allFalse), allFalse)): "<< test.logical_xor(sizeof(allFalse), allFalse)<<"\n";
	std::cout <<"logical_xor(sizeof(oneTrue), oneTrue)): "<< test.logical_xor(sizeof(oneTrue), oneTrue)<<"\n";
	std::cout <<"logical_xor(sizeof(someTrue), someTrue)): "<< test.logical_xor(sizeof(someTrue), someTrue)<<"\n";
	std::cout <<"logical_xor(sizeof(allTrue), allTrue)): "<< test.logical_xor(sizeof(allTrue), allTrue)<<"\n";
	std::cout <<("Strict_XOR:\n");
	// test.logical_strict_xor() example
	std::cout <<"logical_strict_xor(sizeof(allFalse), allFalse)): "<< test.logical_strict_xor(sizeof(allFalse), allFalse)<<"\n";
	std::cout <<"logical_strict_xor(sizeof(oneTrue), oneTrue)): "<< test.logical_strict_xor(sizeof(oneTrue), oneTrue)<<"\n";
	std::cout <<"logical_strict_xor(sizeof(someTrue), someTrue)): "<< test.logical_strict_xor(sizeof(someTrue), someTrue)<<"\n";
	std::cout <<"logical_strict_xor(sizeof(allTrue), allTrue)): "<< test.logical_strict_xor(sizeof(allTrue), allTrue)<<"\n";
	std::cout <<"NOT false: " << NOT false;
	std::cout <<"\nNOT true: " << NOT true << "\n";
	  unsigned short not_i;
	  //Applying not to allFalse array
	  test.logical_not (sizeof(allFalse),allFalse);
	  std::cout <<("allFalseChanged Array:");
	  for (not_i=0;not_i<sizeof(allFalse);not_i++){
		  std::cout <<(allFalse[not_i]);
	  }
	  std::cout <<("\n");

	  //Applying not to ontTrue array
	  std::cout <<("oneTrueOriginal Array:");
	  for (not_i=0;not_i<sizeof(oneTrue);not_i++){
		  std::cout <<(oneTrue[not_i]);
	  }
	  std::cout <<("\n");

	  test.logical_not (sizeof(oneTrue),oneTrue);
	  std::cout <<("oneTrueChanged Array:");
	  for (not_i=0;not_i<sizeof(oneTrue);not_i++){
		  std::cout <<(oneTrue[not_i]);
	  }
	  std::cout <<("\n");

	  //Applying not to someTrue array
	  std::cout <<("someTrueOriginal Array:");
	  for (not_i=0;not_i<sizeof(someTrue);not_i++){
		  std::cout <<(someTrue[not_i]);
	  }
	  std::cout <<("\n");

	  test.logical_not (sizeof(someTrue),someTrue);
	  std::cout <<("someTrueChanged Array:");
	  for (not_i=0;not_i<sizeof(someTrue);not_i++){
		  std::cout <<(someTrue[not_i]);
	  }
	  std::cout <<("\n");

	test.logical_not (sizeof(allTrue),allTrue);
	std::cout <<("allTrueChanged Array:");
	  for (not_i=0;not_i<sizeof(allTrue);not_i++){
		  std::cout <<(allTrue[not_i]);
	  }
	  std::cout <<("\n");

	return 0;
}