//------------------------------------------------------------------------------ // Main function to generate module files in current directory //------------------------------------------------------------------------------ int main(int argc, char* argv[]){ // Strings for command line options std::string namespace_name=""; std::string author=""; std::string email=""; // determine namespace name, author and email from command line process_command_line(argc, argv, namespace_name, author, email); // create file header std::string file_header = create_file_header(author, email); // Generate data.cpp create_data(file_header, namespace_name); // Generate interface.cpp create_interface(file_header, namespace_name); // Generate initialise.cpp create_initialise(file_header, namespace_name); // Generate internal.hpp create_internal(file_header, namespace_name); // Generate internal.hpp create_module(file_header, namespace_name); // Generate makefile create_makefile(file_header, namespace_name); return EXIT_SUCCESS; }
int git_remote_create_with_fetchspec(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch) { git_remote *remote = NULL; int error; if ((error = ensure_remote_name_is_valid(name)) < 0) return error; if ((error = ensure_remote_doesnot_exist(repo, name)) < 0) return error; if (create_internal(&remote, repo, name, url, fetch) < 0) goto on_error; if (git_remote_save(remote) < 0) goto on_error; *out = remote; return 0; on_error: git_remote_free(remote); return -1; }
int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url) { git_buf buf = GIT_BUF_INIT; git_remote *remote = NULL; int error; if ((error = ensure_remote_name_is_valid(name)) < 0) return error; if ((error = ensure_remote_doesnot_exist(repo, name)) < 0) return error; if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0) return -1; if (create_internal(&remote, repo, name, url, git_buf_cstr(&buf)) < 0) goto on_error; git_buf_free(&buf); if (git_remote_save(remote) < 0) goto on_error; *out = remote; return 0; on_error: git_buf_free(&buf); git_remote_free(remote); return -1; }
void Encoding::init(STATE) { onig_init(); // in regexp.cpp too, but idempotent. Class* enc = ontology::new_class_under(state, "EncodingClass", G(rubinius)); GO(encoding).set(ontology::new_class_under(state, "Encoding", enc)); G(encoding)->set_object_type(state, EncodingType); enc->set_const(state, "EncodingMap", LookupTable::create(state)); enc->set_const(state, "EncodingList", Array::create(state, 3)); G(encoding)->set_ivar(state, state->symbol("@default_external"), G(undefined)); G(encoding)->set_ivar(state, state->symbol("@default_internal"), G(undefined)); Encoding* ascii = create_bootstrap(state, "US-ASCII", eAscii, ONIG_ENCODING_US_ASCII); Encoding* binary = create_bootstrap(state, "ASCII-8BIT", eBinary, ONIG_ENCODING_ASCII); Encoding* utf8 = create_bootstrap(state, "UTF-8", eUtf8, ONIG_ENCODING_UTF_8); ascii->name(state, String::create(state, "US-ASCII")); binary->name(state, String::create(state, "ASCII-8BIT")); utf8->name(state, String::create(state, "UTF-8")); #include "vm/gen/encoding_database.cpp" int index = -1; char* locale_charmap; #ifdef HAVE_NL_LANGINFO setlocale(LC_CTYPE, ""); locale_charmap = nl_langinfo(CODESET); #else locale_charmap = "US-ASCII"; #endif enc->set_const(state, "LocaleCharmap", String::create(state, locale_charmap)); index = find_index(state, locale_charmap); if(index < 0) index = find_index(state, "US-ASCII"); create_internal(state, "locale", index); create_internal(state, "external", index); create_internal(state, "filesystem", index); create_internal(state, "internal", -1); Transcoding::init(state); Converter::init(state); }
int git_remote_create_anonymous(git_remote **out, git_repository *repo, const char *url, const char *fetch) { int error; git_remote *remote; if ((error = create_internal(&remote, repo, NULL, url, fetch)) < 0) return error; *out = remote; return 0; }
vulkan_buffer::vulkan_buffer(const compute_queue& cqueue, const size_t& size_, void* host_ptr_, const COMPUTE_MEMORY_FLAG flags_, const uint32_t opengl_type_, const uint32_t external_gl_object_) : compute_buffer(cqueue, size_, host_ptr_, flags_, opengl_type_, external_gl_object_), vulkan_memory((const vulkan_device&)cqueue.get_device(), &buffer) { if(size < min_multiple()) return; // TODO: handle the remaining flags + host ptr if(host_ptr_ != nullptr && !has_flag<COMPUTE_MEMORY_FLAG::NO_INITIAL_COPY>(flags)) { // TODO: flag? } // actually create the buffer if(!create_internal(true, cqueue)) { return; // can't do much else } }
/** * Handle element for iteration over the set. Notifies the * iterator and sends an acknowledgement to the service. * * @param cls the `struct GNUNET_SET_Handle *` * @param mh the message */ static void handle_copy_lazy (void *cls, const struct GNUNET_MessageHeader *mh) { struct GNUNET_SET_CopyLazyResponseMessage *msg; struct GNUNET_SET_Handle *set = cls; struct SetCopyRequest *req; struct GNUNET_SET_Handle *new_set; msg = (struct GNUNET_SET_CopyLazyResponseMessage *) mh; req = set->copy_req_head; if (NULL == req) { /* Service sent us unsolicited lazy copy response */ GNUNET_break (0); return; } LOG (GNUNET_ERROR_TYPE_DEBUG, "Handling response to lazy copy\n"); GNUNET_CONTAINER_DLL_remove (set->copy_req_head, set->copy_req_tail, req); // We pass none as operation here, since it doesn't matter when // cloning. new_set = create_internal (set->cfg, GNUNET_SET_OPERATION_NONE, &msg->cookie); req->cb (req->cls, new_set); GNUNET_free (req); }
/** * Create an empty set, supporting the specified operation. * * @param cfg configuration to use for connecting to the * set service * @param op operation supported by the set * Note that the operation has to be specified * beforehand, as certain set operations need to maintain * data structures spefific to the operation * @return a handle to the set */ struct GNUNET_SET_Handle * GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_SET_OperationType op) { return create_internal (cfg, op, NULL); }