int main(void) { static t_elem *elem[HASH_TABLE_SIZE]; t_elem *tmp; t_to_free *to_free; char *line; int i; i = 0; to_free = NULL; while (get_next_line(0, &line) > 0 && ft_strcmp_ns("", line) != 0) { if (i % 2 == 0) { to_free = init_push(to_free); tmp = ft_build_keyword(elem, line, ft_hashich(line), to_free); } else { tmp->value = line; to_free->value = tmp->value; } ++i; } search_keywords(elem); free_the_slaves(to_free); return (0); }
//--------------------------------------------------------- // Construct the Tart object. This should be called from the // main C++ code, probably after the Application is constructed. // It prepares but does not yet launch the Python interpreter, // as that has to be done in a separate thread. // For now we do nothing with the arguments, but may want to // extract useful info from them later. // Tart::Tart(int argc, char ** argv) : m_thread(NULL) , m_cleanup(false) { if (sm_instance) throw "Singleton already exists"; sm_instance = this; // We may want to do stuff with these later... used to pass it // to the Python interpreter when it was the primary thing, but // now the Cascades Application gets it and maybe we don't care. m_argc = argc; m_argv = argv; PyImport_AppendInittab(TartModule.m_name, &PyInit_tart); extern void init_push(void); init_push(); // only Py_SetProgramName and Py_SetPath may come before this Py_Initialize(); qDebug("Python initialized"); m_wargv = args_to_wargv(argc, argv); m_wargc = argc; PySys_SetArgvEx(argc, m_wargv, 0); qDebug() << QThread::currentThreadId() << "Tart: initialized"; }