本文整理汇总了C++中GET2函数的典型用法代码示例。如果您正苦于以下问题:C++ GET2函数的具体用法?C++ GET2怎么用?C++ GET2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GET2
char *parse_mesocyclone (char *buf, NIDS_mesocyclone *c) {
c->x_start = GET2(buf);
c->y_start = GET2(buf + 2);
c->radius = GET2(buf + 4);
return buf + 6;
}
示例2: GET2
char *parse_raster_header(char *buf, NIDS_raster *r) {
int i;
char *p;
r->op_flags1 = GET2(buf);
r->op_flags2 = GET2(buf + 2);
r->x_start = GET2(buf + 4);
r->y_start = GET2(buf + 6);
r->x_scale_int = GET2(buf + 8);
r->x_scale_fract = GET2(buf + 10);
r->y_scale_int = GET2(buf + 12);
r->y_scale_fract = GET2(buf + 14);
r->num_rows = GET2(buf + 16);
r->packing = GET2(buf + 18);
if (!(r->rows = malloc(r->num_rows * sizeof(NIDS_raster_row))))
ERROR("parse_radial_header");
p = buf + 20;
for (i = 0 ; i < r->num_rows ; i++) {
p = parse_raster_row(p, r->rows + i);
}
return p;
}
示例3: get_first_set
static int
get_first_set(const pcre16 *code, PCRE_SPTR16 stringname, int *ovector)
#endif
{
const REAL_PCRE *re = (const REAL_PCRE *)code;
int entrysize;
pcre_uchar *entry;
#ifdef COMPILE_PCRE8
char *first, *last;
#else
PCRE_UCHAR16 *first, *last;
#endif
#ifdef COMPILE_PCRE8
if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0)
return pcre_get_stringnumber(code, stringname);
entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last);
#else
if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0)
return pcre16_get_stringnumber(code, stringname);
entrysize = pcre16_get_stringtable_entries(code, stringname, &first, &last);
#endif
if (entrysize <= 0) return entrysize;
for (entry = (pcre_uchar *)first; entry <= (pcre_uchar *)last; entry += entrysize)
{
int n = GET2(entry, 0);
if (ovector[n*2] >= 0) return n;
}
return GET2(entry, 0);
}
示例4: GET2
char *parse_linked_vector(char *buf, NIDS_vector *v, int x_start, int y_start) {
v->x_start = x_start;
v->y_start = y_start;
v->x_end = GET2(buf);
v->y_end = GET2(buf + 2);
return buf + 4;
}
示例5: GET2
char *parse_hail (char *buf, NIDS_hail *h) {
h->x_start = GET2(buf);
h->y_start = GET2(buf + 2);
h->prob = GET2(buf + 4);
h->severe = GET2(buf + 6);
h->max_size = GET2(buf + 8);
return buf + 10;
}
示例6: zft_ftape_extract_file_marks
void zft_ftape_extract_file_marks(__u8* address)
{
int i;
TRACE_FUN(ft_t_any);
zft_eof_map = NULL;
if (ft_format_code == fmt_var || ft_format_code == fmt_big) {
__u8* end;
__u8* start = ftape_find_end_of_bsm_list(address);
zft_nr_eof_marks = 0;
if (start) {
start += 3; /* skip end of list mark */
end = find_end_of_eof_list(start,
address + FT_SEGMENT_SIZE);
if (end && end - start <= FT_FSL_SIZE) {
zft_nr_eof_marks = ((end - start) /
sizeof(eof_mark_union));
zft_eof_map = (eof_mark_union *)start;
} else {
TRACE(ft_t_err,
"EOF Mark List is too long or damaged!");
}
} else {
TRACE(ft_t_err,
"Bad Sector List is too long or damaged !");
}
} else {
zft_eof_map = (eof_mark_union *)&address[FT_FSL];
zft_nr_eof_marks = GET2(address, FT_FSL_CNT);
}
TRACE(ft_t_noise, "number of file marks: %d", zft_nr_eof_marks);
if (ftape_fmt_version == 1) {
TRACE(ft_t_info, "swapping version 1 fields");
/* version 1 format uses swapped sector and segment
* fields, correct that !
*/
for (i = 0; i < zft_nr_eof_marks; ++i) {
__u16 tmp = GET2(&zft_eof_map[i].mark.segment,0);
PUT2(&zft_eof_map[i].mark.segment, 0,
GET2(&zft_eof_map[i].mark.date,0));
PUT2(&zft_eof_map[i].mark.date, 0, tmp);
}
}
for (i = 0; i < zft_nr_eof_marks; ++i) {
TRACE(ft_t_noise, "eof mark: %5d/%2d",
GET2(&zft_eof_map[i].mark.segment, 0),
GET2(&zft_eof_map[i].mark.date,0));
}
TRACE_EXIT;
}
示例7: step4
static void step4(int *ix, int *mdist, mat_t mstar, mat_t nmstar,
mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols,
int dmin, int row, int col)
{
int n, rstar, cstar, primeRow, primeCol;
/* generate temporary copy of mstar */
memcpy(nmstar, mstar, sizeof(mat_t));
/* star current zero */
SET2(nmstar, row, col);
/* find starred zero in current column */
cstar = col;
for (rstar = 0; rstar < nrows; rstar++)
if (GET2(mstar, rstar, cstar))
break;
while (rstar < nrows) {
/* unstar the starred zero */
CLEAR2(nmstar, rstar, cstar);
/* find primed zero in current row */
primeRow = rstar;
for (primeCol = 0; primeCol < ncols; primeCol++)
if (GET2(mprime, primeRow, primeCol))
break;
/* star the primed zero */
SET2(nmstar, primeRow, primeCol);
/* find starred zero in current column */
cstar = primeCol;
for (rstar = 0; rstar < nrows; rstar++)
if (GET2(mstar, rstar, cstar))
break;
}
/* use temporary copy as new mstar */
/* delete all primes, uncover all rows */
memcpy(mstar, nmstar, sizeof(mat_t));
memset(mprime, 0, sizeof(mat_t));
memset(crow, 0, sizeof(col_t));
/* move to step 2a */
step2a(ix, mdist, mstar, nmstar,
mprime, ccol, crow, nrows, ncols,
dmin);
}
示例8: ctltrans
static long
ctltrans(Ep *ep, uchar *req, long n)
{
Hostchan *hc;
Epio *epio;
Block *b;
uchar *data;
int datalen;
epio = ep->aux;
if(epio->cb != nil){
freeb(epio->cb);
epio->cb = nil;
}
if(n < Rsetuplen)
error(Ebadlen);
if(req[Rtype] & Rd2h){
datalen = GET2(req+Rcount);
if(datalen <= 0 || datalen > Maxctllen)
error(Ebadlen);
/* XXX cache madness */
epio->cb = b = allocb(ROUND(datalen, ep->maxpkt) + CACHELINESZ);
b->wp = (uchar*)ROUND((uintptr)b->wp, CACHELINESZ);
//epio->cb = b = allocb(ROUND(datalen, ep->maxpkt));
//assert(((uintptr)b->wp & (BLOCKALIGN-1)) == 0);
memset(b->wp, 0x55, b->lim - b->wp);
cachedwbinvse(b->wp, b->lim - b->wp);
data = b->wp;
}else{
b = nil;
datalen = n - Rsetuplen;
data = req + Rsetuplen;
}
hc = chanalloc(ep);
if(waserror()){
chanrelease(ep, hc);
if(strcmp(up->env->errstr, Estalled) == 0)
return 0;
nexterror();
}
chansetup(hc, ep);
chanio(ep, hc, Epout, SETUP, req, Rsetuplen);
if(req[Rtype] & Rd2h){
if(ep->dev->hub <= 1){
ep->toggle[Read] = DATA1;
b->wp += multitrans(ep, hc, Read, data, datalen);
}else
b->wp += chanio(ep, hc, Epin, DATA1, data, datalen);
chanio(ep, hc, Epout, DATA1, nil, 0);
n = Rsetuplen;
}else{
if(datalen > 0)
chanio(ep, hc, Epout, DATA1, data, datalen);
chanio(ep, hc, Epin, DATA1, nil, 0);
n = Rsetuplen + datalen;
}
chanrelease(ep, hc);
poperror();
return n;
}
示例9: pcre32_get_stringnumber
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
pcre32_get_stringnumber(const pcre32 *code, PCRE_SPTR32 stringname)
#endif
{
int rc;
int entrysize;
int top, bot;
pcre_uchar *nametable;
#ifdef COMPILE_PCRE8
if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
return rc;
if (top <= 0) return PCRE_ERROR_NOSUBSTRING;
if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0)
return rc;
if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)
return rc;
#endif
#ifdef COMPILE_PCRE16
if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
return rc;
if (top <= 0) return PCRE_ERROR_NOSUBSTRING;
if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0)
return rc;
if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)
return rc;
#endif
#ifdef COMPILE_PCRE32
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0)
return rc;
if (top <= 0) return PCRE_ERROR_NOSUBSTRING;
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0)
return rc;
if ((rc = pcre32_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0)
return rc;
#endif
bot = 0;
while (top > bot)
{
int mid = (top + bot) / 2;
pcre_uchar *entry = nametable + entrysize*mid;
int c = STRCMP_UC_UC((pcre_uchar *)stringname,
(pcre_uchar *)(entry + IMM2_SIZE));
if (c == 0) return GET2(entry, 0);
if (c > 0) bot = mid + 1; else top = mid;
}
return PCRE_ERROR_NOSUBSTRING;
}
示例10: buildixvector
static void buildixvector(int *ix, mat_t mstar, int nrows, int ncols)
{
int row, col;
for (row = 0; row < nrows; row++) {
for (col = 0; col < ncols; col++) {
if (GET2(mstar, row, col)) {
ix[row] = col;
break;
}
}
}
}
示例11: getrxctl
static int
getrxctl(Dev *d)
{
uchar buf[2];
int r;
memset(buf, 0, sizeof(buf));
if(asixget(d, Crrxctl, buf, sizeof(buf)) < 0)
return -1;
r = GET2(buf);
deprint(2, "%s: rxctl %#x\n", argv0, r);
return r;
}
示例12: GET2
void ProxyConfPrivate::readProxyData()
{
/* Read the proxy settings from /system/proxy* */
GET2(http_proxy, host, String);
GET2(http_port, port, Int);
GET2(ignore_hosts, ignore_hosts, List);
GET(mode, String);
GET(autoconfig_url, String);
GET(secure_host, String);
GET(secure_port, Int);
GET(ftp_host, String);
GET(ftp_port, Int);
GET(socks_host, String);
GET(socks_port, Int);
GET(rtsp_host, String);
GET(rtsp_port, Int);
if (http_proxy.isEmpty())
use_http_host = false;
else
use_http_host = true;
}
示例13: checkhubstatus
/*
* This may be used to detect overcurrent on the hub
*/
static void
checkhubstatus(Hub *h)
{
uint8_t buf[4];
int sts;
if(h->isroot) /* not for root hubs */
return;
if(usbcmd(h->dev, Rd2h|Rclass|Rdev, Rgetstatus, 0, 0, buf, 4) < 0){
dprint(2, "%s: get hub status: %r\n", h->dev->dir);
return;
}
sts = GET2(buf);
dprint(2, "hub %s: status %#x\n", h->dev->dir, sts);
}
示例14: step3
static void step3(int *ix, int *mdist, mat_t mstar, mat_t nmstar,
mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols,
int dmin)
{
int zerosFound;
int row, col, cstar;
zerosFound = 1;
while (zerosFound) {
zerosFound = 0;
for (col = 0; col < ncols; col++) {
if (GET1(ccol, col))
continue;
for (row = 0; row < nrows; row++) {
if (mdist[row + nrows * col] != 0)
continue;
if (GET1(crow, row))
continue;
/* prime zero */
SET2(mprime, row, col);
/* find starred zero in current row */
for (cstar = 0; cstar < ncols; cstar++)
if (GET2(mstar, row, cstar))
break;
if (cstar == ncols) { /* no starred zero */
/* move to step 4 */
step4(ix, mdist, mstar, nmstar,
mprime, ccol, crow, nrows, ncols,
dmin, row, col);
return;
} else {
SET1(crow, row);
CLEAR1(ccol, cstar);
zerosFound = 1;
break;
}
}
}
}
/* move to step 5 */
step5(ix, mdist, mstar, nmstar,
mprime, ccol, crow, nrows, ncols,
dmin);
}
示例15: miiread
static int
miiread(Dev *d, int phy, int reg)
{
int r;
uchar v[2];
r = Rd2h|Rvendor|Rdev;
if(usbcmd(d, r, Crmii, phy, reg, v, 2) < 0){
dprint(2, "%s: miiwrite: %r\n", argv0);
return -1;
}
r = GET2(v);
if(r == 0xFFFF)
return -1;
return r;
}