removing profiling files
Former-commit-id: cef240e6ac16d1f361a6a6ef922d4ab6b0b979cc
This commit is contained in:
parent
14f0e15c76
commit
40f8edca66
1
0.geojson.REMOVED.git-id
Normal file
1
0.geojson.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
4134a9f456f3d77dcc989bb3aac4e72ea3d66bc7
|
1
1.geojson.REMOVED.git-id
Normal file
1
1.geojson.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
a15df18c70ad80df1500fab02e08ece9530c60c0
|
1
3.geojson.REMOVED.git-id
Normal file
1
3.geojson.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
2869090364c7b65cf11284920a17798c8a5231a0
|
|
@ -1 +0,0 @@
|
||||||
85c850fc7f07d0cf30352d3385c7a2aeb57fecf3
|
|
|
@ -1,6 +0,0 @@
|
||||||
curl "https://api.mapbox.com/v4/mapbox.mapbox-streets-v8/8/40/89.mvt?access_token=pk.eyJ1Ijoibm1hdHN1ZGEiLCJhIjoiY2swazhrdGNjMGZ3NzNvcmE0OGxoaGd2byJ9.PAYHqO3any_6vLdjQ44RGw"
|
|
||||||
|
|
||||||
mapbox://styles/nmatsuda/ck0k7rvvt3rkv1cq6l74wjda2
|
|
||||||
|
|
||||||
|
|
||||||
47.695,-123.489
|
|
1
ne_10m_admin_0_boundary_lines_land.shp.REMOVED.git-id
Normal file
1
ne_10m_admin_0_boundary_lines_land.shp.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1c045ad9fa0e297c746045572bdfb1f9b772e13d
|
BIN
ne_10m_admin_0_boundary_lines_land.shx
Normal file
BIN
ne_10m_admin_0_boundary_lines_land.shx
Normal file
Binary file not shown.
1
ne_10m_admin_1_states_provinces_lines.shp.REMOVED.git-id
Normal file
1
ne_10m_admin_1_states_provinces_lines.shp.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
9b38a7aab7224ba49df6c1d537af8f464b53ac4a
|
1
ne_10m_admin_1_states_provinces_lines.shx.REMOVED.git-id
Normal file
1
ne_10m_admin_1_states_provinces_lines.shx.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
a7494045bbf8d8ace0992996e6a759a4a364ead6
|
1
ne_10m_coastline.shp.REMOVED.git-id
Normal file
1
ne_10m_coastline.shp.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
e6f0c1adeb1163f240352e5bc1df5ac72b83e4e8
|
0
ne_10m_coastline.shp:Zone.Identifier
Normal file
0
ne_10m_coastline.shp:Zone.Identifier
Normal file
BIN
ne_10m_coastline.shx
Normal file
BIN
ne_10m_coastline.shx
Normal file
Binary file not shown.
0
ne_10m_coastline.shx:Zone.Identifier
Normal file
0
ne_10m_coastline.shx:Zone.Identifier
Normal file
4
ne_10m_land.svg:Zone.Identifier
Normal file
4
ne_10m_land.svg:Zone.Identifier
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[ZoneTransfer]
|
||||||
|
ZoneId=3
|
||||||
|
ReferrerUrl=about:client
|
||||||
|
HostUrl=about:internet
|
|
@ -1 +0,0 @@
|
||||||
34c8403286643597ad193fa68d13266d3a5f07a6
|
|
172
seen
172
seen
|
@ -1,172 +0,0 @@
|
||||||
net_io.c: while ((p) && (p->next != c)) {
|
|
||||||
net_io.c: p = p->next;
|
|
||||||
net_io.c: p->next = c->next;
|
|
||||||
Binary file .git/objects/pack/pack-bf860161866f3e6c65f8f17c93e90565fe339dff.idx matches
|
|
||||||
Binary file .git/objects/pack/pack-bf860161866f3e6c65f8f17c93e90565fe339dff.pack matches
|
|
||||||
AircraftList.cpp: if (p->addr == addr) return (p);
|
|
||||||
AircraftList.cpp: p = p->next;
|
|
||||||
AircraftList.cpp: p->live = 0;
|
|
||||||
AircraftList.cpp: p = p->next;
|
|
||||||
AircraftList.cpp: p->next = head;
|
|
||||||
AircraftList.cpp: p->prev_seen = p->seen;
|
|
||||||
AircraftList.cpp: p->live = 1;
|
|
||||||
AircraftList.cpp: if(p->seen == a->seen) {
|
|
||||||
AircraftList.cpp: p->seen = a->seen;
|
|
||||||
AircraftList.cpp: p->msSeen = now();
|
|
||||||
AircraftList.cpp: if((p->seen - p->prev_seen) > 0) {
|
|
||||||
AircraftList.cpp: p->messageRate = 1.0 / (double)(p->seen - p->prev_seen);
|
|
||||||
AircraftList.cpp: memcpy(p->flight, a->flight, sizeof(p->flight));
|
|
||||||
AircraftList.cpp: memcpy(p->signalLevel, a->signalLevel, sizeof(p->signalLevel));
|
|
||||||
AircraftList.cpp: p->altitude = a->altitude;
|
|
||||||
AircraftList.cpp: p->speed = a->speed;
|
|
||||||
AircraftList.cpp: p->track = a->track;
|
|
||||||
AircraftList.cpp: p->vert_rate = a->vert_rate;
|
|
||||||
AircraftList.cpp: p->lon = a->lon;
|
|
||||||
AircraftList.cpp: p->lat = a->lat;
|
|
||||||
AircraftList.cpp: if(p->seenLatLon < a->seenLatLon) {
|
|
||||||
AircraftList.cpp: p->msSeenLatLon = now();
|
|
||||||
AircraftList.cpp: // p->oldIdx = (p->oldIdx+1) % 32;
|
|
||||||
AircraftList.cpp: // p->oldLon[p->oldIdx] = p->lon;
|
|
||||||
AircraftList.cpp: // p->oldLat[p->oldIdx] = p->lat;
|
|
||||||
AircraftList.cpp: p->lonHistory.push_back(p->lon);
|
|
||||||
AircraftList.cpp: p->latHistory.push_back(p->lat);
|
|
||||||
AircraftList.cpp: p->headingHistory.push_back(p->track);
|
|
||||||
AircraftList.cpp: p->timestampHistory.push_back(p->msSeenLatLon);
|
|
||||||
AircraftList.cpp: // p->oldHeading[p->oldIdx] = p->track;
|
|
||||||
AircraftList.cpp: // p->oldSeen[p->oldIdx] = p->seenLatLon;
|
|
||||||
AircraftList.cpp: p->seenLatLon = a->seenLatLon;
|
|
||||||
AircraftList.cpp: if(!p->live) {
|
|
||||||
AircraftList.cpp: head = p->next;
|
|
||||||
AircraftList.cpp: prev->next = p->next;
|
|
||||||
AircraftList.cpp: p = p->next;
|
|
||||||
Binary file mapdata.bin matches
|
|
||||||
Binary file viz1090 matches
|
|
||||||
View.cpp: if(p->lonHistory.empty()) {
|
|
||||||
View.cpp: std::vector<float>::iterator lon_idx = p->lonHistory.begin();
|
|
||||||
View.cpp: std::vector<float>::iterator lat_idx = p->latHistory.begin();
|
|
||||||
View.cpp: std::vector<float>::iterator heading_idx = p->headingHistory.begin();
|
|
||||||
View.cpp: int idx = p->lonHistory.size();
|
|
||||||
View.cpp: for(; std::next(lon_idx) != p->lonHistory.end(); ++lon_idx, ++lat_idx, ++heading_idx) {
|
|
||||||
View.cpp: // float age = pow(1.0 - (float)idx / (float)p->lonHistory.size(), 2.2);
|
|
||||||
View.cpp: float age = 1.0 - (float)idx / (float)p->lonHistory.size();
|
|
||||||
View.cpp: unsigned char * pSig = p->signalLevel;
|
|
||||||
View.cpp: if(elapsed(p->msSeen) < 1024) {
|
|
||||||
View.cpp: seenFade = (Uint8) (255.0 - elapsed(p->msSeen) / 4.0);
|
|
||||||
View.cpp: if(elapsed(p->msSeenLatLon) < 1024) {
|
|
||||||
View.cpp: seenFade = (Uint8) (255.0 - elapsed(p->msSeenLatLon) / 4.0);
|
|
||||||
View.cpp: if(elapsed(p->msSeenLatLon) < 500) {
|
|
||||||
View.cpp: circleRGBA(renderer, p->cx, p->cy, elapsed(p->msSeenLatLon) * screen_width / (8192), 255,255, 255, 64 - (uint8_t)(64.0 * elapsed(p->msSeenLatLon) / 500.0));
|
|
||||||
View.cpp: if(p->pressure * screen_width < pressure_scale) {
|
|
||||||
View.cpp: drawSignalMarks(p, p->x, p->y);
|
|
||||||
View.cpp: maxCharCount = snprintf(flight,10," %s", p->flight);
|
|
||||||
View.cpp: drawStringBG(flight, p->x, p->y, mapBoldFont, white, black);
|
|
||||||
View.cpp: //roundedRectangleRGBA(renderer, p->x, p->y, p->x + maxCharCount * mapFontWidth, p->y + mapFontHeight, ROUND_RADIUS, white.r, white.g, white.b, SDL_ALPHA_OPAQUE);
|
|
||||||
View.cpp: //drawString(flight, p->x, p->y, mapBoldFont, white);
|
|
||||||
View.cpp: if(p->pressure * screen_width < 0.5f * pressure_scale) {
|
|
||||||
View.cpp: currentCharCount = snprintf(alt,10," %dm", (int) (p->altitude / 3.2828));
|
|
||||||
View.cpp: currentCharCount = snprintf(alt,10," %d'", p->altitude);
|
|
||||||
View.cpp: drawStringBG(alt, p->x, p->y + currentLine * mapFontHeight, mapFont, grey, black);
|
|
||||||
View.cpp: currentCharCount = snprintf(speed,10," %dkm/h", (int) (p->speed * 1.852));
|
|
||||||
View.cpp: currentCharCount = snprintf(speed,10," %dmph", p->speed);
|
|
||||||
View.cpp: drawStringBG(speed, p->x, p->y + currentLine * mapFontHeight, mapFont, grey, black);
|
|
||||||
View.cpp: Sint16 vx[4] = {p->cx, p->cx + (p->x - p->cx) / 2, p->x, p->x};
|
|
||||||
View.cpp: Sint16 vy[4] = {p->cy, p->cy + (p->y - p->cy) / 2, p->y - mapFontHeight, p->y};
|
|
||||||
View.cpp: if(p->cy > p->y + currentLine * mapFontHeight) {
|
|
||||||
View.cpp: vy[2] = p->y + currentLine * mapFontHeight + mapFontHeight;
|
|
||||||
View.cpp: vy[3] = p->y + currentLine * mapFontHeight;
|
|
||||||
View.cpp: thickLineRGBA(renderer,p->x,p->y,p->x,p->y+currentLine*mapFontHeight,screen_uiscale,200,200,200,SDL_ALPHA_OPAQUE);
|
|
||||||
View.cpp: p->w = maxCharCount * mapFontWidth;
|
|
||||||
View.cpp: p->h = currentLine * mapFontHeight;
|
|
||||||
View.cpp: int x = p->cx - 20;
|
|
||||||
View.cpp: int y = p->cy + 22;
|
|
||||||
View.cpp: if(elapsed(p->msSeenLatLon) < 500) {
|
|
||||||
View.cpp: circleRGBA(renderer, p->cx, p->cy, elapsed(p->msSeenLatLon) * screen_width / (8192), 255,255, 255, 64 - (uint8_t)(64.0 * elapsed(p->msSeenLatLon) / 500.0));
|
|
||||||
View.cpp: maxCharCount = snprintf(flight,10," %s", p->flight);
|
|
||||||
View.cpp: //roundedRectangleRGBA(renderer, p->x, p->y, p->x + maxCharCount * mapFontWidth, p->y + mapFontHeight, ROUND_RADIUS, white.r, white.g, white.b, SDL_ALPHA_OPAQUE);
|
|
||||||
View.cpp: //drawString(flight, p->x, p->y, mapBoldFont, white);
|
|
||||||
View.cpp: currentCharCount = snprintf(alt,10," %dm", (int) (p->altitude / 3.2828));
|
|
||||||
View.cpp: currentCharCount = snprintf(alt,10," %d'", p->altitude);
|
|
||||||
View.cpp: currentCharCount = snprintf(speed,10," %dkm/h", (int) (p->speed * 1.852));
|
|
||||||
View.cpp: currentCharCount = snprintf(speed,10," %dmph", p->speed);
|
|
||||||
View.cpp: int p_left = p->x - 10 * screen_uiscale;
|
|
||||||
View.cpp: int p_right = p->x + p->w + 10 * screen_uiscale;
|
|
||||||
View.cpp: int p_top = p->y - 10 * screen_uiscale;
|
|
||||||
View.cpp: int p_bottom = p->y + p->h + 10 * screen_uiscale;
|
|
||||||
View.cpp: //rectangleRGBA(renderer, p->x, p->y, p->x + p->w, p->y + p->h, 255,0,0, SDL_ALPHA_OPAQUE);
|
|
||||||
View.cpp: //lineRGBA(renderer, p->cx, p->cy, p->x, p->y, 0,255,0, SDL_ALPHA_OPAQUE);
|
|
||||||
View.cpp: p->ddox = 0;
|
|
||||||
View.cpp: p->ddoy = 0;
|
|
||||||
View.cpp: float o_mag = sqrt(p->ox*p->ox + p->oy*p->oy);
|
|
||||||
View.cpp: p->ddox -= p->ox / o_mag * spring_force * (o_mag - spring_length);
|
|
||||||
View.cpp: p->ddoy -= p->oy / o_mag * spring_force * (o_mag - spring_length);
|
|
||||||
View.cpp: p->ox += (float)(10 * screen_uiscale - p_left);
|
|
||||||
View.cpp: p->ox -= (float)(p_right - (screen_width - 10 * screen_uiscale));
|
|
||||||
View.cpp: p->oy += (float)(10 * screen_uiscale - p_top);
|
|
||||||
View.cpp: p->oy -= (float)(p_bottom - (screen_height - 10 * screen_uiscale));
|
|
||||||
View.cpp: p->pressure = 0;
|
|
||||||
View.cpp: if(check_p->addr != p->addr) {
|
|
||||||
View.cpp: int check_left = check_p->x - 5 * screen_uiscale;
|
|
||||||
View.cpp: int check_right = check_p->x + check_p->w + 5 * screen_uiscale;
|
|
||||||
View.cpp: int check_top = check_p->y - 5 * screen_uiscale;
|
|
||||||
View.cpp: int check_bottom = check_p->y + check_p->h + 5 * screen_uiscale;
|
|
||||||
View.cpp: p->pressure += 1.0f / ((check_p->cx - p->cx) * (check_p->cx - p->cx) + (check_p->cy - p->cy) * (check_p->cy - p->cy));
|
|
||||||
View.cpp: check_p->ddox -= label_force * (float)(check_left - p_right);
|
|
||||||
View.cpp: check_p->ddox -= label_force * (float)(check_right - p_left);
|
|
||||||
View.cpp: check_p->ddoy -= label_force * (float)(check_top - p_bottom);
|
|
||||||
View.cpp: check_p->ddoy -= label_force * (float)(check_bottom - p_top);
|
|
||||||
View.cpp: p_left = p->x - 5 * screen_uiscale;
|
|
||||||
View.cpp: p_right = p->x + 5 * screen_uiscale;
|
|
||||||
View.cpp: p_top = p->y - 5 * screen_uiscale;
|
|
||||||
View.cpp: p_bottom = p->y + 5 * screen_uiscale;
|
|
||||||
View.cpp: int check_left = check_p->x - 5 * screen_uiscale;
|
|
||||||
View.cpp: int check_right = check_p->x + check_p->w + 5 * screen_uiscale;
|
|
||||||
View.cpp: int check_top = check_p->y - 5 * screen_uiscale;
|
|
||||||
View.cpp: int check_bottom = check_p->y + check_p->h + 5 * screen_uiscale;
|
|
||||||
View.cpp: check_p->ddox -= plane_force * (float)(check_left - p_right);
|
|
||||||
View.cpp: check_p->ddox -= plane_force * (float)(check_right - p_left);
|
|
||||||
View.cpp: check_p->ddoy -= plane_force * (float)(check_top - p_bottom);
|
|
||||||
View.cpp: check_p->ddoy -= plane_force * (float)(check_bottom - p_top);
|
|
||||||
View.cpp: p = p->next;
|
|
||||||
View.cpp: p->dox += p->ddox;
|
|
||||||
View.cpp: p->doy += p->ddoy;
|
|
||||||
View.cpp: p->dox *= damping_force;
|
|
||||||
View.cpp: p->doy *= damping_force;
|
|
||||||
View.cpp: if(fabs(p->dox) > 10.0f) {
|
|
||||||
View.cpp: p->dox = sign(p->dox) * 10.0f;
|
|
||||||
View.cpp: if(fabs(p->doy) > 10.0f) {
|
|
||||||
View.cpp: p->doy = sign(p->doy) * 10.0f;
|
|
||||||
View.cpp: if(fabs(p->dox) < 1.0f) {
|
|
||||||
View.cpp: p->dox = 0;
|
|
||||||
View.cpp: if(fabs(p->doy) < 1.0f) {
|
|
||||||
View.cpp: p->doy = 0;
|
|
||||||
View.cpp: p->ox += p->dox;
|
|
||||||
View.cpp: p->oy += p->doy;
|
|
||||||
View.cpp: p->x = p->cx + (int)round(p->ox);
|
|
||||||
View.cpp: p->y = p->cy + (int)round(p->oy);
|
|
||||||
View.cpp: p = p->next;
|
|
||||||
View.cpp: p = p->next;
|
|
||||||
View.cpp: if (p->lon && p->lat) {
|
|
||||||
View.cpp: pxFromLonLat(&dx, &dy, p->lon, p->lat);
|
|
||||||
View.cpp: if(p->created == 0) {
|
|
||||||
View.cpp: p->created = now();
|
|
||||||
View.cpp: float age_ms = (float)elapsed(p->created);
|
|
||||||
View.cpp: if(p->msSeenLatLon > p->timestampHistory.back()) {
|
|
||||||
View.cpp: pxFromLonLat(&dx, &dy, p->lonHistory.back(), p->latHistory.back());
|
|
||||||
View.cpp: float velx = (x - oldx) / (p->msSeenLatLon - p->timestampHistory.back());
|
|
||||||
View.cpp: float vely = (y - oldy) / (p->msSeenLatLon - p->timestampHistory.back());
|
|
||||||
View.cpp: usex = x + elapsed(p->msSeenLatLon) * velx;
|
|
||||||
View.cpp: usey = y + elapsed(p->msSeenLatLon) * vely;
|
|
||||||
View.cpp: planeColor = lerpColor(style.planeColor, style.planeGoneColor, float(elapsed_s(p->seen)) / (float) DISPLAY_ACTIVE);
|
|
||||||
View.cpp: drawPlaneOffMap(x, y, &(p->cx), &(p->cy), planeColor);
|
|
||||||
View.cpp: drawPlaneIcon(usex, usey, p->track, planeColor);
|
|
||||||
View.cpp: p->cx = usex;
|
|
||||||
View.cpp: p->cy = usey;
|
|
||||||
View.cpp: p = p->next;
|
|
||||||
View.cpp: if((p->cx - x) * (p->cx - x) + (p->cy - y) * (p->cy - y) < 900) {
|
|
||||||
View.cpp: if((p->cx - x) * (p->cx - x) + (p->cy - y) * (p->cy - y) <
|
|
||||||
View.cpp: p = p->next;
|
|
||||||
all.svg:<g id="00140" postname="Wyman Twp-Franklin Cnty" stateabbr="ME" cntyname="Franklin" cafintrst="One Upstream Watershed" pop2000="0" hostcount="3" lat="45.129440" lon="-70.357120">
|
|
||||||
AppData.cpp: unsigned char * pSig = p->signalLevel;
|
|
||||||
AppData.cpp: if (p->lon && p->lat) {
|
|
||||||
AppData.cpp: msgRateAccumulate += p->messageRate;
|
|
||||||
AppData.cpp: p = p->next;
|
|
1
test.geojson.REMOVED.git-id
Normal file
1
test.geojson.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
||||||
|
a15df18c70ad80df1500fab02e08ece9530c60c0
|
234
view1090.bak
234
view1090.bak
|
@ -1,234 +0,0 @@
|
||||||
// view1090, a Mode S messages viewer for dump1090 devices.
|
|
||||||
//
|
|
||||||
// Copyright (C) 2014 by Malcolm Robb <Support@ATTAvionics.com>
|
|
||||||
//
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are
|
|
||||||
// met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer in the
|
|
||||||
// documentation and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "view1090.h"
|
|
||||||
#include "structs.h"
|
|
||||||
#include "AircraftData.h"
|
|
||||||
|
|
||||||
int go = 1;
|
|
||||||
|
|
||||||
|
|
||||||
AppData appData;
|
|
||||||
Style style;
|
|
||||||
|
|
||||||
//
|
|
||||||
// ============================= Utility functions ==========================
|
|
||||||
//
|
|
||||||
void sigintHandler(int dummy) {
|
|
||||||
NOTUSED(dummy);
|
|
||||||
signal(SIGINT, SIG_DFL); // reset signal handler - bit extra safety
|
|
||||||
AircraftData.modes.exit = 1; // Signal to threads that we are done
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//=========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
// Set up data connection
|
|
||||||
int setupConnection(struct client *c) {
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
// Try to connect to the selected ip address and port. We only support *ONE* input connection which we initiate.here.
|
|
||||||
if ((fd = anetTcpConnect(AircraftData.modes.aneterr, View1090.net_input_beast_ipaddr, AircraftData.modes.net_input_beast_port)) != ANET_ERR) {
|
|
||||||
anetNonBlock(AircraftData.modes.aneterr, fd);
|
|
||||||
//
|
|
||||||
// Setup a service callback client structure for a beast binary input (from dump1090)
|
|
||||||
// This is a bit dodgy under Windows. The fd parameter is a handle to the internet
|
|
||||||
// socket on which we are receiving data. Under Linux, these seem to start at 0 and
|
|
||||||
// count upwards. However, Windows uses "HANDLES" and these don't nececeriy start at 0.
|
|
||||||
// dump1090 limits fd to values less than 1024, and then uses the fd parameter to
|
|
||||||
// index into an array of clients. This is ok-ish if handles are allocated up from 0.
|
|
||||||
// However, there is no gaurantee that Windows will behave like this, and if Windows
|
|
||||||
// allocates a handle greater than 1024, then dump1090 won't like it. On my test machine,
|
|
||||||
// the first Windows handle is usually in the 0x54 (84 decimal) region.
|
|
||||||
|
|
||||||
c->next = NULL;
|
|
||||||
c->buflen = 0;
|
|
||||||
c->fd =
|
|
||||||
c->service =
|
|
||||||
AircraftData.modes.bis = fd;
|
|
||||||
AircraftData.modes.clients = c;
|
|
||||||
}
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// ================================ Main ====================================
|
|
||||||
//
|
|
||||||
void showHelp(void) {
|
|
||||||
printf(
|
|
||||||
"-----------------------------------------------------------------------------\n"
|
|
||||||
"| view1090 dump1090 Viewer Ver : "MODES_DUMP1090_VERSION " |\n"
|
|
||||||
"-----------------------------------------------------------------------------\n"
|
|
||||||
"--server <IPv4/hosname> TCP Beast output listen IPv4 (default: 127.0.0.1)\n"
|
|
||||||
"--port <port> TCP Beast output listen port (default: 30005)\n"
|
|
||||||
"--lat <latitude> Reference/receiver latitide for surface posn (opt)\n"
|
|
||||||
"--lon <longitude> Reference/receiver longitude for surface posn (opt)\n"
|
|
||||||
"--metric Use metric units (meters, km/h, ...)\n"
|
|
||||||
"--help Show this help\n"
|
|
||||||
"--uiscale <factor> UI global scaling (default: 1)\n"
|
|
||||||
"--screensize <width> <height> Set frame buffer resolution (default: screen resolution)\n"
|
|
||||||
"--fullscreen Start fullscreen\n"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
void showCopyright(void) {
|
|
||||||
uint64_t llTime = time(NULL) + 1;
|
|
||||||
|
|
||||||
printf(
|
|
||||||
"-----------------------------------------------------------------------------\n"
|
|
||||||
"| view1090 ModeS Viewer Ver : " MODES_DUMP1090_VERSION " |\n"
|
|
||||||
"-----------------------------------------------------------------------------\n"
|
|
||||||
"\n"
|
|
||||||
" Copyright (C) 2012 by Salvatore Sanfilippo <antirez@gmail.com>\n"
|
|
||||||
" Copyright (C) 2014 by Malcolm Robb <support@attavionics.com>\n"
|
|
||||||
" Copyright (C) 2020 by Nathan Matsuda <info@nathanmatsuda.com>\n"
|
|
||||||
"\n"
|
|
||||||
" All rights reserved.\n"
|
|
||||||
"\n"
|
|
||||||
" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n"
|
|
||||||
" ""AS IS"" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n"
|
|
||||||
" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n"
|
|
||||||
" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n"
|
|
||||||
" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n"
|
|
||||||
" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n"
|
|
||||||
" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n"
|
|
||||||
" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n"
|
|
||||||
" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n"
|
|
||||||
" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n"
|
|
||||||
" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
|
|
||||||
"\n"
|
|
||||||
" For further details refer to <https://github.com/MalcolmRobb/dump1090>\n"
|
|
||||||
"\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
// delay for 1 second to give the user a chance to read the copyright
|
|
||||||
while (llTime >= time(NULL)) {}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
//
|
|
||||||
//=========================================================================
|
|
||||||
//
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
|
||||||
int j, fd;
|
|
||||||
struct client *c;
|
|
||||||
char pk_buf[8];
|
|
||||||
|
|
||||||
AircraftData aircraftData;
|
|
||||||
|
|
||||||
signal(SIGINT, sigintHandler); // Define Ctrl/C handler (exit program)
|
|
||||||
|
|
||||||
|
|
||||||
aircraftData.initialize();
|
|
||||||
|
|
||||||
// Parse the command line options
|
|
||||||
for (j = 1; j < argc; j++) {
|
|
||||||
int more = ((j + 1) < argc); // There are more arguments
|
|
||||||
|
|
||||||
if (!strcmp(argv[j],"--net-bo-port") && more) {
|
|
||||||
AircraftData.modes.net_input_beast_port = atoi(argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--port") && more) {
|
|
||||||
AircraftData.modes.net_input_beast_port = atoi(argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--net-bo-ipaddr") && more) {
|
|
||||||
strcpy(View1090.net_input_beast_ipaddr, argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--server") && more) {
|
|
||||||
strcpy(View1090.net_input_beast_ipaddr, argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--lat") && more) {
|
|
||||||
AircraftData.modes.fUserLat = atof(argv[++j]);
|
|
||||||
appData.centerLat = AircraftData.modes.fUserLat;
|
|
||||||
} else if (!strcmp(argv[j],"--lon") && more) {
|
|
||||||
AircraftData.modes.fUserLon = atof(argv[++j]);
|
|
||||||
appData.centerLon = AircraftData.modes.fUserLon;
|
|
||||||
} else if (!strcmp(argv[j],"--metric")) {
|
|
||||||
AircraftData.modes.metric = 1;
|
|
||||||
} else if (!strcmp(argv[j],"--fullscreen")) {
|
|
||||||
appData.fullscreen = 1;
|
|
||||||
} else if (!strcmp(argv[j],"--uiscale") && more) {
|
|
||||||
appData.screen_uiscale = atoi(argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--screensize") && more) {
|
|
||||||
appData.screen_width = atoi(argv[++j]);
|
|
||||||
appData.screen_height = atoi(argv[++j]);
|
|
||||||
} else if (!strcmp(argv[j],"--help")) {
|
|
||||||
showHelp();
|
|
||||||
exit(0);
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "Unknown or not enough arguments for option '%s'.\n\n", argv[j]);
|
|
||||||
showHelp();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to connect to the selected ip address and port. We only support *ONE* input connection which we initiate.here.
|
|
||||||
c = (struct client *) malloc(sizeof(*c));
|
|
||||||
while(1) {
|
|
||||||
if ((fd = setupConnection(c)) == ANET_ERR) {
|
|
||||||
fprintf(stderr, "Waiting on %s:%d\n", View1090.net_input_beast_ipaddr, AircraftData.modes.net_input_beast_port);
|
|
||||||
sleep(1);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int go;
|
|
||||||
|
|
||||||
|
|
||||||
init("sdl1090");
|
|
||||||
|
|
||||||
atexit(cleanup);
|
|
||||||
|
|
||||||
go = 1;
|
|
||||||
|
|
||||||
while (go == 1)
|
|
||||||
{
|
|
||||||
getInput();
|
|
||||||
|
|
||||||
interactiveRemoveStaleAircrafts();
|
|
||||||
draw();
|
|
||||||
if ((fd == ANET_ERR) || (recv(c->fd, pk_buf, sizeof(pk_buf), MSG_PEEK | MSG_DONTWAIT) == 0)) {
|
|
||||||
free(c);
|
|
||||||
usleep(1000000);
|
|
||||||
c = (struct client *) malloc(sizeof(*c));
|
|
||||||
fd = setupConnection(c);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
modesReadFromClient(c,"",decodeBinMessage);
|
|
||||||
//usleep(10000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The user has stopped us, so close any socket we opened
|
|
||||||
if (fd != ANET_ERR)
|
|
||||||
{close(fd);}
|
|
||||||
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
//=========================================================================
|
|
||||||
//
|
|
149
view1090.dsp
149
view1090.dsp
|
@ -1,149 +0,0 @@
|
||||||
# Microsoft Developer Studio Project File - Name="view1090" - Package Owner=<4>
|
|
||||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
|
||||||
# ** DO NOT EDIT **
|
|
||||||
|
|
||||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
|
||||||
|
|
||||||
CFG=view1090 - Win32 Debug
|
|
||||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
|
||||||
!MESSAGE use the Export Makefile command and run
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "view1090.mak".
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE You can specify a configuration when running NMAKE
|
|
||||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE NMAKE /f "view1090.mak" CFG="view1090 - Win32 Debug"
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE Possible choices for configuration are:
|
|
||||||
!MESSAGE
|
|
||||||
!MESSAGE "view1090 - Win32 Release" (based on "Win32 (x86) Console Application")
|
|
||||||
!MESSAGE "view1090 - Win32 Debug" (based on "Win32 (x86) Console Application")
|
|
||||||
!MESSAGE
|
|
||||||
|
|
||||||
# Begin Project
|
|
||||||
# PROP AllowPerConfigDependencies 0
|
|
||||||
# PROP Scc_ProjName ""
|
|
||||||
# PROP Scc_LocalPath ""
|
|
||||||
CPP=cl.exe
|
|
||||||
RSC=rc.exe
|
|
||||||
|
|
||||||
!IF "$(CFG)" == "view1090 - Win32 Release"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 0
|
|
||||||
# PROP BASE Output_Dir "Release"
|
|
||||||
# PROP BASE Intermediate_Dir "Release"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 0
|
|
||||||
# PROP Output_Dir "Release"
|
|
||||||
# PROP Intermediate_Dir "Release"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
|
|
||||||
# ADD CPP /nologo /W3 /GX /O2 /I ".\pthreads\." /I ".\rtlsdr\." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /c
|
|
||||||
# SUBTRACT CPP /YX /Yc /Yu
|
|
||||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
|
||||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
|
|
||||||
# SUBTRACT LINK32 /pdb:none
|
|
||||||
|
|
||||||
!ELSEIF "$(CFG)" == "view1090 - Win32 Debug"
|
|
||||||
|
|
||||||
# PROP BASE Use_MFC 0
|
|
||||||
# PROP BASE Use_Debug_Libraries 1
|
|
||||||
# PROP BASE Output_Dir "Debug"
|
|
||||||
# PROP BASE Intermediate_Dir "Debug"
|
|
||||||
# PROP BASE Target_Dir ""
|
|
||||||
# PROP Use_MFC 0
|
|
||||||
# PROP Use_Debug_Libraries 1
|
|
||||||
# PROP Output_Dir "Debug"
|
|
||||||
# PROP Intermediate_Dir "Debug"
|
|
||||||
# PROP Ignore_Export_Lib 0
|
|
||||||
# PROP Target_Dir ""
|
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
|
||||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".\pthreads\." /I ".\rtlsdr\." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
|
|
||||||
# SUBTRACT CPP /YX /Yc /Yu
|
|
||||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
|
||||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
|
||||||
BSC32=bscmake.exe
|
|
||||||
# ADD BASE BSC32 /nologo
|
|
||||||
# ADD BSC32 /nologo
|
|
||||||
LINK32=link.exe
|
|
||||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
|
||||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
|
||||||
|
|
||||||
!ENDIF
|
|
||||||
|
|
||||||
# Begin Target
|
|
||||||
|
|
||||||
# Name "view1090 - Win32 Release"
|
|
||||||
# Name "view1090 - Win32 Debug"
|
|
||||||
# Begin Group "Source Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\anet.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\interactive.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\mode_ac.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\mode_s.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\net_io.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\view1090.c
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Header Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\dump1090.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\view1090.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\winstubs.h
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Resource Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
|
||||||
# End Group
|
|
||||||
# Begin Group "Library Files"
|
|
||||||
|
|
||||||
# PROP Default_Filter ""
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\pthreads\pthreadVC2.lib
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\rtlsdr\rtlsdr.lib
|
|
||||||
# End Source File
|
|
||||||
# End Group
|
|
||||||
# End Target
|
|
||||||
# End Project
|
|
111
winstubs.h
111
winstubs.h
|
@ -1,111 +0,0 @@
|
||||||
// dump1090, a Mode S messages decoder for RTLSDR devices.
|
|
||||||
//
|
|
||||||
// Copyright (C) 2014 by Malcolm Robb <support@attavionics.com>
|
|
||||||
//
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are
|
|
||||||
// met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer in the
|
|
||||||
// documentation and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
// This file provides basic Windows implementation of Linux specific functions
|
|
||||||
// used in the dump1090 project. This allows dump1090 to be compiled and debugged
|
|
||||||
// using Microsoft Visual C++ 6.0
|
|
||||||
//
|
|
||||||
// Note that not all functions actually provide equivalent functionality to their
|
|
||||||
// Linux equivalents. They are simply stubs to allow the project to compile.
|
|
||||||
//
|
|
||||||
#ifndef __WINSTUBS_H
|
|
||||||
#define __WINSTUBS_H
|
|
||||||
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <windows.h>
|
|
||||||
#include <basetsd.h>
|
|
||||||
|
|
||||||
typedef UCHAR uint8_t;
|
|
||||||
typedef USHORT uint16_t;
|
|
||||||
typedef UINT32 uint32_t;
|
|
||||||
typedef UINT64 uint64_t;
|
|
||||||
typedef UINT32 mode_t;
|
|
||||||
typedef long ssize_t;
|
|
||||||
typedef int socklen_t;
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <sys/timeb.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <io.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#define M_PI 3.14159265358979323846
|
|
||||||
#include <math.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Functions not included in the MSVC maths library. This will do for our use.
|
|
||||||
_inline double round(double d) {return floor(d + 0.5);}
|
|
||||||
_inline double trunc(double d) {return (d>0) ? floor(d):ceil(d) ;}
|
|
||||||
|
|
||||||
//usleep works in microseconds, and isn't supported in Windows. This will do for our use.
|
|
||||||
_inline void usleep(UINT32 ulSleep) {Sleep(ulSleep/1000);}
|
|
||||||
_inline uint64_t strtoll(const char *p, void *e, UINT32 base) {return _atoi64(p);}
|
|
||||||
_inline int inet_aton(const char * cp, DWORD * ulAddr) { *ulAddr = inet_addr(cp); return (INADDR_NONE != *ulAddr);}
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
|
|
||||||
|
|
||||||
_inline void cls() {
|
|
||||||
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
||||||
COORD coord = {0, 0};
|
|
||||||
DWORD count;
|
|
||||||
|
|
||||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
|
||||||
GetConsoleScreenBufferInfo(hStdOut, &csbi);
|
|
||||||
|
|
||||||
FillConsoleOutputCharacter(hStdOut, ' ', csbi.dwSize.X * csbi.dwSize.Y, coord, &count);
|
|
||||||
|
|
||||||
SetConsoleCursorPosition(hStdOut, coord);
|
|
||||||
}
|
|
||||||
|
|
||||||
_inline int gettimeofday(struct timeval *tv, struct timezone *tz) {
|
|
||||||
SYSTEMTIME stSystemTime;
|
|
||||||
GetLocalTime(&stSystemTime);
|
|
||||||
|
|
||||||
tv->tv_sec = stSystemTime.wSecond + (60 * (stSystemTime.wMinute + (60 * stSystemTime.wHour)));
|
|
||||||
tv->tv_usec = stSystemTime.wMilliseconds * 1000;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define STDIN_FILENO 0
|
|
||||||
#define EINPROGRESS WSAEINPROGRESS
|
|
||||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __WINSTUBS_H
|
|
Loading…
Reference in a new issue