本文整理汇总了C++中sh函数的典型用法代码示例。如果您正苦于以下问题:C++ sh函数的具体用法?C++ sh怎么用?C++ sh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sh函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main_loop
static void
main_loop()
{
int p = 0;
int c, n;
L:
show_all();
sh(p);
fflush(stdout);
while (1) {
c = getch();
if (c == 3 || c == 4 || c == 27 || c < 0)
break;
if (c == 257 && p > 0)
p--;
if (c == 258 && p < counts - 1)
p++;
if (c == 259 && p < counts - 19)
p += 19;
if (c == 260 && p >= 19)
p -= 19;
if (c == 13 || c == 10) {
bbsnet(p);
goto L;
}
for (n = 0; n < counts; n++)
if (str[n] == c)
p = n;
sh(p);
fflush(stdout);
}
}
开发者ID:long5313828,项目名称:ythtbbs,代码行数:32,代码来源:bbsnet.c
示例2: visit_eq
void visit_eq(app* eq) {
ast_manager& m = m_manager;
SASSERT(m.is_eq(eq));
sort* s = m.get_sort(eq->get_arg(0));
SASSERT(is_sort_of(s, m_fid, ARRAY_SORT));
// sort* rng = get_array_range(s);
unsigned arity = get_array_arity(s);
shift_vars sh(m);
expr_ref e1(m), e2(m);
sh(find(eq->get_arg(0)), arity, e1);
sh(find(eq->get_arg(1)), arity, e2);
expr_ref_vector args(m);
buffer<symbol> names;
ptr_buffer<sort> sorts;
args.push_back(e1);
for (unsigned i = 0; i < arity; ++i) {
args.push_back(m.mk_var(i, get_array_domain(s, i)));
sorts.push_back(get_array_domain(s, arity - i - 1));
names.push_back(symbol(m_offset++));
}
e1 = mk_select(args.size(), args.c_ptr());
args[0] = e2;
e2 = mk_select(args.size(), args.c_ptr());
e1 = m.mk_eq(e1, e2);
e1 = m.mk_quantifier(true, arity, sorts.c_ptr(), names.c_ptr(), e1, 1);
insert(eq, e1);
}
开发者ID:sukwon0709,项目名称:byterun,代码行数:28,代码来源:array_property_expander.cpp
示例3: __Call_sh
long __Call_sh( CDSR_VMEval& /*vm*/, MMD_Address& addr, UniWord *arg )
{
#if _DEBUG
if( addr.param2 < 0 )
throw _T("__Call_(fun) : internal error, out of range");
#endif
if( addr.param2 == 0 ) // DSRDATA_TYPE_REAL
*(arg - 1) = CDSRReal( sh( (arg - 1)->getReal() ) );
else // DSRDATA_TYPE_COMPLEX
*(arg - 1) = CDSRComplex( sh( (arg - 1)->getComplex() ) );
return 1 - addr.param3;
}
开发者ID:Nilis640,项目名称:formulator-mathml,代码行数:12,代码来源:execop_fun.cpp
示例4: reflective_copy
void reflective_copy(const Src& s, Dst& d)
{
holder sh(create_holder(const_cast< Src& >(s)));
holder dh(create_holder(d));
reflective_copy(sh, dh);
}
开发者ID:asenac,项目名称:gsim,代码行数:7,代码来源:descriptor_utils.hpp
示例5: qDebug
void CdbDumperHelper::moduleLoadHook(const QString &module, HANDLE debuggeeHandle)
{
if (loadDebug > 1)
qDebug() << "moduleLoadHook" << module << m_state << debuggeeHandle;
switch (m_state) {
case Disabled:
case Initialized:
break;
case NotLoaded:
// Try an inject load as soon as a Qt lib is loaded.
// for the thread to finish as this would lock up.
if (m_tryInjectLoad && module.contains(QLatin1String("Qt"), Qt::CaseInsensitive)) {
// Also shows up in the log window.
m_manager->showStatusMessage(msgLoading(m_library, true), messageTimeOut);
QString errorMessage;
SharedLibraryInjector sh(GetProcessId(debuggeeHandle));
if (sh.remoteInject(m_library, false, &errorMessage)) {
m_state = InjectLoading;
} else {
m_state = InjectLoadFailed;
// Ok, try call loading...
m_manager->showDebuggerOutput(LogMisc, msgLoadFailed(m_library, true, errorMessage));
}
}
break;
case InjectLoading:
// check if gdbmacros.dll loaded
if (module.contains(QLatin1String(dumperModuleNameC), Qt::CaseInsensitive)) {
m_state = Loaded;
m_manager->showDebuggerOutput(LogMisc, msgLoadSucceeded(m_library, true));
}
break;
}
}
开发者ID:TheProjecter,项目名称:project-qtcreator,代码行数:34,代码来源:cdbdumperhelper.cpp
示例6: sh
int basic_socket_impl::send_data(std::string dat)
{
boost::shared_array<char> sh(new char[dat.size()]);
memcpy(sh.get(), dat.c_str(), dat.size());
stream_buffer buf(sh, dat.size(), dat.size());
return send_data(buf);
}
开发者ID:ghosthjt,项目名称:server_client_common,代码行数:7,代码来源:net_socket_basic.cpp
示例7: sh
const AnimationData* ResourceLoader::anim(string name)
{
auto anim = animations.find(name);
if (anim == animations.end()) {
pugi::xml_document animXml;
string path = root + name;
animXml.load_file(path.c_str());
if (animXml.begin() == animXml.end()) {
// Couldn't open .anim file!
std::cerr << "ERROR: couldn't load animation \"" << path << "\"\n";
return &AnimationData::defaultAnim;
}
pugi::xml_node node = animXml.child("animations");
string sheetName = animXml.first_child().first_attribute().as_string();
const SpriteSheet* sheet = sh(sheetName);
if (sheet == nullptr) {
std::cerr << "\t(requested by \"" << path << "\")\n";
return &AnimationData::defaultAnim;
}
AnimationData& aData = animations[name];
if (!loadAnimData(aData, animXml, sheet)) {
animations.erase(animations.find(name));
std::cerr << "\t(requested by \"" << path << "\")\n";
return &AnimationData::defaultAnim;
}
const sf::Texture* texture = tex(sheet->imageName);
if (texture == nullptr) {
std::cerr << "\t(requested by \"" << path << "\")\n";
return &AnimationData::defaultAnim;
}
aData.tx = texture;
return &aData;
}
return &anim->second;
}
开发者ID:Gatleos,项目名称:hexmap,代码行数:35,代码来源:ResourceLoader.cpp
示例8: psutt
double
Pst::
psutt(const ECString& shU, int t, int word_num)
{
//cerr << "Unknown word: " << shU << " for tag: " << t << endl;
double ans = pHugt(t);
//cerr << "pHugt = " << ans << endl;
if(ans == 0) return 0;
double phyp = pHypgt(shU,t);
ans *= phyp;
//cerr << "pHypgt = " << phyp << endl;
double phcp = pCapgt(shU,t, word_num);
ans *= phcp;
ans *= .000001;
if(Term::fromInt(t)->openClass())
{
char temp[1024];
ECString sh(langAwareToLower(shU.c_str(),temp));
float phegt = pegt(sh,t);
if(phegt == 0) phegt = .00001;
//if(phegt == 0) phegt = .00005;
//cerr << "pegt( " << sh << " | " << t << " ) = " << phegt << endl;
ans *= phegt;
}
else
ans *= .00000001;
//cerr << "psutt( " << shU << " | " << t << " ) = " << ans << endl;
return ans;
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:30,代码来源:Pst.C
示例9: sender
void CaptureWgt::slotResolution()
{
QObject * o = sender();
QAction * a = dynamic_cast<QAction *>( o );
if ( !a )
return;
for ( int i=0; i<pd->resList.size(); i++ )
{
QAction * n = dynamic_cast<QAction *>( pd->resList[i] );
if ( ( n ) && ( a == n ) )
n->setChecked( true );
else
n->setChecked( false );
}
QString stri = a->text();
QRegExp reg( "\\d{1,}\\s{0,}x" );
QString sw( "640 x" );
if ( reg.indexIn( stri ) != -1 )
sw = reg.cap( 0 );
QString sh( "x 480" );
reg.setPattern( "x\\s{0,}\\d{1,}" );
if ( reg.indexIn( stri ) != -1 )
sh = reg.cap( 0 );
int w = sw.left( sw.length() - 1 ).toInt();
int h = sh.right( sh.length() - 1 ).toInt();
pd->cap->setResolution( QSize( w, h ) );
}
开发者ID:z80,项目名称:chassis,代码行数:27,代码来源:capture_wgt.cpp
示例10: list_sort
/**
* Sort a linked list in an order defined by the sort handler
*
* @param list Linked list
* @param sh Sort handler
* @param arg Handler argument
*/
void list_sort(struct list *list, list_sort_h *sh, void *arg)
{
struct le *le;
bool sort;
if (!list || !sh)
return;
retry:
le = list->head;
sort = false;
while (le && le->next) {
if (sh(le, le->next, arg)) {
le = le->next;
}
else {
struct le *tle = le->next;
list_unlink(le);
list_insert_after(list, tle, le, le->data);
sort = true;
}
}
if (sort) {
goto retry;
}
}
开发者ID:soramimi,项目名称:qSIP,代码行数:38,代码来源:list.c
示例11: clink
static ERROR clink(const struct stage *stage,
const char *out_fn, const char *inputs, const char *extra) {
static const char fmt[] = "%s %s " LDFLAGS " %s %s %s -o %s%s %s";
const char *ext = "";
if (strcmp(g_opt.compiler, "emcc") == 0) {
ext = ".js";
}
char *user_ldflags = collect_stage_flag(stage, ID_LDFLAGS);
size_t len = strlen(fmt) + strlen(g_opt.ccache)
+ strlen(g_opt.compiler) + strlen(g_opt.cflags)
+ strlen(inputs) + strlen(extra) + strlen(out_fn) + strlen(ext)
+ strlen(user_ldflags);
char *cmd = calloc(len + 1, sizeof(char));
sprintf(cmd, fmt, g_opt.ccache, g_opt.compiler,
g_opt.cflags, inputs, extra, out_fn, ext, user_ldflags);
free(user_ldflags);
error e = sh(cmd);
free(cmd);
EXCEPT(e);
return 0;
}
开发者ID:nanocritical,项目名称:n,代码行数:25,代码来源:ncc0.main.c
示例12: sendServerHello
// send server hello
void sendServerHello(SSL& ssl, BufferOutput buffer)
{
if (ssl.getSecurity().get_resuming())
ssl.verifyState(clientKeyExchangeComplete);
else
ssl.verifyState(clientHelloComplete);
if (ssl.GetError()) return;
ServerHello sh(ssl.getSecurity().get_connection().version_,
ssl.getSecurity().get_connection().compression_);
RecordLayerHeader rlHeader;
HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer);
buildServerHello(ssl, sh);
ssl.set_random(sh.get_random(), server_end);
buildHeaders(ssl, hsHeader, rlHeader, sh);
buildOutput(*out.get(), rlHeader, hsHeader, sh);
hashHandShake(ssl, *out.get());
if (buffer == buffered)
ssl.addBuffer(out.release());
else
ssl.Send(out->get_buffer(), out->get_size());
}
开发者ID:hans511002,项目名称:erydb,代码行数:26,代码来源:handshake.cpp
示例13: sp
void SwaptionVolatilityHullWhite::performCalculations() const {
SwaptionVolatilityDiscrete::performCalculations();
// we might use iterators here...
for (Size i=0; i<volatilities_.rows(); ++i)
for (Size j=0; j<volatilities_.columns(); ++j)
volatilities_[i][j] = volHandles_[i][j]->value();
interpolation_.update();
//LevenbergMarquardt lm;
Simplex sp(0.001); // we should use another optimizer here...
EndCriteria ec(1000,500,1E-8,1E-8,1E-8);
NoConstraint cons;
Array val(1);
for(Size i=0; i<optionTenors_.size() ; i++) {
for(Size j=0; j<swapTenors_.size() ; j++) {
boost::shared_ptr<SwaptionHelper> sh(new SwaptionHelper(optionTenors_[i],swapTenors_[j],Handle<Quote>(new SimpleQuote(volatilities_[i][j])),indexBase_->iborIndex(),indexBase_->fixedLegTenor(),
indexBase_->dayCounter(),Actual360(),yts_)); // FIXME float leg day counter hardcoded ?
boost::shared_ptr<HullWhite> hwTmp(new HullWhite(yts_,reversion_));
boost::shared_ptr<JamshidianSwaptionEngine> jamshidianEngine(new JamshidianSwaptionEngine(hwTmp,yts_));
sh->setPricingEngine(jamshidianEngine);
calibrationFunction cfct(hwTmp,sh);
val[0]=sqrt(0.01);
Problem p(cfct,cons,val);
sp.minimize(p,ec);
hwsigmas_[i][j] = p.currentValue()[0]*p.currentValue()[0];
//std::cout << std::setprecision(8) << "calibration: " << optionTenors_[i] << "/" << swapTenors_[j] << " sigma=" << hwsigmas_[i][j] << " model=" << sh->modelValue() << " market=" << sh->marketValue() << std::endl;
}
}
interpolationSigma_.update();
}
开发者ID:cathie912jin,项目名称:quantlib,代码行数:35,代码来源:swaptionvolhullwhite.cpp
示例14: sh
//trace ray
RGB Multi::traceRay(const Ray& ray)
{
Shade sh(world_->hitNearestObject(ray));
if (sh.hit)
return sh.color;
else return world_->bgColor;
}
开发者ID:tomcarter259,项目名称:Ray-Tracer,代码行数:9,代码来源:Multi.cpp
示例15: mul
unsigned long long mul(const unsigned long long& a, const unsigned long long& b, const unsigned long long& m) {
unsigned long long a_h = (a >> 32),
a_l = (a << 32) >> 32,
b_h = (b >> 32),
b_l = (b << 32) >> 32,
val_hh = (a_h * b_h) % m,
val_hl = (a_h * b_l) % m,
val_lh = (a_l * b_h) % m,
val_ll = (a_l * b_l) % m;
sh(val_hh, 64, m);
sh(val_lh, 32, m);
sh(val_hl, 32, m);
unsigned long long res = (val_hh + val_hl) % m;
res = (res + val_lh) % m;
res = (res + val_ll) % m;
return res;
}
开发者ID:eddrda,项目名称:cpp,代码行数:17,代码来源:PON.cpp
示例16: main
int main()
{
boost::shared_ptr<int> sh(new int(99));
boost::weak_ptr<int> w(sh);
HANDLE threads[2];
threads[0] = CreateThread(0, 0, reset, &sh, 0, 0);
threads[1] = CreateThread(0, 0, print, &w, 0, 0);
WaitForMultipleObjects(2, threads, TRUE, INFINITE);
}
开发者ID:zhuliting,项目名称:code,代码行数:9,代码来源:weak_ptr.cpp
示例17: style
QSize SplitterCollapser::sizeHint() const
{
int extent = style()->pixelMetric(QStyle::PM_ScrollBarExtent);
QSize sh(extent * 3 / 4, extent * 240 / 100);
if (d->isVertical()) {
sh.transpose();
}
return sh;
}
开发者ID:KDE,项目名称:libksane,代码行数:9,代码来源:splittercollapser.cpp
示例18: QMainWindow
Search::Search(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Search)
{
ui->setupUi(this);
sh();
}
开发者ID:sailendraw,项目名称:MontesorryManagementSystem,代码行数:9,代码来源:search.cpp
示例19: main
int
main(int argc, char **argv) {
int ret, f;
if(argc==1)
return sh(0,1);
if((f=open(argv[1],O_RDONLY)) == -1) {
writestr(2,"sh: ");
writestr(2,argv[1]);
writestr(2,": Can't open\n");
return 1;
}
ret=sh(f,0);
close(f);
return ret;
}
开发者ID:HNGNU,项目名称:hutils,代码行数:19,代码来源:sh.c
示例20: sh
int MASA::navierstokes_4d_compressible_powerlaw<Scalar>::init_var()
{
// Set parameter values directly on the instance
MASA::nsctpl::isothermal_channel(*this);
// Tell MASA about each parameter so it believes they are initialized
set_helper<Scalar> sh(this);
this->foreach_parameter(sh);
return 0;
}
开发者ID:hovr2pi,项目名称:MASA,代码行数:11,代码来源:nsctpl.cpp
注:本文中的sh函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论