Bitte um Hilfe
-
Kann mir jemand erklären was diese Funktion macht? Trotz kommentaren versteh ich nicht wie sie arbeitet
// Writes single record in configuration table // *buf --> Points to buffer which receives HTML // idx --> Index of current record (starting with zero) // Returns // Number of generated HTML bytes static int FS20_showrecord (UINT8 *buf, int idx) { static char *input_radio_start = "<INPUT TYPE=RADIO"; static char *input_text_start = "<INPUT TYPE=TEXT"; static char *input_end = ">"; static char *comment_start = " <!--"; static char *comment_mark = "°<!--"; static char *comment_learn = "<marquee>+</marquee><!--"; static char *comment_end = " -->"; // Dynamic char link[] = {0,0}; char *name = FS20_ee_readname(idx); char type = FS20_ee_readtype(idx); int idx3 = idx * 3; link[0] = FS20_ee_readlink(idx) + '0'; return sprintf ( buf, "<TR ALIGN=CENTER>" "<TH>" "%d" "</TH>" "<TD>" "%s NAME='%x' MAXLENGTH=20%s%s" "</TD>" "<TD>" "%s NAME='%x' MAXLENGTH=1 SIZE=1 VALUE='-'%s%s" "</TD>" "<TD>" "%s NAME='%x' VALUE='%x'%s" "</TD>" "<TD>" "%s NAME='%x' VALUE='%x'%s" "</TD>" "<TD>" "%s NAME='%x' VALUE='%x'%s" "</TD>" "</TR>", // Record number (1 is firts record) FS20_LINKNUMBER(idx), // Record name type == FS20_RT_EMPTY ? input_text_start : comment_start, WEB_FS20_TEXT, type == FS20_RT_EMPTY ? input_end : comment_end, type == FS20_RT_EMPTY ? "" : name, // Link type == FS20_RT_EMPTY ? input_text_start : comment_start, WEB_FS20_RECORDLINK, type == FS20_RT_EMPTY ? input_end : comment_end, type == FS20_RT_EMPTY ? "" : (link[0] == '0' ? "--" : link), // Learn WLAN radio button type == FS20_RT_EMPTY ? input_radio_start : (type == FS20_RT_WLAN ? comment_mark : (type == FS20_RT_LEARN_WLAN ? comment_learn : comment_start)), WEB_FS20_RADIO, WEB_FS20_RADIO + idx3, type == FS20_RT_EMPTY ? input_end : comment_end, // Learn RS232 radio button type == FS20_RT_EMPTY ? input_radio_start : (type == FS20_RT_RS232 ? comment_mark : (type == FS20_RT_LEARN_RS232 ? comment_learn : comment_start)), WEB_FS20_RADIO, WEB_FS20_RADIO + idx3 + 1, type == FS20_RT_EMPTY ? input_end : comment_end, // Release button type != FS20_RT_EMPTY ? input_radio_start : comment_start, WEB_FS20_RADIO, WEB_FS20_RADIO + idx3 + 2, type != FS20_RT_EMPTY ? input_end : comment_end ); }
Und diese Makros sind mir auch suspekt
// Offset of field of FS20_RECORD #define FS20_FIELD_OFFSET(_field_) ((int)&(((FS20_RECORD *)0)->_field_)) // Base of FS20_RECORD in EEPROM #define FS20_RECORD_BASE(_num_) ((_num_)*sizeof(FS20_RECORD)) // Base of field of FS20_RECORD in EEPROM #define FS20_FIELD_BASE(_idx_,_name_) (EE_FS20RECORDS_BASE + FS20_RECORD_BASE(_idx_) + FS20_FIELD_OFFSET(_name_))
Namen und Kommentare sind eindeutig, finde ich, aber ich verstehe die Arbeitsweise nicht.
Danke im Voraus.
-
kannst du vielleicht den ganzen code mitliefern??
was fehlt und was kann ich daraus lesen:/ Writes single record in configuration table // *buf --> Points to buffer which receives HTML // idx --> Index of current record (starting with zero) // Returns // Number of generated HTML bytes static int FS20_showrecord (UINT8 *buf, int idx)/* was ist UINT8 soll das ein unsignet int mit 8 bit sein man müsste schon sehen wo typedef angewant wird woher wass ungefaer bekommt idx*/ { //ist klar hier werden dann die variablen die dann über x = y ? z : a //zugeordnet werden ausgegeben static char *input_radio_start = "<INPUT TYPE=RADIO"; static char *input_text_start = "<INPUT TYPE=TEXT"; static char *input_end = ">"; static char *comment_start = " <!--"; static char *comment_mark = "°<!--"; static char *comment_learn = "<marquee>+</marquee><!--"; static char *comment_end = " -->"; // Dynamic char link[] = {0,0}; char *name = FS20_ee_readname(idx); //wo was macht diese methode char type = FS20_ee_readtype(idx);//und diese??? int idx3 = idx * 3; link[0] = FS20_ee_readlink(idx) + '0';//und diese??? return sprintf ( buf, //das folgende wird in buf gescrieben und der ganze block wird returned "<TR ALIGN=CENTER>" "<TH>" "%d" "</TH>" "<TD>" "%s NAME='%x' MAXLENGTH=20%s%s" "</TD>" "<TD>" "%s NAME='%x' MAXLENGTH=1 SIZE=1 VALUE='-'%s%s" "</TD>" "<TD>" "%s NAME='%x' VALUE='%x'%s" "</TD>" "<TD>" "%s NAME='%x' VALUE='%x'%s" "</TD>" "<TD>" "%s NAME='%x' VALUE='%x'%s" "</TD>" "</TR>", // Record number (1 is firts record) FS20_LINKNUMBER(idx),//wo ist diese methode // Record name type == FS20_RT_EMPTY ? input_text_start : comment_start,//wieso ==?????? WEB_FS20_TEXT, type == FS20_RT_EMPTY ? input_end : comment_end, type == FS20_RT_EMPTY ? "" : name, // Link type == FS20_RT_EMPTY ? input_text_start : comment_start, WEB_FS20_RECORDLINK, type == FS20_RT_EMPTY ? input_end : comment_end, type == FS20_RT_EMPTY ? "" : (link[0] == '0' ? "--" : link), // Learn WLAN radio button type == FS20_RT_EMPTY ? input_radio_start : (type == FS20_RT_WLAN ? comment_mark : (type == FS20_RT_LEARN_WLAN ? comment_learn : comment_start)), WEB_FS20_RADIO, WEB_FS20_RADIO + idx3, type == FS20_RT_EMPTY ? input_end : comment_end, // Learn RS232 radio button type == FS20_RT_EMPTY ? input_radio_start : (type == FS20_RT_RS232 ? comment_mark : (type == FS20_RT_LEARN_RS232 ? comment_learn : comment_start)), WEB_FS20_RADIO, WEB_FS20_RADIO + idx3 + 1, type == FS20_RT_EMPTY ? input_end : comment_end, // Release button type != FS20_RT_EMPTY ? input_radio_start : comment_start, WEB_FS20_RADIO, WEB_FS20_RADIO + idx3 + 2, type != FS20_RT_EMPTY ? input_end : comment_end ); }
du musst schon mehr informationen liefern sonst kann man nicht produktiv analysieren