本文整理汇总了C++中G_函数的典型用法代码示例。如果您正苦于以下问题:C++ G_函数的具体用法?C++ G_怎么用?C++ G_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
InputModelSetting * InputModelSettings::CloneSetting(Messager & messager, InputModelSetting * current_setting, SettingInfo & setting_info) const
{
try
{
switch (setting_info.setting_class)
{
#define G_(Y) S_PATH_TO_MODEL_DATABASE##Y
INPUT_MODEL_CLONE_SETTING__STRING(G_(__2), G_(__5))
#undef G_
default:
{
boost::format msg("Unknown input model backend setting \"%1%\" (\"%2%\") being requested.");
msg % setting_info.text % setting_info.setting_class;
messager.AppendMessage(new MessagerWarningMessage(MESSAGER_MESSAGE__INVALID_SETTING_INFO_OBJECT, msg.str()));
}
break;
}
}
catch (std::bad_cast & e)
{
boost::format msg("Unable to retrieve setting \"%1%\" (\"%2%\"): %3%.");
msg % setting_info.text % setting_info.setting_class % e.what();
messager.AppendMessage(new MessagerWarningMessage(MESSAGER_MESSAGE__INVALID_SETTING_INFO_OBJECT, msg.str()));
}
return NULL;
}
开发者ID:daniel347x-github,项目名称:newgene,代码行数:34,代码来源:InputModelSettings.cpp
示例2: gale_key_private
static void *on_target_key(oop_source *oop,struct gale_key *key,void *x) {
struct unpack * const ctx = (struct unpack *) x;
const struct gale_key_assertion * const ass = gale_key_private(key);
if (0 == ctx->target_count) return OOP_CONTINUE;
if (NULL != ass
&& gale_crypto_open(gale_key_data(ass),&ctx->message->data)) {
ctx->target_count = 0;
return on_unsealed(oop,OOP_TIME_NOW,ctx);
}
if (0 == --ctx->target_count) {
const struct gale_text *target;
struct gale_text err = null_text;
for (target = gale_crypto_target(ctx->message->data);
NULL != target && 0 != target->l; ++target)
err = gale_text_concat(3,err,
(0 == err.l ? G_(" to ") : G_(", ")),*target);
gale_alert(GALE_WARNING,gale_text_concat(2,
G_("can't decrypt message"),err),0);
return on_unsealed(oop,OOP_TIME_NOW,ctx);
}
return OOP_CONTINUE;
}
开发者ID:grawity,项目名称:gale,代码行数:25,代码来源:client_unpack.c
示例3: Rgui_Edit
int Rgui_Edit(const char *filename, int enc, const char *title,
int modal)
{
editor c;
EditorData p;
if (neditors == MAXNEDITORS) {
R_ShowMessage(G_("Maximum number of editors reached"));
return 1;
}
c = neweditor();
if (!c) {
R_ShowMessage(G_("Unable to create editor window"));
return 1;
}
if (strlen(filename) > 0) {
editor_load_file(c, filename, enc);
editor_set_title(c, title);
}
else {
editor_set_title(c, G_("Untitled"));
}
show(c);
p = getdata(getdata(c));
p->stealconsole = modal;
if (modal) {
fix_editor_up = TRUE;
eventloop(c);
}
return 0;
}
开发者ID:cyy0523xc,项目名称:r-source,代码行数:32,代码来源:editor.c
示例4: handle_findreplace
PROTECTED
void handle_findreplace(HWND hwnd, LPFINDREPLACE pfr)
{
CHARRANGE sel;
int matchcase=0, wholeword=0, down=0;
char buf[100];
if (pfr->Flags & FR_MATCHCASE) matchcase = 1;
if (pfr->Flags & FR_WHOLEWORD) wholeword = 1;
if (pfr->Flags & FR_DOWN) down = 1;
if (pfr->Flags & FR_FINDNEXT) {
if (!richeditfind(hwnd, pfr->lpstrFindWhat, matchcase, wholeword, down)) {
snprintf(buf, 100, G_("\"%s\" not found"), pfr->lpstrFindWhat);
askok(buf);
}
}
else if (pfr->Flags & FR_REPLACE) {
if (!richeditreplace(hwnd, pfr->lpstrFindWhat, pfr->lpstrReplaceWith, matchcase, wholeword, down)) {
snprintf(buf, 100, G_("\"%s\" not found"), pfr->lpstrFindWhat);
askok(buf);
}
}
else if (pfr->Flags & FR_REPLACEALL) {
/* replace all in the whole buffer then return to original selection state */
sendmessage (hwnd, EM_EXGETSEL, 0, &sel) ;
sendmessage (hwnd, EM_SETSEL, 0, 0) ;
while ( richeditreplace(hwnd, pfr->lpstrFindWhat, pfr->lpstrReplaceWith, matchcase, wholeword, down) ) ;
sendmessage (hwnd, EM_EXSETSEL, 0, &sel) ;
}
else if (pfr->Flags & FR_DIALOGTERM)
hModelessDlg = NULL;
}
开发者ID:Chaos1989,项目名称:r-source,代码行数:33,代码来源:dialogs.c
示例5: copystringtoclipboard
int copystringtoclipboard(char *str)
{
HGLOBAL hglb;
char *s;
int ll = strlen(str) + 1;
if (!(hglb = GlobalAlloc(GHND, ll))){
R_ShowMessage(G_("Insufficient memory: cell not copied to the clipboard"));
return 1;
}
if (!(s = (char *)GlobalLock(hglb))){
R_ShowMessage(G_("Insufficient memory: cell not copied to the clipboard"));
return 1;
}
strcpy(s, str);
GlobalUnlock(hglb);
if (!OpenClipboard(NULL) || !EmptyClipboard()) {
R_ShowMessage(G_("Unable to open the clipboard"));
GlobalFree(hglb);
return 1;
}
SetClipboardData(CF_TEXT, hglb);
CloseClipboard();
return 0;
}
开发者ID:Vladimir84,项目名称:rcc,代码行数:25,代码来源:clipboard.c
示例6: addmenuitemarray
/* FIXME: only one level of sub-menu - no checks -*/
static int addmenuitemarray(menu m,MenuItem a[])
{
menu ma = m;
int i = 0;
while (a[i].nm) {
if (!strcmp(a[i].nm,"@STARTMENU")) {
i += 1;
ma = newsubmenu(m, G_(a[i].nm));
}
else if (!strcmp(a[i].nm,"@ENDMENU")) {
i += 1;
ma = m;
}
else if (!strcmp(a[i].nm,"@STARTSUBMENU")) {
i += 1;
newsubmenu(ma,a[i].nm);
}
else if (!strcmp(a[i].nm,"@ENDSUBMENU")) {
i += 1;
}
else if (!strcmp(a[i].nm,"@MDIMENU")) {
if (!(a[i].m = newmdimenu())) return 0;
ma = a[i].m;
}
else {
if (!(a[i].m = newmenuitem(G_(a[i].nm), a[i].key, a[i].fn))) return 0;
}
i += 1;
}
return 1;
}
开发者ID:csilles,项目名称:cxxr,代码行数:32,代码来源:gmenus.c
示例7: file2xbuf
/*
To be fixed: during creation, memory is allocated two times
(faster for small files but a big waste otherwise)
*/
static xbuf file2xbuf(const char *name, int enc, int del)
{
HANDLE f;
DWORD rr, vv;
char *p;
xlong dim, cnt;
xint ms;
xbuf xb;
wchar_t *wp, *q;
if (enc == CE_UTF8) {
wchar_t wfn[MAX_PATH+1];
Rf_utf8towcs(wfn, name, MAX_PATH+1);
f = CreateFileW(wfn, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL);
} else
f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL);
if (f == INVALID_HANDLE_VALUE) {
R_ShowMessage(G_("Error opening file"));
return NULL;
}
vv = GetFileSize(f, NULL);
p = (char *) malloc((size_t) vv + 1);
if (!p) {
CloseHandle(f);
R_ShowMessage(G_("Insufficient memory to display file in internal pager"));
return NULL;
}
ReadFile(f, p, vv, &rr, NULL);
CloseHandle(f);
if (del) DeleteFile(name);
p[rr] = '\0';
cnt = mbstowcs(NULL, p, 0);
wp = (wchar_t *) malloc((cnt+1) * sizeof(wchar_t));
mbstowcs(wp, p, cnt+1);
for (q = wp, ms = 1, dim = cnt; *q; q++) {
if (*q == '\t')
dim += TABSIZE;
else if (*q == '\n') {
dim++;
ms++;
}
}
free(p);
if ((xb = newxbuf(dim + 1, ms + 1, 1)))
for (q = wp, ms = 0; *q; q++) {
if (*q == L'\r') continue;
if (*q == L'\n') {
ms++;
xbufaddxc(xb, *q);
/* next line interprets underlining in help files */
if (q[1] == L'_' && q[2] == L'\b') xb->user[ms] = -2;
} else xbufaddxc(xb, *q);
}
free(wp);
return xb;
}
开发者ID:edzer,项目名称:cxxr,代码行数:62,代码来源:pager.c
示例8: sizeof
menuItems *wingetmenuitems(const char *mname, char *errmsg) {
menuItems *items;
char mitem[1002], *p, *q, *r;
int i,j = 0;
q = (char *)malloc(1000 * sizeof(char));
r = (char *)malloc(1000 * sizeof(char));
if (strlen(mname) > 1000) {
strcpy(errmsg, G_("'mname' is limited to 1000 bytes"));
return NULL;
}
items = (menuItems *)malloc(sizeof(menuItems));
if(nitems > 0)
items->mItems = (Uitem *)malloc(alloc_items * sizeof(Uitem));
strcpy(mitem, mname); strcat(mitem, "/");
for (i = 0; i < nitems; i++) {
p = strstr(umitems[i]->name, mitem);
if (p == NULL)
continue;
/* the 'mitem' pattern might be showing up */
/* as a substring in another valid name. Make sure */
/* this isn't the case */
if (strlen(p) != strlen(umitems[i]->name))
continue;
strcpy(q, p+strlen(mitem));
/* Due to the way menu items are stored, it can't be */
/* determined if this is say item 'foo' from menu 'Blah/bar' */
/* or item 'bar/foo' from menu 'Blah'. Check this manually */
/* by adding the item label to the menu we're looking for. */
snprintf(r, 1000, "%s%s", mitem, umitems[i]->m->text);
if (strcmp(r, p) != 0)
continue;
items->mItems[j] = (Uitem)malloc(sizeof(uitem));
items->mItems[j]->name = (char *)malloc((strlen(q) + 1) * sizeof(char));
items->mItems[j]->action = (char *)malloc((strlen(umitems[i]->action) + 1) * sizeof(char));
strcpy(items->mItems[j]->name, q);
strcpy(items->mItems[j]->action, umitems[i]->action);
j++;
}
free(q);
free(r);
items->numItems = j;
if (j == 0) sprintf(errmsg, G_("menu %s does not exist"), mname);
return(items);
}
开发者ID:Maxsl,项目名称:r-source,代码行数:55,代码来源:rui.c
示例9: plugin_init
__visible int plugin_init(struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version)
{
const char * const plugin_name = plugin_info->base_name;
const int argc = plugin_info->argc;
const struct plugin_argument *argv = plugin_info->argv;
int tso = 0;
int i;
if (!plugin_default_version_check(version, &gcc_version)) {
error(G_("incompatible gcc/plugin versions"));
return 1;
}
for (i = 0; i < argc; ++i) {
if (!strcmp(argv[i].key, "disable"))
return 0;
/* all remaining options require a value */
if (!argv[i].value) {
error(G_("no value supplied for option '-fplugin-arg-%s-%s'"),
plugin_name, argv[i].key);
return 1;
}
if (!strcmp(argv[i].key, "tso")) {
tso = atoi(argv[i].value);
continue;
}
if (!strcmp(argv[i].key, "offset")) {
canary_offset = atoi(argv[i].value);
continue;
}
error(G_("unknown option '-fplugin-arg-%s-%s'"),
plugin_name, argv[i].key);
return 1;
}
/* create the mask that produces the base of the stack */
sp_mask = ~((1U << (12 + tso)) - 1);
PASS_INFO(arm_pertask_ssp_rtl, "expand", 1, PASS_POS_INSERT_AFTER);
register_callback(plugin_info->base_name, PLUGIN_PASS_MANAGER_SETUP,
NULL, &arm_pertask_ssp_rtl_pass_info);
#if BUILDING_GCC_VERSION >= 9000
register_callback(plugin_info->base_name, PLUGIN_START_UNIT,
arm_pertask_ssp_start_unit, NULL);
#endif
return 0;
}
开发者ID:avagin,项目名称:linux,代码行数:54,代码来源:arm_ssp_per_task_plugin.c
示例10: follow_key
static void follow_key(oop_source *oop,const struct find *find) {
struct find *next;
struct gale_fragment frag;
struct gale_location *base;
struct gale_text name = gale_key_name(find->loc->key);
struct gale_data name_data = gale_text_as_data(name);
assert(NULL != find->func && find->is_found);
if (!gale_group_lookup(
gale_key_data(gale_key_public(find->loc->key,find->now)),
G_("key.redirect"),frag_text,&frag)
|| (NULL != find->map && NULL != gale_map_find(find->map,name_data)))
{
key_i_graph(oop,
find->loc->key,
find->flags,
G_("key.member"),
on_graph,(void *) find);
return;
}
gale_create(next);
*next = *find;
next->count = 0;
next->is_found = 0;
if (NULL == next->map) next->map = gale_make_map(0);
gale_map_add(next->map,name_data,find->loc->key);
base = client_i_get(gale_key_name(find->loc->key));
next->loc = client_i_get(frag.value.text);
if (base != find->loc) {
assert(base->at_part <= find->loc->at_part
&& base->at_part > 0 && !gale_text_compare(
G_("*"),
base->parts[base->at_part - 1]));
next->loc = client_i_get(gale_text_concat(4,
gale_text_concat_array(
next->loc->at_part,
next->loc->parts),
G_("."),
gale_text_concat_array(
find->loc->at_part - base->at_part + 1,
find->loc->parts + base->at_part - 1),
gale_text_concat_array(
next->loc->part_count - next->loc->at_part,
next->loc->parts + next->loc->at_part)));
}
find_key(oop,next);
}
开发者ID:grawity,项目名称:gale,代码行数:53,代码来源:client_location.c
示例11: newmdimenu
menu newmdimenu()
{
menu m ;
if (!ismdi()) return NULL;
m = newmenu(G_("Windows"));
setvalue(newmenuitem(G_("Cascade"),0,mdimenu),1);
setvalue(newmenuitem(G_("Tile &Horizontally"),0,mdimenu),2);
setvalue(newmenuitem(G_("Tile &Vertically"),0,mdimenu),3);
setvalue(newmenuitem(G_("Arrange Icons"),0,mdimenu),4);
current_menubar->menubar = m;
return m;
}
开发者ID:csilles,项目名称:cxxr,代码行数:12,代码来源:gmenus.c
示例12: gale_var
static struct gale_encoding *get_charset(
struct gale_text name,
struct gale_encoding *fallback)
{
const struct gale_text enc = gale_var(name);
struct gale_encoding * const ret = gale_make_encoding(enc);
if (NULL == ret && 0 != enc.l)
gale_alert(GALE_WARNING,gale_text_concat(4,
G_("unknown encoding \""),enc,
G_("\" for "),name),0);
return ret ? ret : fallback;
}
开发者ID:grawity,项目名称:gale,代码行数:13,代码来源:misc_globals.c
示例13: winaddmenu
int winaddmenu(const char *name, char *errmsg)
{
const char *submenu = name;
char *p, start[501];
menu parent;
if (getMenu(name))
return 0; /* Don't add repeats */
if (nmenus >= alloc_menus) {
if(alloc_menus <= 0) {
alloc_menus = 10;
usermenus = (menu *) malloc(sizeof(menu) * alloc_menus);
usermenunames = (char **) malloc(sizeof(char *) * alloc_menus);
} else {
alloc_menus += 10;
usermenus = (menu *) realloc(usermenus, sizeof(menu) * alloc_menus);
usermenunames = (char **) realloc(usermenunames,
sizeof(char *) * alloc_menus);
}
}
if (strlen(name) > 500) {
strcpy(errmsg, G_("'menu' is limited to 500 bytes"));
return 5;
}
p = Rf_strrchr(name, '/');
if (p) {
submenu = p + 1;
strcpy(start, name);
*Rf_strrchr(start, '/') = '\0';
parent = getMenu(start);
if (!parent) {
strcpy(errmsg, G_("base menu does not exist"));
return 3;
}
m = newsubmenu(parent, submenu);
} else {
addto(RMenuBar);
m = newmenu(submenu);
}
if (m) {
usermenus[nmenus] = m;
usermenunames[nmenus] = strdup(name);
nmenus++;
show(RConsole);
return 0;
} else {
strcpy(errmsg, G_("failed to allocate menu"));
return 1;
}
}
开发者ID:Maxsl,项目名称:r-source,代码行数:51,代码来源:rui.c
示例14: editor_set_title
static void editor_set_title(editor c, const char *title)
{
char wtitle[EDITORMAXTITLE+1];
textbox t = getdata(c);
EditorData p = getdata(t);
strncpy(wtitle, title, EDITORMAXTITLE);
wtitle[EDITORMAXTITLE] = '\0';
strcpy(p->title, wtitle);
if (strlen(wtitle) + strlen(G_("R Editor")) + 3 < EDITORMAXTITLE) {
strcat(wtitle, " - ");
strcat(wtitle, G_("R Editor"));
}
settext(c, wtitle);
}
开发者ID:cyy0523xc,项目名称:r-source,代码行数:14,代码来源:editor.c
示例15: gale_crypto_public
/** Extract the public components of a key.
* \param key A key which may contain private data.
* \return The same key with all private data expunged.
* \sa gale_crypto_generate() */
struct gale_group gale_crypto_public(struct gale_group key) {
struct gale_group filtered = key;
while (!gale_group_null(key)) {
struct gale_fragment frag = gale_group_first(key);
key = gale_group_rest(key);
if (gale_text_compare(G_("rsa.private"),frag.name) <= 0
&& gale_text_compare(G_("rsa.private.~"),frag.name) > 0) {
gale_group_remove(&filtered,frag.name,frag.type);
key = filtered;
}
}
return filtered;
}
开发者ID:nandub,项目名称:gale-old,代码行数:19,代码来源:crypto_gen.c
示例16: gale_create
static struct gale_packet *cat_filter(struct gale_packet *msg,void *d) {
struct directed *dir = (struct directed *) d;
struct gale_packet *rewrite;
struct gale_text cat = null_text;
int do_transmit = 0;
gale_create(rewrite);
rewrite->routing = null_text;
rewrite->content = msg->content;
while (gale_text_token(msg->routing,':',&cat)) {
struct gale_text base,host;
int orig_flag;
int flag = is_directed(cat,&orig_flag,&base,&host) && orig_flag
&& !gale_text_compare(host,dir->host);
base = category_escape(base,flag);
do_transmit |= flag;
rewrite->routing =
gale_text_concat(3,rewrite->routing,G_(":"),base);
}
if (!do_transmit) {
gale_dprintf(5,"*** no positive categories; dropped message\n");
return NULL;
}
/* strip leading colon */
if (rewrite->routing.l > 0)
rewrite->routing = gale_text_right(rewrite->routing,-1);
gale_dprintf(5,"*** \"%s\": rewrote categories to \"%s\"\n",
gale_text_to(gale_global->enc_console,dir->host),
gale_text_to(gale_global->enc_console,rewrite->routing));
return rewrite;
}
开发者ID:grawity,项目名称:gale,代码行数:33,代码来源:directed.c
示例17: gale_crypto_verify_raw
/** Low-level signature verification.
* \param key_count Number of keys in the \a keys array
* and number fo signatures in the \a sigs array.
* \param keys Array of keys. The keys must include public key data.
* \param sigs Array of signatures, as returned from gale_crypto_sign_raw().
* \param data Data to verify against signatures.
* \return Nonzero iff the all signatures are valid. */
int gale_crypto_verify_raw(int key_count,
const struct gale_group *keys,
const struct gale_data *sigs,
struct gale_data data)
{
int i,is_valid = 1;
EVP_MD_CTX *context = EVP_MD_CTX_new();
RSA *rsa;
EVP_VerifyInit(context,EVP_md5());
EVP_VerifyUpdate(context,data.p,data.l);
for (i = 0; is_valid && i < key_count; ++i) {
EVP_PKEY *key = EVP_PKEY_new();
EVP_PKEY_assign_RSA(key,RSA_new());
rsa = EVP_PKEY_get0_RSA(key);
crypto_i_rsa(keys[i],rsa);
if (!crypto_i_public_valid(rsa)) {
gale_alert(GALE_WARNING,G_("invalid public key"),0);
is_valid = 0;
goto cleanup;
}
if (!EVP_VerifyFinal(context,sigs[i].p,sigs[i].l,key)) {
crypto_i_error();
is_valid = 0;
goto cleanup;
}
cleanup:
EVP_PKEY_free(key);
}
return is_valid;
}
开发者ID:grawity,项目名称:gale,代码行数:41,代码来源:crypto_sign_raw.c
示例18: askchangedir
void askchangedir()
{
char *s, msg[MAX_PATH + 40];
/* set cod to current directory */
GetCurrentDirectory(MAX_PATH, cod);
s = askcdstring(G_(" Change working directory to:"), cod);
if (s && (SetCurrentDirectory(s) == FALSE)) {
snprintf(msg, MAX_PATH + 40,
G_("Unable to set '%s' as working directory"), s);
askok(msg);
}
/* in every case reset cod (to new directory if all went ok
or to old since user may have edited it) */
GetCurrentDirectory(MAX_PATH, cod);
}
开发者ID:Chaos1989,项目名称:r-source,代码行数:16,代码来源:dialogs.c
示例19: pagercopy
static void pagercopy(control m)
{
control c = getdata(m);
if (consolecancopy(c)) consolecopy(c);
else R_ShowMessage(G_("No selection"));
}
开发者ID:edzer,项目名称:cxxr,代码行数:7,代码来源:pager.c
示例20: vertex_connectivity
int vertex_connectivity()
{
Graph_List<Edge_Flow<int> > G_(2*G.V(), false); // on double les sommets
Graph_List<Edge>::iterator_all it(G);
for(Edge *e = it.beg(); !it.end(); e = it.nxt())
G_.insert(new Edge_Flow<>(G.V() + e->v(), e->w(), G_.V()*G_.V()));
for(int i = 0; i < G.V(); i++)
G_.insert(new Edge_Flow<>(i, G.V() + i, 1));
int min_flow = -1;
for(int s = G.V(); s < G_.V(); s++)
for(int t = 0; t < G.V(); t++)
{
if(s == t) continue;
Graph_List<Edge_Flow<int> >::iterator_all it(G_);
for(Edge_Flow<int> *e = it.beg(); !it.end(); e = it.nxt())
e->set_flow(0);
//IO<Edge_Flow<int>, Graph_List<Edge_Flow<int> >>::show_capR(G_);
NoNullCap<> noNull(G_.V(), t);
Fulkerson<int, Edge_Flow<> > ful(G_, noNull, s, t);
ful(0);
int flow = ful.get_outflow();
//IO<Edge_Flow<int>, Graph_List<Edge_Flow<int> >>::show_flow(G_);
if(min_flow == -1 || min_flow > flow)
min_flow = flow;
/*if(flow < 3)
cout<<s<<"-"<<t<<endl;*/
}
return min_flow;
}
开发者ID:fev2g,项目名称:SGL,代码行数:31,代码来源:Connectivity.hpp
注:本文中的G_函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论