예제 #1
0
/* Output something interesing when we can for route and trackpoints */
static void kml_output_description(const waypoint *pt)
{
	char *alt_units;
	double alt;

	if (!trackdata) {
		return;
	}

	alt = fmt_distance(pt->altitude, &alt_units);

	kml_write_xml(1, "<description><![CDATA[\n");
	kml_write_xml(1, "<table>\n");

	TD("Longitude: %f", pt->longitude);
	TD("Latitude: %f", pt->latitude);
	if (pt->altitude != unknown_alt) TD2("Altitude: %.3f %s", alt, alt_units);
	if (pt->heartrate) TD("Heart rate: %d", pt->heartrate);
	if (pt->cadence) TD("Cadence: %d", pt->cadence);
	/* Which unit is this temp in? C? F? K? */
	if WAYPT_HAS(pt, temperature) TD("Temperature: %.1f", pt->temperature);
	if WAYPT_HAS(pt, depth) {
		char *depth_units;
		double depth = fmt_distance(pt->depth, &depth_units);
		TD2("Depth: %.1f %s", depth, depth_units);
	}
예제 #2
0
파일: tput.c 프로젝트: BA3IK/node-ncurses
/*
 * Lookup the type of call we should make to tparm().  This ignores the actual
 * terminfo capability (bad, because it is not extensible), but makes this
 * code portable to platforms where sizeof(int) != sizeof(char *).
 */
static TParams
tparm_type(const char *name)
{
#define TD(code, longname, ti, tc) {code,longname},{code,ti},{code,tc}
    TParams result = Numbers;
    /* *INDENT-OFF* */
    static const struct {
	TParams code;
	const char *name;
    } table[] = {
	TD(Num_Str,	"pkey_key",	"pfkey",	"pk"),
	TD(Num_Str,	"pkey_local",	"pfloc",	"pl"),
	TD(Num_Str,	"pkey_xmit",	"pfx",		"px"),
	TD(Num_Str,	"plab_norm",	"pln",		"pn"),
	TD(Num_Str_Str, "pkey_plab",	"pfxl",		"xl"),
    };
    /* *INDENT-ON* */

    unsigned n;
    for (n = 0; n < SIZEOF(table); n++) {
	if (!strcmp(name, table[n].name)) {
	    result = table[n].code;
	    break;
	}
    }
    return result;
}
예제 #3
0
OCCTesselation *OCCEdge::tesselate(double angular, double curvature)
{
    OCCTesselation *ret = new OCCTesselation();
    try {
        Standard_Real start, end;
        OCCStruct3f vert;
        
        TopLoc_Location loc = this->getEdge().Location();
        gp_Trsf location = loc.Transformation();
        
        const Handle(Geom_Curve)& curve = BRep_Tool::Curve(this->getEdge(), start, end);
        const GeomAdaptor_Curve& aCurve(curve);
		
        GCPnts_TangentialDeflection TD(aCurve, start, end, angular, curvature);
        
        for (Standard_Integer i = 1; i <= TD.NbPoints(); i++)
        {
            gp_Pnt pnt = TD.Value(i).Transformed(location);
            vert.x = (float)pnt.X();
            vert.y = (float)pnt.Y();
            vert.z = (float)pnt.Z();
            ret->vertices.push_back(vert);
        }
        
        ret->ranges.push_back(0);
        ret->ranges.push_back(ret->vertices.size());
        
    } catch(Standard_Failure &err) {
        return NULL;
    }
    return ret;
}
예제 #4
0
 static String TR( const StringList& cols )
 {
    String tr( "<tr style=\"background:" + ((tableRow & 1) ? oddBgColor : evenBgColor) + "\">" );
    for ( StringList::const_iterator i = cols.Begin(); i != cols.End(); ++i )
       tr += TD( *i );
    tr += "</tr>";
    ++tableRow;
    return tr;
 }
예제 #5
0
/* SUBGOAL flip-to ?grasper ?knob na ?knob-position */
void PA_FlipTo(Context *cx, Subgoal *sg, Ts *ts, Obj *a, Obj *o)
{
  Dur d;
  Dbg(DBGPLAN, DBGOK, "PA_FlipTo", E);
  switch (sg->state) {
    case STBEGIN:
      SG(cx, sg, 1, STFAILURE, L(N("near-graspable"), I(o,1), I(o,2), E));
      return;
    case 1:
      d = DurationOf(I(o, 0));
      AA(ts, d, o);
      TsIncrement(ts, d);
      TD(ts, L(N("knob-position"), I(o,2), E), 0);
      AS(ts, 0, L(I(o,4), I(o,2), E));
      TOSTATE(cx, sg, STSUCCESS);
      return;
    default: Dbg(DBGPLAN, DBGBAD, "PA_FlipTo: undefined state %d", sg->state);
  }
  TOSTATE(cx, sg, STFAILURE);
}
예제 #6
0
OCCTesselation *OCCWire::tesselate(double angular, double curvature)
{
    OCCTesselation *ret = new OCCTesselation();
    try {
        Standard_Real start, end;
        OCCStruct3f dtmp;
        
        // explore wire edges in connected order
        int lastSize = 0;
        BRepTools_WireExplorer exWire;
        
        for (exWire.Init(this->getWire()); exWire.More(); exWire.Next()) {
            const TopoDS_Edge& edge = exWire.Current();
            TopLoc_Location loc = edge.Location();
            gp_Trsf location = loc.Transformation();
            
            const Handle(Geom_Curve)& curve = BRep_Tool::Curve(edge, start, end);
            const GeomAdaptor_Curve& aCurve(curve);
            
            GCPnts_TangentialDeflection TD(aCurve, start, end, angular, curvature);
            
            ret->ranges.push_back(ret->vertices.size());
            
            for (Standard_Integer i = 1; i <= TD.NbPoints(); i++)
            {
                gp_Pnt pnt = TD.Value(i).Transformed(location);
                dtmp.x = (float)pnt.X();
                dtmp.y = (float)pnt.Y();
                dtmp.z = (float)pnt.Z();
                ret->vertices.push_back(dtmp);
            }
            
            ret->ranges.push_back(ret->vertices.size() - lastSize);
            lastSize = ret->vertices.size();
        }
    } catch(Standard_Failure &err) {
        return NULL;
    }
    return ret;
}
예제 #7
0
파일: keymap.c 프로젝트: 0xdec/qmk_firmware
// Runs for each key down or up event.
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  if (keycode != TD(TAP_MACRO)) {
    // That key is processed by the macro_tapdance_fn. Not ignoring it here is
    // mostly a no-op except that it is recorded in the macros (and uses space).
    // We can't just return false when the key is a tap dance, because
    // process_record_user, is called before the tap dance processing (and
    // returning false would eat the tap dance).
    if (!process_record_dynamic_macro(keycode, record)) {
      return false;
    }

    if(record->event.pressed) {
      switch(keycode) {
        case MC_ARROW:
          SEND_STRING("=>");
          return false;
          break;
      }
    }
  }

  return true; // Let QMK send the enter press/release events
}
예제 #8
0
파일: keymap.c 프로젝트: 0xdec/qmk_firmware
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/* LAYER 0
 * ,-----------------------.
 * |   1   |   2   |   3   |
 * |-------+-------+-------|
 * |   4   | 5/ENT |   6   | Dbl Tap 5 for Enter
 * |-------+-------+-------|
 * |  7/0  |   8   | 9/FN  | 7/0 = Dbl Tap 7 for 0  -  9/FN = Hold 9 for FN
 * `-----------------------'
 */
[0] = LAYOUT( \
  KC_1,       KC_2,      KC_3,       \
  KC_4,       TD(ENT_5), KC_6,       \
  TD(ZERO_7), KC_8,      LT(1, KC_9) \
),

/* LAYER 1
 * ,-----------------------.
 * |  ESC  |   +   |   -   |
 * |-------+-------+-------|
 * |  BSPC |   *   |   /   |
 * |-------+-------+-------|
 * |  00   |   .   |       |
 * `-----------------------'
 */
[1] = LAYOUT( \
  KC_ESC,   KC_PLUS, KC_MINS, \
  KC_BSPC,  KC_ASTR, KC_SLSH, \
예제 #9
0
bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
  unsigned MatchCount = 0;

  for (auto &AST : QS.ASTs) {
    MatchFinder Finder;
    std::vector<BoundNodes> Matches;
    DynTypedMatcher MaybeBoundMatcher = Matcher;
    if (QS.BindRoot) {
      llvm::Optional<DynTypedMatcher> M = Matcher.tryBind("root");
      if (M)
        MaybeBoundMatcher = *M;
    }
    CollectBoundNodes Collect(Matches);
    if (!Finder.addDynamicMatcher(MaybeBoundMatcher, &Collect)) {
      OS << "Not a valid top-level matcher.\n";
      return false;
    }
    Finder.matchAST(AST->getASTContext());

    if (QS.PrintMatcher) {
      std::string prefixText = "Matcher: ";
      OS << "\n  " << prefixText << Source << "\n";
      OS << "  " << std::string(prefixText.size() + Source.size(), '=') << '\n';
    }

    for (auto MI = Matches.begin(), ME = Matches.end(); MI != ME; ++MI) {
      OS << "\nMatch #" << ++MatchCount << ":\n\n";

      for (auto BI = MI->getMap().begin(), BE = MI->getMap().end(); BI != BE;
           ++BI) {
        if (QS.DiagOutput) {
          clang::SourceRange R = BI->second.getSourceRange();
          if (R.isValid()) {
            TextDiagnostic TD(OS, AST->getASTContext().getLangOpts(),
                              &AST->getDiagnostics().getDiagnosticOptions());
            TD.emitDiagnostic(
                FullSourceLoc(R.getBegin(), AST->getSourceManager()),
                DiagnosticsEngine::Note, "\"" + BI->first + "\" binds here",
                CharSourceRange::getTokenRange(R), None);
          }
        }
        if (QS.PrintOutput) {
          OS << "Binding for \"" << BI->first << "\":\n";
          BI->second.print(OS, AST->getASTContext().getPrintingPolicy());
          OS << "\n";
        }
        if (QS.DetailedASTOutput) {
          OS << "Binding for \"" << BI->first << "\":\n";
          BI->second.dump(OS, AST->getSourceManager());
          OS << "\n";
        }
      }

      if (MI->getMap().empty())
        OS << "No bindings.\n";
    }
  }

  OS << MatchCount << (MatchCount == 1 ? " match.\n" : " matches.\n");
  return true;
}
예제 #10
0
main()
{
	vec_t test;
	vec_t tout;

#define TD(i,j) test.put(&d[i], j); cerr << "d is at " << ::dec((unsigned int)d) << endl;
#define TB(i,j) test.put(&b[i], j); cerr << "b is at " << ::dec((unsigned int)b) << endl;
#define TA(i,j) test.put(&a[i], j); cerr << "a is at " << ::dec((unsigned int)a) << endl;
#define TC(i,j) test.put(&c[i], j); cerr << "c is at " << ::dec((unsigned int)c) << endl;

	TA(0,10);
	TB(0,10);
	TC(0,10);
	TD(0,10);


	V(test, 5, 7, tout);
	V(test, 5, 10, tout);
	V(test, 5, 22, tout);

	V(test, 11, 0, tout);
	V(test, 11, 7, tout);
	V(test, 11, 9, tout);

	V(test, 30, 9, tout);
	V(test, 30, 29, tout);
	V(test, 30, 40, tout);
	V(test, 40, 30, tout);

	V(test, 100, 9, tout);

	P("{ {1   \"}\" }");
	/*{{{*/
	P("{ {3 \"}}}\"      }}");
	P("{ {30 \"xxxxxxxxxxyyyyyyyyyyzzzzzzzzzz\"} }");
	P("{ {30 \"xxxxxxxxxxyyyyyyyyyyzzzzzzzzzz\"}{10    \"abcdefghij\"} }");

	{
		vec_t t;
		t.reset();
		t.put("abc",3);
		for(int i=0; i<t.count(); i++) {
			cout <<"vec["<<i<<"]=("
				<<::dec((unsigned int)t.ptr(i)) <<"," <<t.len(i) <<")" << endl;
		}
		cout << "FINAL: "<< t << endl;
	}

	{
		cout << "ZVECS: " << endl;

		{
			zvec_t z(0);
			cout << "z(0).count() = " << z.count() << endl;
			cout << "z(0) is zero vec: " << z.is_zvec() << endl;
			vec_t  zv;
			zv.set(z);
			cout << "zv.set(z).count() = " << zv.count() << endl;
			cout << "zv is zero vec: " << zv.is_zvec() << endl;
		}
		{
			zvec_t z;
			cout << "z is zero vec: " << z.is_zvec() << endl;
			cout << "z.count() = " << z.count() << endl;
			vec_t  zv;
			zv.set(z);
			cout << "zv.set(z).count() = " << zv.count() << endl;
			cout << "zv(0) is zero vec: " << zv.is_zvec() << endl;
		}
	}

	{
		int n = 0x80000003;
		int m = 0xeffffffc;
		vec_t   num( (void*)&n, sizeof(n));
		vec_t   num2( (void*)&m, sizeof(m));

		cout << "vec containing 0x80000003 prints as: " << num  << endl;
		cout << "vec containing 0xeffffffc prints as: " << num2  << endl;
	}

	{
		char c = 'h';
		char last = (char)'\377';
		char last1 = '\377';
		char last2 = (char)0xff;

		vec_t   cv( (void*)&c, sizeof(c));
		vec_t   lastv( (void*)&last, sizeof(last));
		vec_t   last1v( (void*)&last1, sizeof(last1));
		vec_t   last2v( (void*)&last2, sizeof(last2));

		bool result = (bool)(cv < lastv);
		cout << "cv <= lastv: " << result << endl;
		cout << "cv prints as: " << cv <<endl;
		cout << "lastv prints as: " << lastv <<endl;
		cout << "last1 prints as: " << last1v <<endl;
		cout << "last2 prints as: " << last2v <<endl;
	}
}
예제 #11
0
  B Row     R2 (reversed)
*/

// Colemak PB&J (Mod-DH)
[_COLEMAK] = LAYOUT( \
   XK_TAB,    KC_Q,    KC_W,    KC_F,    KC_P,    KC_B,            KC_J,    KC_L,        KC_U,         KC_Y,  ALT_IT,         XK_DEL, \
   XK_BSP,    KC_A,    KC_R,    KC_S,    KC_T,    KC_G,            KC_M,    KC_N,        KC_E,         KC_I,    KC_O,         XK_APO, \
    KYSFT,    KC_X,    KC_C,    KC_D,    KC_V,    KC_Z,            KC_K,    KC_H,     TD(COD),       KC_DOT,  CTL_IT, SFT_T(KC_SLSH), \
    KYCTL, KC_LGUI, TD(ESC), KC_LALT, XK_PGUP,  XK_SPC,          XK_ENT, XK_PGDN, MO(_MLAYER), TT(_NAVIGAT),  PIPBOY,         XK_GRV \
),

// useful for one-handed typing
[_KAMELOC] = LAYOUT( \
   XK_DEL, KC_SCLN,    KC_Y,    KC_U,    KC_L,    KC_J,            KC_B,    KC_P,    KC_F,    KC_W,    KC_Q,  XK_TAB, \
  _______,    KC_O,    KC_I,    KC_E,    KC_N,    KC_M,            KC_G,    KC_T,    KC_S,    KC_R,    KC_A, _______, \
    KYSFT, KC_SLSH,  KC_DOT, KC_COMM,    KC_H,    KC_K,         TD(UND),    KC_V,    KC_D,    KC_C,    KC_X,   KYSFT, \
   XK_GRV,  PIPBOY,    M(1), KC_BTN1, KC_HOME,  KC_ENT,          KC_ENT,  KC_END, KC_LGUI, TD(ESC), KC_LALT,   KYCTL \
),

/*
  ┌────┬────┬────┬────┬────┬────┐    ┌────┬────┬────┬────┬────┬────┐
  │    │ 1  │ 2  │ 3  │ 4  │ 5  │    │ 6  │ 7  │ 8  │ 9  │ 0  │    │
  ├────┼────┼────┼────┼────┼────┤    ├────┼────┼────┼────┼────┼────┤
  │    │ M  │ V- │ V+ │NEXT│PLAY│    │ ←  │ ↓  │ ↑  │ →  │DASH│INS │
  ├────┼────┼────┼────┼────┼────┤    ├────┼────┼────┼────┼────┼────┤
  │    │ -  │ =  │TGL │    │    │    │HOME│END │HOME│    │ \  │ ~  │
  ├────┼────┼────┼────┼────┼────┤    ├────┼────┼────┼────┼────┼────┤
  │    │    │    │    │    │    │    │    │    │    │    │    │    │
  └────┴────┴────┴────┴────┴────┘    └────┴────┴────┴────┴────┴────┘
*/
[_IKAPILA] = LAYOUT( \
예제 #12
0
파일: keymap.c 프로젝트: 0xdec/qmk_firmware
#define AC_G_L    LGUI(KC_L)   // Ubuntu/Windows: Lock session
#define AC_G_T    LGUI(KC_T)   // Ubuntu: Shows Trash // elementary: Opens terminal
#define AC_G_E    LGUI(KC_E)   // Windows: Opens file explorer
#define AC_G_H    LGUI(KC_H)   // Windows: Show/Hide hidden files
#define AC_G_SPC  LGUI(KC_SPC) // elementary: Shows application launcher


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

  // 0: Base Layer
  LAYOUT_all(
      KC_GRAVE, KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,     KC_0,     KC_MINS,   KC_EQL,   KC_BSPC,   KC_DEL,    \
      KC_TAB,   KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,     KC_P,     KC_LBRC,   KC_RBRC,             KC_BSLS,   \
      KC_ESC,   KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L,     KC_SCLN,  KC_QUOT,   KC_NO,               KC_ENT,    \
      KC_LSFT,  KC_LGUI, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M,    KC_COMM,  KC_DOT,   KC_SLSH,   KC_RSFT,  KC_UP,     F(0),      \
      KC_LCTL,  TD(0),   KC_LALT,                            KC_SPC ,                             KC_RALT,  KC_RCTRL,  KC_LEFT,  KC_DOWN,   KC_RIGHT),
                                                                                                                                           
  // 1: Function 1 Layers                                                                                                                  
  LAYOUT_all(                                                                                                                                  
      RESET,   KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,    KC_F10,   KC_F11,    KC_F12,   KC_PAUS,   KC_PSCR,    \
      KC_TRNS, KC_BTN1, KC_MS_U, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,  KC_TRNS,  KC_TRNS,   KC_TRNS,             KC_TRNS,    \
      KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MPRV, KC_MNXT,  KC_MSTP,  KC_TRNS,   KC_NO,               KC_TRNS,    \
      KC_TRNS, F(2),    KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD,  KC_VOLU,  KC_TRNS,   KC_TRNS,  KC_PGUP,   KC_TRNS,    \
      KC_TRNS, KC_TRNS, KC_TRNS,                            KC_TRNS,                             KC_TRNS,  KC_TRNS,   KC_HOME,  KC_PGDOWN, KC_END),
                                                                                                                                           
  // 2: GUI/Function 2 Layer                                                                                                                   
  LAYOUT_all(                                                                                                                                  
      KC_ESC,  KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,    KC_F10,   KC_F11,    KC_F12,   KC_PAUS,    KC_PSCR,   \
      KC_TRNS, KC_TRNS, AC_G_W,  AC_G_E,  KC_TRNS, AC_G_T,  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,  KC_TRNS,  KC_TRNS,   KC_TRNS,              KC_TRNS,   \
      KC_TRNS, KC_TRNS, AC_G_S,  AC_G_D,  KC_TRNS, KC_TRNS, AC_G_H,  KC_TRNS, KC_TRNS, AC_G_L,   KC_TRNS,  KC_TRNS,   KC_NO,                KC_TRNS,   \
      KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,  KC_TRNS,  KC_TRNS,   KC_TRNS,  KC_PGUP,    KC_TRNS,   \
예제 #13
0
파일: user_data.c 프로젝트: drafnel/Vis5d
int	user_data_get_topo (Display_Context dtx, char topo_name[])

{

    int		i, ir, ic, nr, nc, ielev;
    long	ndat, ltmp;
    char	file_name[1000], *ptmp;
    float	*dat;
    FILE	*file;



    if ((ptmp = user_data_check_name (dtx, topo_name, TOPOFILE)) != NULL)
    {
        strcpy (file_name, ptmp);
    }
    else
    {
        if (strlen (user_file_name) == 0) return 0;

        strcpy (file_name, user_file_name);

        ptmp = strrchr (file_name, '.');
        if (ptmp == NULL) ptmp = file_name + strlen (file_name);
        sprintf (ptmp, "_TOPO.dat");
    }

    fprintf (stderr, "Reading user topo file %s\n", file_name);
    if ((file = fopen (file_name, "rb")) == NULL) return 0;



    nr   = dtx->Nr;
    nc   = dtx->Nc;
    ndat = nr * nc;
    dat  = (float *) malloc (ndat * sizeof (float));
    if (dat == NULL) return 0;

    fread (&ltmp, 1, sizeof (long), file); /* skip over reference time */
    fread (&ltmp, 1, sizeof (long), file); /* skip over forecast time */
    fread (dat, ndat, sizeof (float), file);



    dtx->topo->TopoData = (short *) malloc (ndat * sizeof (short));
    if (dtx->topo->TopoData == NULL)
    {
        free (dat);
        return 0;
    }


#define TD(ROW, COL)   dtx->topo->TopoData[ (COL) + ((ROW) * nc) ]

    i = 0;
    for (ir = nr-1; ir >= 0; ir--)
    {
        for (ic = 0; ic < nc; ic++, i++)
        {
            ielev = dat[i];
            ielev = (ielev == 0) ? 1 : ielev * 2;
            TD(ir, ic) = ielev;
        }
    }

    free (dat);

    dtx->topo->Topo_rows = nr;
    dtx->topo->Topo_cols = nc;

    dtx->topo->Topo_westlon  = dtx->WestBound;
    dtx->topo->Topo_eastlon  = dtx->EastBound;
    dtx->topo->Topo_northlat = dtx->NorthBound;
    dtx->topo->Topo_southlat = dtx->SouthBound;


    return 1;
}
예제 #14
0
파일: hts_endian.c 프로젝트: atks/vt
    TF(0x00, 0x00, 0x80, 0x3f,  1.0f),
    TF(0x00, 0x00, 0x80, 0xbf, -1.0f),
    TF(0x00, 0x00, 0x20, 0x41, 10.0f),
    TF(0xd0, 0x0f, 0x49, 0x40,  3.14159f),
    TF(0xa8, 0x0a, 0xff, 0x66,  6.022e23f),
    TF(0xcd, 0x84, 0x03, 0x13,  1.66e-27f),
};

#define TD(b0, b1, b2, b3, b4, b5, b6, b7, d) { \
    { b0, b1, b2, b3, b4, b5, b6, b7 },         \
    { 0x00, b0, b1, b2, b3, b4, b5, b6, b7 },   \
    d                                           \
}

Test_double tests_double[] = {
    TD(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  0.0),
    TD(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,  1.0),
    TD(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xbf, -1.0),
    TD(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x40, 10.0),
    TD(0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40,  3.141592653589793),
    TD(0x2b, 0x08, 0x0c, 0xd3, 0x85, 0xe1, 0xdf, 0x44,  6.022140858e23),
    TD(0x55, 0xfa, 0x81, 0x74, 0xf7, 0x71, 0x60, 0x3a,  1.66053904e-27),
};

#define NELE(x) (sizeof(x)/sizeof(x[0]))

static char * to_hex(uint8_t *buf, int len) {
    static char str[64];
    int i, o;

    for (i = 0, o = 0; i < len; i++, o += 3) {
예제 #15
0
/*
 * Output the track summary.
 */
static 
void kml_output_trkdescription(const route_head *header, computed_trkdata *td)
{
	char *max_alt_units;
	double max_alt;
	char *min_alt_units;
	double min_alt;
	char *distance_units;
	double distance;

	if (!td || !trackdata) {
		return;
	}

	max_alt = fmt_distance(td->max_alt, &max_alt_units);
	min_alt = fmt_distance(td->min_alt, &min_alt_units);
	distance = fmt_distance(td->distance_meters, &distance_units);

	kml_write_xml(0, "<Snippet/>\n");

	kml_write_xml(1, "<description>\n");
	kml_write_xml(1, "<![CDATA[<table>\n");

	if (header->rte_desc) {
		TD("<b>Description</b> %s", header->rte_desc);
	}
	TD2("<b>Distance</b> %.1f %s", distance, distance_units);
	if (min_alt != unknown_alt) {
		TD2("<b>Min Alt</b> %.3f %s", min_alt, min_alt_units);
	}
	if (max_alt != unknown_alt) {
		TD2("<b>Max Alt</b> %.3f %s", max_alt, max_alt_units);
	}
	if (td->min_spd) {
		char *spd_units;
		double spd = fmt_speed(td->min_spd, &spd_units);
		TD2("<b>Min Speed</b> %.1f %s", spd, spd_units);
	}
	if (td->max_spd) {
		char *spd_units;
		double spd = fmt_speed(td->max_spd, &spd_units);
		TD2("<b>Max Speed</b> %.1f %s", spd, spd_units);
	}
	if (td->max_spd && td->start && td->end) {
		char *spd_units;
		time_t elapsed = td->end - td->start;
		double spd = fmt_speed(td->distance_meters / elapsed, &spd_units);
		if (spd > 1.0)  {
			TD2("<b>Avg Speed</b> %.1f %s", spd, spd_units);
		}
	}
	if (td->avg_hrt) {
		TD("<b>Avg Heart Rate</b> %.1f bpm", td->avg_hrt);
	}
	if (td->min_hrt < td->max_hrt) {
		TD("<b>Min Heart Rate</b> %d bpm", td->min_hrt);
	}
	if (td->max_hrt) {
		TD("<b>Max Heart Rate</b> %d bpm", td->max_hrt);
	}
	if (td->avg_cad) {
		TD("<b>Avg Cadence</b> %.1f rpm", td->avg_cad);
	}
	if (td->max_cad) {
		TD("<b>Max Cadence</b> %d rpm", td->max_cad);
	}
	if (td->start && td->end) {
		char time_string[64];

		xml_fill_in_time(time_string, td->start, 0, XML_LONG_TIME);
		TD("<b>Start Time</b> %s ", time_string);
		xml_fill_in_time(time_string, td->end, 0, XML_LONG_TIME);
		TD("<b>End Time</b> %s ", time_string);
	}

	kml_write_xml(-1, "</table>]]>\n");
	kml_write_xml(-1, "</description>\n");

	/* We won't always have times. Garmin saved tracks, for example... */
	if (td->start && td->end) {
		char time_string[64];
		kml_write_xml(1, "<TimeSpan>\n");
		xml_fill_in_time(time_string, td->start, 0, XML_LONG_TIME);
		kml_write_xml(0, "<begin>%s</begin>\n", time_string);
		xml_fill_in_time(time_string, td->end, 0, XML_LONG_TIME);
		kml_write_xml(0, "<end>%s</end>\n", time_string);
		kml_write_xml(-1, "</TimeSpan>\n");
	}
}
예제 #16
0
bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const {
  unsigned MatchCount = 0;

  for (llvm::ArrayRef<ASTUnit *>::iterator I = QS.ASTs.begin(),
                                           E = QS.ASTs.end();
       I != E; ++I) {
    ASTUnit *AST = *I;
    MatchFinder Finder;
    std::vector<BoundNodes> Matches;
    DynTypedMatcher MaybeBoundMatcher = Matcher;
    if (QS.BindRoot) {
      llvm::Optional<DynTypedMatcher> M = Matcher.tryBind("root");
      if (M)
        MaybeBoundMatcher = *M;
    }
    CollectBoundNodes Collect(Matches);
    if (!Finder.addDynamicMatcher(MaybeBoundMatcher, &Collect)) {
      OS << "Not a valid top-level matcher.\n";
      return false;
    }
    Finder.matchAST(AST->getASTContext());

    for (std::vector<BoundNodes>::iterator MI = Matches.begin(),
                                           ME = Matches.end();
         MI != ME; ++MI) {
      OS << "\nMatch #" << ++MatchCount << ":\n\n";

      for (BoundNodes::IDToNodeMap::const_iterator BI = MI->getMap().begin(),
                                                   BE = MI->getMap().end();
           BI != BE; ++BI) {
        switch (QS.OutKind) {
        case OK_Diag: {
          clang::SourceRange R = BI->second.getSourceRange();
          if (R.isValid()) {
            TextDiagnostic TD(OS, AST->getASTContext().getLangOpts(),
                              &AST->getDiagnostics().getDiagnosticOptions());
            TD.emitDiagnostic(
                R.getBegin(), DiagnosticsEngine::Note,
                "\"" + BI->first + "\" binds here",
                ArrayRef<CharSourceRange>(CharSourceRange::getTokenRange(R)),
                ArrayRef<FixItHint>(), &AST->getSourceManager());
          }
          break;
        }
        case OK_Print: {
          OS << "Binding for \"" << BI->first << "\":\n";
          BI->second.print(OS, AST->getASTContext().getPrintingPolicy());
          OS << "\n";
          break;
        }
        case OK_Dump: {
          OS << "Binding for \"" << BI->first << "\":\n";
          BI->second.dump(OS, AST->getSourceManager());
          OS << "\n";
          break;
        }
        }
      }

      if (MI->getMap().empty())
        OS << "No bindings.\n";
    }
  }

  OS << MatchCount << (MatchCount == 1 ? " match.\n" : " matches.\n");
  return true;
}
예제 #17
0
{
  TD_DOTCOM = 0
};
//Tap Dance Definitions
qk_tap_dance_action_t tap_dance_actions[] = {
    //Tap once for Esc, twice for Caps Lock
    [TD_DOTCOM] = ACTION_TAP_DANCE_DOUBLE(KC_COMMA, KC_DOT)
    // Other declarations would go here, separated by commas, if you have them
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

    [_BL] = LAYOUT_625_space(
        LT(OSL(2), KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
        GUI_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(3, KC_ENT),
        KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, TD(TD_DOTCOM), OSL(2), OSM(MOD_RSFT),
        KC_ESC, KC_LALT, KC_LCTL, KC_SPC, KC_RGUI, RGB_TOG),
    [_WIN] = LAYOUT_625_space(
        LT(OSL(2), KC_TAB), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
        CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(3, KC_ENT),
        KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, TD(TD_DOTCOM), OSL(2), OSM(MOD_RSFT),
        KC_ESC, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, RGB_TOG),
    [_FN1] = LAYOUT_625_space(
        KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
        GUI_T(KC_ESC), KC_PGUP, KC_VOLU, KC_DEL, KC_TRNS, KC_BSLS, KC_LBRC, KC_RBRC, KC_MINS, KC_EQL, KC_TRNS,
        KC_LSFT, KC_PGDN, KC_VOLD, BL_STEP, BL_TOGG, KC_SCLN, KC_QUOT, KC_SLSH, KC_DOT, KC_TRNS, KC_TRNS,
        KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),

    [_FN2] = LAYOUT_625_space(
        KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, RESET,
        MT(KC_LGUI, KC_ESC), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, TG(1), KC_TRNS, KC_TRNS, KC_F11, KC_F12, KC_TRNS,