Comments (14)
Not efficient, but possible. replacing VLAs with malloc is fairly straightforward process.
from nextvi.
Static arrays probably won't work, unless you be willing to make some assumptions and reserve large blocks of memory.
from nextvi.
So how would you go about it? I can migrate to malloc, but not sure about sizes for static arrays. Migrate all VLAs to malloc-ed ones?
from nextvi.
Here's how nextvi looks on 9front
from nextvi.
How did you get it to compile?
Actually, changing to static array is rather trivial. Just make 1 global char array with size of 0.5MB-1MB and reference it everywhere its needed. Basically we simulate our own stack. The only case where this would not work is multithreaded code, which does exists if you use the threaded_search.patch. Its optional however.
from nextvi.
How did you get it to compile?
I just created static arrays with large sizes, but opened the issue because I was unsure about the sizes.
Actually, changing to static array is rather trivial. Just make 1 global char array with size of 0.5MB-1MB and reference it everywhere its needed. Basically we simulate our own stack. The only case where this would not work is multithreaded code, which does exists if you use the threaded_search.patch. Its optional however.
I might switch to multi threaded code because I'm considering adding mouse support. Where can I find the threaded_search patch?
from nextvi.
Any other tips for porting to a multi threaded environment?
from nextvi.
How did you get it to compile?
I just created static arrays with large sizes, but opened the issue because I was unsure about the sizes.
Ahh, in that case I can tell you that regex would need the most memory.
char nsubs[prog->sub];
nsubs can get quite large.
I might switch to multi threaded code because I'm considering adding mouse support. Where can I find the threaded_search patch?
https://github.com/kyx0r/nextvi/tree/patches
Not sure if multithreading is actually required for mouse though. Because all that mouse is just reading keycodes from the terminal. Not difference from keyboard. Only question if the terminal a universal format for this.
from nextvi.
The terminal is not in a standard format. I doesn't support escape codes. This is more of a GUI application than a TUI application in 9front. From what I understand, mouse support requires a multi threaded environment: https://9fans.github.io/plan9port/man/man3/thread.html.
https://wiki.9front.org/programming-gui
This is what term.c
would look like on 9front (wip) http://okturing.com/src/17118/body.
from nextvi.
Any other tips for porting to a multi threaded environment?
I think regex is the most problematic where just making a static array may not cut it. In that case you can add pointers in the rcode structure and malloc them at reg_comp. Then just use those pointers in re_pikevm.
from nextvi.
Hi, any progress on this? It would be nice to add an optional patch that removes VLA for systems that may benefit from it.
from nextvi.
Related Issues (20)
- syntax highlighting : standard strings in Python HOT 4
- Adding the ability to use custom keyboad layouts? HOT 3
- clang: Missing prototype HOT 1
- `clock_gettime` function in led.c isn't portable HOT 3
- segfault when trying to edit file that doesnt exist or is a directory HOT 3
- stdin pipe breaks all syntax highlighting HOT 1
- Issues with stdin_pipe HOT 14
- Is gf bind in normal mode that edits the file whose address is under the cursor, a thing in Nextvi? HOT 6
- arrowkeys_normal.patch shouldn't exit insert mode HOT 24
- arrowkeys_insert: the first time entering command mode, the command bar is broken until you type something HOT 1
- gcc warning HOT 2
- visual mode equivalent? HOT 2
- ec_closebuf segfaults if it is the only remaining buffer HOT 1
- Float without leading zero HOT 2
- a way to change how big tabs are HOT 1
- soft line wrap? HOT 2
- implementing vim-like dw HOT 3
- stdin_pipe: lockup if stdin is terminal HOT 5
- Skip command confirmation when only one line HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nextvi.