예제 #1
0
void IndiGui::CreateNumberWidget(INDI::Property *property, IndiProp *indiProp)
{
   //printf("CreateNumberWidget\n");
   int pos = 0;
   wxStaticText *value;
   wxTextCtrl *entry;
   wxButton *button;
   wxPanel *p;
   wxGridBagSizer *gbs;
   
   INumberVectorProperty *nvp = property->getNumber();
   p = indiProp->panel;
   gbs = indiProp->gbs;
   
   for (pos = 0; pos < nvp->nnp; pos++) {
      gbs->Add(new wxStaticText(p, wxID_ANY, wxString::FromAscii(nvp->np[pos].label)),
	       POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL);
      
      value = new wxStaticText(p, wxID_ANY, wxString::Format(_T("%f"), nvp->np[pos].value));
      indiProp->ctrl[wxString::FromAscii(nvp->np[pos].name)] = value;
      gbs->Add(value, POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL);
      if (nvp->p != IP_RO) {
	 entry = new wxTextCtrl(p, wxID_ANY);
	 indiProp->entry[wxString::FromAscii(nvp->np[pos].name)] = entry;
	 gbs->Add(entry, POS(pos, 2), SPAN(1, 1), wxALIGN_LEFT | wxEXPAND | wxALL);
      }
   }
   if (nvp->p != IP_RO) {
      button = new wxButton(p, wxID_ANY, _T("Set"));
      button->SetClientData(indiProp);
      Connect(button->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(IndiGui::SetButtonEvent));
      gbs->Add(button, POS(0, 3), SPAN(pos, 1), wxALIGN_LEFT | wxALL);
   }
}
예제 #2
0
파일: reduce.c 프로젝트: daveshields/AdaEd
Tuple remove_duplicate_labels(Tuple label_list)
											/*;remove_duplicate_labels*/
{
	Tuple new_label_list = tup_new(0), label_id_set = tup_new(0);
	Fortup ft1, ft2;
	Node tmp_node, tmp_node2, node, label;

	FORTUP(tmp_node = (Node), label_list, ft1);
	    if (N_KIND((node = tmp_node)) == as_simple_name) {
			if (in_label_set(node, label_id_set))
				syntax_err(SPAN(node),"Duplicate label name");
			else {
				/* new_label_list = concatl(new_label_list,initlist(node)); */
				label_id_set = tup_with(label_id_set, (char *)node);
			}
			new_label_list = tup_with(new_label_list, (char *)node);
		}
		else {
			FORTUP(tmp_node2 = (Node), N_LIST(node), ft2);
		    	label = tmp_node2;
				if (in_label_set(label,label_id_set))
					syntax_err(SPAN(label),"Duplicate label name");
				else
					label_id_set = tup_with(label_id_set, (char *)label);
			ENDFORTUP(ft2);
		}
	ENDFORTUP(ft1)
/*
	if (label_id_set != (struct two_pool *)0)
		TFREE(label_id_set->link,label_id_set);
	if (label_list != (struct two_pool *)0)
		TFREE(label_list->link,label_list);
*/
	return(new_label_list);
}
예제 #3
0
파일: reduce.c 프로젝트: daveshields/AdaEd
void check_choices(Node alt_node, char *source)	/*;check_choices*/
{
	Tuple choice_list, others_indices = tup_new(0);
	Node tmp_node, tmp_node2, last_alt = (Node) 0;
	Fortup ft1, ft2;
	int choice_flag = 0;

	FORTUP(tmp_node = (Node), N_LIST(alt_node), ft1);
	    if (N_KIND(tmp_node) != as_pragma) {
			choice_list = N_LIST(N_AST1(tmp_node));
			if (tup_size(choice_list) > 1) {
				FORTUP(tmp_node2 = (Node), choice_list, ft2);
					if (N_KIND(tmp_node2) == as_others
					  || N_KIND(tmp_node2) == as_others_choice) {
						char msg[90];

						sprintf(msg,"The choice OTHERS must appear alone in %s",
						  source);
						syntax_err(SPAN(tmp_node2),msg);
						choice_flag = 1;
						break;
					}
				ENDFORTUP(ft2);
			}
		   	if (!choice_flag) {
				if (N_KIND((Node)choice_list[1]) == as_others
				  || N_KIND((Node)choice_list[1]) == as_others_choice)
					others_indices = tup_with(others_indices, (char *)tmp_node);
			}
			else
				choice_flag = 0;
			last_alt = tmp_node;
		}
	ENDFORTUP(ft1);

	FORTUP(tmp_node = (Node), others_indices, ft1); {
		Node choice;
		char msg[90];

		if (tmp_node == last_alt)
			continue;
		choice = (Node)N_LIST(N_AST1(tmp_node))[1];
		sprintf(msg,"The choice OTHERS must appear last in %s",source);
		syntax_err(SPAN(choice),msg);
	} ENDFORTUP(ft1);
/*
	if (others_indices != (struct two_pool *)0 )
		TFREE(others_indices->link,others_indices);
*/
}
예제 #4
0
void IndiGui::CreateSwitchCombobox(ISwitchVectorProperty *svp, IndiProp *indiProp)
{
   wxChoice *combo;
   wxPanel *p;
   wxGridBagSizer *gbs;
   wxString *choices = new wxString[svp->nsp];
   int i = 0;
   int idx = 0;
   
   p = indiProp->panel;
   gbs = indiProp->gbs;
   for (i = 0; i < svp->nsp; i++){
      if(svp->sp[i].s == ISS_ON)
	 idx = i;
      indiProp->ctrl[wxString::FromAscii(svp->sp[i].name)] = (void *) (intptr_t) i;
      wxString swlbl = wxString::FromAscii(svp->sp[i].label);
      if (! swlbl) swlbl = wxString::FromAscii(svp->sp[i].name);
      choices[i] = swlbl;
   }
   combo = new wxChoice(p, wxID_ANY, wxDefaultPosition, wxDefaultSize, svp->nsp, choices);
   combo->SetSelection(idx);
   combo->SetClientData(indiProp);
   Connect(combo->GetId(), wxEVT_COMMAND_CHOICE_SELECTED,
	   wxCommandEventHandler(IndiGui::SetComboboxEvent));
   gbs->Add(combo, POS(0, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL);
   indiProp->ctrl[wxString::FromAscii(svp->name)] = (void *) combo;
   delete [] choices;
}
예제 #5
0
void IndiGui::OnNewPropertyFromThread(wxThreadEvent& event)
{
    INDI::Property *property = (INDI::Property *) event.GetExtraLong();
    //printf("newproperty from thread %s %s %s\n",property->getDeviceName(),property->getGroupName(),property->getName());
    wxString devname =  wxString::FromAscii(property->getDeviceName());
    wxString groupname =  wxString::FromAscii(property->getGroupName());
    wxString propname =  wxString::FromAscii(property->getName());
    
    IndiProp *indiProp = new IndiProp();
    wxPanel *page;
    wxGridBagSizer *gbs;
    int next_free_row;
    IndiDev *indiDev = (IndiDev *)devlist[devname];
    if (! indiDev) return;
    indiProp->idev = indiDev;
    
    page = (wxPanel *)indiDev->groups[groupname];
    if (! page) {
	page = new wxPanel(indiDev->page);
	indiDev->page->AddPage(page, groupname);
	page->SetSizer(new wxGridBagSizer(0, 20));
	indiDev->groups[groupname] = page;
    }
    
    gbs = (wxGridBagSizer *)page->GetSizer();
    gbs->Layout();
    next_free_row = gbs->GetRows();
    BuildPropWidget(property, page, indiProp);
    
    gbs->Add(indiProp->state, POS(next_free_row, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL);
    gbs->Add(indiProp->name, POS(next_free_row, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL);
    gbs->Add(indiProp->panel,POS(next_free_row, 2), SPAN(1, 1), wxALIGN_LEFT | wxEXPAND | wxALL);
    gbs->Layout();
    page->Fit();
    panel->Fit();
    page->Show();
    indiDev->properties[propname] = indiProp;
    indiDev->page->Fit();
    indiDev->page->Layout();
    indiDev->page->Show();
    sizer->Layout();
    Fit();
}
예제 #6
0
파일: reduce.c 프로젝트: daveshields/AdaEd
static void pragma_warning(Node pragma_node)			/*;pragma_warning*/
{
	/* Give a warning that a pragma is ignored. */

	char msg[MAXLINE + 30];

#define id (N_AST1(pragma_node))
	sprintf(msg,"Pragma %s is ignored", namelist(N_ID(id)));
	prs_warning(SPAN(pragma_node),msg);
#undef id
}
예제 #7
0
파일: reduce.c 프로젝트: daveshields/AdaEd
void check_discrete_range(Node discrete_range) /*;check_discrete_range*/
{
	/* Check whether a discrete range node is valid. */

	switch (N_KIND(discrete_range))
	{
	case as_range_expression :
#define name (N_AST1(discrete_range))
		if (!check_expanded_name(name))
			syntax_err(SPAN(discrete_range),
			  "Invalid discrete_range specification");
		else
			N_KIND(discrete_range) = as_name;
		break;
#undef name
	case as_range_attribute :
	case as_subtype :
		break;
	default :
		syntax_err(SPAN(discrete_range),
		  "Invalid discrete_range specification");
	}
}
예제 #8
0
void IndiGui::CreateSwitchCheckbox(ISwitchVectorProperty *svp, IndiProp *indiProp)
{
   wxPanel *p;
   wxGridBagSizer *gbs;
   int pos = 0;
   
   p = indiProp->panel;
   gbs = indiProp->gbs;
   for (pos = 0; pos < svp->nsp; pos++){
      wxString swlbl = wxString::FromAscii(svp->sp[pos].label);
      if (! swlbl) swlbl = wxString::FromAscii(svp->sp[pos].name);
      wxCheckBox *button = new wxCheckBox(p, wxID_ANY, swlbl);
      indiProp->ctrl[wxString::FromAscii(svp->sp[pos].name)] = button;
      if (svp->sp[pos].s == ISS_ON)
	 button->SetValue(true);
      button->SetClientData(indiProp);
      Connect(button->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED,
	      wxCommandEventHandler(IndiGui::SetCheckboxEvent));
      gbs->Add(button, POS(pos / 4, pos % 4), SPAN(1, 1), wxALIGN_LEFT | wxALL);
   }
}
예제 #9
0
파일: reduce.c 프로젝트: daveshields/AdaEd
void check_pragmas(Node pragma_node, int (*allowed_test)(int))
													/*;check_pragmas*/
{
	/* Check that a pragma is valid. */

	Tuple new_list = tup_new(0);
	Node tmp_node;
	Fortup ft1;
	int id;

	if (N_LIST(pragma_node) != (Tuple)0) {
		FORTUP(tmp_node = (Node), N_LIST(pragma_node), ft1);
			id = N_ID(N_AST1(tmp_node));
			if (is_pragma(id) && (*allowed_test)(id - MIN_PRAGMA)) {
				if (strcmp(namelist(id),"PRIORITY")
				  && strcmp(namelist(id),"ELABORATE")
				  && strcmp(namelist(id),"INTERFACE")) {
					pragma_warning(tmp_node);
				}
				else
					new_list = tup_with(new_list, (char *)tmp_node);
			}
			else if (is_pragma(id) && ispredef_pragma[id - MIN_PRAGMA]) {
				char msg[200];

				sprintf(msg,"Pragma %s is not valid in this context",
				  namelist(id));
				prs_warning(SPAN(tmp_node),msg);
			}
			else if (!(is_pragma(id) && isimpldef_pragma[id - MIN_PRAGMA])
			  && strcmp(namelist(id),"OPTIMIZE")) {
				pragma_warning(tmp_node);
			}
			else
				new_list = tup_with(new_list, (char *)tmp_node);
		ENDFORTUP(ft1);
		N_LIST(pragma_node) = new_list;
	}
}
예제 #10
0
void IndiGui::CreateSwitchButton(ISwitchVectorProperty *svp, IndiProp *indiProp)
{
   wxPanel *p;
   wxGridBagSizer *gbs;
   int pos = 0;
   
   p = indiProp->panel;
   gbs = indiProp->gbs;
   for (pos = 0; pos < svp->nsp; pos++){
      wxString swlbl = wxString::FromAscii(svp->sp[pos].label);
      if (! swlbl) swlbl = wxString::FromAscii(svp->sp[pos].name);
      wxToggleButton *button = new wxToggleButton(p, wxID_ANY, swlbl);
      indiProp->ctrl[wxString::FromAscii(svp->sp[pos].name)] = button;
      if (svp->sp[pos].s == ISS_ON)
         button->SetValue(true);
      button->SetClientData(indiProp);
      Connect(button->GetId(), wxEVT_COMMAND_TOGGLEBUTTON_CLICKED,
      wxCommandEventHandler(IndiGui::SetToggleButtonEvent));
      if (!allow_connect_disconnect && strcmp(svp->name,"CONNECTION")==0) {
        button->Enable(false);
      }
      gbs->Add(button, POS(0, pos), SPAN(1, 1), wxALIGN_LEFT | wxALL);
   }
}
예제 #11
0
INDIConfig::INDIConfig(wxWindow *parent, int devtype) : wxDialog(parent, wxID_ANY, (const wxString)_T("INDI Configuration"))
{
    dev_type = devtype;
    int pos;
    wxGridBagSizer *gbs = new wxGridBagSizer(0, 20);
    wxBoxSizer *sizer;

    pos = 0;
    gbs->Add(new wxStaticText(this, wxID_ANY, _T("Hostname:")),
	     POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL);
    host = new wxTextCtrl(this, wxID_ANY);
    gbs->Add(host, POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxEXPAND);

    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _T("Port:")),
	     POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL);
    port = new wxTextCtrl(this, wxID_ANY);
    gbs->Add(port, POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxEXPAND);
    
    pos ++;
    connect_status = new wxStaticText(this, wxID_ANY, _T("Disconnected"));
    gbs->Add(connect_status,POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL);
    gbs->Add(new wxButton(this, MCONNECT, _T("Connect")), POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxEXPAND);
    
    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _T("========")),
	     POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL);
    devlabel = new wxStaticText(this, wxID_ANY, _T("Device"));
    gbs->Add(devlabel,POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL);
    if (devtype == TYPE_CAMERA) {
	devlabel->SetLabel(_T("Camera"));
    }
    else if (devtype == TYPE_MOUNT) {
	devlabel->SetLabel(_T("Mount"));
    }
    
    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _T("Driver:")),
	     POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL);
    dev =  new wxComboBox(this, wxID_ANY, _T(""));
    gbs->Add(dev, POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxEXPAND);

    if (devtype == TYPE_CAMERA) {
	pos ++;
	gbs->Add(new wxStaticText(this, wxID_ANY, _T("CCD:")),
		 POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL);
	ccd =  new wxComboBox(this, wxID_ANY, _T(""));
	gbs->Add(ccd, POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxEXPAND);
	ccd->Append(_T("Main imager"));
	ccd->Append(_T("Guider"));
    }
    
    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _T("Port:")),
	     POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL);
    devport = new wxTextCtrl(this, wxID_ANY);
    gbs->Add(devport, POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL | wxEXPAND);
    

    sizer = new wxBoxSizer(wxVERTICAL) ;
    sizer->Add(gbs);
    sizer->Add(CreateButtonSizer(wxOK | wxCANCEL));
    SetSizer(sizer);
    sizer->SetSizeHints(this) ;
    sizer->Fit(this) ;
}
예제 #12
0
INDIConfig::INDIConfig(wxWindow *parent, int devtype) :
    wxDialog(parent, wxID_ANY, _("INDI Configuration"),
    wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
    auto sizerLabelFlags  = wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL;
    auto sizerButtonFlags = wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL;
    auto sizerSectionFlags = wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL;
    auto sizerTextFlags = wxALIGN_LEFT | wxALL | wxEXPAND;
    int border = 2;

    dev_type = devtype;
    gui = NULL;
    
    int pos;
    wxGridBagSizer *gbs = new wxGridBagSizer(0, 20);
    wxBoxSizer *sizer;

    pos = 0;
    gbs->Add(new wxStaticText(this, wxID_ANY, _("INDI Server")),
	     POS(pos, 0), SPAN(1, 1), sizerSectionFlags, border);

    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _("Hostname")),
	     POS(pos, 0), SPAN(1, 1), sizerLabelFlags, border);
    host = new wxTextCtrl(this, wxID_ANY);
    gbs->Add(host, POS(pos, 1), SPAN(1, 1), sizerTextFlags, border);

    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _("Port")),
	     POS(pos, 0), SPAN(1, 1), sizerLabelFlags, border);
    port = new wxTextCtrl(this, wxID_ANY);
    gbs->Add(port, POS(pos, 1), SPAN(1, 1), sizerTextFlags, border);
    
    pos ++;
    connect_status = new wxStaticText(this, wxID_ANY, _("Disconnected"));
    gbs->Add(connect_status,POS(pos, 0), SPAN(1, 1), wxALIGN_RIGHT | wxALL | wxALIGN_CENTER_VERTICAL, border);
    gbs->Add(new wxButton(this, MCONNECT, _("Connect")), POS(pos, 1), SPAN(1, 1), sizerButtonFlags, border);
    
    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _T("========")),
	     POS(pos, 0), SPAN(1, 1), wxALIGN_LEFT | wxALL, border);
    devlabel = new wxStaticText(this, wxID_ANY, _("Device"));
    if (devtype == TYPE_CAMERA) {
	devlabel->SetLabel(_("Camera"));
    }
    else if (devtype == TYPE_MOUNT) {
	devlabel->SetLabel(_("Mount"));
    }
    gbs->Add(devlabel,POS(pos, 1), SPAN(1, 1), wxALIGN_LEFT | wxALL, border);
    
    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _("Driver")),
	     POS(pos, 0), SPAN(1, 1), sizerLabelFlags, border);
    dev =  new wxComboBox(this, wxID_ANY, _T(""));
    gbs->Add(dev, POS(pos, 1), SPAN(1, 1), sizerTextFlags, border);

    if (devtype == TYPE_CAMERA) {
	pos ++;
	gbs->Add(new wxStaticText(this, wxID_ANY, _("CCD")),
		 POS(pos, 0), SPAN(1, 1), sizerLabelFlags, border);
	ccd =  new wxComboBox(this, wxID_ANY, _T(""));
	ccd->Append(_("Main imager"));
	ccd->Append(_("Guider"));
	gbs->Add(ccd, POS(pos, 1), SPAN(1, 1), sizerTextFlags, border);
    }
    
    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _("Port")),
	     POS(pos, 0), SPAN(1, 1), sizerLabelFlags, border);
    devport = new wxTextCtrl(this, wxID_ANY);
    gbs->Add(devport, POS(pos, 1), SPAN(1, 1), sizerTextFlags, border);

    pos ++;
    gbs->Add(new wxStaticText(this, wxID_ANY, _("Other options")),
	     POS(pos, 0), SPAN(1, 1), sizerLabelFlags, border);
    gbs->Add(new wxButton(this, MINDIGUI, _("INDI")), POS(pos, 1), SPAN(1, 1), sizerButtonFlags, border);

    sizer = new wxBoxSizer(wxVERTICAL) ;
    sizer->Add(gbs);
    sizer->AddSpacer(10);
    sizer->Add(CreateButtonSizer(wxOK | wxCANCEL));
    sizer->AddSpacer(10);
    SetSizer(sizer);
    sizer->SetSizeHints(this) ;
    sizer->Fit(this) ;
}
예제 #13
0
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>


/*
 * Build mapping between variables and indexes of sorted scored tuples
 *
 * The overall scheme is:
 * variable -> index of score/tuple index pair -> tuple
 *
 * Thus, for every variable we have access to sorted scores and associated tuple
 */
void build_var_to_tupix(
    SPAN(deque_t) var_to_tupix,
    SPAN(indexed_score_t) indexed_scores,
    SPAN(var_t) tuples,
    const size_t tup_dim
    )
{
    const uint64_t time0 = timestamp();

    size_t six = 0;

    for (six = 0; six < indexed_scores.sz; ++six)
    {
        const size_t tix = indexed_scores.ptr[six].first;

        size_t vix = 0;
        for (vix = 0; vix < tup_dim; ++vix)
int main()
{
    {
        deque_t d = new_deque();

        SPAN(tuple_ix_t) span = deque_as_span(&d);
        assert(span.ptr == NULL);
        assert(span.sz == 0);

        deque_free(&d);
    }

    {
        deque_t d = new_deque();

        deque_push_back(&d, 1234);

        SPAN(tuple_ix_t) span = deque_as_span(&d);
        assert(span.ptr != NULL);
        assert(span.sz == 1);
        assert(span.ptr[0] == 1234);

        deque_free(&d);
        free(span.ptr);
    }

    {
        deque_t d = new_deque();
        enum {NREP = 40000};

        size_t ix = 0;
        for (ix = 0; ix < NREP; ++ix)
        {
            deque_push_back(&d, ix + 1234);
        }

        SPAN(tuple_ix_t) span = deque_as_span(&d);
        assert(span.ptr != NULL);
        assert(span.sz == NREP);
        for (ix = 0; ix < NREP; ++ix)
        {
            assert(span.ptr[ix] == (ix + 1234));
        }

        deque_free(&d);
        free(span.ptr);
    }

    {
        deque_t d = new_deque();
        enum {NREP = 40000000};

        size_t ix = 0;
        for (ix = 0; ix < NREP; ++ix)
        {
            deque_push_back(&d, ix + 1234);
        }

        SPAN(tuple_ix_t) span = deque_as_span(&d);
        assert(span.ptr != NULL);
        assert(span.sz == NREP);
        for (ix = 0; ix < NREP; ++ix)
        {
            assert(span.ptr[ix] == (ix + 1234));
        }

        deque_free(&d);
        free(span.ptr);
    }


    return 0;
}
예제 #15
0
파일: message2.c 프로젝트: clokep/libgadu
	gg_encoding_t encoding;
	const char *attr;
	size_t attr_len;
};

#define SPAN(text) "<span style=\"color:#000000; " \
	"font-family:'MS Shell Dlg 2'; font-size:9pt; \">" text "</span>"
#define SPAN_COLOR(color, text) "<span style=\"color:#" color "; " \
	"font-family:'MS Shell Dlg 2'; font-size:9pt; \">" text "</span>"

const struct test_data text_to_html[] =
{
	/* style:maxlinelength:start-ignore */

	/* Typowa wiadomość */
	{ "<bzdura>\n\"ala&ma'kota\"", SPAN("&lt;bzdura&gt;<br>&quot;ala&amp;ma&apos;kota&quot;"), GG_ENCODING_UTF8, NULL, 0 },

	/* Obrazek na początku tekstu */
	{ " test", "<img name=\"8877665544332211\">" SPAN("test"), GG_ENCODING_UTF8, "\x00\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 13 },

	/* Obrazek na początku tekstu, dokładnie tak jak wysyła oryginalny klient */
	{ "\xa0test", "<img name=\"8877665544332211\">" SPAN("test"), GG_ENCODING_CP1250, "\x01\x00\x08\x00\x00\x00\x00\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 19 },

	/* Obrazek na końcu tekstu */
	{ "test", SPAN("test<img name=\"8877665544332211\">"), GG_ENCODING_UTF8, "\x04\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 13 },

	/* Obrazek na końcu tekstu, dokładnie tak jak wysyła oryginalny klient */
	{ "test\xa0", SPAN("test<img name=\"8877665544332211\">"), GG_ENCODING_CP1250, "\x00\x00\x08\x00\x00\x00\x04\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 19 },

	/* Obrazek w środku tekstu */
	{ "test test", SPAN("test<img name=\"8877665544332211\">test"), GG_ENCODING_UTF8, "\x04\x00\x80\x09\x01\x11\x22\x33\x44\x55\x66\x77\x88", 13 },