/* ** Perform a search operation. ** @return #1 Function to iterate over the result entries. ** @return #2 nil. ** @return #3 nil as first entry. ** The search result is defined as an upvalue of the iterator. */ static int lualdap_search (lua_State *L) { conn_data *conn = getconnection (L); ldap_pchar_t base; ldap_pchar_t filter; char *attrs[LUALDAP_MAX_ATTRS]; int scope, attrsonly, msgid, rc, sizelimit; struct timeval st, *timeout; if (!lua_istable (L, 2)) return luaL_error (L, LUALDAP_PREFIX"no search specification"); if (!get_attrs_param (L, attrs)) return 2; /* get other parameters */ attrsonly = booltabparam (L, "attrsonly", 0); base = (ldap_pchar_t) strtabparam (L, "base", NULL); filter = (ldap_pchar_t) strtabparam (L, "filter", NULL); scope = string2scope (L, strtabparam (L, "scope", NULL)); sizelimit = longtabparam (L, "sizelimit", LDAP_NO_LIMIT); timeout = get_timeout_param (L, &st); rc = ldap_search_ext (conn->ld, base, scope, filter, attrs, attrsonly, NULL, NULL, timeout, sizelimit, &msgid); if (rc != LDAP_SUCCESS) return luaL_error (L, LUALDAP_PREFIX"%s", ldap_err2string (rc)); create_search (L, 1, msgid); lua_pushcclosure (L, next_message, 1); return 1; }
static char * test_is_extension_good_ko() { struct search_t *search; search = create_search(); add_element(&search->extension, ".cpp"); mu_assert("test_is_extension_good_ko failed", is_ignored_file(search, "file.c") == 0); free_search(search); return 0; }
static char * test_is_ignored_file_ko() { struct search_t *search; search = create_search(); add_element(&search->ignore, "rules"); mu_assert("test_is_ignored_file_ko failed", is_ignored_file(search, "Rules") == 0); free_search(search); return 0; }
static char * test_is_specific_file_ko() { struct search_t *search; search = create_search(); add_element(&search->specific_file, "Makefile"); mu_assert("test_is_specific_file_ko failed", is_specific_file(search, "makefile") == 0); free_search(search); return 0; }
static char * test_two_entries() { struct search_t *search; search = create_search(); char text[] = "this is a the first line\nthis is the second line\n"; const char *pattern = "line"; parse_text(search, "fake_file", strlen(text), text, pattern); mu_assert("error in number of entry", search->nbentry == 3); free_search(search); return 0; }
static char * test_one_entry_incase() { struct search_t *search; search = create_search(); search->incase_option = 1; char text[] = "this is a the first line\nthis is the second line\n"; const char *pattern = "First"; parse_text(search, "fake_file", strlen(text), text, pattern); mu_assert("error in number of entry", search->nbentry == 2); free_search(search); return 0; }
GtkWidget *create_window(wconf_t conf) { GtkWidget *window; GtkWidget *fixed_cont; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); fixed_cont = gtk_fixed_new(); gtk_container_add(GTK_CONTAINER(window), fixed_cont); search = create_search(conf.keypress); gtk_container_add(GTK_CONTAINER(fixed_cont), search); g_signal_connect(G_OBJECT(window), "delete-event", gtk_main_quit, NULL); style_window(window, conf); return window; }
static char * test_cursor_up_top_first_page() { struct display_t *display; struct search_t *search; int terminal_line_nb; char text[] = "this is the first line\nthis the second line\n"; const char *pattern = "line"; display = create_display(); search = create_search(); terminal_line_nb = 10; parse_text(search, "fake_file", strlen(text), text, pattern); move_cursor_up(display, search, terminal_line_nb); mu_assert("test_cursor_up_top_first_page failed", display->cursor == 1); free_search(search); free_display(display); return 0; }
void create_mangroup ( Widget parent ) /************************************************************************ * * This subroutione creates the manual group widgets. * * create_mangroup ( parent ) * * Input parameters: * parent Wiget parent widget id * ***********************************************************************/ { Arg args[10]; Cardinal argcnt; Widget group_pane, form, frame[3]; Widget rowcol, model_button; /*----------------------------------------------------------------------*/ /* Create a popup shell & list widget for the file list. */ group_panel_toplevel = XmCreateBulletinBoardDialog(parent, "group_panel", args, 0); argcnt = 0; XtSetArg(args[argcnt], XmNsashWidth, 1); argcnt++; XtSetArg(args[argcnt], XmNsashHeight, 1); argcnt++; group_pane = XtCreateManagedWidget("group_pane", xmPanedWindowWidgetClass, group_panel_toplevel, args, argcnt); argcnt = 0; form = XtCreateManagedWidget("group_form", xmFormWidgetClass, group_pane, NULL, argcnt); frame[0] = XtVaCreateManagedWidget("Inc_Group", xmFrameWidgetClass, form, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 80, NULL ); create_search(frame[0]); frame[1] = XtVaCreateManagedWidget("FListFrame", xmFrameWidgetClass, form, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, frame[0], XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 80, NULL ); gframe_listW = create_framelist(frame[1], 1); frame[2] = XtVaCreateManagedWidget("FListGroup", xmFrameWidgetClass, form, XmNtopAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, frame[1], XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 80, NULL ); ggroup_listW = create_grouplist(frame[2]); rowcol = XtVaCreateManagedWidget("GroupNameRc", xmRowColumnWidgetClass, form, XmNtopAttachment, XmATTACH_POSITION, XmNleftAttachment, XmATTACH_POSITION, XmNnumColumns, 1, XmNorientation, XmHORIZONTAL, XmNradioBehavior, False, XmNpacking, XmPACK_TIGHT, NULL ); create_groupname(rowcol); model_button = create_buttons(form); create_model_selection(model_button); rowcol = XtVaCreateManagedWidget("ManualGroupCtrbRc", xmRowColumnWidgetClass, group_pane, XmNnumColumns, 1, XmNorientation, XmHORIZONTAL, XmNradioBehavior, False, NULL ); create_ctrB(rowcol); }