Beispiel #1
0
void writeData()
{
    std::string defs;
    fs::path defs_path = out_dir / (out_file_prepend + ".defs");

    print(format("write directory   = %s\n")     % out_dir);
    print(format("write file prefix = \"%s\"\n") % out_file_prepend);

    if(!dry_run) fs::create_directories(out_dir);

    for(int i = 0; i < packer.numSheets(); i++)
    {
        Sheet *s         = packer.getSheet(i);
        fs::path dst     = out_dir / str(format("%s%03d.%s") % out_file_prepend % i % "png");

        print(format("writing sheet to %s\n") % dst);
        s->saveImage(dst);
        defs += getSheetDefinitions(dst, s);
    }

    print(format("writing definitions to %s\n") % defs_path);
    if(!dry_run)
    {
        fs::ofstream out(defs_path);
        out << defs;

        if(out.fail())
            print(format("failed to write %s\n") % defs_path, VERBOSE);
    }
}
Beispiel #2
0
void Process::send_multicast(
	const std::vector<int> &targets,
	Net *net,
	int edge_id,
	int tokens_count,
	const Packer &packer,
	Thread *thread)
{
	thread->get_requests()->check();
	char *buffer = packer.get_buffer();
	size_t size = packer.get_size();
	std::vector<int>::const_iterator i;
	Tokens *data = (Tokens*) packer.get_buffer();
	data->edge_id = edge_id;
	data->tokens_count = tokens_count;
	char *d = buffer;
	for (i = targets.begin(); i != targets.end(); i++) {
		int target = *i;
		if(target < 0 || target >= process_count) {
			fprintf(stderr, "Net sends %i token(s) to invalid process id %i (valid ids: [0 .. %i])\n",
				tokens_count, target, process_count - 1);
			exit(1);
		}
		CA_DLOG("SEND index=%i target=%i process=%i\n", place_index, target, get_process_id());

		MPI_Request *request = thread->get_requests()->new_request(d);
		d = NULL;
		MPI_Isend(buffer, size, MPI_BYTE, target, CA_TAG_TOKENS, MPI_COMM_WORLD, request);
	}
}
Beispiel #3
0
	void msgpack_pack(Packer& _Pk) const {
		_Pk.pack_array(4);
		_Pk.pack(key);
		_Pk.pack(ovalue);
		_Pk.pack(nvalue);
		_Pk.pack(xt);
	}
 void msgpack_pack(Packer& pk) const
 {
   if (is_double)
     pk.pack(msgpack::type::tuple<bool, double>(true, value.f));
   else
     pk.pack(msgpack::type::tuple<bool, int>(false, value.i));
 }
Beispiel #5
0
Packer *PackMaster::getPacker(InputFile *f)
{
    Packer *pp = visitAllPackers(try_pack, f, opt, f);
    if (!pp)
        throwUnknownExecutableFormat();
    pp->assertPacker();
    return pp;
}
Beispiel #6
0
Packer *PackMaster::getUnpacker(InputFile *f)
{
    Packer *pp = visitAllPackers(try_unpack, f, opt, f);
    if (!pp)
        throwNotPacked();
    pp->assertPacker();
    return pp;
}
Beispiel #7
0
		/**
		 * @brief Copy Constructor
		 *
		 * @details 
		 * <p> Copy constructor of Packer does not copy children items. </p> 
		 * <p> Only copies member variables(productArray, wrapperArray) of Packer's. </p>
		 */
		Packer(const Packer &packer)
			: Packer(packer.productArray)
		{
			this->reserve(packer.size());

			for (size_t i = 0; i < packer.size(); i++)
				this->emplace_back(new WrapperArray(*packer[i]));
		};
bool sqlapi_bndstmtfread( FILE *bndfile, SqlApiBindStmt &bndstmt) {
  Packer p;
  if(!p.read(ByteInputFile(bndfile))) {
    return false;
  }
  p >> bndstmt;
  return true;
}
bool sqlapi_bndprogramidfread(FILE *bndfile, SqlApiBindProgramId &programid) {
  Packer p;
  if(!p.read(ByteInputFile(bndfile))) {
    return false;
  }
  p >> programid;
  return true;
}
 void packString(Packer& pk, int index) const {
   size_t len;
   const char* str = lua_tolstring(L, index, &len);
   if (str == NULL) {
     int t = lua_type(L, index);
     luaL_error(L, "lua_tolstring failed for index %d: type = %s",
                index, lua_typename(L, t));
     return;
   }
   pk.pack_raw(len);
   pk.pack_raw_body(str, len);
 }
Beispiel #11
0
int main(int argc, char* argv[])
#endif
{
#ifdef WIN32
	wstring exePath(argv[0]);
#else
	string arg = string(argv[0]);
	wstring exePath(arg.begin(), arg.end());
#endif

	if(argc != 3) {
		cout << "Usage: pack <directory> <outputPath>" << endl;
		return -1;
	}

#ifdef WIN32
	wstring dirName(argv[1]);
#else
	arg = string(argv[1]);
	wstring dirName(arg.begin(), arg.end());
#endif

	dirName = DirUtils::GetDirectoryName(dirName);
	Packer* packer = new Packer();	
	packer->AddDirectory(dirName);

#ifdef WIN32
	wstring outPath(argv[2]);
#else
	arg = string(argv[2]);
	wstring outPath(arg.begin(), arg.end());
#endif
	cout << "Writing package... " << string(outPath.begin(), outPath.end())  << endl;
	packer->WritePack(outPath);
	delete packer;

	//packer = Packer::ReadPack(L"C:\\TEST.PAK");
	//PackEntry *entry = packer->GetEntry(L"Debug/PruebaTexto.txt");
	//wchar_t* data = (wchar_t*) packer->GetUncompressedData(entry);

	//wcout.imbue(locale(""));

	//wstring test(data, 1, (entry->GetUncompressedSize() / sizeof(wchar_t)) - 1);
	//wcout << test << endl;

	//delete data;
	//delete packer;

	return 0;
}
Beispiel #12
0
/**
 * packerに基づきイメージを結合する
 */
static void combineImages(){
	// 出力フォーマットの選別
	const int ch = getChannels(ofmt_type);
	const int type = (ch == 4)? CV_8UC4 : CV_8UC3;
	const cv::Scalar scalar = (ch == 4)? cv::Scalar(127, 127, 127, 255) : cv::Scalar(127, 127, 127);	// 初期色

	cv::Mat dst(cv::Size(packer.getW(), packer.getH()), type, scalar);

	int count = 0;	// for debug
	DataArray::iterator it = inputs.begin();
	for(; it != inputs.end(); it++){
		if(!it->fit)
			continue;	// skip

		cv::Mat src = cv::imread(it->path, -1);
		if(src.channels() != ch){
			adjustmentImage(src, ch);
		}
		cv::Mat roi = dst(cv::Rect(it->fit->rect.getX() + packer.getPadding(), it->fit->rect.getY() + packer.getPadding(), it->w, it->h));
		src.copyTo(roi);
		// for debug
#if 0
		cv::rectangle(dst, cv::Rect(it->fit->rect.getX(), it->fit->rect.getY(), it->fit->rect.getW(), it->fit->rect.getH()), cv::Scalar(255, 255, 255), 1);
		std::ostringstream oss;
		oss << it->w << "x" << it->h << "(" << count << ")";
		count++;
		const std::string size = oss.str();
		cv::putText(dst, size, cv::Point(it->fit->rect.getX() + 1, it->fit->rect.getY() + 21), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 0, 0), 1);
		cv::putText(dst, size, cv::Point(it->fit->rect.getX(), it->fit->rect.getY() + 20), cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(255, 255, 255), 1);
#endif
	}
	// 出力
	if((om_type == OutputMode_WriteOnly) || (om_type == OutputMode_Both)){
		bool ret = cv::imwrite(output_path, dst, params);
	}
	if((om_type == OutputMode_DisplayOnly) || (om_type == OutputMode_Both)){
		std::ostringstream oss;
		oss << "packed image(" << packer.getW() << " x " << packer.getH() << ")";
		const std::string name = oss.str();
		cv::namedWindow(name, CV_WINDOW_AUTOSIZE | CV_WINDOW_KEEPRATIO);
		cv::imshow(name, dst);
		if(ch == 4){
			std::vector<cv::Mat> mv;
			cv::split(dst, mv);
			cv::Mat dsta = mv[3].clone();
			cv::imshow("packed image(alpha)", dsta);
		}
	}
}
  void msgpack_pack(Packer& pk) const {
    int n = lua_gettop(L);
    if (arg_base_ > n) {
      if (pack_as_array_) pk.pack_array(0);
      return;
    }

    // If pack_as_array is true, all elements in the stack
    // will be serialized into an array. Otherwise,
    // each element will be serialized independently.
    if (pack_as_array_) pk.pack_array(n - arg_base_ + 1);
    for (int i = arg_base_; i <= n; i++) {
      pack(pk, i);
    }
  }
    void msgpack_pack(Packer& pk) const
    {
        static_assert(sizeof...(Args) % 2 == 0, "");
        pk.pack_map(sizeof...(Args) / 2);

        define_map_imp<std::tuple<Args&...>, sizeof...(Args)>::pack(pk, a);
    }
Beispiel #15
0
int main(int argc, char *argv[])
{
    parseCmdLine(argc, argv);
    setWriteEnabled(!dry_run);

    if(silent)
        setPrintMode(SILENT);
    else if(verbose)
        setPrintMode(VERBOSE);
    else
        setPrintMode(INFO);


    out_dir          = fs::path(cmd_output).parent_path();
    out_file_prepend = fs::path(cmd_output).filename().string();

    if(out_file_prepend == "." && boost::ends_with(fs::path(cmd_output).string(), "/"))
        out_file_prepend = "";

    if(read_stdin)
    {
        std::string line;
        while(!std::getline(std::cin, line).eof())
            input_paths.push_back(line);
    }

    std::vector<fs::path> files;
    findFiles(files);

    print(format("%d files found\n") % files.size());

    if(files.empty())
        return EXIT_SUCCESS;

    packer.setSheetSize(cmd_sheet_width, cmd_sheet_height);
    packer.setTexCoordOrigin(tex_coord_origin);
    packer.setPowerOfTwo(power_of_two);
    packer.setCompact(compact);
    packer.setExtrude(extrude);
    packer.setCaching(!no_cache);

    for(size_t i = 0; i < files.size(); i++)
        packer.addImage(files[i].string());

    if(packer.numImages() == 0)
        return EXIT_SUCCESS;

    packer.pack();
    writeData();

    return EXIT_SUCCESS;
}
Beispiel #16
0
Message * Filter::packMsg()
{
    Packer packer;
    packer.packInt(info.filter_id);
    packer.packStr(info.so_file);

    char *bufs[1];
    int sizes[1];
    
    bufs[0] = packer.getPackedMsg();
    sizes[0] = packer.getPackedMsgLen();

    Message *msg = new Message();
    msg->build(info.filter_id, SCI_GROUP_ALL, 1, bufs, sizes, Message::FILTER_LOAD);
    delete [] bufs[0];
    return msg;
}
Beispiel #17
0
int SCI_Group_operate(sci_group_t group1, sci_group_t group2,
        sci_op_t op, sci_group_t *newgroup)
{
    if (gCtrlBlock->getMyRole() == CtrlBlock::INVALID)
        return SCI_ERR_UNINTIALIZED;
    
    if (gCtrlBlock->getMyRole() != CtrlBlock::FRONT_END)
        return SCI_ERR_INVALID_CALLER;

    if (!gCtrlBlock->getRoutingList()->isGroupExist(group1))
        return SCI_ERR_GROUP_NOTFOUND;

    if (!gCtrlBlock->getRoutingList()->isGroupExist(group2))
        return SCI_ERR_GROUP_NOTFOUND;

    if ((op!=SCI_UNION) && (op!=SCI_INTERSECTION) && (op!=SCI_DIFFERENCE))
        return SCI_ERR_INVALID_OPERATOR;

    int msgID;
    try {
        Packer packer;
        packer.packInt((int) op);
        packer.packInt((int) group1);
        packer.packInt((int) group2);

        char *bufs[1];
        int sizes[1];

        bufs[0] = packer.getPackedMsg();
        sizes[0] = packer.getPackedMsgLen();
        msgID = gNotifier->allocate();

        Message *msg = new Message();
        gAllocator->allocateGroup(newgroup);
        msg->build(SCI_FILTER_NULL, *newgroup, 1, bufs, sizes, Message::GROUP_OPERATE, msgID);
        delete [] bufs[0];
        gCtrlBlock->getRouterInQueue()->produce(msg);
    } catch (std::bad_alloc) {
        return SCI_ERR_NO_MEM;
    }
    
    int rc;
    gNotifier->freeze(msgID, &rc);
    return rc;
}
Beispiel #18
0
int main(int argc, char ** argv)
{
	std::cout << "--------------------------------------------" << std::endl
		      << "Pakunpaker v1.0 by Xesc & Technology 2008-09" << std::endl 
		      << "--------------------------------------------" << std::endl << std::endl;
	
	if (argc > 2)
	{
		// create a new package
		if (strcmp(argv[1], "-i") == 0)
		{
			Packer *packer = new Packer;
			
			for (int param = 3; param < argc; param++)
			{
				packer->addFile(std::string(argv[param]));
				std::cout << "added: " << argv[param] << std::endl;
			}
			
			packer->buildPackage(argv[2]);
			std::cout << "Package build: " << argv[2] << std::endl;
			
			delete packer;
		}
		// extract files from package
		else if ((strcmp(argv[1], "-o") == 0 || strcmp(argv[1], "-oo") == 0) && argc == 4)
		{
			Unpacker *unpacker = new Unpacker;
			
			unpacker->extractPackage(std::string(argv[2]), std::string(argv[3]), strcmp(argv[1], "-o") == 0);
			
			for (int n = 0; n < unpacker->getExtractedFilesCount(); n++)
				std::cout << "Unpacked file " << n + 1 << " to: " << unpacker->getExtractedFileName(n) << std::endl;
			
			delete unpacker;
		}
		else // unknonw parameters
			displayHelp();
	}
	else // invalid parameters
		displayHelp();

	return 0;
}
Beispiel #19
0
int SCI_Group_create(int num_bes, int * be_list, sci_group_t * group)
{
    if (gCtrlBlock->getMyRole() == CtrlBlock::INVALID)
        return SCI_ERR_UNINTIALIZED;
    
    if (gCtrlBlock->getMyRole() != CtrlBlock::FRONT_END)
        return SCI_ERR_INVALID_CALLER;

    assert(be_list);
    for (int i=0; i<num_bes; i++) {
        if (!gCtrlBlock->getTopology()->hasBE(be_list[i]))
            return SCI_ERR_BACKEND_NOTFOUND;
    }

    int msgID;
    try {
        Packer packer;
        packer.packInt(num_bes);
        for (int i=0; i<num_bes; i++) {
            packer.packInt(be_list[i]);
        }

        char *bufs[1];
        int sizes[1];

        bufs[0] = packer.getPackedMsg();
        sizes[0] = packer.getPackedMsgLen();
        msgID = gNotifier->allocate();

        Message *msg = new Message();
        gAllocator->allocateGroup(group);
        msg->build(SCI_FILTER_NULL, *group, 1, bufs, sizes, Message::GROUP_CREATE, msgID);
        delete [] bufs[0];
        gCtrlBlock->getRouterInQueue()->produce(msg);
    } catch (std::bad_alloc) {
        return SCI_ERR_NO_MEM;
    }
    
    int rc;
    gNotifier->freeze(msgID, &rc);
    return rc;
}
  void packTableAsArray(Packer& pk, int index) const {
    int n = lua_gettop(L);
    size_t len = lua_objlen(L, index);

    pk.pack_array(len);
    for (size_t i = 1; i <= len; i++) {
      lua_rawgeti(L, index, i);
      pack(pk, n + 1);
      lua_pop(L, 1);
    }
  }
Beispiel #21
0
int SCI_BE_add(sci_be_t *be)
{
    if (gCtrlBlock->getMyRole() == CtrlBlock::INVALID)
        return SCI_ERR_UNINTIALIZED;
    
    if (gCtrlBlock->getMyRole() != CtrlBlock::FRONT_END)
        return SCI_ERR_INVALID_CALLER;

    if (be->id >= 0) { // user-assigned back end id
        if (gCtrlBlock->getTopology()->hasBE(be->id)) 
            return SCI_ERR_BACKEND_EXISTED;
    } else { // SCI allocated back end id
        gAllocator->allocateBE(&(be->id));
    }

    int msgID;
    try {
        Packer packer; 
        packer.packStr(be->hostname);
        packer.packInt(be->level);

        char *bufs[1];
        int sizes[1];

        bufs[0] = packer.getPackedMsg();
        sizes[0] = packer.getPackedMsgLen();

        Message *msg = new Message();
        msgID = gNotifier->allocate();
        msg->build(SCI_FILTER_NULL, (sci_group_t) (be->id), 1, bufs, sizes, Message::BE_ADD, msgID);
        delete [] bufs[0];
        gCtrlBlock->getRouterInQueue()->produce(msg);
    } catch (std::bad_alloc) {
        return SCI_ERR_NO_MEM;
    }

    int rc;
    gNotifier->freeze(msgID, &rc);
    return rc;
}
Beispiel #22
0
void
packerPrintf(Packer * p, const char *fmt,...)
{
    va_list args;
    va_start(args, fmt);
#else
void
packerPrintf(va_alist)
     va_dcl
{
    va_list args;
    Packer *p = NULL;
    const char *fmt = NULL;
    int sz = 0;
    va_start(args);
    p = va_arg(args, Packer *);
    fmt = va_arg(args, char *);
#endif
    assert(p);
    assert(p->real_handler && p->vprintf);
    p->vprintf(p->real_handler, fmt, args);
    va_end(args);
}
  void packTableAsTable(Packer& pk, int index) const {
    // calc the size of the table
    // TODO: Make this faster!!
    size_t len = 0;
    lua_pushnil(L);
    while (lua_next(L, index) != 0) {
      len++; lua_pop(L, 1);
    }
    pk.pack_map(len);

    int n = lua_gettop(L); // used as a positive index
    lua_pushnil(L);
    while (lua_next(L, index) != 0) {  
      pack(pk, n + 1); // -2:key
      pack(pk, n + 2); // -1:value
      lua_pop(L, 1); // removes value, keeps key for next iteration
    }
  }
 static void pack(Packer& pk, Tuple const& t) {
     define_map_imp<Tuple, N-1>::pack(pk, t);
     pk.pack(std::get<N-1>(t));
 }
Beispiel #25
0
int main ()
{
	ifstream infile;	//stream to read from txt file
	ofstream toBin;		//stream to write to the binary file
	ifstream fromBin;	//stream to read from the binary file
	STATE reader = NOT_READY;	//program status bit
	vector < int > values ( 1 );	//vector containing uncompressed digits
	vector < unsigned short int > bin ( 1 );	//vector containing bit packed digits
	vector < int > format ( 2 );	//vector containing formatting data

	int data_set = 1;	//counter for how many data sets have been processed
	Reader read;		//set up of reader class object to pull data from txt file
	Packer pack;		//set up of packer class that will perform bit packing / unpacking
	Writer write;		//set up of writer class that will read / write binary file

	try	//enclosed in a try block to catch any unexpected errors
	{



		reader = read.open(infile);	//open the file. File name is coded into the funciton

		
		while (reader != FILE_END)	//while loop will ensure that it will continue until all data sets are processed
		{
			reader = read.process(infile, values);	//first set of data is read from the file and stored in the values array
			
			if (reader == SET_END || reader == FILE_END)	//main body of main will only be processed if a data set was read successfully
			{
				format.resize ( read.getPer_set() + 1);	//prepare format array to hold the formatting data
	
				format[0] = read.getPer_set();	//first slot of the format array is the number of digits in each set to be encoded

				for(int i = 0; i < format[0] ; ++i)	//the remaining slots are how may bits each digit will be packed into
					format[ i + 1 ] = read.getBits_per(i);
		
				cout << "\n\nDisplay input for data set " << data_set << ":\n";	//display the data pulled from the file
				read.display(values);

				pack.compress(values, format, bin);	//perform bit packing and save in the bin array

				cout << "\nDisplay binary file input:\n";	//display bit packed data
				read.display(bin);

				write.Write(bin, toBin);	//write the binary data to the file

				write.Read(bin, fromBin);	//read the binary data from the file and store in the bin array

				cout << "\nDisplay binary file output:\n";	//display bit packed data as it was read from the file
				read.display(bin);

				pack.decompress(values, bin);	//unpack the digits and store in the values array

				cout << "\nDisplay data read from file:\n";	//display the unpacked digits
				read.display(values);

				cout << "\n\nEnd of data set " << data_set << endl << endl;	//show end of data set

				++data_set;	//incriment data set counter
			}
		}
	}


	catch (exception & error)	//catch any error thrown by program, display .what string
	{
		cout << error.what();
	}

	infile.close();	//close the stream from the .txt file. toBin and fromBin are opened and closed within the function using them

	cout << "\nProgram Ending\n\n\n";	//end program
	cout << "Press Enter key to end -->";
	cin.ignore(80, '\n');
	cout << endl;

	return 0;
}
 void msgpack_pack(Packer& pk) const
 {
     pk.pack_array(0);
 }
    void msgpack_pack(Packer& pk) const
    {
        pk.pack_array(sizeof...(Args));

        define_imp<std::tuple<Args&...>, sizeof...(Args)>::pack(pk, a);
    }
 static void pack(Packer& pk, Tuple const& t) {
     pk.pack(std::get<0>(t));
 }
Beispiel #29
0
/**
 * エントリ
 */
int main(int argc, char *argv[]){
#if	0	// for debug
	std::vector<std::string> output_array;

	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0163.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0164.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0165.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0166.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0167.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0168.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0169.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0170.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0172.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0173.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0174.jpg;");
	output_array.push_back("E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\miku.png;");

	char* _argv[] = {
		"",
		"-i=E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0163.jpg;E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\eyes0164.jpg;",
//		"-o=E:\\GitHubRepository\\2dpacker\\2dpacker\\image\\packed.png",
//		"-p=100",
		"-pad=0",
		"-aln=false",
		"-d=true"
	};

	std::string output("-i=");
	if(!output_array.empty()){
		std::vector<std::string>::iterator it = output_array.begin();
		for(; it != output_array.end(); it++){
			output.append(*it);
		}
		_argv[1] = const_cast<char*>(output.c_str());
	}

	argv = _argv;
	argc = sizeof(_argv) / sizeof(_argv[0]);
#endif
	// {:パーサ文字列の開始
	// }:パーサ文字列の終了
	// |:セパレータ
	// ショートネーム,フルネーム,デフォルト値,ヘルプ文
	const char* keys = {
		"{i|input     |      |input files}"
		"{o|output    |      |output file}"
		"{p|param     |-1    |output parameter}"
		"{pad|padding |0     |padding pixel}"
		"{aln|aligned |false |aligned power of two boundary}"
		"{d|display   |false |display images}"
	};

	cv::CommandLineParser parser(argc, argv, keys);
	if(argc == 1){
		parser.printParams();
		return EXIT_SUCCESS;
	}

	std::string param_i = parser.get<std::string>("i");
	const std::string param_o = parser.get<std::string>("o");
	int param_p = parser.get<int>("p");
	const unsigned int param_pad = parser.get<unsigned int>("pad");
	const bool param_aln = parser.get<bool>("aln");
	const bool param_d = parser.get<bool>("d");

	if(param_i.empty()){
		std::cout << "[error] empty input data." << std::endl;
		return EXIT_FAILURE;
	}
	else{
#if 0
		std::stringstream ss(param_i);
		std::string temp;
		while(ss >> temp){
			input_images.push_back(temp);
		}
#else
		std::string temp;
		while(param_i.find(";", 0) != std::string::npos){
			size_t pos = param_i.find(";", 0);
			temp = param_i.substr(0, pos);
			param_i.erase(0, pos + 1);
			input_images.push_back(temp);
		}
#endif
	}
	// 出力設定
	padding = param_pad;
	aligned = param_aln;
	output_path = param_o;
	if(!output_path.empty()){
		ofmt_type = getExtension(output_path);
		if(ofmt_type == OutputFormat_Unsupported){
			std::cerr << "[error] unsupported output format." << std::endl;
			return EXIT_FAILURE;
		}
		if(ofmt_type == OutputFormat_Jpg){
			params.push_back(CV_IMWRITE_JPEG_QUALITY);
			param_p = (param_p == -1)? 95 : param_p;	// 0-100(default=95)
			params.push_back(param_p);
		}
		else
		if(ofmt_type == OutputFormat_Png){
			params.push_back(CV_IMWRITE_PNG_COMPRESSION);
			param_p = (param_p == -1)? 3 : param_p;	// 0-9(default=3)
			params.push_back(param_p);
		}
//		else
//		if(output_type == Output_Pnm){
//			params.push_back(CV_IMWRITE_PXM_BINARY);
//			param_p = (param_p == -1)? 1 : param_p;	// 0:ascii 1:binary(default=1)
//			params.push_back(param_p);
//		}
		om_type = (param_d)? OutputMode_Both : OutputMode_WriteOnly;
	}
	else{
		ofmt_type = OutputFormat_Png;
		om_type = OutputMode_DisplayOnly;
	}

	// 準備を行う
	setup();

	// パッキング
	packer.setPadding(padding);
	packer.setAligned(aligned);
	if(!packer.pack(inputs)){
		std::cerr << "[error] failed to pack." << std::endl;
		return EXIT_FAILURE;
	}

	// 画像の合成
	combineImages();

	cv::waitKey(0);

	return EXIT_SUCCESS;
}
 void packBoolean(Packer& pk, int index) const {
   int b = lua_toboolean(L, index);
   pk.pack(b != 0);
 }