summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0dd1248)
raw | patch | inline | side by side (parent: 0dd1248)
author | ishmal <ishmal@users.sourceforge.net> | |
Fri, 18 May 2007 12:05:32 +0000 (12:05 +0000) | ||
committer | ishmal <ishmal@users.sourceforge.net> | |
Fri, 18 May 2007 12:05:32 +0000 (12:05 +0000) |
buildtool.cpp | patch | blob | history |
diff --git a/buildtool.cpp b/buildtool.cpp
index 39ae5be6ef87214665a371ed77809106453d419a..ac7a1a8ae31da6e67d4ebf73ddeeb5cb15038f17 100644 (file)
--- a/buildtool.cpp
+++ b/buildtool.cpp
void getLineAndColumn(int pos, int *lineNr, int *colNr);
- void error(char *fmt, ...);
+ void error(const char *fmt, ...);
int peek(int pos);
typedef struct
{
- char *escaped;
+ const char *escaped;
char value;
} EntityEntry;
}
-void Parser::error(char *fmt, ...)
+void Parser::error(const char *fmt, ...)
{
int lineNr;
int colNr;
if (ch!='<')
return p0;
- int line, col;
+ //int line, col;
//getLineAndColumn(p, &line, &col);
p++;
int peek(int p);
- int match(int p, char *key);
+ int match(int p, const char *key);
int parseScheme(int p);
typedef struct
{
- int ival;
- char *sval;
- int port;
+ int ival;
+ const char *sval;
+ int port;
} LookupEntry;
LookupEntry schemes[] =
-int URI::match(int p0, char *key)
+int URI::match(int p0, const char *key)
{
int p = p0;
while (p < parselen)
/**
* Print a printf()-like formatted error message
*/
- void error(char *fmt, ...);
+ void error(const char *fmt, ...);
/**
* Print a printf()-like formatted trace message
*/
- void status(char *fmt, ...);
+ void status(const char *fmt, ...);
/**
* Print a printf()-like formatted trace message
*/
- void trace(char *fmt, ...);
+ void trace(const char *fmt, ...);
/**
* Check if a given string matches a given regex pattern
/**
* Print a printf()-like formatted error message
*/
-void MakeBase::error(char *fmt, ...)
+void MakeBase::error(const char *fmt, ...)
{
va_list args;
va_start(args,fmt);
/**
* Print a printf()-like formatted trace message
*/
-void MakeBase::status(char *fmt, ...)
+void MakeBase::status(const char *fmt, ...)
{
va_list args;
va_start(args,fmt);
/**
* Print a printf()-like formatted trace message
*/
-void MakeBase::trace(char *fmt, ...)
+void MakeBase::trace(const char *fmt, ...)
{
va_list args;
va_start(args,fmt);
/**
*
*/
- bool sequ(int pos, char *key);
+ bool sequ(int pos, const char *key);
/**
*
* Return whether the sequence of characters in the buffer
* beginning at pos match the key, for the length of the key
*/
-bool DepTool::sequ(int pos, char *key)
+bool DepTool::sequ(int pos, const char *key)
{
while (*key)
{
TASK_MAKEFILE,
TASK_MKDIR,
TASK_MSGFMT,
+ TASK_PKG_CONFIG,
TASK_RANLIB,
TASK_RC,
TASK_SHAREDLIB,
srcFullName.c_str());
fprintf(f, "#### COMMAND ###\n");
int col = 0;
- for (int i = 0 ; i < cmd.size() ; i++)
+ for (unsigned int i = 0 ; i < cmd.size() ; i++)
{
char ch = cmd[i];
if (isspace(ch) && col > 63)
+/**
+ * Perform a Package-Config query similar to pkg-config
+ */
+class TaskPkgConfig : public Task
+{
+public:
+
+ typedef enum
+ {
+ PKG_CONFIG_QUERY_CFLAGS,
+ PKG_CONFIG_QUERY_LIBS,
+ PKG_CONFIG_QUERY_BOTH
+ } QueryTypes;
+
+ TaskPkgConfig(MakeBase &par) : Task(par)
+ {
+ type = TASK_PKG_CONFIG; name = "pkg-config";
+ }
+
+ virtual ~TaskPkgConfig()
+ {}
+
+ virtual bool execute()
+ {
+ String path = parent.resolve(pkg_config_path);
+ //fill this in
+ return true;
+ }
+
+ virtual bool parse(Element *elem)
+ {
+ String s;
+ if (!parent.getAttribute(elem, "path", s))
+ return false;
+ if (s.size()>0)
+ pkg_config_path = s;
+ if (!parent.getAttribute(elem, "query", s))
+ return false;
+ if (s == "cflags")
+ query = PKG_CONFIG_QUERY_CFLAGS;
+ else if (s == "libs")
+ query = PKG_CONFIG_QUERY_LIBS;
+ else if (s == "both")
+ query = PKG_CONFIG_QUERY_BOTH;
+ else
+ {
+ error("<pkg-config> requires 'query=\"type\"' attribute");
+ error("where type = cflags, libs, or both");
+ return false;
+ }
+ return true;
+ }
+
+private:
+
+ String pkg_config_path;
+ int query;
+
+};
+
+
+
+
/**
/**
* Format an error message in printf() style
*/
-static void error(char *fmt, ...)
+static void error(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
/**
* Compare a buffer with a key, for the length of the key
*/
-static bool sequ(const String &buf, char *key)
+static bool sequ(const String &buf, const char *key)
{
int len = buf.size();
for (int i=0 ; key[i] && i<len ; i++)