本文整理汇总了C++中GET_FLAG函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_FLAG函数的具体用法?C++ GET_FLAG怎么用?C++ GET_FLAG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_FLAG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TEXT
*/ REBOOL OS_Request_File(REBRFR *fr)
/*
***********************************************************************/
{
OPENFILENAME ofn = {0};
BOOL ret;
//int err;
REBCHR *filters = TEXT("All files\0*.*\0REBOL scripts\0*.r\0Text files\0*.txt\0" );
ofn.lStructSize = sizeof(ofn);
// ofn.hwndOwner = WIN_WIN(win); // Must find a way to set this
ofn.lpstrTitle = fr->title;
ofn.lpstrInitialDir = fr->dir;
ofn.lpstrFile = fr->files;
ofn.lpstrFilter = fr->filter ? fr->filter : filters;
ofn.nMaxFile = fr->len;
ofn.lpstrFileTitle = 0;
ofn.nMaxFileTitle = 0;
ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER | OFN_NOCHANGEDIR; //|OFN_NONETWORKBUTTON; //;
if (GET_FLAG(fr->flags, FRF_MULTI)) ofn.Flags |= OFN_ALLOWMULTISELECT;
if (GET_FLAG(fr->flags, FRF_SAVE))
ret = GetSaveFileName(&ofn);
else
ret = GetOpenFileName(&ofn);
//if (!ret)
// err = CommDlgExtendedError(); // CDERR_FINDRESFAILURE
return ret;
}
开发者ID:RamchandraApte,项目名称:rebol,代码行数:35,代码来源:host-lib.c
示例2: Open_IO
//
// Open_IO: C
//
DEVICE_CMD Open_IO(REBREQ *req)
{
REBDEV *dev;
dev = Devices[req->device];
// Avoid opening the console twice (compare dev and req flags):
if (GET_FLAG(dev->flags, RDF_OPEN)) {
// Device was opened earlier as null, so req must have that flag:
if (GET_FLAG(dev->flags, SF_DEV_NULL))
SET_FLAG(req->modes, RDM_NULL);
SET_FLAG(req->flags, RRF_OPEN);
return DR_DONE; // Do not do it again
}
if (!GET_FLAG(req->modes, RDM_NULL)) {
// Get the raw stdio handles:
Std_Out = GetStdHandle(STD_OUTPUT_HANDLE);
Std_Inp = GetStdHandle(STD_INPUT_HANDLE);
//Std_Err = GetStdHandle(STD_ERROR_HANDLE);
Std_Echo = 0;
Redir_Out = (GetFileType(Std_Out) != 0);
Redir_Inp = (GetFileType(Std_Inp) != 0);
if (!Redir_Inp || !Redir_Out) {
// If either input or output is not redirected, preallocate
// a buffer for conversion from/to UTF-8.
Std_Buf = OS_ALLOC_N(wchar_t, BUF_SIZE);
}
开发者ID:kjanz1899,项目名称:ren-c,代码行数:33,代码来源:dev-stdio.c
示例3: CLR_FLAG
*/ DEVICE_CMD Write_File(REBREQ *file)
/*
** Bug?: update file->size value after write !?
**
***********************************************************************/
{
if (!file->id) {
file->error = -RFE_NO_HANDLE;
return DR_ERROR;
}
if (GET_FLAG(file->modes, RFM_APPEND)) {
CLR_FLAG(file->modes, RFM_APPEND);
lseek(file->id, 0, SEEK_END);
}
if (file->modes & ((1 << RFM_SEEK) | (1 << RFM_RESEEK) | (1 << RFM_TRUNCATE))) {
CLR_FLAG(file->modes, RFM_RESEEK);
if (!Seek_File_64(file)) return DR_ERROR;
if (GET_FLAG(file->modes, RFM_TRUNCATE))
if (ftruncate(file->id, file->file.index)) return DR_ERROR;
}
if (file->length == 0) return DR_DONE;
file->actual = write(file->id, file->data, file->length);
if (file->actual < 0) {
if (errno == ENOSPC) file->error = -RFE_DISK_FULL;
else file->error = -RFE_BAD_WRITE;
return DR_ERROR;
}
return DR_DONE;
}
开发者ID:Oldes,项目名称:R3A110,代码行数:34,代码来源:dev-file.c
示例4: tascii
std::string enchant::print_to_file() const
{
std::stringstream out;
out << "Ench: I " << name_ << "\n" << " T "<< type_ << "\n";
for (std::vector<obj_affected_type>::const_iterator i = affected_.begin(),
iend = affected_.end(); i != iend; ++i)
{
out << " A " << i->location << " " << i->modifier << "\n";
}
*buf = '\0';
tascii(&GET_FLAG(affects_flags_, 0), 4, buf);
out << " F " << buf << "\n";
*buf = '\0';
tascii(&GET_FLAG(extra_flags_, 0), 4, buf);
out << " E " << buf << "\n";
*buf = '\0';
tascii(&GET_FLAG(no_flags_, 0), 4, buf);
out << " N " << buf << "\n";
out << " W " << weight_ << "\n";
out << " B " << ndice_ << "\n";
out << " C " << sdice_ << "\n";
out << "~\n";
return out.str();
}
开发者ID:Stribog1,项目名称:Bylins,代码行数:30,代码来源:obj_enchant.cpp
示例5: find_string
static REBCNT find_string(REBSER *series, REBCNT index, REBCNT end, REBVAL *target, REBCNT len, REBCNT flags, REBINT skip)
{
REBCNT start = index;
if (flags & (AM_FIND_REVERSE | AM_FIND_LAST)) {
skip = -1;
start = 0;
if (flags & AM_FIND_LAST) index = end - len;
else index--;
}
if (ANY_BINSTR(target)) {
// Do the optimal search or the general search?
if (BYTE_SIZE(series) && VAL_BYTE_SIZE(target) && !(flags & ~(AM_FIND_CASE|AM_FIND_MATCH)))
return Find_Byte_Str(series, start, VAL_BIN_DATA(target), len, !GET_FLAG(flags, ARG_FIND_CASE-1), GET_FLAG(flags, ARG_FIND_MATCH-1));
else
return Find_Str_Str(series, start, index, end, skip, VAL_SERIES(target), VAL_INDEX(target), len, flags & (AM_FIND_MATCH|AM_FIND_CASE));
}
else if (IS_BINARY(target)) {
return Find_Byte_Str(series, start, VAL_BIN_DATA(target), len, 0, GET_FLAG(flags, ARG_FIND_MATCH-1));
}
else if (IS_CHAR(target)) {
return Find_Str_Char(series, start, index, end, skip, VAL_CHAR(target), flags);
}
else if (IS_INTEGER(target)) {
return Find_Str_Char(series, start, index, end, skip, (REBUNI)VAL_INT32(target), flags);
}
else if (IS_BITSET(target)) {
return Find_Str_Bitset(series, start, index, end, skip, VAL_SERIES(target), flags);
}
return NOT_FOUND;
}
开发者ID:RamchandraApte,项目名称:rebol,代码行数:33,代码来源:t-string.c
示例6: delayed_trigger_activity
void
delayed_trigger_activity ()
{
CHAR_DATA *ch;
//for (ch = character_list; ch; ch = ch->next)
for (std::list<char_data*>::iterator tch_iterator = character_list.begin(); tch_iterator != character_list.end(); tch_iterator++)
{
ch = *tch_iterator;
if (ch->deleted)
continue;
if (GET_FLAG (ch, FLAG_INHIBITTED))
{
if (!GET_FLAG (ch, FLAG_ENTERING) &&
!GET_FLAG (ch, FLAG_LEAVING) && !ch->delay)
ch->flags &= ~FLAG_INHIBITTED;
else
continue;
}
if (ch->trigger_delay && !--(ch->trigger_delay))
trigger (ch, "", ch->trigger_id);
}
}
开发者ID:stefanludlow,项目名称:shadows2011,代码行数:27,代码来源:mobprogs.cpp
示例7: closeStream
/*
* Stream contains open file descriptors that could not be completed.
* If stream has only pending open file descriptors close file
* descriptors.
*/
static void
closeStream()
{
FileInfo_t *file;
int id;
id = Stream->first;
while (id > EOS) {
PthreadMutexLock(&Stream->mutex);
file = GetFile(id);
PthreadMutexLock(&file->mutex);
if (GET_FLAG(file->flags, FI_DCACHE_CLOSE)) {
if (close(file->dcache) == -1) {
WarnSyscallError(HERE,
"close", "");
}
CLEAR_FLAG(file->flags, FI_DCACHE);
NumOpenFiles--;
} else if (GET_FLAG(file->flags, FI_DCACHE)) {
SendErrorResponse(file);
}
id = file->next;
PthreadMutexUnlock(&Stream->mutex);
PthreadMutexUnlock(&file->mutex);
}
if (GET_FLAG(Stream->flags, SR_UNAVAIL)) {
rejectRequest(ENODEV, B_TRUE);
} else {
rejectRequest(0, B_TRUE);
}
}
开发者ID:BackupTheBerlios,项目名称:samqfs,代码行数:39,代码来源:copyfile.c
示例8: OS_Make
*/ DEVICE_CMD Read_DNS(REBREQ *sock)
/*
** Initiate the GetHost request and return immediately.
** Note the temporary results buffer (must be freed later).
**
***********************************************************************/
{
void *host;
#ifdef HAS_ASYNC_DNS
HANDLE handle;
#else
HOSTENT *he;
#endif
host = OS_Make(MAXGETHOSTSTRUCT); // be sure to free it
#ifdef HAS_ASYNC_DNS
if (!GET_FLAG(sock->modes, RST_REVERSE)) // hostname lookup
handle = WSAAsyncGetHostByName(Event_Handle, WM_DNS, sock->data, host, MAXGETHOSTSTRUCT);
else
handle = WSAAsyncGetHostByAddr(Event_Handle, WM_DNS, (char*)&(sock->net.remote_ip), 4, AF_INET, host, MAXGETHOSTSTRUCT);
if (handle != 0) {
sock->net.host_info = host;
sock->handle = handle;
return DR_PEND; // keep it on pending list
}
#else
// Use old-style blocking DNS (mainly for testing purposes):
if (GET_FLAG(sock->modes, RST_REVERSE)) {
he = gethostbyaddr((char*)&sock->net.remote_ip, 4, AF_INET);
if (he) {
sock->net.host_info = host; //???
sock->data = he->h_name;
SET_FLAG(sock->flags, RRF_DONE);
return DR_DONE;
}
}
else {
he = gethostbyname(sock->data);
if (he) {
sock->net.host_info = host; // ?? who deallocs?
COPY_MEM((char*)&(sock->net.remote_ip), (char *)(*he->h_addr_list), 4); //he->h_length);
SET_FLAG(sock->flags, RRF_DONE);
return DR_DONE;
}
}
#endif
OS_Free(host);
sock->net.host_info = 0;
sock->error = GET_ERROR;
//Signal_Device(sock, EVT_ERROR);
return DR_ERROR; // Remove it from pending list
}
开发者ID:angerangel,项目名称:rebol3,代码行数:56,代码来源:dev-dns.c
示例9: SET_FLAG
*/ int OS_Do_Device(REBREQ *req, REBCNT command)
/*
** Tell a device to perform a command. Non-blocking in many
** cases and will attach the request for polling.
**
** Returns:
** =0: for command success
** >0: for command still pending
** <0: for command error
**
***********************************************************************/
{
REBDEV *dev;
REBINT result;
req->error = 0; // A94 - be sure its cleared
// Validate device:
if (req->device >= RDI_MAX || !(dev = Devices[req->device])) {
req->error = RDE_NO_DEVICE;
return -1;
}
// Confirm device is initialized. If not, return an error or init
// it if auto init option is set.
if (!GET_FLAG(dev->flags, RDF_INIT)) {
if (GET_FLAG(dev->flags, RDO_MUST_INIT)) {
req->error = RDE_NO_INIT;
return -1;
}
if (!dev->commands[RDC_INIT] || !dev->commands[RDC_INIT]((REBREQ*)dev))
SET_FLAG(dev->flags, RDF_INIT);
}
// Validate command:
if (command > dev->max_command || dev->commands[command] == 0) {
req->error = RDE_NO_COMMAND;
return -1;
}
// Do the command:
req->command = command;
result = dev->commands[command](req);
// If request is pending, attach it to device for polling:
if (result > 0) Attach_Request(&dev->pending, req);
else if (dev->pending) {
Detach_Request(&dev->pending, req); // often a no-op
if (result == DR_ERROR && GET_FLAG(req->flags, RRF_ALLOC)) { // not on stack
Signal_Device(req, EVT_ERROR);
}
}
return result;
}
开发者ID:51weekend,项目名称:r3,代码行数:55,代码来源:host-device.c
示例10: catalog_validate_objects
void catalog_validate_objects()
{
catalog_object_header * i = local_catalog->invalid_list;
while (i != NULL) {
if (GET_FLAG(i->flags, CAT_OBJECT_DELETED_FLAG)) {
} else if (GET_FLAG(i->flags, CAT_OBJECT_INVALID_FLAG)) {
i->validate();
}
i = i->next_invalid;
}
local_catalog->invalid_list = NULL;
}
开发者ID:bitkeeper,项目名称:sedna,代码行数:13,代码来源:catalog.cpp
示例11: VAL_CLR_OPT
*/ static void Protect_Word(REBVAL *value, REBCNT flags)
/*
***********************************************************************/
{
if (GET_FLAG(flags, PROT_WORD)) {
if (GET_FLAG(flags, PROT_SET)) VAL_SET_OPT(value, OPTS_LOCK);
else VAL_CLR_OPT(value, OPTS_LOCK);
}
if (GET_FLAG(flags, PROT_HIDE)) {
if GET_FLAG(flags, PROT_SET) VAL_SET_OPT(value, OPTS_HIDE);
else VAL_CLR_OPT(value, OPTS_HIDE);
}
开发者ID:RamchandraApte,项目名称:rebol,代码行数:13,代码来源:n-control.c
示例12: CLEAR_FLAGS
/**
* Get the flags associated with a format string
* @param format The format string to search.
* @param flags A pointer to flags that are turned on.
* @return A pointer to the format string
*/
const char *_get_flags(const char *format, uchar *flags)
{
uchar f;
uchar done = 0;
// start with no flags
CLEAR_FLAGS(f, PRINTF_ALL);
// skip past the % char
++format;
while(!done) {
char ch = *format++;
switch(ch) {
case '-':
// justify, overrides padding
SET_FLAGS(f, PRINTF_JUSTIFY);
CLEAR_FLAGS(f, PRINTF_PADDING);
break;
case '+':
// sign, overrides space
SET_FLAGS(f, PRINTF_SIGN);
CLEAR_FLAGS(f, PRINTF_SPACE);
break;
case ' ':
if(!GET_FLAG(f, PRINTF_SIGN)) {
SET_FLAGS(f, PRINTF_SPACE);
}
break;
case '#':
SET_FLAGS(f, PRINTF_PREFIX);
break;
case '0':
if(!GET_FLAG(f, PRINTF_JUSTIFY)) {
SET_FLAGS(f, PRINTF_PADDING);
}
break;
default:
done = 1;
--format;
}
}
*flags = f;
return format;
}
开发者ID:wspeirs,项目名称:Mooose,代码行数:55,代码来源:printf_engine.cpp
示例13: GET_ANY_CHAR
*/ REBCNT Find_Str_Char(REBSER *ser, REBCNT head, REBCNT index, REBCNT tail, REBINT skip, REBUNI c2, REBCNT flags)
/*
** General purpose find a char in a string.
**
** Supports: forward/reverse with skip, cased/uncase, Unicode/byte.
**
** Skip can be set positive or negative (for reverse).
**
** Flags are set according to ALL_FIND_REFS
**
***********************************************************************/
{
REBUNI c1;
REBOOL uncase = !GET_FLAG(flags, ARG_FIND_CASE-1); // uncase = case insenstive
if (uncase && c2 < UNICODE_CASES) c2 = LO_CASE(c2);
for (; index >= head && index < tail; index += skip) {
c1 = GET_ANY_CHAR(ser, index);
if (uncase && c1 < UNICODE_CASES) c1 = LO_CASE(c1);
if (c1 == c2) return index;
if GET_FLAG(flags, ARG_FIND_MATCH-1) break;
}
return NOT_FOUND;
}
开发者ID:BrianHawley,项目名称:rebol,代码行数:29,代码来源:s-find.c
示例14:
*/ int OS_Quit_Devices(int flags)
/*
** Terminate all devices in preparation to quit.
**
** Allows devices to perform cleanup and resource freeing.
**
** Set flags to zero for now. (May later be used to indicate
** a device query check or a brute force quit.)
**
** Returns: 0 for now.
**
***********************************************************************/
{
int d;
REBDEV *dev;
for (d = RDI_MAX-1; d >= 0; d--) {
dev = Devices[d];
if (dev && GET_FLAG(dev->flags, RDF_INIT) && dev->commands[RDC_QUIT]) {
dev->commands[RDC_QUIT]((REBREQ*)dev);
}
}
return 0;
}
开发者ID:51weekend,项目名称:r3,代码行数:25,代码来源:host-device.c
示例15: process_output
int
process_output (DESCRIPTOR_DATA * t)
{
char i[MAX_STRING_LENGTH + 1];
if (!t->prompt_mode && !t->connected && t->edit_index == -1)
if (write_to_descriptor (t, "\r\n") < 0)
return (-1);
/* Cycle thru output queue */
while (get_from_q (&t->output, i))
{
if (t->snoop.snoop_by && t->snoop.snoop_by->desc != NULL
&& !IS_NPC (t->snoop.snoop_by))
{
write_to_q ("% ", &t->snoop.snoop_by->desc->output);
write_to_q (i, &t->snoop.snoop_by->desc->output);
}
if (write_to_descriptor (t, i))
return (-1);
}
if (!t->connected && !(t->character && !IS_NPC (t->character) &&
GET_FLAG (t->character, FLAG_COMPACT)))
if (IS_SET (t->edit_mode, MODE_DONE_EDITING) && t->edit_index == -1)
if (write_to_descriptor (t, "\r\n") < 0)
return (-1);
return (1);
}
开发者ID:nuggs,项目名称:RPI-Engine,代码行数:30,代码来源:net_link.cpp
示例16: update_sensitivity
static void
update_sensitivity (void *unused, GtkWidget *dialog)
{
TerminalSearchDialogPrivate *priv = TERMINAL_SEARCH_DIALOG_GET_PRIVATE (dialog);
const gchar *search_string;
gboolean valid;
if (priv->regex) {
g_regex_unref (priv->regex);
priv->regex = NULL;
}
search_string = gtk_entry_get_text (GTK_ENTRY (priv->search_text_entry));
g_return_if_fail (search_string != NULL);
valid = *search_string != '\0';
if (valid && GET_FLAG (regex_checkbutton)) {
/* Check that the regex is valid */
valid = NULL != terminal_search_dialog_get_regex (dialog);
/* TODO show the error message somewhere */
}
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT, valid);
}
开发者ID:3dfxmadscientist,项目名称:gnome-apps,代码行数:25,代码来源:terminal-search-dialog.c
示例17: Read_Directory
*/ DEVICE_CMD Read_File(REBREQ *file)
/*
***********************************************************************/
{
if (GET_FLAG(file->modes, RFM_DIR)) {
return Read_Directory(file, (REBREQ*)file->data);
}
if (!file->id) {
file->error = -RFE_NO_HANDLE;
return DR_ERROR;
}
if (file->modes & ((1 << RFM_SEEK) | (1 << RFM_RESEEK))) {
CLR_FLAG(file->modes, RFM_RESEEK);
if (!Seek_File_64(file)) return DR_ERROR;
}
// printf("read %d len %d\n", file->id, file->length);
file->actual = read(file->id, file->data, file->length);
if (file->actual < 0) {
file->error = -RFE_BAD_READ;
return DR_ERROR;
} else {
file->file.index += file->actual;
}
return DR_DONE;
}
开发者ID:Oldes,项目名称:R3A110,代码行数:29,代码来源:dev-file.c
示例18:
*/ REBCNT Find_Str_Bitset(REBSER *ser, REBCNT head, REBCNT index, REBCNT tail, REBINT skip, REBSER *bset, REBCNT flags)
/*
** General purpose find a bitset char in a string.
**
** Supports: forward/reverse with skip, cased/uncase, Unicode/byte.
**
** Skip can be set positive or negative (for reverse).
**
** Flags are set according to ALL_FIND_REFS
**
***********************************************************************/
{
REBUNI c1;
REBOOL uncase = !GET_FLAG(flags, ARG_FIND_CASE-1); // uncase = case insenstive
for (; index >= head && index < tail; index += skip) {
c1 = GET_ANY_CHAR(ser, index);
//if (uncase && c1 < UNICODE_CASES) {
// if (Check_Bit(bset, LO_CASE(c1)) || Check_Bit(bset, UP_CASE(c1)))
// return index;
//}
//else
if (Check_Bit(bset, c1, uncase)) return index;
if (flags & AM_FIND_MATCH) break;
}
return NOT_FOUND;
}
开发者ID:BrianHawley,项目名称:rebol,代码行数:31,代码来源:s-find.c
示例19: catalog_find_name
catalog_object_header * catalog_find_name(
enum catalog_named_objects obj_type,
const char * name)
{
catalog_object_header * result = NULL;
catalog_name_record * n = NULL;
n = catalog_cachetree_find_name(obj_type, name);
if (n != NULL) {
if (n->name_deleted) { return NULL; }
result = n->obj;
}
if (result == NULL) {
xptr obj = catalog_nametree_find_name(CATALOG_NAME_TREE(obj_type), name);
if (obj != XNULL) {
result = catalog_acquire_object(obj);
catalog_cachetree_add_name(obj_type, name, result);
}
} else if (GET_FLAG(result->flags, CAT_OBJECT_DELETED_FLAG)) {
return NULL;
}
return result;
}
开发者ID:bitkeeper,项目名称:sedna,代码行数:27,代码来源:catalog.cpp
示例20: socket
*/ DEVICE_CMD Close_Socket(REBREQ *sock)
/*
** Close a socket.
**
** Returns 0 on success.
** On failure, error code is OS local.
**
***********************************************************************/
{
sock->error = 0;
if (GET_FLAG(sock->state, RSM_OPEN)) {
sock->state = 0; // clear: RSM_OPEN, RSM_CONNECT
// If DNS pending, abort it:
if (sock->net.host_info) { // indicates DNS phase active
#ifdef HAS_ASYNC_DNS
if (sock->handle) WSACancelAsyncRequest(sock->handle);
#endif
OS_Free(sock->net.host_info);
sock->socket = sock->length; // Restore TCP socket (see Lookup)
}
if (CLOSE_SOCKET(sock->socket)) {
sock->error = GET_ERROR;
return DR_ERROR;
}
}
return DR_DONE;
}
开发者ID:earl,项目名称:r3-hostkit,代码行数:32,代码来源:dev-net.c
注:本文中的GET_FLAG函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论