Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from vlang:master #2

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e2c5514
fix -prod compilation with latest V; run `v fmt -w .` too
spytheman Oct 20, 2022
5b93c1b
Add fseek and rewind built-in functions (#82)
rilysh Nov 2, 2022
bf48b33
spawn keyword
medvednikov Nov 5, 2022
fea624e
some refactoring (#75)
ArtemkaKun Nov 16, 2022
53030e4
Refactor `node.v` (#87)
ArtemkaKun Jan 14, 2023
1386d1e
implement skipping _linux.c on non linux platforms
spytheman Jan 14, 2023
4cc7bd9
fix v.mod dependency to point to the renamed ArtemkaKun.textproc
spytheman Feb 2, 2023
a18cfea
fix enum with const value declaration (#97)
felipensp Feb 17, 2023
b592afb
Improve CI push trigger (#99)
ArtemkaKun Feb 17, 2023
e1b069e
Improve CI push trigger (#100)
ArtemkaKun Feb 17, 2023
911967d
fix jni header parsing (#98)
felipensp Feb 17, 2023
367ddf8
Fix: main branch main (#102)
ArtemkaKun Feb 17, 2023
1d7aba7
Fix: main branch name (#103)
ArtemkaKun Feb 17, 2023
a19dce8
Fix jni translation expected output (#104)
ArtemkaKun Feb 17, 2023
cac0a7f
fix generated code for if stmt without braces (#101)
felipensp Feb 17, 2023
afeecb8
Fix tests names order (#105)
ArtemkaKun Feb 17, 2023
2ff3ed6
fix switch with default stmt before case stmt (#106)
felipensp Feb 17, 2023
0f7b717
Fix default stmt without break (#107)
felipensp Feb 18, 2023
335a17e
node.is_builtin(); skip expr comments and deprecated attrs
medvednikov Mar 14, 2023
c589a9a
fix code generated to multiple var declaration (#114)
felipensp Mar 21, 2023
811a8b7
Fix enum params in function calls and test runner warning
trollkarlen May 3, 2023
d84d969
fix issue with .c in folder name (#126)
trollkarlen May 11, 2023
b9d40c5
remove print on optional else after if block (#128)
trollkarlen May 11, 2023
3043b5c
fix escaping runes (#116) (#130)
prantlf Jul 9, 2023
5fe41c6
fix newline rune (#133)
yuyi98 Aug 9, 2023
1f17436
handle return stmt and do stmt after else
medvednikov Aug 9, 2023
e0d91a3
translation of opaque pointer types (#134)
ArtemkaKun Aug 11, 2023
15dbc8c
ci: set a predictable temp output path for `vgret` with `VTMP` (#142)
larpon Sep 1, 2023
553a19b
remove inline comments (#144)
yuyi98 Sep 6, 2023
d34ecec
format match expr with comments (#145)
yuyi98 Sep 6, 2023
3e23478
Fix global var with init (#146)
yuyi98 Sep 6, 2023
bb8c478
Revert "Fix global var with init (#146)" (#147)
yuyi98 Sep 7, 2023
0eb7eda
implement uint16_t conversion (#148)
ArtemkaKun Sep 8, 2023
388a4ab
fix visibility attribute (#149)
ArtemkaKun Sep 8, 2023
c0bcfbc
fix module name when generating wrapper (#135)
ArtemkaKun Sep 8, 2023
2d292fd
Fix doubling of typedefs (#150)
ArtemkaKun Sep 9, 2023
0c63eed
Fix argv confersion (#151)
ArtemkaKun Sep 9, 2023
ba042eb
fix uninited global var generation (#152)
ArtemkaKun Sep 9, 2023
1943b20
Fix remove method parameters name (#153)
ArtemkaKun Sep 9, 2023
c76d51c
Fix shared method parameter name (#154)
ArtemkaKun Sep 9, 2023
19ad91d
Fix select method parameter name (#155)
ArtemkaKun Sep 9, 2023
4485cc2
handle long double
medvednikov Sep 29, 2023
bf2f775
handle compound_literal_expr; keep_ast config parameter
medvednikov Oct 8, 2023
a8485fa
fix init_list_expr
medvednikov Oct 8, 2023
d7c13a2
anonymous struct
medvednikov Oct 8, 2023
ef1e35a
global anon struct
medvednikov Oct 8, 2023
122c2fb
tests: fix 5.struct.out
medvednikov Oct 8, 2023
85f25fd
lower case field name
medvednikov Oct 8, 2023
a4c837f
fix build_doom_file.vsh
medvednikov Oct 8, 2023
75e85f9
fix capitalized fields
medvednikov Oct 8, 2023
fda6882
ci: fix and update workflows (#157)
ttytm Oct 14, 2023
ff9c8f8
test: update `run_test.vsh` (#156)
ttytm Oct 14, 2023
3134e91
update @[attr] + clang-17 to path find (#162)
xn0px90 Jan 12, 2024
947fbd0
fix __func__, __line__ and __file__ handling (#166)
felipensp Jan 12, 2024
04849db
fix all tests after V attributes change - restore CI (#167)
felipensp Jan 12, 2024
729b50f
fix sizeof generated code (#169)
felipensp Jan 13, 2024
5ff52bd
fix missing `as` as keyword (#170)
felipensp Jan 13, 2024
a64056c
fix missing param name + @[c2v_variadic] attr (#171)
felipensp Jan 14, 2024
23fe665
fix restrict ptr translate (#168)
felipensp Feb 11, 2024
b0dc0fa
fixes, spotted while translating tcc's source (#176)
felipensp Feb 27, 2024
eafdd3c
camel_to_snake(); globals consts keep their c names; remove is_builti…
kbkpbot Jul 8, 2024
81f0596
fixes for most of the .out tests, run with: `v -g run ~/.vmodules/c2v…
spytheman Jul 8, 2024
0879006
more fixes for fn signatures, vfmt src/c2v.v as well
spytheman Jul 8, 2024
e2d8b6d
more cleanup
spytheman Jul 8, 2024
773f557
fix var/const conflict, update format of test output, update json ign…
JalonSolov Aug 26, 2024
51f34bf
improve line_is_builtin_header/1 by using (cached) `xcrun --show-sdk-…
spytheman Aug 26, 2024
26b32ce
sort the input .c files, when translating a whole folder, to guarante…
spytheman Sep 4, 2024
1c18d8d
fix system headers for windows (#183)
crackedmind Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 80 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,107 +2,131 @@ name: CI

on:
push:
paths-ignore: ['**/*.md', '^\.*', 'LICENSE']
pull_request:
paths-ignore: ['**/*.md', '^\.*', 'LICENSE']
schedule:
- cron: '31 1,12 * * *'

jobs:
ubuntu:
runs-on: ubuntu-latest
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout V
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: vlang/v
- name: Checkout c2v
uses: actions/checkout@v2
- name: Checkout C2V
uses: actions/checkout@v4
with:
path: c2v

- name: Install Dependencies
- name: Install dependencies
run: |
sudo apt-get update -y -qq
sudo apt-get install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev

if [ "${{ runner.os }}" == "Linux" ]; then
sudo apt update -y -qq
sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
else
brew install sdl2 sdl2_mixer sdl2_net libpng libsamplerate
fi
- name: Build V
run: make && ./v symlink -githubci

- name: Build c2v and setup ~/code
run: make -j4 && ./v symlink -githubci
- name: Setup C2V
run: |
ls -la /home/runner/work/c2v/c2v/c2v
ln -s /home/runner/work/c2v/c2v/c2v ~/.vmodules/c2v
mkdir -p ~/code/
v -g ~/.vmodules/c2v/
~/.vmodules/c2v/c2v || true

- name: Test c2v
mv c2v ~/.vmodules/c2v
v -g ~/.vmodules/c2v/ || true
- name: Test C2V
run: |
v -g test ~/.vmodules/c2v/
v -g run ~/.vmodules/c2v/tests/run_tests.vsh

- name: Build original Chocolate Doom
run: |
git clone --quiet --depth 1 https://github.com/vlang/doom ~/code/doom
cd ~/code/doom/chocolate-doom
cmake -DCMAKE_BUILD_TYPE=Debug .
make chocolate-doom

- name: Translate just p_enemy.v
run: |
cd ~/.vmodules/c2v/
v -g run tools/build_doom_file.vsh doom/p_enemy

- name: Translate the whole game in project/folder mode
run: |
cd ~/code/doom
touch ~/DOOM1.WAD
WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh

macos:
runs-on: macos-latest
touch ~/DOOM1.WAD
if [ "${{ runner.os }}" == "Linux" ]; then
WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh
else
echo "TODO: ... building doom should be fixed on macos, after it regressed in eafdd3c"
fi

test-regressions:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
VFLAGS: -cc tcc
DISPLAY: :99
LIBGL_ALWAYS_SOFTWARE: true
VTMP: /tmp
steps:
- name: Checkout V
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: vlang/v
- name: Checkout c2v
uses: actions/checkout@v2
- name: Checkout C2V
uses: actions/checkout@v4
with:
path: c2v

- name: Install Dependencies
run: brew install sdl2 sdl2_mixer sdl2_net libpng libsamplerate

- name: Install dependencies
run: |
sudo apt update -y -qq
sudo apt install libsdl2-dev libsdl2-mixer-dev libsdl2-net-dev libpng-dev libsamplerate0-dev
# c2v / DOOM dependencies
# vgret dependencies
# imagemagick : convert, mogrify, import
# xvfb : For starting X11 Virtual FrameBuffers
# openimageio-tools : idiff
# libgl1-mesa-dri : For headless rendering / software DRI driver (LIBGL_ALWAYS_SOFTWARE=true)
# freeglut3-dev : Fixes graphic apps compilation with tcc
sudo apt install imagemagick openimageio-tools freeglut3-dev libgl1-mesa-dri xvfb xsel xclip
- name: Setup test tools
run: |
# Fetch the free ~4MB DOOM1.WAD from the link at https://doomwiki.org/wiki/DOOM1.WAD
wget https://distro.ibiblio.org/slitaz/sources/packages/d/doom1.wad -O ~/doom1.wad
# Get imgur upload script
wget https://raw.githubusercontent.com/tremby/imgur.sh/c98345d/imgur.sh
chmod +x ./imgur.sh
# Get regression images to test against
git clone https://github.com/Larpon/doom-regression-images
- name: Build V
run: make && ./v symlink -githubci

- name: Build c2v and setup ~/code
run: make -j4 && ./v symlink -githubci
- name: Setup C2V
run: |
ls -la /Users/runner/work/c2v/c2v/c2v
ln -s /Users/runner/work/c2v/c2v/c2v ~/.vmodules/c2v
mkdir -p ~/code/
v -g ~/.vmodules/c2v/
~/.vmodules/c2v/c2v || true

- name: Test c2v
mv c2v ~/.vmodules/c2v
v -g ~/.vmodules/c2v/ || true
- name: Test C2V
run: |
v -g test ~/.vmodules/c2v/
v -g run ~/.vmodules/c2v/tests/run_tests.vsh

- name: Build original Chocolate Doom
run: |
git clone --quiet --depth 1 https://github.com/vlang/doom ~/code/doom
cd ~/code/doom/chocolate-doom
cmake -DCMAKE_BUILD_TYPE=Debug .
make chocolate-doom

- name: Translate just p_enemy.v
run: |
cd ~/.vmodules/c2v/
v -g run tools/build_doom_file.vsh doom/p_enemy

- name: Translate the whole game in project/folder mode
run: WAD_FILE=~/doom1.wad ~/code/doom/build_whole_project.sh
- name: Sample and compare
id: compare
continue-on-error: true
run: |
Xvfb $DISPLAY -screen 0 800x600x24 -fbdir /var/tmp/ &
sleep 1; while [ ! -f /var/tmp/Xvfb_screen0 ]; do sleep 0.5; done # give xvfb time to start, even on slow CI runs
sleep 1; v gret -r ~/code/doom -t ./doom-regression-images/vgret.doom.toml -v ./doom-sample_images ./doom-regression-images
- name: Upload regression to imgur
if: steps.compare.outcome != 'success'
run: |
cd ~/code/doom
touch ~/DOOM1.WAD
WAD_FILE=~/DOOM1.WAD ~/code/doom/build_whole_project.sh
./imgur.sh /tmp/fail.png
./imgur.sh /tmp/diff.png
exit 1
97 changes: 0 additions & 97 deletions .github/workflows/doom_gfx_regressions.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ c2v
vls.log
tests/run_tests
.idea/
tests/**.json
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ No dependencies other than a `clang` binary.

### Usage

c2v accepts the following arguments:
```
-keep_ast keep ast files
-print_tree print the entire tree
```

```
c2v file.c
```
Expand Down
23 changes: 0 additions & 23 deletions enum/gen_str.v

This file was deleted.

16 changes: 0 additions & 16 deletions enum/parse.v

This file was deleted.

Loading