本文整理汇总了C++中prefix函数的典型用法代码示例。如果您正苦于以下问题:C++ prefix函数的具体用法?C++ prefix怎么用?C++ prefix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prefix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: moveFilesProc
//.........这里部分代码省略.........
}
chdir(user.home);
fnames->dirtarget = True;
toend = strlen(to);
if (to[toend-1] != '/')
{
to[toend++] = '/';
to[toend] = 0;
}
}
else if (fnames->n_sel == 1) fnames->dirtarget = False;
else
{
error(fnames->shell, op_name, "Target for multiple files must be a folder");
umountDev(devto, False);
umountDev(devfrom, False);
freeSelFiles(fnames);
return;
}
if (!fnames->first) zzz();
XTFREE(fnames->target);
fnames->target = XtNewString(to);
for (i = fnames->first; i < fnames->n_sel; i++)
{
name = fnames->names[i];
if (fnames->op != LINK && (!strcmp(name, ".") || !strcmp(name, "..")))
{
error(fnames->shell, "Cannot move or copy . or ..", NULL);
continue;
}
strcpy(from+fromend, name);
if (fnames->dirtarget)
{
if (fnames->op != LINK && prefix(from, to))
{
String err_str, format = "Cannot move or copy %s to";
err_str = (String) XtMalloc((strlen(format) + strlen(from)) * sizeof(char));
sprintf(err_str, format, from);
error(fnames->shell, err_str, to);
XTFREE(err_str);
umountDev(devto, False);
umountDev(devfrom, False);
freeSelFiles(fnames);
wakeUp();
return;
}
strcpy(to+toend, name);
}
if (!(lstat(to, &tolstats)))
{
fnames->first = i;
is_dir = False;
if (!(stat(to, &tostats)))
{
if (S_ISDIR(tostats.st_mode))
is_dir = True;
if (!stat(from, &frstats) && tostats.st_ino == frstats.st_ino)
{
error(fnames->shell, op_name, "Source and destination are identical");
umountDev(devto, False);
umountDev(devfrom, False);
freeSelFiles(fnames);
wakeUp();
return;
}
}
示例2: folder
void BlockDataManagerConfig::parseArgs(int argc, char* argv[])
{
/***
--testnet: run db against testnet bitcoin network
--regtest: run db against regression test network
--rescan: delete all processed history data and rescan blockchain from the
first block
--rebuild: delete all DB data and build and scan from scratch
--rescanSSH: delete balance and txcount data and rescan it. Much faster than
rescan or rebuild.
--datadir: path to the operation folder
--dbdir: path to folder containing the database files. If empty, a new db
will be created there
--satoshi-datadir: path to blockchain data folder (blkXXXXX.dat files)
--ram_usage: defines the ram use during scan operations. 1 level averages
128MB of ram (without accounting the base amount, ~400MB). Defaults at 4.
Can't be lower than 1. Can be changed in between processes
--thread-count: defines how many processing threads can be used during db
builds and scans. Defaults to maximum available CPU threads. Can't be
lower than 1. Can be changed in between processes
--zcthread-count: defines the maximum number on threads the zc parser can
create for processing incoming transcations from the network node
--db-type: sets the db type:
DB_BARE: tracks wallet history only. Smallest DB.
DB_FULL: tracks wallet history and resolves all relevant tx hashes.
~750MB DB at the time of 0.95 release. Default DB type.
DB_SUPER: tracks all blockchain history. XXL DB (100GB+).
Not implemented yet
db type cannot be changed in between processes. Once a db has been built
with a certain type, it will always function according to that type.
Specifying another type will do nothing. Build a new db to change type.
--cookie: create a cookie file holding a random authentication key to allow
local clients to make use of elevated commands, like shutdown.
--fcgi-port: sets the DB listening port.
--clear-mempool: delete all zero confirmation transactions from the DB.
***/
try
{
//parse cli args
map<string, string> args;
for (int i = 1; i < argc; i++)
{
//check prefix
if (strlen(argv[i]) < 2)
throw DbErrorMsg("invalid CLI arg");
string prefix(argv[i], 2);
if (prefix != "--")
throw DbErrorMsg("invalid CLI arg");
//string prefix and tokenize
string line(argv[i] + 2);
auto&& argkeyval = getKeyValFromLine(line, '=');
args.insert(make_pair(
argkeyval.first, stripQuotes(argkeyval.second)));
}
processArgs(args, true);
//figure out datadir
auto argIter = args.find("datadir");
if (argIter != args.end())
{
dataDir_ = argIter->second;
args.erase(argIter);
}
else
{
if (!testnet_ && !regtest_)
dataDir_ = defaultDataDir_;
else if (!regtest_)
dataDir_ = defaultTestnetDataDir_;
else
dataDir_ = defaultRegtestDataDir_;
}
expandPath(dataDir_);
//get datadir
auto configPath = dataDir_;
appendPath(configPath, "armorydb.conf");
if (DBUtils::fileExists(configPath, 2))
//.........这里部分代码省略.........
示例3: parsePrefix
QString IrcMessagePrivate::host() const
{
if (m_host.isNull())
parsePrefix(prefix(), &m_nick, &m_ident, &m_host);
return m_host;
}
示例4: while
PRBool nsDefaultURIFixup::MakeAlternateURI(nsIURI *aURI)
{
if (!mPrefBranch)
{
return PR_FALSE;
}
PRBool makeAlternate = PR_TRUE;
mPrefBranch->GetBoolPref("browser.fixup.alternate.enabled", &makeAlternate);
if (!makeAlternate)
{
return PR_FALSE;
}
// Code only works for http. Not for any other protocol including https!
PRBool isHttp = PR_FALSE;
aURI->SchemeIs("http", &isHttp);
if (!isHttp) {
return PR_FALSE;
}
// Security - URLs with user / password info should NOT be fixed up
nsCAutoString userpass;
aURI->GetUserPass(userpass);
if (!userpass.IsEmpty()) {
return PR_FALSE;
}
nsCAutoString oldHost;
nsCAutoString newHost;
aURI->GetHost(oldHost);
// Count the dots
PRInt32 numDots = 0;
nsReadingIterator<char> iter;
nsReadingIterator<char> iterEnd;
oldHost.BeginReading(iter);
oldHost.EndReading(iterEnd);
while (iter != iterEnd) {
if (*iter == '.')
numDots++;
++iter;
}
nsresult rv;
// Get the prefix and suffix to stick onto the new hostname. By default these
// are www. & .com but they could be any other value, e.g. www. & .org
nsCAutoString prefix("www.");
nsXPIDLCString prefPrefix;
rv = mPrefBranch->GetCharPref("browser.fixup.alternate.prefix", getter_Copies(prefPrefix));
if (NS_SUCCEEDED(rv))
{
prefix.Assign(prefPrefix);
}
nsCAutoString suffix(".com");
nsXPIDLCString prefSuffix;
rv = mPrefBranch->GetCharPref("browser.fixup.alternate.suffix", getter_Copies(prefSuffix));
if (NS_SUCCEEDED(rv))
{
suffix.Assign(prefSuffix);
}
if (numDots == 0)
{
newHost.Assign(prefix);
newHost.Append(oldHost);
newHost.Append(suffix);
}
else if (numDots == 1)
{
if (!prefix.IsEmpty() &&
oldHost.EqualsIgnoreCase(prefix.get(), prefix.Length())) {
newHost.Assign(oldHost);
newHost.Append(suffix);
}
else if (!suffix.IsEmpty()) {
newHost.Assign(prefix);
newHost.Append(oldHost);
}
else
{
// Do nothing
return PR_FALSE;
}
}
else
{
// Do nothing
return PR_FALSE;
}
if (newHost.IsEmpty()) {
return PR_FALSE;
}
// Assign the new host string over the old one
aURI->SetHost(newHost);
//.........这里部分代码省略.........
示例5: ut_start
/*
* ut_start -- initialize unit test framework, indicate test started
*/
void
ut_start(const char *file, int line, const char *func,
int argc, char * const argv[], const char *fmt, ...)
{
va_list ap;
int saveerrno = errno;
char logname[MAXLOGNAME];
char *logsuffix;
va_start(ap, fmt);
if (getenv("UNITTEST_NO_SIGHANDLERS") == NULL)
ut_register_sighandlers();
if (getenv("UNITTEST_QUIET") != NULL)
Quiet++;
Testname = getenv("UNITTEST_NAME");
if ((logsuffix = getenv("UNITTEST_NUM")) == NULL)
logsuffix = "";
snprintf(logname, MAXLOGNAME, "out%s.log", logsuffix);
if ((Outfp = fopen(logname, "w")) == NULL) {
perror(logname);
exit(1);
}
snprintf(logname, MAXLOGNAME, "err%s.log", logsuffix);
if ((Errfp = fopen(logname, "w")) == NULL) {
perror(logname);
exit(1);
}
snprintf(logname, MAXLOGNAME, "trace%s.log", logsuffix);
if ((Tracefp = fopen(logname, "w")) == NULL) {
perror(logname);
exit(1);
}
setlinebuf(Outfp);
setlinebuf(Errfp);
setlinebuf(Tracefp);
setlinebuf(stdout);
prefix(file, line, func, 0);
vout(OF_LOUD|OF_NAME, "START", fmt, ap);
out(OF_NONL, 0, " args:");
for (int i = 0; i < argc; i++)
out(OF_NONL, " %s", argv[i]);
out(0, NULL);
va_end(ap);
record_open_files();
long long sc = sysconf(_SC_PAGESIZE);
if (sc < 0)
abort();
Ut_pagesize = (unsigned long)sc;
errno = saveerrno;
}
示例6: init_gcu
/*
* Prepare "curses" for use by the file "z-term.c"
*
* Installs the "hook" functions defined above, and then activates
* the main screen "term", which clears the screen and such things.
*
* Someone should really check the semantics of "initscr()"
*/
errr init_gcu(int argc, char **argv)
{
int i;
int rows, cols, y, x;
int next_win = 0;
bool graphics = TRUE;
/* Initialize info about terminal capabilities */
termtype = getenv("TERM");
loaded_terminfo = termtype && tgetent(0, termtype) == 1;
/* Parse args */
for (i = 1; i < argc; i++) {
if (prefix(argv[i], "-b"))
use_big_screen = TRUE;
else if (prefix(argv[i], "-B"))
bold_extended = TRUE;
else if (prefix(argv[i], "-a"))
graphics = FALSE;
else
plog_fmt("Ignoring option: %s", argv[i]);
}
if (graphics) {
ctrl_char[CTRL_WALL] = ' ';
ctrl_attr[CTRL_ORE] = A_REVERSE;
ctrl_attr[CTRL_WALL] = A_REVERSE;
ctrl_attr[CTRL_ROCK] = A_REVERSE;
}
/* Extract the normal keymap */
keymap_norm_prepare();
/* We do it like this to prevent a link error with curseses that
* lack ESCDELAY.
*/
if (!getenv("ESCDELAY"))
putenv("ESCDELAY=20");
/* Initialize */
if (initscr() == NULL) return (-1);
/* Activate hooks */
quit_aux = hook_quit;
/* Require standard size screen */
if (LINES < 24 || COLS < 80)
quit("Angband needs at least an 80x24 'curses' screen");
#ifdef A_COLOR
/* Do we have color, and enough color, available? */
can_use_color = ((start_color() != ERR) && has_colors() &&
(COLORS >= 8) && (COLOR_PAIRS >= 8));
#ifdef HAVE_USE_DEFAULT_COLORS
/* Should we use curses' "default color" */
/*
* Turned off since it screws up the colors,
* making background white and text black. -CJN
*/
/* if (use_default_colors() == OK) bg_color = -1; */
#endif
/* Attempt to use colors */
if (can_use_color) {
/* Prepare the color pairs */
/* PAIR_WHITE (pair 0) is *always* WHITE on BLACK */
init_pair(PAIR_RED, COLOR_RED, bg_color);
init_pair(PAIR_GREEN, COLOR_GREEN, bg_color);
init_pair(PAIR_YELLOW, COLOR_YELLOW, bg_color);
init_pair(PAIR_BLUE, COLOR_BLUE, bg_color);
init_pair(PAIR_MAGENTA, COLOR_MAGENTA, bg_color);
init_pair(PAIR_CYAN, COLOR_CYAN, bg_color);
init_pair(PAIR_BLACK, COLOR_BLACK, bg_color);
/* Prepare the colors */
colortable[TERM_DARK] = (COLOR_PAIR(PAIR_BLACK));
colortable[TERM_WHITE] = (COLOR_PAIR(PAIR_WHITE) | A_BRIGHT);
colortable[TERM_SLATE] = (COLOR_PAIR(PAIR_WHITE));
colortable[TERM_ORANGE] = (COLOR_PAIR(PAIR_YELLOW) | A_BRIGHT);
colortable[TERM_RED] = (COLOR_PAIR(PAIR_RED));
colortable[TERM_GREEN] = (COLOR_PAIR(PAIR_GREEN));
colortable[TERM_BLUE] = (COLOR_PAIR(PAIR_BLUE));
colortable[TERM_UMBER] = (COLOR_PAIR(PAIR_YELLOW));
colortable[TERM_L_DARK] = (COLOR_PAIR(PAIR_BLACK) | A_BRIGHT);
colortable[TERM_L_WHITE] = (COLOR_PAIR(PAIR_WHITE));
colortable[TERM_L_PURPLE] = (COLOR_PAIR(PAIR_MAGENTA));
colortable[TERM_YELLOW] = (COLOR_PAIR(PAIR_YELLOW) | A_BRIGHT);
colortable[TERM_L_RED] = (COLOR_PAIR(PAIR_MAGENTA) | A_BRIGHT);
colortable[TERM_L_GREEN] = (COLOR_PAIR(PAIR_GREEN) | A_BRIGHT);
colortable[TERM_L_BLUE] = (COLOR_PAIR(PAIR_BLUE) | A_BRIGHT);
colortable[TERM_L_UMBER] = (COLOR_PAIR(PAIR_YELLOW));
//.........这里部分代码省略.........
示例7: sys_setxattr
int sys_setxattr (const char *path, const char *uname, const void *value, size_t size, int flags)
{
const char *name = prefix(uname);
#if defined(HAVE_SETXATTR)
#ifndef XATTR_ADD_OPT
return setxattr(path, name, value, size, flags);
#else
int options = 0;
return setxattr(path, name, value, size, 0, options);
#endif
#elif defined(HAVE_SETEA)
return setea(path, name, value, size, flags);
#elif defined(HAVE_EXTATTR_SET_FILE)
int retval = 0;
if (flags) {
/* Check attribute existence */
retval = extattr_get_file(path, EXTATTR_NAMESPACE_USER, uname, NULL, 0);
if (retval < 0) {
/* REPLACE attribute, that doesn't exist */
if (flags & XATTR_REPLACE && errno == ENOATTR) {
errno = ENOATTR;
return -1;
}
/* Ignore other errors */
}
else {
/* CREATE attribute, that already exists */
if (flags & XATTR_CREATE) {
errno = EEXIST;
return -1;
}
}
}
retval = extattr_set_file(path, EXTATTR_NAMESPACE_USER, uname, value, size);
return (retval < 0) ? -1 : 0;
#elif defined(HAVE_ATTR_SET)
int myflags = 0;
char *attrname = strchr(name,'.') + 1;
if (strncmp(name, "system", 6) == 0) myflags |= ATTR_ROOT;
if (flags & XATTR_CREATE) myflags |= ATTR_CREATE;
if (flags & XATTR_REPLACE) myflags |= ATTR_REPLACE;
return attr_set(path, attrname, (const char *)value, size, myflags);
#elif defined(HAVE_ATTROPEN)
int ret = -1;
int myflags = O_RDWR;
int attrfd;
if (flags & XATTR_CREATE) myflags |= O_EXCL;
if (!(flags & XATTR_REPLACE)) myflags |= O_CREAT;
attrfd = solaris_attropen(path, name, myflags, (mode_t) SOLARIS_ATTRMODE);
if (attrfd >= 0) {
ret = solaris_write_xattr(attrfd, value, size);
close(attrfd);
}
return ret;
#else
errno = ENOSYS;
return -1;
#endif
}
示例8: main
main()
{
int state 1000, i, book, volume, corp, report;
int na;
char *v[20], **vv, **rr;
char ubuff[1000], *up;
char line[100];
char *p, *s, *r, *q;
while (gets(line))
{
if (line[1]>'9' || line[1]<'0') continue;
switch(line[0])
{
case 'T':
if (state > 'T')
{
book=0;
report=0;
printf("\n%%T ");
}
printf("%s\n", line+18);
state='T';
na = getargs(line+18, v);
for(i=0;i<na;i++)
if (strcmp(v[i], "(Book)")==0)
book=1;
continue;
case 'A':
state = 'A';
na=getargs(line+18, vv=v);
if (na<=0) continue;
while (na>0)
{
printf("%%A ");
corp=0;
for(p=vv[1]; *p; p++)
if (islower(*p))
corp=1;
if (corp==0)
{
for(p=vv[1]; *p; p++)
printf("%c. ", *p);
if (na>2 &&strcmp(vv[2], "+"))
{
printf("%s", vv[0]);
if (strcmp(vv[2], "Jr.")==0)
printf(",");
printf(" %s\n",vv[2]);
vv++;
na--;
}
else
printf("%s\n", vv[0]);
}
else
printf("%s %s\n",vv[0],vv[1]);
vv+=2;
na-=2;
if (strcmp(vv[0], "+")==0)
{
vv++;
na--;
}
}
continue;
case 'U':
if (state!='U')
ubuff[0]=0;
else
strcat(ubuff, " ");
state = 'U';
strcat(ubuff, line+18);
if (line[2]=='.')
{ /* end of item */
p=ubuff; /*start*/
volume=0;
for(s=ubuff; *s; s++)
if (s[-1]==' ' && prefix("Vol", s))
{
for(q=s-1; q>ubuff; q--)
{
if (*q==' ' || *q==',') *q=0;
else break;
}
volume=1;
break;
}
if (*s==0)
for(s=ubuff; *s && (*s!=',' || sprefix("Inc", s+1)); s++)
;
else
s++;
if (*s==',')*s++=0;
if (book)
printf("%%I %s\n",ubuff);
else if (volume)
printf("%%J %s\n", ubuff);
else if (substr(ubuff, "Report")!=0)
{
report=1;
//.........这里部分代码省略.........
示例9: input
//.........这里部分代码省略.........
i = sstr2arg(bigbuf, 20, av, " \t");
if( i == 1 ) { /* tell him what the current options are */
printf(" Copyfile - '%s'\n", copyfile);
printf(" Signature - '%s'\n", signature);
printf(" Aliases - '%s'\n", aliasfilename);
printf(" Editor - '%s'\n", editor);
printf(" Checker - '%s'\n", checker);
printf(" Subargs - '%s'\n", subargs);
if(qflag == 0 && cflag == 1)
printf(" File copy option is on\n");
if(qflag == 1 && cflag == 0)
printf(" File copy on confirmation only\n");
continue;
}
if( (i = picko( av[1] ) ) < 0) {
fprintf(stderr,"Option '%s' is invalid.\n", av[1]);
continue;
}
select_o( i, &av[1] );
continue;
}
compress (bigbuf, bigbuf);
/* so prefix works on multi-words */
if (bigbuf[0] == '\0')
continue; /* just hit newline */
signal (SIGINT, onint);
for (i = 0; !isnull (bigbuf[i]); i++)
bigbuf[i] = uptolow (bigbuf[i]);
if (prefix ("bcc", bigbuf))
{
getaddr (bccname, bcc, YES, locname);
bccflag = 1;
continue;
}
/* "Edit" option (grandfathered to also accept "v" for visual edit) */
if (prefix ("edit body", bigbuf) || prefix("visual edit body", bigbuf))
{
dropen( DRBEGIN );
if((tmpfd = open(tmpdrffile, 2, 0600)) < 0)
{
fprintf(stderr,"Cannot open temporary draft file %s\n", tmpdrffile);
s_exit(-1);
}
if(lseek(tmpfd, 0L, 0) < 0)
{
fprintf(stderr,"Lseek failed on temporary draft file %s\n", tmpdrffile);
s_exit(-1);
}
if(chmod(drffile, 0600) < 0)
fprintf(stderr,"Could not make draft %s writable\n", drffile);
/* Write the header info to the temporary draft */
dist = 0L;
dist += write(tmpfd, fromname, strlen( fromname ));
dist += write(tmpfd, from, strlen( from ));
dist += write(tmpfd, "\n", 1);
dist += write(tmpfd, toname, strlen( toname ));
示例10: default_pos_analyzer
sequence_analyzer default_pos_analyzer()
{
sequence_analyzer analyzer;
auto word_feats = [](const std::string& word, uint64_t t,
sequence_analyzer::collector& coll)
{
auto norm = utf::foldcase(word);
for (uint64_t i = 1; i <= 4; i++)
{
auto len = std::to_string(i);
coll.add("w[t]_suffix_" + len + "=" + suffix(norm, i), 1);
coll.add("w[t]_prefix_" + len + "=" + prefix(norm, i), 1);
}
coll.add("w[t]=" + norm, 1);
// additional binary word features
if (std::any_of(word.begin(), word.end(), [](char c)
{
return std::isdigit(c);
}))
{
coll.add("w[t]_has_digit=1", 1);
}
if (std::find(word.begin(), word.end(), '-') != word.end())
coll.add("w[t]_has_hyphen=1", 1);
if (std::any_of(word.begin(), word.end(), [](char c)
{
return std::isupper(c);
}))
{
coll.add("w[t]_has_upper=1", 1);
if (t != 0)
{
coll.add("w[t]_has_upper_and_not_sentence_start=1", 1);
}
}
if (std::all_of(word.begin(), word.end(), [](char c)
{
return std::isupper(c);
}))
{
coll.add("w[t]_all_upper=1", 1);
}
};
// current word features
analyzer.add_observation_function(
[=](const sequence& seq, uint64_t t, sequence_analyzer::collector& coll)
{
std::string word = seq[t].symbol();
word_feats(word, t, coll);
});
// previous word features
analyzer.add_observation_function(
[](const sequence& seq, uint64_t t, sequence_analyzer::collector& coll)
{
std::string word = seq[t].symbol();
if (t > 0)
{
auto prevword = seq[t - 1].symbol();
coll.add("w[t-1]=" + utf::foldcase(prevword), 1);
if (t > 1)
{
auto prev2word = seq[t - 2].symbol();
coll.add("w[t-2]=" + utf::foldcase(prev2word), 1);
}
else
{
coll.add("w[t-2]=<s>", 1);
}
}
else
{
coll.add("w[t-1]=<s>", 1);
coll.add("w[t-2]=<s1>", 1);
}
});
// next word features
analyzer.add_observation_function(
[](const sequence& seq, uint64_t t, sequence_analyzer::collector& coll)
{
if (t + 1 < seq.size())
{
auto nextword = seq[t + 1].symbol();
coll.add("w[t+1]=" + utf::foldcase(nextword), 1);
if (t + 2 < seq.size())
{
auto next2word = seq[t + 2].symbol();
coll.add("w[t+2]=" + utf::foldcase(next2word), 1);
}
else
{
coll.add("w[t+2]=</s>", 1);
}
//.........这里部分代码省略.........
示例11: init_x11
/*
* Initialization function for an "X11" module to Angband
*/
errr init_x11(int argc, char **argv)
{
int i;
cptr dpy_name = "";
int num_term = 1;
#ifdef USE_GRAPHICS
cptr bitmap_file = "";
char filename[1024];
int pict_wid = 0;
int pict_hgt = 0;
char *TmpData;
#endif /* USE_GRAPHICS */
/* Parse args */
for (i = 1; i < argc; i++)
{
if (prefix(argv[i], "-d"))
{
dpy_name = &argv[i][2];
continue;
}
#ifdef USE_GRAPHICS
if (prefix(argv[i], "-s"))
{
smoothRescaling = FALSE;
continue;
}
if (prefix(argv[i], "-o"))
{
arg_graphics = GRAPHICS_ORIGINAL;
continue;
}
if (prefix(argv[i], "-a"))
{
arg_graphics = GRAPHICS_ADAM_BOLT;
continue;
}
if (prefix(argv[i], "-g"))
{
smoothRescaling = FALSE;
arg_graphics = GRAPHICS_DAVID_GERVAIS;
continue;
}
if (prefix(argv[i], "-b"))
{
use_bigtile = TRUE;
continue;
}
#endif /* USE_GRAPHICS */
if (prefix(argv[i], "-n"))
{
num_term = atoi(&argv[i][2]);
if (num_term > MAX_TERM_DATA) num_term = MAX_TERM_DATA;
else if (num_term < 1) num_term = 1;
continue;
}
plog_fmt("Ignoring option: %s", argv[i]);
}
/* Init the Metadpy if possible */
if (Metadpy_init_name(dpy_name)) return (-1);
/* Prepare cursor color */
MAKE(xor, infoclr);
Infoclr_set(xor);
Infoclr_init_ppn(Metadpy->fg, Metadpy->bg, "xor", 0);
/* Prepare normal colors */
for (i = 0; i < 256; ++i)
{
Pixell pixel;
MAKE(clr[i], infoclr);
Infoclr_set(clr[i]);
/* Acquire Angband colors */
color_table[i][0] = angband_color_table[i][0];
//.........这里部分代码省略.........
示例12: init_xaw
/*
* Initialization function for an X Athena Widget module to Angband
*
* We should accept "-d<dpy>" requests in the "argv" array. XXX XXX XXX
*/
errr init_xaw(int argc, char **argv)
{
int i;
Widget topLevel;
Display *dpy;
cptr dpy_name = "";
#ifdef USE_GRAPHICS
cptr bitmap_file = "";
char filename[1024];
int pict_wid = 0;
int pict_hgt = 0;
char *TmpData;
#endif /* USE_GRAPHICS */
/* Parse args */
for (i = 1; i < argc; i++)
{
if (prefix(argv[i], "-d"))
{
dpy_name = &argv[i][2];
continue;
}
#ifdef USE_GRAPHICS
if (prefix(argv[i], "-s"))
{
smoothRescaling = FALSE;
continue;
}
if (prefix(argv[i], "-o"))
{
arg_graphics = GRAPHICS_ORIGINAL;
continue;
}
if (prefix(argv[i], "-a"))
{
arg_graphics = GRAPHICS_ADAM_BOLT;
continue;
}
if (prefix(argv[i], "-g"))
{
smoothRescaling = FALSE;
arg_graphics = GRAPHICS_DAVID_GERVAIS;
continue;
}
if (prefix(argv[i], "-b"))
{
use_bigtile = TRUE;
continue;
}
#endif /* USE_GRAPHICS */
if (prefix(argv[i], "-n"))
{
num_term = atoi(&argv[i][2]);
if (num_term > MAX_TERM_DATA) num_term = MAX_TERM_DATA;
else if (num_term < 1) num_term = 1;
continue;
}
plog_fmt("Ignoring option: %s", argv[i]);
}
/* Attempt to open the local display */
dpy = XOpenDisplay(dpy_name);
/* Failure -- assume no X11 available */
if (!dpy) return (-1);
/* Close the local display */
XCloseDisplay(dpy);
#ifdef USE_XAW_LANG
/* Support locale processing */
XtSetLanguageProc(NULL, NULL, NULL);
#endif /* USE_XAW_LANG */
/* Initialize the toolkit */
//.........这里部分代码省略.........
示例13:
void M2kGearAnimation::registerChannels(Bus* bus) {
GearSequenceAnimation::registerChannels(bus);
b_Absorber02Angle = bus->registerLocalDataChannel<double>(prefix() + ".Absorber02", 0.0);
b_Absorber03Angle = bus->registerLocalDataChannel<double>(prefix() + ".Absorber03", 0.0);
b_Compression = bus->registerLocalDataChannel<double>(prefix() + ".Compression", 0.0);
}
示例14: registerChannels
void GearSequenceAnimation::registerChannels(Bus* bus) {
if (m_RetractSequence.valid()) m_RetractSequence->registerChannels(bus);
if (m_CompressionSequence.valid()) m_CompressionSequence->registerChannels(bus);
b_TireRotation = bus->registerLocalDataChannel<double>(prefix() + ".TireRotation", 0.0);
b_SteeringAngle = bus->registerLocalDataChannel<double>(prefix() + ".SteeringAngle", 0.0);
}
示例15: prefix
void EOTHeader::updateEOTSize(size_t fontDataSize)
{
prefix()->eotSize = m_buffer.size() + fontDataSize;
}