Example #1
0
File: go.c Project: Novator/geany
static void parseFunctionOrMethod (tokenInfo *const token)
{
	// FunctionDecl = "func" identifier Signature [ Body ] .
	// Body         = Block.
	//
	// MethodDecl   = "func" Receiver MethodName Signature [ Body ] .
	// Receiver     = "(" [ identifier ] [ "*" ] BaseTypeName ")" .
	// BaseTypeName = identifier .

	// Skip over receiver.
	readToken (token);
	if (isType (token, TOKEN_OPEN_PAREN))
		skipToMatched (token);

	if (isType (token, TOKEN_IDENTIFIER))
	{
		makeTag (token, GOTAG_FUNCTION);
		
		// Skip over parameters.
		readToken (token);
		skipToMatched (token);

		// Skip over result.
		skipType (token);

		// Skip over function body.
		if (isType (token, TOKEN_OPEN_CURLY))
			skipToMatched (token);
	}
}
Example #2
0
//**************************************************************************
void fatpredict_t::overwrite( int32 entry, la_t vpc, uint64 accesses )
{
  ASSERT( entry < m_num_entries );
  ASSERT( entry >= 0 );
  m_fatarray[entry].m_tag = makeTag( vpc );
  m_fatarray[entry].m_accesses = accesses;
  m_fatarray[entry].clearPredict( m_history_bits );
}
Example #3
0
//**************************************************************************
int32 fatpredict_t::searchTable( la_t vpc )
{
  for (int32 i = 0; i < m_num_entries; i++) {
    if (m_fatarray[i].m_tag == makeTag( vpc )) {
      return (i);
    }
  }
  return (-1);
}
Example #4
0
static void
possiblyMakeTag (struct p6Ctx *ctx, const char *s, int len)
{
    Assert(ctx->n_tokens > 0);
    enum perl6Kind kind = token2kind[ ctx->tokens[ctx->n_tokens - 1] ];
    if (K_NONE != kind && perl6Kinds[kind].enabled
                       && (len = trimIdentifier(kind, &s, len)) > 0)
        makeTag(ctx, kind, s, len);
}
Example #5
0
void ParseXML::chars(const char* text, int textlen) {
	// The text is not zero terminated; thus we need the  length:
	string str(text, textlen);
	// The text is likely to have trailing white space, e.g. newline, etc
	stripTrailWhiteSpace(str);

	if (str.size())
		xmlData.insert(std::pair<string, string>(makeTag(), str));
}
Example #6
0
File: go.c Project: 15ramky/geany
static void parseFunctionOrMethod (tokenInfo *const token)
{
	// FunctionDecl = "func" identifier Signature [ Body ] .
	// Body         = Block.
	//
	// MethodDecl   = "func" Receiver MethodName Signature [ Body ] .
	// Receiver     = "(" [ identifier ] [ "*" ] BaseTypeName ")" .
	// BaseTypeName = identifier .

	// Skip over receiver.
	readToken (token);
	if (isType (token, TOKEN_OPEN_PAREN))
		skipToMatched (token);

	if (isType (token, TOKEN_IDENTIFIER))
	{
		vString *argList;
		tokenInfo *functionToken = copyToken (token);

		// Start recording signature
		signature = vStringNew ();

		// Skip over parameters.
		readToken (token);
		skipToMatchedNoRead (token);

		vStringStripLeading (signature);
		vStringStripTrailing (signature);
		argList = signature;
		signature = vStringNew ();

		readToken (token);

		// Skip over result.
		skipType (token);

		// Remove the extra { we have just read
		vStringStripTrailing (signature);
		vStringChop (signature);

		vStringStripLeading (signature);
		vStringStripTrailing (signature);
		makeTag (functionToken, GOTAG_FUNCTION, NULL, GOTAG_UNDEFINED, argList->buffer, signature->buffer);
		deleteToken (functionToken);
		vStringDelete(signature);
		vStringDelete(argList);

		// Stop recording signature
		signature = NULL;

		// Skip over function body.
		if (isType (token, TOKEN_OPEN_CURLY))
			skipToMatched (token);
	}
}
Example #7
0
File: go.c Project: Dev0Null/ctags
static void parsePackage (tokenInfo *const token)
{
	readToken (token);
	if (isType (token, TOKEN_IDENTIFIER))
	{
		makeTag (token, GOTAG_PACKAGE, NULL, GOTAG_UNDEFINED, NULL);
		if (!scope && isXtagEnabled(XTAG_QUALIFIED_TAGS))
		{
			scope = vStringNew ();
			vStringCopy (scope, token->string);
		}
	}
}
Example #8
0
File: go.c Project: 15ramky/geany
static void parsePackage (tokenInfo *const token)
{
	readToken (token);
	if (isType (token, TOKEN_IDENTIFIER))
	{
		makeTag (token, GOTAG_PACKAGE, NULL, GOTAG_UNDEFINED, NULL, NULL);
		if (!scope && Option.include.qualifiedTags)
		{
			scope = vStringNew ();
			vStringCopy (scope, token->string);
		}
	}
}
Example #9
0
File: go.c Project: Novator/geany
static void parseConstTypeVar (tokenInfo *const token, goKind kind)
{
	// ConstDecl      = "const" ( ConstSpec | "(" { ConstSpec ";" } ")" ) .
	// ConstSpec      = IdentifierList [ [ Type ] "=" ExpressionList ] .
	// IdentifierList = identifier { "," identifier } .
	// ExpressionList = Expression { "," Expression } .
	// TypeDecl     = "type" ( TypeSpec | "(" { TypeSpec ";" } ")" ) .
	// TypeSpec     = identifier Type .
	// VarDecl     = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) .
	// VarSpec     = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .
	boolean usesParens = FALSE;

	readToken (token);

	if (isType (token, TOKEN_OPEN_PAREN))
	{
		usesParens = TRUE;
		readToken (token);
	}

	do
	{
		while (!isType (token, TOKEN_EOF))
		{
			if (isType (token, TOKEN_IDENTIFIER))
			{
				makeTag (token, kind);
				readToken (token);
			}
			if (!isType (token, TOKEN_COMMA))
				break;
			readToken (token);
		}

		skipType (token);
		while (!isType (token, TOKEN_SEMICOLON) && !isType (token, TOKEN_CLOSE_PAREN)
				&& !isType (token, TOKEN_EOF))
		{
			readToken (token);
			skipToMatched (token);
		}

		if (usesParens && !isType (token, TOKEN_CLOSE_PAREN))
		{
			// we are at TOKEN_SEMICOLON
			readToken (token);
		}
	}
	while (!isType (token, TOKEN_EOF) &&
			usesParens && !isType (token, TOKEN_CLOSE_PAREN));
}
Example #10
0
int
blogatom_main()
{
	char userid[IDLEN + 1];
	struct Blog blog;
	int n, i;

	printf("Content-type: text/xml; charset=utf-8\r\n\r\n");
	printf("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
	       "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:lang=\"zh-CN\">");

	strsncpy(userid, getparm2("U", "userid"), sizeof (userid));
	if (openBlog(&blog, userid) < 0) {
		printf("<title>该 Blog 尚不存在</title>");
		printf("<link href=\"http://" MY_BBS_DOMAIN "\" />");
		goto END;
	}
	printf("<id>%s</id>", makeTag(&blog, NULL));
	printf("<title>%s</title>", nohtml(blog.config->title));
	printf("<link href=\"blog?U=%s\" />", blog.config->useridEN);
	printf("<link rel=\"self\" href=\"blogatom?U=%s\" />",
	       blog.config->useridEN);
	printf("<author><name>%s</name></author>", blog.config->useridUTF8);
	printf("<updated>%s</updated>", atomctime(&blog.indexFile.mtime));
	//tagline...
	//id...
	//generator...

	for (i = blog.nIndex - 1, n = 0; i >= 0 && n < 30; i--) {
		if (now_t - blog.index[i].fileTime > 7 * 24 * 3600 && n > 10)
			break;
		printEntry(&blog, i);
	}

	closeBlog(&blog);
      END:
	printf("</feed>");
	return 0;
}
Example #11
0
static void
printEntry(struct Blog *blog, int i)
{
	struct BlogHeader *blh;
	char buf[256];
	blh = &blog->index[i];
	printf("<entry>");
	printf("<title>%s</title>", nohtml(blh->title));
	printf("<link href=\"blogread?U=%s&amp;T=%d\" />",
	       blog->config->useridEN, (int) blh->fileTime);
	printf("<id>%s</id>", makeTag(blog, &blh->fileTime));
	printf("<updated>%s</updated>", atomctime(&blh->fileTime));

	//printf("<author><name>%s</name></author>", blog->config->useridUTF8);
	//printf("<issued>%s</issued>", gmtctime(&blh->fileTime));
	/*
	   for (i = 0; i < blog->nTag; i++) {
	   if (!*blog->tag[i].title || !blog->tag[i].count
	   || blog->tag[i].hide)
	   continue;
	   printf("<category>%s</category>", nohtml(blog->tag[i].title));
	   } */

	printf("<summary type=\"html\"><![CDATA[");
	if (blh->hasAbstract) {
		setBlogAbstract(buf, blog->userid, blh->fileTime);
		showfile(buf);
		printf
		    ("<br /><a href=\"blogread?U=%s&amp;T=%d\">(继续阅读...)</a>",
		     blog->config->useridEN, (int) blh->fileTime);
	} else {
		setBlogPost(buf, blog->userid, blh->fileTime);
		showfile(buf);
	}
	printf("]]></summary>");
	printf("</entry>");
}
Example #12
0
File: go.c Project: Dev0Null/ctags
static void parseConstTypeVar (tokenInfo *const token, goKind kind)
{
	// ConstDecl      = "const" ( ConstSpec | "(" { ConstSpec ";" } ")" ) .
	// ConstSpec      = IdentifierList [ [ Type ] "=" ExpressionList ] .
	// IdentifierList = identifier { "," identifier } .
	// ExpressionList = Expression { "," Expression } .
	// TypeDecl     = "type" ( TypeSpec | "(" { TypeSpec ";" } ")" ) .
	// TypeSpec     = identifier Type .
	// VarDecl     = "var" ( VarSpec | "(" { VarSpec ";" } ")" ) .
	// VarSpec     = IdentifierList ( Type [ "=" ExpressionList ] | "=" ExpressionList ) .
	boolean usesParens = FALSE;

	readToken (token);

	if (isType (token, TOKEN_OPEN_PAREN))
	{
		usesParens = TRUE;
		readToken (token);
	}

	do
	{
		tokenInfo *typeToken = NULL;

		while (!isType (token, TOKEN_EOF))
		{
			if (isType (token, TOKEN_IDENTIFIER))
			{
				if (kind == GOTAG_TYPE)
				{
					typeToken = copyToken (token);
					readToken (token);
					if (isKeyword (token, KEYWORD_struct))
						makeTag (typeToken, GOTAG_STRUCT, NULL, GOTAG_UNDEFINED, NULL);
					else if (isKeyword (token, KEYWORD_interface))
						makeTag (typeToken, GOTAG_INTERFACE, NULL, GOTAG_UNDEFINED, NULL);
					else
						makeTag (typeToken, kind, NULL, GOTAG_UNDEFINED, NULL);
					break;
				}
				else
					makeTag (token, kind, NULL, GOTAG_UNDEFINED, NULL);
				readToken (token);
			}
			if (!isType (token, TOKEN_COMMA))
				break;
			readToken (token);
		}

		if (typeToken)
		{
			if (isKeyword (token, KEYWORD_struct))
				parseStructMembers (token, typeToken);
			else
				skipType (token);
			deleteToken (typeToken);
		}
		else
			skipType (token);

		while (!isType (token, TOKEN_SEMICOLON) && !isType (token, TOKEN_CLOSE_PAREN)
				&& !isType (token, TOKEN_EOF))
		{
			readToken (token);
			skipToMatched (token);
		}

		if (usesParens && !isType (token, TOKEN_CLOSE_PAREN))
		{
			// we are at TOKEN_SEMICOLON
			readToken (token);
		}
	}
	while (!isType (token, TOKEN_EOF) &&
			usesParens && !isType (token, TOKEN_CLOSE_PAREN));
}
Example #13
0
File: go.c Project: Dev0Null/ctags
static void parseStructMembers (tokenInfo *const token, tokenInfo *const parent_token)
{
	// StructType     = "struct" "{" { FieldDecl ";" } "}" .
	// FieldDecl      = (IdentifierList Type | AnonymousField) [ Tag ] .
	// AnonymousField = [ "*" ] TypeName .
	// Tag            = string_lit .

	readToken (token);
	if (!isType (token, TOKEN_OPEN_CURLY))
		return;

	readToken (token);
	while (!isType (token, TOKEN_EOF) && !isType (token, TOKEN_CLOSE_CURLY))
	{
		tokenInfo *memberCandidate = NULL;
		boolean first = TRUE;

		while (!isType (token, TOKEN_EOF))
		{
			if (isType (token, TOKEN_IDENTIFIER))
			{
				if (first)
				{
					// could be anonymous field like in 'struct {int}' - we don't know yet
					memberCandidate = copyToken (token);
					first = FALSE;
				}
				else
				{
					if (memberCandidate)
					{
						// if we are here, there was a comma and memberCandidate isn't an anonymous field
						makeTag (memberCandidate, GOTAG_MEMBER, parent_token, GOTAG_STRUCT, NULL);
						deleteToken (memberCandidate);
						memberCandidate = NULL;
					}
					makeTag (token, GOTAG_MEMBER, parent_token, GOTAG_STRUCT, NULL);
				}
				readToken (token);
			}
			if (!isType (token, TOKEN_COMMA))
				break;
			readToken (token);
		}

		// in the case of  an anonymous field, we already read part of the
		// type into memberCandidate and skipType() should return FALSE so no tag should
		// be generated in this case.
		if (skipType (token) && memberCandidate)
			makeTag (memberCandidate, GOTAG_MEMBER, parent_token, GOTAG_STRUCT, NULL);

		if (memberCandidate)
			deleteToken (memberCandidate);

		while (!isType (token, TOKEN_SEMICOLON) && !isType (token, TOKEN_CLOSE_CURLY)
				&& !isType (token, TOKEN_EOF))
		{
			readToken (token);
			skipToMatched (token);
		}

		if (!isType (token, TOKEN_CLOSE_CURLY))
		{
			// we are at TOKEN_SEMICOLON
			readToken (token);
		}
	}
}
Example #14
0
void ParseXML::start(const char* el, const char* attr[]) {
	tagNames.push_back(el);

	for (int i = 0; attr[i]; i += 2)
		xmlData.insert(std::make_pair(makeTag(attr[i]), attr[i + 1]));
}
	void MakeViewCodeSequence(DataSet &data_set, View view)
	{
		Sequence view_seq;
		DataSet view_ds;
		ViewCodeSequenceEntry entry;
         
		switch(view)
		{
			case ML:
					entry=ViewCodeSequenceEntry("R-10224","SNM3","medio-lateral");
					break;
			case MLO:
					entry=ViewCodeSequenceEntry("R-10226","SNM3","medio-lateral oblique");
					break;
			case LM:
					entry=ViewCodeSequenceEntry("R-10228","SNM3","latero-medial");
					break;
			case LMO:
					entry=ViewCodeSequenceEntry("R-10230","SNM3","lateral-medio oblique");
					break;
			case CC:
					//entry.view_code_value = "R-10242";
					//entry.view_coding_scheme_designator = "SNM3";
					//entry.view_code_meaning = "cranio-caudal";
					entry=ViewCodeSequenceEntry("R-10242","SNM3","cranio-caudal");
					break;
			case FB:
					entry=ViewCodeSequenceEntry("R-10244","SNM3","cranio-caudal (from below)");
					break;
			case SIO:
					entry=ViewCodeSequenceEntry("R-102D0","SNM3","superlateral to inferomedial oblique");
					break;
			case XCC:
					entry=ViewCodeSequenceEntry("R-102CF","SNM3","exaggerated cranio-caudal");
					break;
			case XCCL:
					entry=ViewCodeSequenceEntry("R-1024A","SRT","cranio-caudal exaggerated laterally");
					break;
			case XCCM:
					entry=ViewCodeSequenceEntry("R-1024B","SRT","cranio-caudal exaggerated medially");
					break;
			default:
					throw dicom::exception("Unknown view type specified.");
		}

		//populate dataset
		view_ds.Put<VR_SH>(TAG_CODE_VALUE, entry.view_code_value);//T1
		view_ds.Put<VR_SH>(TAG_CODING_SCHEME_DESIGNATOR, entry.view_coding_scheme_designator);//T1
		view_ds.Put<VR_SH>(TAG_CODE_MEANING, entry.view_code_meaning);//T1

		//make empty view modifier sequence
		dicom::Sequence view_modifier_seq;
		dicom::DataSet view_modifier_ds;
		view_modifier_seq.push_back(view_modifier_ds);
		view_ds.Put<VR_SQ>(makeTag(0x0054, 0x0222), view_modifier_seq);


		view_seq.push_back(view_ds);

		////make empty view modifier sequence
		//dicom::Sequence view_modifier_seq;
		//dicom::DataSet view_modifier_ds;
		//view_modifier_seq.push_back(view_modifier_ds);
		//view_ds.Put<VR_SQ>(makeTag(0x0054, 0x0222), view_modifier_seq);

		data_set.erase(makeTag(0x0054, 0x0220));
		data_set.Put<VR_SQ>(makeTag(0x0054, 0x0220),view_seq);
	}
Example #16
0
void Network::sendList() {
	std::ostringstream tmp;
	uint32_t tagCount = 0;
	SchedBase &s = SchedBase::instance();
	Hydranode &h = Hydranode::instance();

	tmp << makeTag(TAG_UPSPEED,       s.getDisplayUpSpeed()),   ++tagCount;
	tmp << makeTag(TAG_DOWNSPEED,     s.getDisplayDownSpeed()), ++tagCount;
	tmp << makeTag(TAG_CONNCNT,       s.getConnCount()),        ++tagCount;
	tmp << makeTag(TAG_CONNECTINGCNT, s.getConnectingCount()),  ++tagCount;
	tmp << makeTag(TAG_TOTALUP,       h.getTotalUploaded()),    ++tagCount;
	tmp << makeTag(TAG_TOTALDOWN,     h.getTotalDownloaded()),  ++tagCount;
	tmp << makeTag(TAG_DOWNPACKETS,   s.getDownPackets()),      ++tagCount;
	tmp << makeTag(TAG_UPPACKETS,     s.getUpPackets()),        ++tagCount;
	tmp << makeTag(TAG_UPLIMIT,       s.getUpLimit()),          ++tagCount;
	tmp << makeTag(TAG_DOWNLIMIT,     s.getDownLimit()),        ++tagCount;
	tmp << makeTag(TAG_SESSUP,        s.getTotalUpstream()),    ++tagCount;
	tmp << makeTag(TAG_SESSDOWN,      s.getTotalDownstream()),  ++tagCount;
	tmp << makeTag(TAG_RUNTIMESESS,   h.getRuntime()),          ++tagCount;
	tmp << makeTag(TAG_RUNTIMETOTAL,  h.getTotalRuntime()),     ++tagCount;

	std::ostringstream tmp2;
	Utils::putVal<uint8_t>(tmp2, OC_LIST);
	Utils::putVal<uint32_t>(tmp2, tagCount);
	Utils::putVal<std::string>(tmp2, tmp.str().data(), tmp.str().size());
	
	sendPacket(tmp2.str());
}