Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lmj01 committed May 11, 2024
1 parent a5993aa commit 175aec6
Show file tree
Hide file tree
Showing 546 changed files with 37,054 additions and 12,402 deletions.
6 changes: 6 additions & 0 deletions cg/mesh/PolygonMeshProcessing.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# [Polygon Mesh Processing](http://www.pmp-book.org/)
> 以此书为点,由此及线,再到面
## 章节笔记
- 5
- 5.1,Computing a parameterization of an object means attaching a coordinate system to it.坐标系的建立是很多的基础,也是公式化的基础。这样可以使用很多数学概念进行操作。

### slides
- [Surface Representations](http://www.pmp-book.org/download/slides/Representations.pdf)
6 changes: 5 additions & 1 deletion cpl/cplusplus.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,15 @@ base + sizeof * 偏移量,数组指针好像就是这样的,用*(a+b)访
- [Calling conventions for different C++ compilers and operating systems](https://www.agner.org/optimize/calling_conventions.pdf),更新到2023年的技术
- [微软出品C++下一代的多态Proxy: Next Generation Polymorphism in C++](https://github.com/microsoft/proxy)
## 工具
### 工具
- [C++在线编译器,可以查看汇编等细节](https://godbolt.org/)
- [C++分析,可看到预处理状态](https://cppinsights.io/)
- [C++Benchmark](https://quick-bench.com/q/6tDxsmk3FMX55B8W1RrdiG_s7_k)
### 代码例子
- [crtp](/cpl/cpp/crtp.cpp)
- [offsetof](/cpl/cpp/offsetof.cpp)
- [reference](/cpl/cpp/reference.cpp)
## 观点
Expand Down
9 changes: 8 additions & 1 deletion cpl/language.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,11 @@ rust语言的安全,就是通过所有权的确定来保证在运行期不会

### [正则表达式regular expression](https://www.regular-expressions.info/)
- [New regular expression features in ECMAScript 6](https://2ality.com/2015/07/regexp-es6.html)
- [js RegExp](/cpl/js/regularExpressions.js)
- [JS的XRegExp扩展的正则表达式 The one of a kind JavaScript regular expression library](https://xregexp.com/)
- [XRegExp Regular Expression Library for JavaScript](https://www.regular-expressions.info/xregexp.html)
- [github XRegExp provides augmented (and extensible) JavaScript regular expressions](https://github.com/slevithan/xregexp)
- [js RegExp](/cpl/js/regularExpressions.js)

### 语法高亮

- [js版的highlight高亮配置,选中语言,下载后选择es版本的](https://highlightjs.org/download)
64 changes: 2 additions & 62 deletions cpl/lua.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,19 @@
# [lua](http://www.lua.org/)

注释

```lua
-- xxx to c // xxx
--[[ xxx ]] to c /* xxx */
```
- [注释](/cpl/lua/comment.lua)

## 模块与包

lua的模块是由变量,函数等组成的table,其是加载机制通过require来导入

require的路径是全局变量package.path中的,lua启动后,有三个大致范围

```lua
print(package.path) -- 编译后执行的路径,并未安装
-- /usr/local/share/lua/x.y/?.lua;/usr/local/share/lua/x.y/?/init.lua;/usr/local/lib/lua/x.y/?.lua;/usr/local/lib/lua/x.y/?/init.lua;./?.lua;./?/init.lua
-- 添加环境变量 export LUA_PATH="~/lua/?.lua;;" 最后的;;表示加上原来默认的路径
```

C包,使用C为lua写包,是动态库的调用方式

# lua-src

lua把虚拟机执行代码的效率作为一个设计目标。lua的vm是Register based VM。

```c
// register based vm
add a b c;
// stack based vm
push b;
push c;
add
mov a
```

## lopcodes

> 理解lua,直接从这里开始,是最好的,特别是有汇编,C语言的功底后,就相当于先理解lua的汇编指令,再去理解lua的逻辑。
Expand Down Expand Up @@ -63,8 +42,6 @@ pow(2,18)=262144 => [0, 262143]
luac -l -l src.lua
```



## 编译系统

编译系统就是将符合语法规则的chunk转成可运行的closure, 即chunk作为输入,closure作为输出。
Expand Down Expand Up @@ -95,16 +72,8 @@ proto对象是lua内部代表一个closure原型的对象,有关函数的大

lua没有使用llex和yacc生成,而是完全手写的词法和语法分析器,按功能划分,主要有三个模块

#### 词法分析模块

llex.h/c

#### 语法分析模块

lparser.h/c


![](./images/lua-opcode.png)
![lua-opcode](/images/lua_opcode.png)


```c
Expand All @@ -120,35 +89,6 @@ lparser.h/c
这里存在些疑惑,Opcode只占6bit,而opmode中的值占8bit,令人不解,多出来的一个bit是什么地方来的?
#### 指令生成模块
lcode.h/c
#### 其他
lprefix.h
luaconf.h
lua.h/c
主要接口
lctype.h/c
针对非ASCII进行定义一些基础字符
lmem.h/c
lzio.h/c
buffered streams,内存是stream形式,与C的File有点类似,核心就是两个函数luaZ_read,luaZ_fill
lobject.h/c
lua的类型定义
## 参考
- [Lua Awesome-lua官方链接上的记录](https://github.com/LewisJEllis/awesome-lua)
- [Quickly view and test GLSL fragment shaders while allowing lua scripting to modify uniforms ](https://github.com/nevilc/ShaderPreview)
Expand Down
28 changes: 28 additions & 0 deletions cpl/lua/comment.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

-- xxx single line comment

--[[
xxx
block comment
]]

/*
like c comment
*/

-- 模块与包

print(package.path) -- 编译后执行的路径,并未安装
-- /usr/local/share/lua/x.y/?.lua;/usr/local/share/lua/x.y/?/init.lua;/usr/local/lib/lua/x.y/?.lua;/usr/local/lib/lua/x.y/?/init.lua;./?.lua;./?/init.lua
-- 添加环境变量 export LUA_PATH="~/lua/?.lua;;" 最后的;;表示加上原来默认的路径


-- register based vm 调用方式不一样
-- add a b c
-- stack based vm 像汇编代码一样的逻辑
-- push b
-- push c
-- add
-- mov a


Loading

0 comments on commit 175aec6

Please sign in to comment.