本文整理汇总了C++中R_ShowMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ R_ShowMessage函数的具体用法?C++ R_ShowMessage怎么用?C++ R_ShowMessage使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了R_ShowMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: process_site_Renviron
/* try site Renviron: R_ENVIRON, then R_HOME/etc/Renviron.site. */
void process_site_Renviron ()
{
char buf[PATH_MAX], *p = getenv("R_ENVIRON");
if(p) {
if(*p) process_Renviron(p);
return;
}
#ifdef R_ARCH
if(strlen(R_Home) + strlen("/etc/Renviron.site") + strlen(R_ARCH) > PATH_MAX - 2) {
R_ShowMessage("path to arch-specific Renviron.site is too long: skipping");
} else {
snprintf(buf, PATH_MAX, "%s/etc/%s/Renviron.site", R_Home, R_ARCH);
if(access(buf, R_OK) == 0) {
process_Renviron(buf);
return;
}
}
#endif
if(strlen(R_Home) + strlen("/etc/Renviron.site") > PATH_MAX - 1) {
R_ShowMessage("path to Renviron.site is too long: skipping");
return;
}
snprintf(buf, PATH_MAX, "%s/etc/Renviron.site", R_Home);
process_Renviron(buf);
}
示例4: 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;
}
示例5: newmetafile
/* width and height are in mm */
metafile newmetafile(const char *name, double width, double height)
{
metafile obj;
HDC hDC;
RECT wr;
static double cppix=-1, ppix, cppiy, ppiy;
/*
* In theory, (cppix=ppix) and (cppiy=ppiy). However, we
* use the ratio to adjust the 'reference dimension'
* in case.... ("Importing graph in MsWord" thread)
*/
if (cppix < 0) {
cppix = 25.40 * devicewidth(NULL) / devicewidthmm(NULL);
ppix = 100 * devicepixelsx(NULL);
cppiy = 25.40 * deviceheight(NULL) / deviceheightmm(NULL);
ppiy = 100 * devicepixelsy(NULL);
}
/* This is all very peculiar. We would really like to create
a metafile measured in some sensible units, but it seems
we get it in units of 0.01mm *on the current screen* with
horizontal and vertical resolution set for that screen.
And of course Windows is famous for getting screen sizes wrong.
*/
wr.left = 0;
wr.top = 0 ;
wr.right = (ppix * width) / cppix ;
wr.bottom = (ppiy * height) / cppiy ;
/* Here the size is in 0.01mm units */
hDC = CreateEnhMetaFile(NULL, strlen(name) ? name : NULL, &wr,
"GraphApp\0\0");
if ( !hDC ) {
R_ShowMessage(_("Unable to create metafile"));
return NULL;
}
obj = new_object(MetafileObject, (HANDLE) hDC, get_metafile_base());
if ( !obj ) {
R_ShowMessage(_("Insufficient memory to create metafile"));
DeleteEnhMetaFile(CloseEnhMetaFile(hDC));
return NULL;
}
/* In looks like Windows rounds up the width and height, so we
do too. 1 out is common, but 2 out has been seen.
This is needed to get complete painting of the background.
*/
obj->rect = rect(0, 0, 2+(ppix * width)/2540, 2+(ppiy * height)/2540);
obj->depth = GetDeviceCaps(hDC, BITSPIXEL) * GetDeviceCaps(hDC, PLANES);
obj->die = private_delmetafile;
obj->drawstate = copydrawstate();
obj->drawstate->dest = obj;
settext(obj, name ? name : "");
return obj;
}
示例6: hiplar_dtrMatrix_matrix_mm
SEXP hiplar_dtrMatrix_matrix_mm(SEXP a, SEXP b, SEXP right, SEXP trans) {
#ifdef HIPLAR_DBG
R_ShowMessage("DBG: Entering hiplar_dtrMatrix_matrix_mm");
#endif
#if defined(HIPLAR_WITH_PLASMA) && defined(HIPLAR_WITH_MAGMA)
int *dims = INTEGER(GET_SLOT(a, Matrix_DimSym));
int size = dims[0];
if ((hiplar_library == HIPLAR_USE_PLASMA) ||
((hiplar_library == HIPLAR_USE_AUTO) && (size < xover_dtrMatrix_matrix_mm))) {
#endif
#ifdef HIPLAR_WITH_PLASMA
return plasma_dtrMatrix_matrix_mm(a, b, right, trans);
#endif
#if defined(HIPLAR_WITH_PLASMA) && defined(HIPLAR_WITH_MAGMA)
} else {
#endif
#ifdef HIPLAR_WITH_MAGMA
return magma_dtrMatrix_matrix_mm(a, b, right, trans);
#endif
#if defined(HIPLAR_WITH_PLASMA) && defined(HIPLAR_WITH_MAGMA)
}
#endif
return R_NilValue;
}
示例7: copytoclipboard
void copytoclipboard(drawing sb)
{
HBITMAP hbmpOldDest, hbmpNew;
HDC hdcSrc, hdcDest;
rect r;
r = getrect(sb);
hdcSrc = get_context((object)sb);
hdcDest = CreateCompatibleDC(hdcSrc);
hbmpNew = CreateCompatibleBitmap(hdcSrc, r.width, r.height);
hbmpOldDest = SelectObject(hdcDest, hbmpNew);
BitBlt(hdcDest, 0, 0, r.width, r.height, hdcSrc, 0, 0, SRCCOPY);
SelectObject(hdcDest, hbmpOldDest);
DeleteDC(hdcDest);
if (!OpenClipboard(NULL) || !EmptyClipboard()) {
R_ShowMessage(G_("Unable to open the clipboard"));
DeleteObject(hbmpNew);
return;
}
SetClipboardData(CF_BITMAP, hbmpNew);
CloseClipboard();
return;
}
示例8: pagercopy
static void pagercopy(control m)
{
control c = getdata(m);
if (consolecancopy(c)) consolecopy(c);
else R_ShowMessage(G_("No selection"));
}
示例9: process_Renviron
static int process_Renviron(const char *filename)
{
FILE *fp;
char *s, *p, sm[BUF_SIZE], *lhs, *rhs, msg[MSG_SIZE+50];
int errs = 0;
if (!filename || !(fp = R_fopen(filename, "r"))) return 0;
snprintf(msg, MSG_SIZE+50,
"\n File %s contains invalid line(s)", filename);
while(fgets(sm, BUF_SIZE, fp)) {
sm[BUF_SIZE-1] = '\0';
s = rmspace(sm);
if(strlen(s) == 0 || s[0] == '#') continue;
if(!(p = Rf_strchr(s, '='))) {
errs++;
if(strlen(msg) < MSG_SIZE) {
strcat(msg, "\n "); strcat(msg, s);
}
continue;
}
*p = '\0';
lhs = rmspace(s);
rhs = findterm(rmspace(p+1));
/* set lhs = rhs */
if(strlen(lhs) && strlen(rhs)) Putenv(lhs, rhs);
}
fclose(fp);
if (errs) {
strcat(msg, "\n They were ignored\n");
R_ShowMessage(msg);
}
return 1;
}
示例10: R_EditFiles
/*
* nfile = number of files
* file = array of filenames
* editor = editor to be used.
*/
int R_EditFiles(int nfile, const char **file, const char **title,
const char *editor)
{
char buf[1024];
if (ptr_R_EditFiles) return(ptr_R_EditFiles(nfile, file, title, editor));
if (nfile > 0) {
if (nfile > 1)
R_ShowMessage(_("WARNING: Only editing the first in the list of files"));
if (ptr_R_EditFile) ptr_R_EditFile((char *) file[0]);
else {
/* Quote path if necessary */
if (editor[0] != '"' && Rf_strchr(editor, ' '))
snprintf(buf, 1024, "\"%s\" \"%s\"", editor, file[0]);
else
snprintf(buf, 1024, "%s \"%s\"", editor, file[0]);
if (R_system(buf) == 127)
warningcall(R_NilValue, _("error in running command"));
}
return 0;
}
return 1;
}
示例11: R_Suicide
void R_Suicide(const char *s)
{
char pp[1024];
snprintf(pp, 1024, _("Fatal error: %s\n"), s);
R_ShowMessage(pp);
R_CleanUp(SA_SUICIDE, 2, 0);
}
示例12: since
/*
I don't use 'error' since (1) we must free 'scanline' and
(2) we can be arrived here from a button or menuitem callback maybe
in a different thread from the one where R runs.
*/
static void my_png_error(png_structp png_ptr, png_const_charp msg)
{
R_ShowMessage((char *) msg);
#if PNG_LIBPNG_VER < 10400
longjmp(png_ptr->jmpbuf,1);
#else
longjmp(png_jmpbuf(png_ptr),1);
#endif
}
示例13: SetSize
static void SetSize(R_size_t vsize)
{
char msg[1024];
/* vsize > 0 to catch long->int overflow */
if (vsize < 1000 && vsize > 0) {
R_ShowMessage("WARNING: vsize ridiculously low, Megabytes assumed\n");
vsize *= R_size_t( Mega);
}
if(vsize < Min_Vsize || vsize > Max_Vsize) {
snprintf(msg, 1024,
"WARNING: invalid v(ector heap)size `%lu' ignored\n"
"using default = %gM\n", static_cast<unsigned long>( vsize),
R_VSIZE / Mega);
R_ShowMessage(msg);
R_VSize = R_VSIZE;
} else
R_VSize = vsize;
}
示例14: my_output_message
/* We also replace the output method */
static void my_output_message (j_common_ptr cinfo)
{
char buffer[JMSG_LENGTH_MAX];
/* Create the message */
(*cinfo->err->format_message) (cinfo, buffer);
/* and show it */
R_ShowMessage(buffer);
}
示例15: pagerpastecmds
static void pagerpastecmds(control m)
{
control c = getdata(m);
if (CharacterMode != RGui) {
R_ShowMessage(G_("No RGui console to paste to"));
return;
}
if (!consolecancopy(c)) {
R_ShowMessage(G_("No selection"));
return;
} else {
consolecopy(c);
}
if (consolecanpaste(RConsole)) {
consolepastecmds(RConsole);
show(RConsole);
}
}