示例#1
0
文件: mylist.c 项目: sulit/learn
int
main(int argc, char *argv[])
{
	struct L *p = NULL;
	struct L *head;

	int i;

	for (i = 0; i < 10; i++)
	{
		if (!p)
		{
			p = (struct L *)malloc(sizeof(struct L));
			head = p;
			p->v = i;
			p->next = NULL;
		}
		else
		{
			p->next = (struct L *)malloc(sizeof(struct L));
			p = p->next;
			p->v = i;
			p->next = NULL;
		}
	}
	showL(head);
	addvalue(head, 10);
	printf("After add, list L is:\n");
	showL(head);
	
	exit(0);
}
示例#2
0
bool  AngularMotor::setInitialStandUpBack(){
	effect.str("");
	addvalue();
	moveArm(right_side, addraj1, addraj2, addraj3, addraj4);
	moveLeg(right_side, addrlj1, addrlj2, addrlj3, addrlj4, addrlj5, addrlj6);
	moveArm(left_side, addlaj1, addlaj2, addlaj3, addlaj4);
	moveLeg(left_side, addllj1, addllj2, addllj3, addllj4, addllj5, addllj6);
	return true;
}
示例#3
0
void MetaEditor::selectElement()
{
    QStringList codes;
    {
         AddMetadata addelement(GetElementMap(), this);
         if (addelement.exec() == QDialog::Accepted) {
            codes = addelement.GetSelectedEntries();
         }
    }
    foreach(QString code, codes) {
        if (code == "dc:language") {
            QStringList langcodes;
            AddMetadata addvalue(Language::instance()->GetLangMap(), this);
            if (addvalue.exec() == QDialog::Accepted) {
                 langcodes = addvalue.GetSelectedEntries();
            }
            QString lang = "en";
            if (!langcodes.isEmpty()) {
                lang = langcodes.at(0);
            }
            insertRow(code, lang);
        } else if (code == "dc:identifier-isbn") {
            QString content = "urn:isbn:[No data]";
            code = "dc:identifier";
            insertRow(code, content);
        } else if (code == "dc:identifier-issn") {
            QString content = "urn:issn:[No data]";
            code = "dc:identifier";
            insertRow(code, content);
        } else if (code == "dc:identifier-doi") {
            QString content = "urn:doi:[No data]";
            code = "dc:identifier";
            insertRow(code, content);
        } else if (code == "dc:identifier-uuid") {
            QString content = "urn:uuid:[No data]";
            code = "dc:identifier";
            insertRow(code, content);
        } else if ((code == "dc:date") || (code == "dcterms:issued") || (code == "dcterms:created")) {
            QString content = QDate::currentDate().toString(Qt::ISODate);
            insertRow(code, content);
        } else if (code == "dc:type") {
            QString content = "[dictionary,index]";
            insertRow(code, content);
        } else if (code == "dc:creator-aut") {
            code = "dc:creator";
            insertRow(code);
            insertChild(QString("role"),QString("aut"));
            insertChild(QString("scheme"),QString("marc:relators"));
        } else {
            insertRow(code);
        }
    }
}
示例#4
0
void MetaEditor::selectE2Property()
{
    QStringList codes;
    {
        AddMetadata addproperty(GetPropertyMap(), this);
        if (addproperty.exec() == QDialog::Accepted) {
            codes = addproperty.GetSelectedEntries();
        }
    }
    foreach(QString code, codes) {
        if (code.startsWith("dir:")) {
            QStringList parts = code.split(':');
            QString content = parts.at(1);
            insertChild(code, content);
        } else if (code == "opf:scheme") {
            insertChild(code);
        } else if (code == "xml:lang") {
            QStringList langcodes;
            AddMetadata addvalue(Language::instance()->GetLangMap(), this);
            if (addvalue.exec() == QDialog::Accepted) {
                langcodes = addvalue.GetSelectedEntries();
            }
            QString lang= "en";
            if (!langcodes.isEmpty()) {
                lang = langcodes.at(0);
            }
            insertChild(code, lang);
        } else if (code == "opf:role") {
            QStringList rolecodes;
            AddMetadata addrole(MarcRelators::instance()->GetCodeMap(), this);
            if (addrole.exec() == QDialog::Accepted) {
                rolecodes = addrole.GetSelectedEntries();
            }
            QString role = "aut";
            if (!rolecodes.isEmpty()) {
                role = rolecodes.at(0);
            }
            insertChild(code, role);
            code = "opf:scheme";
            QString scheme = "marc:relators";
            insertChild(code, scheme);
        } else {
            insertChild(code);
        }
    }
}
示例#5
0
void MetaEditor::selectProperty()
{
    QStringList codes;
    {
        AddMetadata addproperty(GetPropertyMap(), this);
        if (addproperty.exec() == QDialog::Accepted) {
            codes = addproperty.GetSelectedEntries();
        }
    }
    foreach(QString code, codes) {
        if (code.startsWith("title-type:")) {
            QStringList parts = code.split(':');
            QString content = parts.at(1);
            code = parts.at(0);
            insertChild(code, content);
        } else if (code.startsWith("collection-type:")) {
            QStringList parts = code.split(':');
            QString content = parts.at(1);
            code = parts.at(0);
            insertChild(code, content);
        } else if (code.startsWith("dir:")) {
            QStringList parts = code.split(':');
            QString content = parts.at(1);
            code = parts.at(0);
            insertChild(code, content);
        } else if (code == "source-of") {
            QString content = "pagination";
            insertChild(code, content);
        } else if (code == "group-position") {
            QString content = "1";
            insertChild(code, content);
        } else if (code == "display-seq") {
            QString content = "1";
            insertChild(code, content);
        } else if (code == "scheme") {
            insertChild(code);
        } else if ((code == "altlang") || (code == "xml:lang")) {
            QStringList langcodes;
            AddMetadata addvalue(Language::instance()->GetLangMap(), this);
            if (addvalue.exec() == QDialog::Accepted) {
                langcodes = addvalue.GetSelectedEntries();
            }
            QString lang= "en";
            if (!langcodes.isEmpty()) {
                lang = langcodes.at(0);
            }
            insertChild(code, lang);
        } else if (code == "role") {
            QStringList rolecodes;
            AddMetadata addrole(MarcRelators::instance()->GetCodeMap(), this);
            if (addrole.exec() == QDialog::Accepted) {
                rolecodes = addrole.GetSelectedEntries();
            }
            QString role = "aut";
            if (!rolecodes.isEmpty()) {
                role = rolecodes.at(0);
            }
            insertChild(code, role);
            code = "scheme";
            QString scheme = "marc:relators";
            insertChild(code, scheme);
        } else if (code == "identifier-type") {
            insertChild(code);
            code = "scheme";
            insertChild(code);
        } else {
            insertChild(code);
        }
    }
}
示例#6
0
void MetaEditor::selectE2Element()
{
    QStringList codes;
    {
         AddMetadata addelement(GetElementMap(), this);
         if (addelement.exec() == QDialog::Accepted) {
            codes = addelement.GetSelectedEntries();
         }
    }
    foreach(QString code, codes) {
        if (code == "dc:language") {
            QStringList langcodes;
            AddMetadata addvalue(Language::instance()->GetLangMap(), this);
            if (addvalue.exec() == QDialog::Accepted) {
                 langcodes = addvalue.GetSelectedEntries();
            }
            QString lang = "en";
            if (!langcodes.isEmpty()) {
                lang = langcodes.at(0);
            }
            insertRow(code, lang);
        } else if (code == "dc:identifier-isbn") {
            QString content = tr("[ISBN here]");
            code = "dc:identifier";
            insertRow(code, content);
            insertChild(QString("opf:scheme"), QString("ISBN"));
        } else if (code == "dc:identifier-issn") {
            QString content = tr("[ISSN here]");
            code = "dc:identifier";
            insertRow(code, content);
            insertChild(QString("opf:scheme"), QString("ISSN"));
        } else if (code == "dc:identifier-doi") {
            QString content = tr("[DOI here]");
            code = "dc:identifier";
            insertRow(code, content);
            insertChild(QString("opf:scheme"), QString("DOI"));
        } else if (code == "dc:identifier-uuid") {
            QString content = tr("[UUID here]");
            code = "dc:identifier";
            insertRow(code, content);
            insertChild(QString("opf:scheme"), QString("UUID"));
        } else if (code == "dc:identifier-custom") {
            QString content = tr("[Custom identifier here]");
            code = "dc:identifier";
            insertRow(code, content);
            insertChild(QString("opf:scheme"));
        } else if (code.startsWith("dc:date-")) {
            QStringList parts = code.split('-');
            QString dc_event = parts.at(1);
            code = "dc:date";
            QString content = QDate::currentDate().toString(Qt::ISODate);
            insertRow(code,content);
            insertChild(QString("opf:event"),dc_event);
        } else if (code == "dc:creator-aut") {
            code = "dc:creator";
            QString content = tr("[Author name here]");
            insertRow(code, content);
            insertChild(QString("opf:role"),QString("aut"));
        } else if (code == "dc:creator") {
            code = "dc:creator";
            QString content = tr("[Creator name here]");
            insertRow(code, content);
        } else if (code == "dc:contributor") {
            code = "dc:contributor";
            QString content = tr("[Contributor name here]");
            insertRow(code, content);
        } else {
            insertRow(code);
        }
    }
}