示例#1
0
//
// Decode 41 sequence
//
int decode41(char *data, int len, char *text){
		struct self_s self;
		int ret;
		u8 *pkt_my;
		u32 pkt_my_len;


		pkt_my=data;
		pkt_my_len=len;

		ret=unpack41_structure(pkt_my,pkt_my_len,(char *)&self);
		if (ret==-1) {
			printf("possible not all bytes decoded! (not found last 2 bytes of crc16)\n");
		};

		if (ret==-2){
			return 0;
		};

		print_structure(text,(char *)&self,1);		

		free_structure((char *)&self);


	return 0;
};
示例#2
0
int main(int argc, char *argv[]) {
   
  struct config cfg;
  cfg.match_first = 0; //option (boolean): match first line only
  cfg.starting_db_line = 0;    //option: starting line
  cfg.current_db_line = 0;
  cfg.end_of_match = 0;  //in most cases this will be strlen(speech)
  cfg.var_Header = NULL;
  cfg.var_LL = NULL;
  cfg.speech = NULL; // What the user said.
  cfg.database = NULL; // File to check what command to run
			 // based on what was said.
  cfg.command = NULL; // The command to run.
  
  
  if(parse_args(argc,argv,&cfg) != 0) {
    exit(EXIT_FAILURE);
  }
  str_lower(cfg.speech);  
  get_command(&cfg);

  if(cfg.command) {
    printf("%s\n",cfg.command);
    if(cfg.starting_db_line > 0) { // if we ask for a line, we get one back.
      printf("%d\n",cfg.current_db_line-1);
    }
  }else{
    return 1;
  }
    
  free_structure(&cfg);

  return 0;
}
static void
structure_sweep (void)
{
    rep_struct *x = all_structures;
    all_structures = 0;
    while (x != 0)
    {
	rep_struct *next = x->next;
	if (!rep_GC_CELL_MARKEDP (rep_VAL(x)))
	    free_structure (x);
	else
	{
	    rep_GC_CLR_CELL (rep_VAL(x));
	    x->next = all_structures;
	    all_structures = x;
	}
	x = next;
    }
}
示例#4
0
static INT_PTR CALLBACK ps_dlg_proc(HWND hdlg, UINT msg, WPARAM wp, LPARAM lp)
{
    /* native uses prop name "Structure", but we're not compatible
       with that so we'll prepend "Wine_". */
    static const WCHAR prop_name[] = {'W','i','n','e','_','S','t','r','u','c','t','u','r','e',0};
    ps_struct_t *ps_struct;

    TRACE("(%p, %04x, %08lx, %08lx)\n", hdlg, msg, wp, lp);

    ps_struct = GetPropW(hdlg, prop_name);

    if(msg != WM_INITDIALOG)
    {
        if(!ps_struct)
            return 0;

        if(ps_struct->ps->lpfnHook)
        {
            INT_PTR ret = ps_struct->ps->lpfnHook(hdlg, msg, wp, lp);
            if(ret) return ret;
        }
    }

    switch(msg)
    {
    case WM_INITDIALOG:
    {
        ps_struct = HeapAlloc(GetProcessHeap(), 0, sizeof(*ps_struct));
        ps_struct->ps = (OLEUIPASTESPECIALW*)lp;
        ps_struct->type_name = NULL;
        ps_struct->source_name = NULL;
        ps_struct->link_type_name = NULL;
        ps_struct->link_source_name = NULL;
        ps_struct->app_name = NULL;
        ps_struct->flags = ps_struct->ps->dwFlags;

        SetPropW(hdlg, prop_name, ps_struct);

        if(!(ps_struct->ps->dwFlags & PSF_SHOWHELP))
        {
            ShowWindow(GetDlgItem(hdlg, IDC_OLEUIHELP), SW_HIDE);
            EnableWindow(GetDlgItem(hdlg, IDC_OLEUIHELP), 0);
        }

        if(ps_struct->ps->lpszCaption)
            SetWindowTextW(hdlg, ps_struct->ps->lpszCaption);

        get_descriptors(hdlg, ps_struct);

        init_lists(hdlg, ps_struct);

        update_src_text(hdlg, ps_struct);

        selection_change(hdlg, ps_struct);

        SetFocus(GetDlgItem(hdlg, IDC_PS_DISPLAYLIST));

        if(ps_struct->ps->lpfnHook)
            ps_struct->ps->lpfnHook(hdlg, msg, 0, 0);
        return FALSE; /* use new focus */
    }
    case WM_COMMAND:
        switch(LOWORD(wp))
        {
        case IDC_PS_DISPLAYLIST:
            switch(HIWORD(wp))
            {
            case LBN_SELCHANGE:
                selection_change(hdlg, ps_struct);
                return FALSE;
            default:
                return FALSE;
            }
        case IDC_PS_PASTE:
        case IDC_PS_PASTELINK:
            switch(HIWORD(wp))
            {
            case BN_CLICKED:
                mode_change(hdlg, ps_struct, LOWORD(wp));
                return FALSE;

            default:
                return FALSE;
            }
        case IDC_OLEUIHELP:
            switch(HIWORD(wp))
            {
            case BN_CLICKED:
                post_help_msg(hdlg, ps_struct);
                return FALSE;
            default:
                return FALSE;
            }
        case IDOK:
        case IDCANCEL:
            switch(HIWORD(wp))
            {
            case BN_CLICKED:
                send_end_dialog_msg(hdlg, ps_struct, LOWORD(wp));
                return FALSE;
            default:
                return FALSE;
            }
        }
        return FALSE;
    default:
        if(msg == oleui_msg_enddialog)
        {
            if(wp == IDOK)
                update_structure(hdlg, ps_struct);
            EndDialog(hdlg, wp);
            /* native does its cleanup in WM_DESTROY */
            RemovePropW(hdlg, prop_name);
            free_structure(ps_struct);
            return TRUE;
        }
        return FALSE;
    }

}