Compare commits

..

No commits in common. 'master' and 'srq_branch' have entirely different histories.

@ -1,27 +1,27 @@
# 手语翻译软件
### 工程简介:
### mediapipe_hands
#### 工程包括PC端以及android端其中PC端包括AI运算部分以及Web服务部分android端包括app以及网页部分。上述除Web服务部分均具有手语翻译功能且均可实现本地运算与云上运算。
![](https://mediapipe.dev/images/mobile/hand_tracking_3d_android_gpu.gif)
#### android端包括app及网页部分在设备算力足够的情况下进行本地运算如果算力不足则可选择云上运算。如果您想为本项目贡献更多可以分享您的算力为他人提供运算。android端主要模块如下
通过使用mediapipe来获取手部结点信息具体信息如下
```
media_camera()//获取摄像头的视频流
media_pipe()//获取云上视频流,为他人提供运算
hands_recegnation()//对手语进行识别,转化为自然语言
word_show()//在本地输出转化后的自然语言
word_send()//向云端发送转化后的自然语言,为他人提供运算
word_input()//本地输入自然语言转化为手语动画
word_recv()//接收云端的数据转化为手语
hands_translation()//将输入的自然语言转化为手语数据
hands_3d()//根据数据生成3d手语动画
```
![](https://mediapipe.dev/images/mobile/hand_landmarks.png)
#### PC端包括AI运算部分以及Web服务部分AI部分为其它设备提供算力支持Web服务部分则进行提供android端网页链接及设备算力共享服务。PC端主要模块如下
每个手分为21个结点每个结点右分x,y,z三个坐标值由于再android手机上z值很小并无意义故而不考虑z轴数据。下图为不同手势效果展示
```
包含android所有算力共享服务
nginx-rtmp()//提供视频流传输服务
load_alancing()//负载均衡,为算力共享设备选择提供服务
Webserver()//为网页提供后端支持
```
![](https://mediapipe.dev/images/mobile/hand_crops.png)
### 具体使用方法:
#### 手语翻译:
进入手语翻译界面,通过摄像头捕获手势,翻译为文字,可点击DESTROY清除。
![](./image/img1.png)
#### 动画生成:
通过输入文字,生成对应动画。
![](./image/img2.png)

@ -0,0 +1,46 @@
分析类图:
用例名:视频获取
业务目标:获取视频信息,
执行者:系统
前置条件:软件开启摄像头请求
基本交互动作:
1、软件请求摄像头
2、获取摄像头信息
3、传给本地或云端
扩展交互动作:
1a: 选择前置后置摄像头
用例名:文字获取
业务目标:获取文字信息,
执行者:系统
前置条件:云端或本地输入
基本交互动作:
1、读取文字信息
2、对文字进行分片处理
3、传给本地或云端
用例名:神经网络运算
业务目标:对信息进行分析运算
执行者:系统
基本交互动作:
1、分析信息类型
2、根据分析类型生成响应数据
3、将数据发送到云端或本地
4、生成信息给用户
扩展交互动作:
4a判断视频转化为文字或文字转化为动画
用例名:网络服务
业务目标负责负载均衡及web服务
执行者:网络服务器
基本交互动作:
1、推送网页内容
2、对于用户发来的算力共享请求进行分配
3、用户之间数据沟通视频数据等
扩展交互动作:
4a计算用户算力贡献

@ -0,0 +1,159 @@
## 1、系统说明
##### 手语翻译项目旨在构建一个手语翻译系统,方便手语与自然语言的相互转换,这个系统的主要功能有:
1. 实现手语视频录制,并转化为自然语言
2. 完成自然语言转化为手语动画
3. 实现设备间算力共享
##### 手语翻译系统只有一类用户:用户
功能12供用户使用
功能3根据用户意愿开启
##### 该系统必须满足以下限制:
1. 能以较低的性能要求实现运算
2. 仅在用户允许情况下使用算力共享
## 2、需求获取与分析
### 2.1系统初步用例图:
![](/home/smj/Work/work2/初步用例图.png)
### 2.2用例描述与顺序图:
**用例名**:输入自然语言
**业务目标**:用户输入需要翻译的自然语言
**执行者**:用户
**前置条件**app正常运行
**基本事件流**
1、用户打开手语翻译app
2、app跳转到主页面
3、用户点击输入框
4、用户输入自然语言
5、用户提交自然语言
6、app接收自然语言
**扩展交互动作**
1a: 修改输入内容
1a1:直接在输入框进行文本编辑
**后置条件**:输入数据无损失
**可靠性需求**数据安全性无限接近100%
![](/home/smj/Work/work2/输入自然语言.png)
**用例名**:获取手语视频
**业务目标**用户上传视频到app
**执行者**:用户
**前置条件**app正常运行
**基本事件流**
1、用户打开手语翻译app
2、app跳转到主页面
3、app提示是否打开摄像头
4、用户允许app开启摄像头
5、用户打开摄像头
6、app获取摄像头视频流
**扩展交互动作**
1a: 重新录制视频
1a1:删除已录制视频并重新录制
**后置条件**:硬件正常时,能获取无损视频
**可靠性要求**视频在传输过程中受损率无限接近0%
![](/home/smj/Work/work2/获取手语视频.png)
**用例名**:翻译自然语言为动画
**业务目标**将用户输入或云端获取的自然语言转换为3D动画
**执行者**:用户
**前置条件**
1、网络正常连接或本地算力足够
2、用户已输入自然语言
**基本事件流**
1、用户点击“语言翻译”按钮
2、app对获取自然语言进行翻译
3、app提示翻译成功
**扩展交互动作**
1a: 选择本地运算或云端运算
1a1:根据选择来确定运算设备
**后置条件**:在词库内有对应数据时,可生成完整动画
**性能要求**响应事件小于200ms
**可靠性要求**保证词条对应数据100%正确
![](/home/smj/Work/work2/翻译自然语言为动画.png)
**用例名**:翻译视频为自然语言
**业务目标**:将用户输入或云端获取的视频转换为自然语言
**执行者**:用户
**前置条件**
1、网络正常连接或本地算力足够
2、用户已输入视频
**基本事件流**
1、用户点击“视频翻译”按钮
2、app显示正在翻译
3、app对视频进行翻译
4、app显示翻译成功
**扩展交互动作**
1a: 选择本地运算或云端运算
1a1:根据选择来确定运算设备
**后置条件**:当视频内容有效时,根据视频可生成对应自然语言
**性能要求**每秒处理速度达到30fps
**可靠性要求**翻译直译准确率达到90%以上
![](/home/smj/Work/work2/翻译视频为自然语言.png)
**用例名**:显示动画
**业务目标**在app显示数据转换后的3D动画
**执行者**:用户
**前置条件**app已经获取3D动画数据
**基本事件流**
1、用户点击“翻译自然语言”按钮
2、app显示生成3D动画
**后置条件**:当动画生成后,在屏幕指定位置展示动画
**可靠性要求**动作混淆错位等错误发生率为0%
![](/home/smj/Work/work2/显示动画.png)
**用例名**:显示自然语言
**业务目标**在app显示数据转换后的自然语言
**执行者**:用户
**前置条件**app已经获取处理后的自然语言
**基本事件流**
1、用户点击“翻译手语动画”按钮
2、app显示翻译后的自然语言
**后置条件**:当收到自然语言时,在屏幕指定位置生成文字
**可靠性要求**:保证数据准确度为100%
![](/home/smj/Work/work2/显示自然语言.png)
### 2.3分析类图:
![](/home/smj/Work/work2/分析类图.png)

Binary file not shown.

@ -0,0 +1,44 @@
## 3、体系结构设计
### 3.1体系结构的逻辑视图
![](/home/smj/Documents/软工/体系结构逻辑视图.drawio.png)
### 3.2体系结构设计的开发视图
![](/home/smj/Documents/软工/体系结构开发视图.drawio.png)
## 4、用户界面设计
### 4.1系统界面的外观设计及其类表示
#### 4.1.1视频翻译界面及其类表示:
![](/home/smj/Work/for_you/model/app/im1.png)
![](/home/smj/Work/work2/手语翻译.png)
#### 4.1.2文字翻译界面及其类表示:
![](/home/smj/Work/for_you/model/app/im2.png)
![](/home/smj/Work/work2/自然语言翻译.png)
#### 4.1.3设置界面及其类表示:
![im3](/home/smj/Work/for_you/model/app/im3.png)
![](/home/smj/Work/work2/设置.png)
### 4.2界面流的类表示:
![](/home/smj/Work/work2/界面流类表示.png)
### 4.3界面流的顺序图:
![](/home/smj/Work/work2/界面流顺序图.png)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Binary file not shown.

@ -1,201 +0,0 @@
(function() {
/*
Copyright The Closure Library Authors.
SPDX-License-Identifier: Apache-2.0
*/
'use strict';
function h(a) {
var c = 0;
return function() {
return c < a.length ? {
done: !1,
value: a[c++]
} : {
done: !0
}
}
}
var l = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, c, b) {
if (a == Array.prototype || a == Object.prototype) return a;
a[c] = b.value;
return a
};
function m(a) {
a = ["object" == typeof globalThis && globalThis, a, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global];
for (var c = 0; c < a.length; ++c) {
var b = a[c];
if (b && b.Math == Math) return b
}
throw Error("Cannot find global object");
}
var n = m(this);
function p(a, c) {
if (c) a: {
var b = n;a = a.split(".");
for (var d = 0; d < a.length - 1; d++) {
var e = a[d];
if (!(e in b)) break a;
b = b[e]
}
a = a[a.length - 1];d = b[a];c = c(d);c != d && null != c && l(b, a, {
configurable: !0,
writable: !0,
value: c
})
}
}
function q(a) {
var c = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator];
return c ? c.call(a) : {
next: h(a)
}
}
var r = "function" == typeof Object.assign ? Object.assign : function(a, c) {
for (var b = 1; b < arguments.length; b++) {
var d = arguments[b];
if (d)
for (var e in d) Object.prototype.hasOwnProperty.call(d, e) && (a[e] = d[e])
}
return a
};
p("Object.assign", function(a) {
return a || r
});
p("Array.prototype.fill", function(a) {
return a ? a : function(c, b, d) {
var e = this.length || 0;
0 > b && (b = Math.max(0, e + b));
if (null == d || d > e) d = e;
d = Number(d);
0 > d && (d = Math.max(0, e + d));
for (b = Number(b || 0); b < d; b++) this[b] = c;
return this
}
});
function t(a) {
return a ? a : Array.prototype.fill
}
p("Int8Array.prototype.fill", t);
p("Uint8Array.prototype.fill", t);
p("Uint8ClampedArray.prototype.fill", t);
p("Int16Array.prototype.fill", t);
p("Uint16Array.prototype.fill", t);
p("Int32Array.prototype.fill", t);
p("Uint32Array.prototype.fill", t);
p("Float32Array.prototype.fill", t);
p("Float64Array.prototype.fill", t);
var u = this || self;
function v(a, c) {
a = a.split(".");
var b = u;
a[0] in b || "undefined" == typeof b.execScript || b.execScript("var " + a[0]);
for (var d; a.length && (d = a.shift());) a.length || void 0 === c ? b[d] && b[d] !== Object.prototype[d] ? b = b[d] : b = b[d] = {} : b[d] = c
};
var w = {
color: "white",
lineWidth: 4,
radius: 6,
visibilityMin: .5
};
function x(a) {
a = a || {};
return Object.assign(Object.assign(Object.assign({}, w), {
fillColor: a.color
}), a)
}
function y(a, c) {
return a instanceof Function ? a(c) : a
}
function z(a, c, b) {
return Math.max(Math.min(c, b), Math.min(Math.max(c, b), a))
}
v("clamp", z);
v("drawLandmarks", function(a, c, b) {
if (c) {
b = x(b);
a.save();
var d = a.canvas,
e = 0;
c = q(c);
for (var f = c.next(); !f.done; f = c.next())
if (f = f.value, void 0 !== f && (void 0 === f.visibility || f.visibility > b.visibilityMin)) {
a.fillStyle = y(b.fillColor, {
index: e,
from: f
});
a.strokeStyle = y(b.color, {
index: e,
from: f
});
a.lineWidth = y(b.lineWidth, {
index: e,
from: f
});
var g = new Path2D;
g.arc(f.x * d.width, f.y * d.height, y(b.radius, {
index: e,
from: f
}), 0, 2 * Math.PI);
a.fill(g);
a.stroke(g);
++e
} a.restore()
}
});
v("drawConnectors", function(a, c, b, d) {
if (c && b) {
d = x(d);
a.save();
var e = a.canvas,
f = 0;
b = q(b);
for (var g = b.next(); !g.done; g = b.next()) {
var k = g.value;
a.beginPath();
g = c[k[0]];
k = c[k[1]];
g && k && (void 0 === g.visibility || g.visibility > d.visibilityMin) && (void 0 === k.visibility || k.visibility > d.visibilityMin) && (a.strokeStyle = y(d.color, {
index: f,
from: g,
to: k
}), a.lineWidth = y(d.lineWidth, {
index: f,
from: g,
to: k
}), a.moveTo(g.x * e.width, g.y * e.height), a.lineTo(k.x * e.width, k.y * e.height));
++f;
a.stroke()
}
a.restore()
}
});
v("drawRectangle", function(a, c, b) {
b = x(b);
a.save();
var d = a.canvas;
a.beginPath();
a.lineWidth = y(b.lineWidth, {});
a.strokeStyle = y(b.color, {});
a.fillStyle = y(b.fillColor, {});
a.translate(c.xCenter * d.width, c.yCenter * d.height);
a.rotate(c.rotation * Math.PI / 180);
a.rect(-c.width / 2 * d.width, -c.height / 2 * d.height, c.width * d.width, c.height * d.height);
a.translate(-c.xCenter * d.width, -c.yCenter * d.height);
a.stroke();
a.fill();
a.restore()
});
v("lerp", function(a, c, b, d, e) {
return z(d * (1 - (a - c) / (b - c)) + e * (1 - (b - a) / (b - c)), d, e)
});
}).call(this);

@ -1,194 +0,0 @@
var Module = typeof createMediapipeSolutionsPackedAssets !== 'undefined' ? createMediapipeSolutionsPackedAssets : {};
if (!Module.expectedDataFileDownloads) {
Module.expectedDataFileDownloads = 0;
}
Module.expectedDataFileDownloads++;
(function() {
// When running as a pthread, FS operations are proxied to the main thread, so we don't need to
// fetch the .data bundle on the worker
if (Module['ENVIRONMENT_IS_PTHREAD']) return;
var loadPackage = function(metadata) {
var PACKAGE_PATH = '';
if (typeof window === 'object') {
PACKAGE_PATH = window['encodeURIComponent'](window.location.pathname.toString().substring(0, window.location.pathname.toString().lastIndexOf('/')) + '/');
} else if (typeof process === 'undefined' && typeof location !== 'undefined') {
// web worker
PACKAGE_PATH = encodeURIComponent(location.pathname.toString().substring(0, location.pathname.toString().lastIndexOf('/')) + '/');
}
var PACKAGE_NAME = 'blaze-out/k8-opt/genfiles/third_party/mediapipe/web/solutions/hands/hands_solution_packed_assets.data';
var REMOTE_PACKAGE_BASE = 'hands_solution_packed_assets.data';
if (typeof Module['locateFilePackage'] === 'function' && !Module['locateFile']) {
Module['locateFile'] = Module['locateFilePackage'];
err('warning: you defined Module.locateFilePackage, that has been renamed to Module.locateFile (using your locateFilePackage for now)');
}
var REMOTE_PACKAGE_NAME = Module['locateFile'] ? Module['locateFile'](REMOTE_PACKAGE_BASE, '') : REMOTE_PACKAGE_BASE;
var REMOTE_PACKAGE_SIZE = metadata['remote_package_size'];
var PACKAGE_UUID = metadata['package_uuid'];
function fetchRemotePackage(packageName, packageSize, callback, errback) {
if (typeof process === 'object' && typeof process.versions === 'object' && typeof process.versions.node === 'string') {
require('fs').readFile(packageName, function(err, contents) {
if (err) {
errback(err);
} else {
callback(contents.buffer);
}
});
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', packageName, true);
xhr.responseType = 'arraybuffer';
xhr.onprogress = function(event) {
var url = packageName;
var size = packageSize;
if (event.total) size = event.total;
if (event.loaded) {
if (!xhr.addedTotal) {
xhr.addedTotal = true;
if (!Module.dataFileDownloads) Module.dataFileDownloads = {};
Module.dataFileDownloads[url] = {
loaded: event.loaded,
total: size
};
} else {
Module.dataFileDownloads[url].loaded = event.loaded;
}
var total = 0;
var loaded = 0;
var num = 0;
for (var download in Module.dataFileDownloads) {
var data = Module.dataFileDownloads[download];
total += data.total;
loaded += data.loaded;
num++;
}
total = Math.ceil(total * Module.expectedDataFileDownloads/num);
if (Module['setStatus']) Module['setStatus']('Downloading data... (' + loaded + '/' + total + ')');
} else if (!Module.dataFileDownloads) {
if (Module['setStatus']) Module['setStatus']('Downloading data...');
}
};
xhr.onerror = function(event) {
throw new Error("NetworkError for: " + packageName);
}
xhr.onload = function(event) {
if (xhr.status == 200 || xhr.status == 304 || xhr.status == 206 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
var packageData = xhr.response;
callback(packageData);
} else {
throw new Error(xhr.statusText + " : " + xhr.responseURL);
}
};
xhr.send(null);
};
function handleError(error) {
console.error('package error:', error);
};
var fetchedCallback = null;
var fetched = Module['getPreloadedPackage'] ? Module['getPreloadedPackage'](REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE) : null;
if (!fetched) fetchRemotePackage(REMOTE_PACKAGE_NAME, REMOTE_PACKAGE_SIZE, function(data) {
if (fetchedCallback) {
fetchedCallback(data);
fetchedCallback = null;
} else {
fetched = data;
}
}, handleError);
function runWithFS() {
function assert(check, msg) {
if (!check) throw msg + new Error().stack;
}
Module['FS_createPath']("/", "third_party", true, true);
Module['FS_createPath']("/third_party", "mediapipe", true, true);
Module['FS_createPath']("/third_party/mediapipe", "modules", true, true);
Module['FS_createPath']("/third_party/mediapipe/modules", "palm_detection", true, true);
Module['FS_createPath']("/third_party/mediapipe/modules", "hand_landmark", true, true);
/** @constructor */
function DataRequest(start, end, audio) {
this.start = start;
this.end = end;
this.audio = audio;
}
DataRequest.prototype = {
requests: {},
open: function(mode, name) {
this.name = name;
this.requests[name] = this;
Module['addRunDependency']('fp ' + this.name);
},
send: function() {},
onload: function() {
var byteArray = this.byteArray.subarray(this.start, this.end);
this.finish(byteArray);
},
finish: function(byteArray) {
var that = this;
Module['FS_createPreloadedFile'](this.name, null, byteArray, true, true, function() {
Module['removeRunDependency']('fp ' + that.name);
}, function() {
if (that.audio) {
Module['removeRunDependency']('fp ' + that.name); // workaround for chromium bug 124926 (still no audio with this, but at least we don't hang)
} else {
err('Preloading file ' + that.name + ' failed');
}
}, false, true); // canOwn this data in the filesystem, it is a slide into the heap that will never change
this.requests[this.name] = null;
}
};
var files = metadata['files'];
for (var i = 0; i < files.length; ++i) {
new DataRequest(files[i]['start'], files[i]['end'], files[i]['audio'] || 0).open('GET', files[i]['filename']);
}
function processPackageData(arrayBuffer) {
assert(arrayBuffer, 'Loading data file failed.');
assert(arrayBuffer instanceof ArrayBuffer, 'bad input to processPackageData');
var byteArray = new Uint8Array(arrayBuffer);
var curr;
// Reuse the bytearray from the XHR as the source for file reads.
DataRequest.prototype.byteArray = byteArray;
var files = metadata['files'];
for (var i = 0; i < files.length; ++i) {
DataRequest.prototype.requests[files[i].filename].onload();
} Module['removeRunDependency']('datafile_blaze-out/k8-opt/genfiles/third_party/mediapipe/web/solutions/hands/hands_solution_packed_assets.data');
};
Module['addRunDependency']('datafile_blaze-out/k8-opt/genfiles/third_party/mediapipe/web/solutions/hands/hands_solution_packed_assets.data');
if (!Module.preloadResults) Module.preloadResults = {};
Module.preloadResults[PACKAGE_NAME] = {fromCache: false};
if (fetched) {
processPackageData(fetched);
fetched = null;
} else {
fetchedCallback = processPackageData;
}
}
if (Module['calledRun']) {
runWithFS();
} else {
if (!Module['preRun']) Module['preRun'] = [];
Module["preRun"].push(runWithFS); // FS is not initialized yet, wait for it
}
}
loadPackage({"files": [{"filename": "/third_party/mediapipe/modules/palm_detection/palm_detection_lite.tflite", "start": 0, "end": 1985440}, {"filename": "/third_party/mediapipe/modules/palm_detection/palm_detection_full.tflite", "start": 1985440, "end": 4326720}, {"filename": "/third_party/mediapipe/modules/hand_landmark/handedness.txt", "start": 4326720, "end": 4326731}], "remote_package_size": 4326731, "package_uuid": "f2b11ac8-0259-41a9-b49f-d0fb8d91f87d"});
})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,27 +0,0 @@
{
"name": "@mediapipe/hands",
"version": "0.4.1646424915",
"description": "Mediapipe Hands Solution",
"main": "hands.js",
"module": "hands.js",
"jsdelivr": "hands.js",
"unpkg": "hands.js",
"types": "index.d.ts",
"author": "mhays@google.com",
"license": "Apache-2.0",
"homepage": "https://google.github.io/mediapipe/solutions/hands",
"keywords": [ "AR", "ML", "Augmented" ],
"devDependencies": {
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
},
"browser": {
"node-fetch": false,
"util": false,
"crypto": false
},
"sideEffects" : []
}

@ -1,162 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="/static/hand/camera_utils.js" crossorigin="anonymous"></script>
<script src="/static/hand/control_utils.js" crossorigin="anonymous"></script>
<script src="/static/hand/drawing_utils.js" crossorigin="anonymous"></script>
<script src="/static/hand/hands.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">
<canvas class="output_canvas" width="1280px" height="720px"></canvas>
</div>
<button id="clean" onclick="clean()">清空</button>
<div id="txtHint"></div>
<script>
function clean() {
var obj = document.getElementById("txtHint");
obj.innerHTML="";
}
</script>
<script type="module">
function ajax(str) {
var xmlhttp;
if (str.length==0)
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var xml = xmlhttp.responseText
xml = xml.slice(33,xml.length-2);
document.getElementById("txtHint").innerHTML+=xml;
num=0
}
}
xmlhttp.open("GET","/trans?str="+str,true)
xmlhttp.send();
}
const videoElement = document.createElement("video");
const canvasElement = document.getElementsByClassName('output_canvas')[0];
const canvasCtx = canvasElement.getContext('2d');
var str =""
var pre=str
var num=2
function onResults(results) {
canvasCtx.save();
canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height);
canvasCtx.drawImage(results.image, 0, 0, canvasElement.width, canvasElement.height);
if (results.multiHandLandmarks) {
var Left=[0,0,0,0,0,0,0,0,0]
var Right=[0,0,0,0,0,0,0,0,0]
for (let i = 0; i < results.multiHandLandmarks.length; i++) {
var hand_lable=results.multiHandedness[i].label
if (hand_lable=="Left"){
Left[0]=1
var wrist=results.multiHandLandmarks[i][0]
var index_finger_mcp=results.multiHandLandmarks[i][5]
var index_finger_tip=results.multiHandLandmarks[i][8]
var middle_finger_mcp=results.multiHandLandmarks[i][9]
var middle_finger_tip=results.multiHandLandmarks[i][12]
var ring_finger_mcp=results.multiHandLandmarks[i][13]
var ring_finger_tip=results.multiHandLandmarks[i][16]
var pinky_mcp=results.multiHandLandmarks[i][17]
var pinky_tip=results.multiHandLandmarks[i][20]
var one_x = index_finger_mcp.x-pinky_mcp.x
var one_y = index_finger_mcp.y-pinky_mcp.y
if (Math.abs(one_x)>Math.abs(one_y)) {
Left[3]=1;//平
if (one_x>0) Left[1]=1;//正
var tow = index_finger_mcp.y-wrist.y;
if (tow<0) Left[2]=1;//
var length = Math.abs(middle_finger_mcp.y-wrist.y)/3;
if (Math.abs(index_finger_tip.y-index_finger_mcp.y)>length) Left[5]=1;
if (Math.abs(middle_finger_tip.y-middle_finger_mcp.y)>length) Left[6]=1;
if (Math.abs(ring_finger_tip.y-ring_finger_mcp.y)>length) Left[7]=1;
if (Math.abs(pinky_tip.y-pinky_mcp.y)>length) Left[8]=1;
} else {
var length = Math.abs(one_y)/3;
if (Math.abs(index_finger_mcp.x-index_finger_tip.x)>length) Left[5]=1;
if (Math.abs(middle_finger_mcp.x-middle_finger_tip.x)>length) Left[6]=1;
if (Math.abs(ring_finger_mcp.x-ring_finger_tip.x)>length) Left[7]=1;
if (Math.abs(pinky_mcp.x-pinky_tip.x)>length) Left[8]=1;
}
} else {
Right[0]=1
var wrist=results.multiHandLandmarks[i][0]
var index_finger_mcp=results.multiHandLandmarks[i][5]
var index_finger_tip=results.multiHandLandmarks[i][8]
var middle_finger_mcp=results.multiHandLandmarks[i][9]
var middle_finger_tip=results.multiHandLandmarks[i][12]
var ring_finger_mcp=results.multiHandLandmarks[i][13]
var ring_finger_tip=results.multiHandLandmarks[i][16]
var pinky_mcp=results.multiHandLandmarks[i][17]
var pinky_tip=results.multiHandLandmarks[i][20]
var one_x = index_finger_mcp.x-pinky_mcp.x
var one_y = index_finger_mcp.y-pinky_mcp.y
if (Math.abs(one_x)>Math.abs(one_y)) {
Right[3]=1;//平
if (one_x>0) Right[1]=1;//正
var tow = index_finger_mcp.y-wrist.y;
if (tow<0) Right[2]=1;//
var length = Math.abs(middle_finger_mcp.y-wrist.y)/3;
if (Math.abs(index_finger_tip.y-index_finger_mcp.y)>length) Right[5]=1;
if (Math.abs(middle_finger_tip.y-middle_finger_mcp.y)>length) Right[6]=1;
if (Math.abs(ring_finger_tip.y-ring_finger_mcp.y)>length) Right[7]=1;
if (Math.abs(pinky_tip.y-pinky_mcp.y)>length) Right[8]=1;
} else {
var length = Math.abs(one_y)/3;
if (Math.abs(index_finger_mcp.x-index_finger_tip.x)>length) Right[5]=1;
if (Math.abs(middle_finger_mcp.x-middle_finger_tip.x)>length) Right[6]=1;
if (Math.abs(ring_finger_mcp.x-ring_finger_tip.x)>length) Right[7]=1;
if (Math.abs(pinky_mcp.x-pinky_tip.x)>length) Right[8]=1;
}
}
pre=str
str=''
for (let j = 0; j < Left.length; j++) str+=Left[j]
str+='|'
for (let j = 0; j < Right.length; j++) str+=Right[j]
if (pre==str) num=num+1
console.log(pre,str,num)
if (num==20) ajax(str)
drawConnectors(canvasCtx, results.multiHandLandmarks[i], HAND_CONNECTIONS,
{color: '#00FF00', lineWidth: 5});
drawLandmarks(canvasCtx, results.multiHandLandmarks[i], {color: '#FF0000', lineWidth: 2});
}
}
canvasCtx.restore();
}
const hands = new Hands({locateFile: (file) => {
return `/static/hand/${file}`;
}});
hands.setOptions({
maxNumHands: 2,
modelComplexity: 1,
minDetectionConfidence: 0.5,
minTrackingConfidence: 0.5
});
hands.onResults(onResults);
const camera = new Camera(videoElement, {
onFrame: async () => {
await hands.send({image: videoElement});
},
width: 1280,
height: 720
});
camera.start();
</script>
</body>
</html>

@ -1,746 +0,0 @@
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 950px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
.output_canvas{
width: 950px;
height: 415px;
}
.container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 950px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position:relative;
top: 20%;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输出框*/
.output{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
position: relative;
top: 10%;
}
/*输入框*/
.input{
position: relative;
top: 10%;
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
/*普通笔记本电脑900px<屏幕宽<950px高小于800px*/
@media screen and (max-width:950px) and (min-width:900px) and (max-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 900px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
.output_canvas{
width: 900px;
height: 415px;
}
.container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 900px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position:relative;
top: 20%;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输出框*/
.output{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
position: relative;
top: 10%;
}
/*输入框*/
.input{
position: relative;
top: 10%;
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}
/*普通移动手机屏幕高大于800px*/
@media screen and (min-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 950px;
height: 1200px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
.output_canvas{
width: 950px;
height: 1200px;
}
.container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 950px;
height: 1200px;
}
.button1{
position: absolute;
}
.button2{
position:relative;
top: 20%;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输出框*/
.output{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
position: relative;
top: 10%;
}
/*输入框*/
.input{
position: relative;
top: 10%;
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}
/*普通笔记本电脑850px<屏幕宽<900px高小于800px*/
@media screen and (max-width:900px) and (min-width:850px) and (max-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 850px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
.output_canvas{
width: 850px;
height: 415px;
}
.container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 850px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position:relative;
top: 20%;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输出框*/
.output{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
position: relative;
top: 10%;
}
/*输入框*/
.input{
position: relative;
top: 10%;
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}

@ -1,81 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/control_utils/control_utils.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js" crossorigin="anonymous"></script>
<title>手语翻译</title>
<link rel="stylesheet" type="text/css" href="./main/test1.css">
</head>
<body>
<div class="box">
<div class="top">
</div>
<div class="container">
<canvas class="output_canvas"></canvas>
</div>
<div class="container1">
<script type="module">
const videoElement = document.createElement("video");
const canvasElement = document.getElementsByClassName('output_canvas')[0];
const canvasCtx = canvasElement.getContext('2d');
function onResults(results) {
canvasCtx.save();
canvasCtx.clearRect(0, 0, canvasElement.width, canvasElement.height);
canvasCtx.drawImage(results.image, 0, 0, canvasElement.width, canvasElement.height);
if (results.multiHandLandmarks) {
for (const landmarks of results.multiHandLandmarks) {
console.log(landmarks)
drawConnectors(canvasCtx, landmarks, HAND_CONNECTIONS,
{color: '#00FF00', lineWidth: 5});
drawLandmarks(canvasCtx, landmarks, {color: '#FF0000', lineWidth: 2});
}
}
canvasCtx.restore();
}
const hands = new Hands({locateFile: (file) => {
return `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`;
}});
hands.setOptions({
maxNumHands: 2,
modelComplexity: 1,
minDetectionConfidence: 0.5,
minTrackingConfidence: 0.5
});
hands.onResults(onResults);
const camera = new Camera(videoElement, {
onFrame: async () => {
await hands.send({image: videoElement});
},
width: 1280,
height: 720
});
camera.start();
</script>
</div>
<div class="button1">
<button>START</button>
<button>DESTORY</button>
<button>SUMIT</button>
</div>
<div class="output">
<output name = "shuchu" type = "text"></output>
</div>
<div class="button2">
<a href="./test1.html">
<button id="btn4" class="btn">VIDEO</button>
</a>
<a href="./test2.html">
<button id="btn5" class="btn">WORD</button>
</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands_solution_packed_assets_loader.js" crossorigin="anonymous"></script><script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands_solution_simd_wasm_bin.js" crossorigin="anonymous">
</script>
</div>
</body>
</html>

@ -1,659 +0,0 @@
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 950px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
#container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 950px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position: absolute;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输入框*/
.input{
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
/*普通笔记本电脑900px<屏幕宽<950px高小于800px*/
@media screen and (max-width:950px) and (min-width:900px) and (max-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 900px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
#container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 900px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position: absolute;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输入框*/
.input{
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}
/*普通移动手机屏幕高大于800px*/
@media screen and (min-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 950px;
height: 1500px;
position:absolute;
top: 50%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
#container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 950px;
height: 1200px;
}
.button1{
position: absolute;
}
.button2{
position: absolute;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输入框*/
.input{
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}
/*普通笔记本电脑850px<屏幕宽<900px高小于800px*/
@media screen and (max-width:900px) and (min-width:850px) and (max-height:800px){
:root{
/*背景颜色*/
--white:#e9e9e9;
--gray:#333;
--blue:#0367a6;
--lightblue:#008997;
/*外边框圆角属性*/
--button-radius:0.7rem;
--max-width:758px;
--max-height:480px;
/*字体样式*/
font-size:16px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
*{
/* 初始化 */
margin: 0;
padding: 0;
}
body{
/* 100%窗口高度 */
height: 100vh;
/* 渐变背景 */
background: linear-gradient(200deg,#f3e7e9,#e3eeff);
}
.box{
width: 850px;
height: 500px;
position:absolute;
top: 40%;
left: 50%;
transform:translate(-50%,-50%);
}
.top{
height: 20px;
width: 30px;
position:relative;
}
#container{
background-color: #fff;
border-radius: 5px;
/* 阴影 */
box-shadow: 5px 5px 5px rgba(0,0,0,0.1);
/* 相对定位 */
position: relative;
width: 850px;
height: 415px;
}
.button1{
position: absolute;
}
.button2{
position: absolute;
}
button{
width: 100px;
background-color: #f6f6f6;
outline: none;
border-radius: 8px;
padding: 13px;
color: #a262ad;
letter-spacing: 2px;
border: none;
cursor: pointer;
}
button:hover{
background-color: #a262ad;
color: #f6f6f6;
transition: background-color 0.5s ease;
}
/*输入框*/
.input{
}
input{
background-color: transparent;
width: 300px;
color: #fff;
border: none;
/* 下边框样式 */
border-bottom: 1px solid rgba(255,255,255,0.4);
padding: 10px 0;
text-indent: 10px;
margin: 8px 0;
font-size: 14px;
letter-spacing: 2px;
}
input::placeholder{
color: #fff;
}
input:focus{
color: #a262ad;
outline: none;
border-bottom: 1px solid #a262ad80;
transition: 0.5s;
}
input:focus::placeholder{
opacity: 0;
}
.switch-wrapper {
width: 100px;
height: 50px;
/*margin: 200px auto;*/
/* outline: 1px solid red; */
}
.switch {
width: 100px;
height: 50px;
overflow: hidden;
}
.switch .switch__label{
display: block;
height: 100%;
cursor: pointer;
}
.switch .switch__round {
position: relative;
display: block;
width: 100%;
height: 100%;
background-color: #9e9292;
transition: all .8s ease-in-out;
}
.switch .switch__round__btn {
display: block;
position: absolute;
top: 3px;
left: 3px;
bottom: 3px;
width: 44px;
height: 44px;
background-color: #fff;
transition: all .2s ease-in-out;
}
.switch .switch__input {
display: none;
}
.switch .switch__input:checked + .switch__round {
background-color: #4d59ce;
}
.switch .switch__input:checked + .switch__round > .switch__round__btn {
left: 53px;
}
.switch .switch__radius {
border-radius: 50px;
}
}

@ -1,36 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>手语翻译</title>
<link rel="stylesheet" type="text/css" href="./main/test2.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="importmap">
{
"imports":{
"three":"./main/three.module.js",
"three/addons/":"./main/"
}
}
</script>
</head>
<body>
<div class="box">
<div id="container">
</div>
<div class="input">
<input id="txt" type="text">
<button type="button" id="btn" onclick="loadXMLDoc(txt.value)">start</button>
</div>
<div class="button2">
<a href="./test1.html">
<button id="btn4" class="btn4" onclick="add">VIDEO</button>
</a>
<a href="./test2.html">
<button id="btn5" class="btn5">WORD</button>
</a>
</div>
</div>
</body>
<script type="module" src="./main/main2_class2.js" ></script>
</html>

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>手语翻译</title>
<link rel="stylesheet" type="text/css" href="/static/1.css">
<script src="/static/three.js-r122/build/three.js"></script>
<script src="/static/three.js-r122/examples/jsm/controls/OrbitControls.js" type="module"></script>
</head>
<body>
<div class="box">
<div id="container">
</div>
<div class="input">
<input type="text">
</div>
<div class="button2">
<a href="./test1.html">
<button id="btn4" class="btn4">VIDEO</button>
</a>
<a href="./test2.html">
<button id="btn5" class="btn5">WORD</button>
</a>
<a href="./test3.html">
<button id="btn6" class="btn6">SETTING</button>
</a>
</div>
<script type="module" src="/static/three.js" ></script>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,26 @@
/*
* Copyright (C) 2002-2019 Igor Sysoev
* Copyright (C) 2011-2019 Nginx, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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 AUTHOR 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 AUTHOR 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.
*/

@ -0,0 +1,23 @@
default: build
clean:
rm -rf Makefile objs
build:
$(MAKE) -f objs/Makefile
install:
$(MAKE) -f objs/Makefile install
modules:
$(MAKE) -f objs/Makefile modules
upgrade:
./build/sbin/nginx -t
kill -USR2 `cat ./build/logs/nginx.pid`
sleep 1
test -f ./build/logs/nginx.pid.oldbin
kill -QUIT `cat ./build/logs/nginx.pid.oldbin`

@ -0,0 +1,3 @@
Documentation is available at http://nginx.org

@ -0,0 +1,14 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# aCC: HP ANSI C++ B3910B A.03.55.02
# C89 mode
CFLAGS="$CFLAGS -Ae"
CC_TEST_FLAGS="-Ae"
PCRE_OPT="$PCRE_OPT -Ae"
ZLIB_OPT="$ZLIB_OPT -Ae"

@ -0,0 +1,71 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Borland C++ 5.5
# optimizations
# maximize speed
CFLAGS="$CFLAGS -O2"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-5"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-6"
;;
esac
# __stdcall
#CPU_OPT="$CPU_OPT -ps"
# __fastcall
#CPU_OPT="$CPU_OPT -pr"
CFLAGS="$CFLAGS $CPU_OPT"
# multithreaded
CFLAGS="$CFLAGS -tWM"
# stop on warning
CFLAGS="$CFLAGS -w!"
# disable logo
CFLAGS="$CFLAGS -q"
# precompiled headers
CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.csm"
NGX_PCH="$NGX_OBJS/ngx_config.csm"
NGX_BUILD_PCH="-H=$NGX_OBJS/ngx_config.csm"
NGX_USE_PCH="-Hu -H=$NGX_OBJS/ngx_config.csm"
# Win32 GUI mode application
#LINK="\$(CC) -laa"
# the resource file
NGX_RES="$NGX_OBJS/nginx.res"
NGX_RCC="brcc32 -fo$NGX_OBJS/nginx.res \$(CORE_INCS) $NGX_WIN32_RC"
# the pragma allows to link the resource file using bcc32 and
# to avoid the direct ilink32 calling and the c0w32.obj's WinMain/main problem
NGX_PRAGMA="#pragma resource \"$NGX_OBJS/nginx.res\""
ngx_include_opt="-I"
ngx_objout="-o"
ngx_binout="-e"
ngx_objext="obj"
ngx_long_start='@&&|
'
ngx_long_end='|'
ngx_regex_dirsep='\\'
ngx_dirsep="\\"

@ -0,0 +1,46 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Compaq C V6.5-207
ngx_include_opt="-I"
# warnings
CFLAGS="$CFLAGS -msg_enable level6 -msg_fatal level6"
CFLAGS="$CFLAGS -msg_disable unknownmacro"
CFLAGS="$CFLAGS -msg_disable unusedincl"
CFLAGS="$CFLAGS -msg_disable unnecincl"
CFLAGS="$CFLAGS -msg_disable nestincl"
CFLAGS="$CFLAGS -msg_disable strctpadding"
CFLAGS="$CFLAGS -msg_disable ansialiascast"
CFLAGS="$CFLAGS -msg_disable inlinestoclsmod"
CFLAGS="$CFLAGS -msg_disable cxxkeyword"
CFLAGS="$CFLAGS -msg_disable longlongsufx"
CFLAGS="$CFLAGS -msg_disable valuepres"
# STUB
CFLAGS="$CFLAGS -msg_disable truncintcast"
CFLAGS="$CFLAGS -msg_disable trunclongcast"
CFLAGS="$CFLAGS -msg_disable truncintasn"
CFLAGS="$CFLAGS -msg_disable trunclongint"
CFLAGS="$CFLAGS -msg_disable intconcastsgn"
CFLAGS="$CFLAGS -msg_disable intconstsign"
CFLAGS="$CFLAGS -msg_disable switchlong"
CFLAGS="$CFLAGS -msg_disable subscrbounds2"
CFLAGS="$CFLAGS -msg_disable hexoctunsign"
CFLAGS="$CFLAGS -msg_disable ignorecallval"
CFLAGS="$CFLAGS -msg_disable nonstandcast"
CFLAGS="$CFLAGS -msg_disable embedcomment"
CFLAGS="$CFLAGS -msg_disable unreachcode"
CFLAGS="$CFLAGS -msg_disable questcompare2"
CFLAGS="$CFLAGS -msg_disable unusedtop"
CFLAGS="$CFLAGS -msg_disable unrefdecl"
CFLAGS="$CFLAGS -msg_disable bitnotint"

@ -0,0 +1,99 @@
# Copyright (C) Nginx, Inc.
# clang
NGX_CLANG_VER=`$CC -v 2>&1 | grep 'version' 2>&1 \
| sed -n -e 's/^.*clang version \(.*\)/\1/p' \
-e 's/^.*LLVM version \(.*\)/\1/p'`
echo " + clang version: $NGX_CLANG_VER"
have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define
CC_TEST_FLAGS="-pipe"
# optimizations
#NGX_CLANG_OPT="-O2"
#NGX_CLANG_OPT="-Oz"
NGX_CLANG_OPT="-O"
case $CPU in
pentium)
# optimize for Pentium
CPU_OPT="-march=pentium"
NGX_CPU_CACHE_LINE=32
;;
pentiumpro | pentium3)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-march=pentiumpro"
NGX_CPU_CACHE_LINE=32
;;
pentium4)
# optimize for Pentium 4
CPU_OPT="-march=pentium4"
NGX_CPU_CACHE_LINE=128
;;
athlon)
# optimize for Athlon
CPU_OPT="-march=athlon"
NGX_CPU_CACHE_LINE=64
;;
opteron)
# optimize for Opteron
CPU_OPT="-march=opteron"
NGX_CPU_CACHE_LINE=64
;;
esac
CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT"
CFLAGS="$CFLAGS -pipe $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="-O2 -pipe $CPU_OPT"
else
PCRE_OPT="$PCRE_OPT -pipe"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O2 -pipe $CPU_OPT"
else
ZLIB_OPT="$ZLIB_OPT -pipe"
fi
# warnings
CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith"
CFLAGS="$CFLAGS -Wconditional-uninitialized"
#CFLAGS="$CFLAGS -Wmissing-prototypes"
# we have a lot of unused function arguments
CFLAGS="$CFLAGS -Wno-unused-parameter"
# deprecated system OpenSSL library on OS X
if [ "$NGX_SYSTEM" = "Darwin" ]; then
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
fi
# stop on warning
CFLAGS="$CFLAGS -Werror"
# debug
CFLAGS="$CFLAGS -g"
if [ ".$CPP" = "." ]; then
CPP="$CC -E"
fi

@ -0,0 +1,254 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
LINK="\$(CC)"
MAIN_LINK=
MODULE_LINK="-shared"
ngx_include_opt="-I "
ngx_compile_opt="-c"
ngx_pic_opt="-fPIC"
ngx_objout="-o "
ngx_binout="-o "
ngx_objext="o"
ngx_binext=
ngx_modext=".so"
ngx_long_start=
ngx_long_end=
ngx_regex_dirsep="\/"
ngx_dirsep='/'
ngx_regex_cont=' \\\
'
ngx_cont=' \
'
ngx_tab=' \
'
ngx_spacer=
ngx_long_regex_cont=$ngx_regex_cont
ngx_long_cont=$ngx_cont
. auto/cc/name
if test -n "$CFLAGS"; then
CC_TEST_FLAGS="$CFLAGS $NGX_CC_OPT"
case $NGX_CC_NAME in
ccc)
# Compaq C V6.5-207
ngx_include_opt="-I"
;;
sunc)
MAIN_LINK=
MODULE_LINK="-G"
case "$NGX_MACHINE" in
i86pc)
NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
;;
sun4u | sun4v)
NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
;;
esac
case $CPU in
amd64)
NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
;;
esac
;;
esac
else
case $NGX_CC_NAME in
gcc)
# gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
# 4.0.0, 4.0.1, 4.1.0
. auto/cc/gcc
;;
clang)
# Clang C compiler
. auto/cc/clang
;;
icc)
# Intel C++ compiler 7.1, 8.0, 8.1
. auto/cc/icc
;;
sunc)
# Sun C 5.7 Patch 117837-04 2005/05/11
. auto/cc/sunc
;;
ccc)
# Compaq C V6.5-207
. auto/cc/ccc
;;
acc)
# aCC: HP ANSI C++ B3910B A.03.55.02
. auto/cc/acc
;;
msvc*)
# MSVC++ 6.0 SP2, MSVC++ Toolkit 2003
. auto/cc/msvc
;;
owc)
# Open Watcom C 1.0, 1.2
. auto/cc/owc
;;
bcc)
# Borland C++ 5.5
. auto/cc/bcc
;;
esac
CC_TEST_FLAGS="$CC_TEST_FLAGS $NGX_CC_OPT"
fi
CFLAGS="$CFLAGS $NGX_CC_OPT"
NGX_TEST_LD_OPT="$NGX_LD_OPT"
if [ "$NGX_PLATFORM" != win32 ]; then
if test -n "$NGX_LD_OPT"; then
ngx_feature=--with-ld-opt=\"$NGX_LD_OPT\"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test=
. auto/feature
if [ $ngx_found = no ]; then
echo $0: error: the invalid value in --with-ld-opt=\"$NGX_LD_OPT\"
echo
exit 1
fi
fi
ngx_feature="-Wl,-E switch"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=-Wl,-E
ngx_feature_test=
. auto/feature
if [ $ngx_found = yes ]; then
MAIN_LINK="-Wl,-E"
fi
if [ "$NGX_CC_NAME" = "sunc" ]; then
echo "checking for gcc builtin atomic operations ... disabled"
else
ngx_feature="gcc builtin atomic operations"
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
ngx_feature_run=yes
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="long n = 0;
if (!__sync_bool_compare_and_swap(&n, 0, 1))
return 1;
if (__sync_fetch_and_add(&n, 1) != 1)
return 1;
if (n != 2)
return 1;
__sync_synchronize();"
. auto/feature
fi
if [ "$NGX_CC_NAME" = "ccc" ]; then
echo "checking for C99 variadic macros ... disabled"
else
ngx_feature="C99 variadic macros"
ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS"
ngx_feature_run=yes
ngx_feature_incs="#include <stdio.h>
#define var(dummy, ...) sprintf(__VA_ARGS__)"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[30]; buf[0] = '0';
var(0, buf, \"%d\", 1);
if (buf[0] != '1') return 1"
. auto/feature
fi
ngx_feature="gcc variadic macros"
ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
ngx_feature_run=yes
ngx_feature_incs="#include <stdio.h>
#define var(dummy, args...) sprintf(args)"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char buf[30]; buf[0] = '0';
var(0, buf, \"%d\", 1);
if (buf[0] != '1') return 1"
. auto/feature
ngx_feature="gcc builtin 64 bit byteswap"
ngx_feature_name="NGX_HAVE_GCC_BSWAP64"
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="if (__builtin_bswap64(0)) return 1"
. auto/feature
# ngx_feature="inline"
# ngx_feature_name=
# ngx_feature_run=no
# ngx_feature_incs="int inline f(void) { return 1 }"
# ngx_feature_path=
# ngx_feature_libs=
# ngx_feature_test=
# . auto/feature
#
# if [ $ngx_found = yes ]; then
# fi
fi

@ -0,0 +1,179 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
# 4.0.0, 4.0.1, 4.1.0
NGX_GCC_VER=`$CC -v 2>&1 | grep 'gcc version' 2>&1 \
| sed -e 's/^.* version \(.*\)/\1/'`
echo " + gcc version: $NGX_GCC_VER"
have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define
# Solaris 7's /usr/ccs/bin/as does not support "-pipe"
CC_TEST_FLAGS="-pipe"
ngx_feature="gcc -pipe switch"
ngx_feature_name=
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test=
. auto/feature
CC_TEST_FLAGS=
if [ $ngx_found = yes ]; then
PIPE="-pipe"
fi
case "$NGX_MACHINE" in
sun4u | sun4v | sparc | sparc64 )
# "-mcpu=v9" enables the "casa" assembler instruction
CFLAGS="$CFLAGS -mcpu=v9"
;;
esac
# optimizations
#NGX_GCC_OPT="-O2"
#NGX_GCC_OPT="-Os"
NGX_GCC_OPT="-O"
#CFLAGS="$CFLAGS -fomit-frame-pointer"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-march=pentium"
NGX_CPU_CACHE_LINE=32
;;
pentiumpro | pentium3)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-march=pentiumpro"
NGX_CPU_CACHE_LINE=32
;;
pentium4)
# optimize for Pentium 4, gcc 3.x
CPU_OPT="-march=pentium4"
NGX_CPU_CACHE_LINE=128
;;
athlon)
# optimize for Athlon, gcc 3.x
CPU_OPT="-march=athlon"
NGX_CPU_CACHE_LINE=64
;;
opteron)
# optimize for Opteron, gcc 3.x
CPU_OPT="-march=opteron"
NGX_CPU_CACHE_LINE=64
;;
sparc32)
# build 32-bit UltraSparc binary
CPU_OPT="-m32"
CORE_LINK="$CORE_LINK -m32"
NGX_CPU_CACHE_LINE=64
;;
sparc64)
# build 64-bit UltraSparc binary
CPU_OPT="-m64"
CORE_LINK="$CORE_LINK -m64"
NGX_CPU_CACHE_LINE=64
;;
ppc64)
# build 64-bit PowerPC binary
CPU_OPT="-m64"
CPU_OPT="$CPU_OPT -falign-functions=32 -falign-labels=32"
CPU_OPT="$CPU_OPT -falign-loops=32 -falign-jumps=32"
CORE_LINK="$CORE_LINK -m64"
NGX_CPU_CACHE_LINE=128
;;
esac
CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT"
case "$NGX_GCC_VER" in
2.7*)
# batch build
CPU_OPT=
;;
esac
CFLAGS="$CFLAGS $PIPE $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
else
PCRE_OPT="$PCRE_OPT $PIPE"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
else
ZLIB_OPT="$ZLIB_OPT $PIPE"
fi
# warnings
# -W requires at least -O
CFLAGS="$CFLAGS ${NGX_GCC_OPT:--O} -W"
CFLAGS="$CFLAGS -Wall -Wpointer-arith"
#CFLAGS="$CFLAGS -Wconversion"
#CFLAGS="$CFLAGS -Winline"
#CFLAGS="$CFLAGS -Wmissing-prototypes"
case "$NGX_GCC_VER" in
2.*)
# we have a lot of the unused function arguments
CFLAGS="$CFLAGS -Wno-unused"
;;
*)
# we have a lot of the unused function arguments
CFLAGS="$CFLAGS -Wno-unused-parameter"
# 4.2.1 shows the warning in wrong places
#CFLAGS="$CFLAGS -Wunreachable-code"
# deprecated system OpenSSL library on OS X
if [ "$NGX_SYSTEM" = "Darwin" ]; then
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
fi
;;
esac
# stop on warning
CFLAGS="$CFLAGS -Werror"
# debug
CFLAGS="$CFLAGS -g"
# DragonFly's gcc3 generates DWARF
#CFLAGS="$CFLAGS -g -gstabs"
if [ ".$CPP" = "." ]; then
CPP="$CC -E"
fi

@ -0,0 +1,117 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Intel C++ compiler 7.1, 8.0, 8.1, 9.0, 11.1
NGX_ICC_VER=`$CC -V 2>&1 | grep 'Version' 2>&1 \
| sed -e 's/^.* Version \([^ ]*\) *Build.*$/\1/'`
echo " + icc version: $NGX_ICC_VER"
have=NGX_COMPILER value="\"Intel C Compiler $NGX_ICC_VER\"" . auto/define
# optimizations
CFLAGS="$CFLAGS -O"
CORE_LINK="$CORE_LINK -opt_report_file=$NGX_OBJS/opt_report_file"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-march=pentium"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-mcpu=pentiumpro -march=pentiumpro"
;;
pentium4)
# optimize for Pentium 4, default
CPU_OPT="-march=pentium4"
;;
esac
CFLAGS="$CFLAGS $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="-O $CPU_OPT"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O $CPU_OPT"
fi
# warnings
CFLAGS="$CFLAGS -w2"
# disable some warnings
# invalid type conversion: "int" to "char *"
CFLAGS="$CFLAGS -wd171"
# argument is incompatible with corresponding format string conversion
CFLAGS="$CFLAGS -wd181"
# zero used for undefined preprocessing identifier
CFLAGS="$CFLAGS -wd193"
# the format string ends before this argument
CFLAGS="$CFLAGS -wd268"
# invalid format string conversion
CFLAGS="$CFLAGS -wd269"
# conversion from "long long" to "size_t" may lose significant bits
CFLAGS="$CFLAGS -wd810"
# parameter was never referenced
CFLAGS="$CFLAGS -wd869"
# attribute "unused" is only allowed in a function definition, warning on pTHX_
CFLAGS="$CFLAGS -wd1301"
# STUB
# enumerated type mixed with another type
CFLAGS="$CFLAGS -wd188"
# controlling expression is constant
CFLAGS="$CFLAGS -wd279"
# operands are evaluated in unspecified order
CFLAGS="$CFLAGS -wd981"
# external definition with no prior declaration
CFLAGS="$CFLAGS -wd1418"
# external declaration in primary source file
CFLAGS="$CFLAGS -wd1419"
case "$NGX_ICC_VER" in
9.*)
# "cc" clobber ignored, warnings for Linux's htonl()/htons()
CFLAGS="$CFLAGS -wd1469"
# explicit conversion of a 64-bit integral type to a smaller
# integral type
CFLAGS="$CFLAGS -wd1683"
# conversion from pointer to same-sized integral type,
# warning on offsetof()
CFLAGS="$CFLAGS -wd1684"
# floating-point equality and inequality comparisons are unreliable,
# warning on SvTRUE()
CFLAGS="$CFLAGS -wd1572"
;;
8.*)
# "cc" clobber ignored, warnings for Linux's htonl()/htons()
CFLAGS="$CFLAGS -wd1469"
# floating-point equality and inequality comparisons are unreliable,
# warning on SvTRUE()
CFLAGS="$CFLAGS -wd1572"
;;
*)
;;
esac
# stop on warning
CFLAGS="$CFLAGS -Werror"
# debug
CFLAGS="$CFLAGS -g"

@ -0,0 +1,156 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# MSVC 6.0 SP2 cl 12.00
# MSVC Toolkit 2003 (7.1) cl 13.10
# MSVC 2005 Express Edition SP1 (8.0) cl 14.00
# MSVC 2008 Express Edition (9.0) cl 15.00
# MSVC 2010 (10.0) cl 16.00
# MSVC 2015 (14.0) cl 19.00
NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'Compiler Version' 2>&1 \
| sed -e 's/^.* Version \(.*\)/\1/'`
echo " + cl version: $NGX_MSVC_VER"
have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/define
ngx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'`
# optimizations
# maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy
CFLAGS="$CFLAGS -O2"
# enable global optimization
#CFLAGS="$CFLAGS -Og"
# enable intrinsic functions
#CFLAGS="$CFLAGS -Oi"
# disable inline expansion
#CFLAGS="$CFLAGS -Ob0"
# explicit inline expansion
#CFLAGS="$CFLAGS -Ob1"
# explicit and implicit inline expansion
#CFLAGS="$CFLAGS -Ob2"
# enable frame pointer omission
#CFLAGS="$CFLAGS -Oy"
# disable stack checking calls
#CFLAGS="$CFLAGS -Gs"
# pools strings as read/write
#CFLAGS="$CFLAGS -Gf"
# pools strings as read-only
#CFLAGS="$CFLAGS -GF"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-G5"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II and Pentium III
CPU_OPT="-G6"
;;
pentium4)
# optimize for Pentium 4, MSVC 7
CPU_OPT="-G7"
;;
esac
# __cdecl, default, must be used with OpenSSL, md5 asm, and sha1 asm
#CPU_OPT="$CPU_OPT -Gd"
# __stdcall
#CPU_OPT="$CPU_OPT -Gz"
# __fastcall
#CPU_OPT="$CPU_OPT -Gr"
CFLAGS="$CFLAGS $CPU_OPT"
# warnings
CFLAGS="$CFLAGS -W4"
# stop on warning
CFLAGS="$CFLAGS -WX"
# disable logo
CFLAGS="$CFLAGS -nologo"
# the link flags
CORE_LINK="$CORE_LINK -link -verbose:lib"
# link with libcmt.lib, multithreaded
LIBC="-MT"
# link with msvcrt.dll
# however, MSVC Toolkit 2003 has no MSVCRT.LIB
#LIBC="-MD"
CFLAGS="$CFLAGS $LIBC"
CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib"
# Win32 GUI mode application
#CORE_LINK="$CORE_LINK -subsystem:windows -entry:mainCRTStartup"
# debug
# msvc under Wine issues
# C1902: Program database manager mismatch; please check your installation
if [ -z "$NGX_WINE" ]; then
CFLAGS="$CFLAGS -Zi -Fd$NGX_OBJS/nginx.pdb"
CORE_LINK="$CORE_LINK -debug"
fi
# MSVC 2005 supports C99 variadic macros
if [ "$ngx_msvc_ver" -ge 14 ]; then
have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
fi
# precompiled headers
CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
CORE_LINK="$CORE_LINK $NGX_OBJS/ngx_pch.obj"
NGX_PCH="$NGX_OBJS/ngx_config.pch"
NGX_BUILD_PCH="-Ycngx_config.h -Fp$NGX_OBJS/ngx_config.pch"
NGX_USE_PCH="-Yungx_config.h -Fp$NGX_OBJS/ngx_config.pch"
# the resource file
NGX_RES="$NGX_OBJS/nginx.res"
NGX_RCC="rc -fo$NGX_RES \$(CORE_INCS) $NGX_WIN32_RC"
CORE_LINK="$NGX_RES $CORE_LINK"
# dynamic modules
#MAIN_LINK="-link -def:$NGX_OBJS/nginx.def"
#MODULE_LINK="-LD $NGX_OBJS/nginx.lib"
ngx_pic_opt=
ngx_objout="-Fo"
ngx_binout="-Fe"
ngx_objext="obj"
ngx_long_start='@<<
'
ngx_long_end='<<'
ngx_long_regex_cont=' \
'
ngx_long_cont='
'
# MSVC understand / in path
#ngx_regex_dirsep='\\'
#ngx_dirsep="\\"

@ -0,0 +1,70 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ "$NGX_PLATFORM" != win32 ]; then
ngx_feature="C compiler"
ngx_feature_name=
ngx_feature_run=yes
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test=
. auto/feature
if [ $ngx_found = no ]; then
echo
echo $0: error: C compiler $CC is not found
echo
exit 1
fi
fi
if [ "$CC" = cl ]; then
NGX_CC_NAME=msvc
echo " + using Microsoft Visual C++ compiler"
elif [ "$CC" = wcl386 ]; then
NGX_CC_NAME=owc
echo " + using Open Watcom C compiler"
elif [ "$CC" = bcc32 ]; then
NGX_CC_NAME=bcc
echo " + using Borland C++ compiler"
elif `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then
NGX_CC_NAME=icc
echo " + using Intel C++ compiler"
elif `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then
NGX_CC_NAME=gcc
echo " + using GNU C compiler"
elif `$CC -v 2>&1 | grep 'clang version' >/dev/null 2>&1`; then
NGX_CC_NAME=clang
echo " + using Clang C compiler"
elif `$CC -v 2>&1 | grep 'LLVM version' >/dev/null 2>&1`; then
NGX_CC_NAME=clang
echo " + using Clang C compiler"
elif `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then
NGX_CC_NAME=sunc
echo " + using Sun C compiler"
elif `$CC -V 2>&1 | grep '^Compaq C' >/dev/null 2>&1`; then
NGX_CC_NAME=ccc
echo " + using Compaq C compiler"
elif `$CC -V 2>&1 | grep '^aCC: ' >/dev/null 2>&1`; then
NGX_CC_NAME=acc
echo " + using HP aC++ compiler"
else
NGX_CC_NAME=unknown
fi

@ -0,0 +1,103 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Open Watcom C 1.0, 1.2, 1.3
# optimizations
# maximize speed
CFLAGS="$CFLAGS -ot"
# reorder instructions for best pipeline usage
CFLAGS="$CFLAGS -op"
# inline intrinsic functions
CFLAGS="$CFLAGS -oi"
# inline expansion
CFLAGS="$CFLAGS -oe"
# disable stack checking calls
CFLAGS="$CFLAGS -s"
case $CPU in
pentium)
# optimize for Pentium and Athlon
# register-based arguments passing conventions
CPU_OPT="-5r"
# stack-based arguments passing conventions
#CPU_OPT="-5s"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II and Pentium III
# register-based arguments passing conventions
CPU_OPT="-6r"
# stack-based arguments passing conventions
#CPU_OPT="-6s"
;;
esac
CFLAGS="$CFLAGS $CPU_OPT"
# warnings
# maximum level
CFLAGS="$CFLAGS -wx"
#CFLAGS="$CFLAGS -w3"
# stop on warning
CFLAGS="$CFLAGS -we"
# built target is NT
CFLAGS="$CFLAGS -bt=nt"
# multithreaded
CFLAGS="$CFLAGS -bm"
# debug
CFLAGS="$CFLAGS -d2"
# quiet
CFLAGS="$CFLAGS -zq"
# Open Watcom C 1.2
have=NGX_HAVE_C99_VARIADIC_MACROS . auto/have
# the precompiled headers
#CORE_DEPS="$CORE_DEPS $NGX_OBJS/ngx_config.pch"
#NGX_PCH="$NGX_OBJS/ngx_config.pch"
#NGX_BUILD_PCH="-fhq=$NGX_OBJS/ngx_config.pch"
#NGX_USE_PCH="-fh=$NGX_OBJS/ngx_config.pch"
# the link flags, built target is NT GUI mode application
#CORE_LINK="$CORE_LINK -l=nt_win"
# the resource file
NGX_RCC="wrc \$(CORE_INCS) -fo=$NGX_OBJS/nginx.res "
NGX_RCC="$NGX_RCC $NGX_WIN32_RC $NGX_OBJS/nginx.exe"
ngx_include_opt="-i="
ngx_objout="-fo"
ngx_binout="-fe="
ngx_objext="obj"
ngx_regex_dirsep='\\'
ngx_dirsep="\\"
ngx_long_start=' '
ngx_long_end=' '
ngx_long_regex_cont=' \&\
'
ngx_long_cont=' &
'
ngx_regex_cont=' \&\
'
ngx_cont=' &
'
ngx_tab=' &
'

@ -0,0 +1,163 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# Sun C 5.7 Patch 117837-04 2005/05/11 Sun Studio 10
# Sun C 5.8 2005/10/13 Sun Studio 11
# Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12
# Sun C 5.9 SunOS_sparc 2007/05/03
# Sun C 5.10 SunOS_i386 2009/06/03 Sun Studio 12.1
# Sun C 5.11 SunOS_i386 2010/08/13 Oracle Solaris Studio 12.2
# Sun C 5.12 SunOS_i386 2011/11/16 Oracle Solaris Studio 12.3
# Sun C 5.13 SunOS_i386 2014/10/20 Oracle Solaris Studio 12.4
# Sun C 5.14 SunOS_i386 2016/05/31 Oracle Developer Studio 12.5
NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
| sed -e 's/^.* Sun C \(.*\)/\1/'`
echo " + Sun C version: $NGX_SUNC_VER"
have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define
cat << END > $NGX_AUTOTEST.c
int main(void) {
printf("%d", __SUNPRO_C);
return 0;
}
END
eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
ngx_sunc_ver=`$NGX_AUTOTEST`
fi
rm -rf $NGX_AUTOTEST*
# 1424 == 0x590, Sun Studio 12
if [ "$ngx_sunc_ver" -ge 1424 ]; then
ngx_sparc32="-m32"
ngx_sparc64="-m64"
ngx_amd64="-m64"
else
ngx_sparc32="-xarch=v8plus"
ngx_sparc64="-xarch=v9"
ngx_amd64="-xarch=amd64"
fi
case "$NGX_MACHINE" in
i86pc)
NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
;;
sun4u | sun4v)
NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
;;
esac
MAIN_LINK=
MODULE_LINK="-G"
# optimizations
# 20736 == 0x5100, Sun Studio 12.1
if [ "$ngx_sunc_ver" -ge 20736 ]; then
ngx_fast="-fast"
else
# older versions had problems with bit-fields
ngx_fast="-fast -xalias_level=any"
fi
IPO=-xipo
CFLAGS="$CFLAGS $ngx_fast $IPO"
CORE_LINK="$CORE_LINK $ngx_fast $IPO"
case $CPU in
pentium)
# optimize for Pentium and Athlon
CPU_OPT="-xchip=pentium"
;;
pentiumpro)
# optimize for Pentium Pro, Pentium II
CPU_OPT="-xchip=pentium_pro"
;;
pentium3)
# optimize for Pentium III
CPU_OPT="-xchip=pentium3"
#CPU_OPT="$CPU_OPT -xarch=sse"
CPU_OPT="$CPU_OPT -xcache=16/32/4:256/32/4"
;;
pentium4)
# optimize for Pentium 4
CPU_OPT="-xchip=pentium4"
#CPU_OPT="$CPU_OPT -xarch=sse2"
CPU_OPT="$CPU_OPT -xcache=8/64/4:256/128/8"
;;
opteron)
# optimize for Opteron
CPU_OPT="-xchip=opteron"
#CPU_OPT="$CPU_OPT -xarch=sse2"
CPU_OPT="$CPU_OPT -xcache=64/64/2:1024/64/16"
;;
sparc32)
# build 32-bit UltraSparc binary
CPU_OPT="$ngx_sparc32"
CORE_LINK="$CORE_LINK $ngx_sparc32"
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc32"
NGX_CPU_CACHE_LINE=64
;;
sparc64)
# build 64-bit UltraSparc binary
CPU_OPT="$ngx_sparc64"
CORE_LINK="$CORE_LINK $ngx_sparc64"
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc64"
NGX_CPU_CACHE_LINE=64
;;
amd64)
# build 64-bit amd64 binary
CPU_OPT="$ngx_amd64"
CORE_LINK="$CORE_LINK $ngx_amd64"
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_amd64"
NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
NGX_CPU_CACHE_LINE=64
;;
esac
CFLAGS="$CFLAGS $CPU_OPT"
if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="$ngx_fast $IPO $CPU_OPT"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="$ngx_fast $IPO $CPU_OPT"
fi
# stop on warning
CFLAGS="$CFLAGS -errwarn=%all"
# debug
CFLAGS="$CFLAGS -g"

@ -0,0 +1,12 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $have
#define $have $value
#endif
END

@ -0,0 +1,50 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
echo $ngx_n "checking for system byte ordering ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
----------------------------------------
checking for system byte ordering
END
cat << END > $NGX_AUTOTEST.c
int main(void) {
int i = 0x11223344;
char *p;
p = (char *) &i;
if (*p == 0x44) return 0;
return 1;
}
END
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
-o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
if $NGX_AUTOTEST >/dev/null 2>&1; then
echo " little endian"
have=NGX_HAVE_LITTLE_ENDIAN . auto/have
else
echo " big endian"
fi
rm -rf $NGX_AUTOTEST*
else
rm -rf $NGX_AUTOTEST*
echo
echo "$0: error: cannot detect system byte ordering"
exit 1
fi

@ -0,0 +1,123 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
echo $ngx_n "checking for $ngx_feature ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
----------------------------------------
checking for $ngx_feature
END
ngx_found=no
if test -n "$ngx_feature_name"; then
ngx_have_feature=`echo $ngx_feature_name \
| tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
fi
if test -n "$ngx_feature_path"; then
for ngx_temp in $ngx_feature_path; do
ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp"
done
fi
cat << END > $NGX_AUTOTEST.c
#include <sys/types.h>
$NGX_INCLUDE_UNISTD_H
$ngx_feature_incs
int main(void) {
$ngx_feature_test;
return 0;
}
END
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
-o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
ngx_feature_inc_path=
eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
case "$ngx_feature_run" in
yes)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
else
echo " found but is not working"
fi
;;
value)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " found"
ngx_found=yes
cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $ngx_feature_name
#define $ngx_feature_name `$NGX_AUTOTEST`
#endif
END
else
echo " found but is not working"
fi
;;
bug)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " not found"
else
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
fi
;;
*)
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
;;
esac
else
echo " not found"
echo "----------" >> $NGX_AUTOCONF_ERR
cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR
echo "----------" >> $NGX_AUTOCONF_ERR
echo $ngx_test >> $NGX_AUTOCONF_ERR
echo "----------" >> $NGX_AUTOCONF_ERR
fi
rm -rf $NGX_AUTOTEST*

@ -0,0 +1,12 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $have
#define $have 1
#endif
END

@ -0,0 +1,12 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
cat << END >> $NGX_AUTO_HEADERS_H
#ifndef $have
#define $have 1
#endif
END

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save