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

Filesystem refactor and update #419

Merged
merged 44 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0e251eb
Consolidate all filesystem related functions to it's own translation …
a740g Dec 9, 2023
4853986
Repace fixdir() with filepath_fix_directory()
a740g Dec 10, 2023
a11a66f
Rename startDir to g_startDir
a740g Dec 10, 2023
7a1f510
Use Win32 ANSI API names
a740g Dec 10, 2023
96a2ffc
Simplify func__cwd()
a740g Dec 10, 2023
ffcd045
Make func__dir() cross-platform ready
a740g Dec 10, 2023
20e5789
Simplify func__direxists() and func__fileexists()
a740g Dec 10, 2023
1b3a5a7
Simplify and remove magic numbers
a740g Dec 10, 2023
4ca0cf3
Add initial support for FILES$()
a740g Dec 10, 2023
07c8554
Cross-platform full sub_kill() implementation
a740g Dec 11, 2023
3604a7a
Update sub_kill() to handle file spec without wildcard correctly
a740g Dec 11, 2023
3353364
Make PATHNAME_LENGTH_MAX > 4k or FILENAME_MAX
a740g Dec 11, 2023
ed30f7c
Add some known directory support for macOS & Linux
a740g Dec 11, 2023
a52c3ba
Simplify sub_kill()
a740g Dec 12, 2023
ede0d38
Merge branch 'QB64-Phoenix-Edition:main' into filesystem-refactor-and…
a740g Dec 13, 2023
941f358
Update comments
a740g Dec 13, 2023
901bdb4
Add filesys test
a740g Dec 13, 2023
4d4b99d
Fix some known directories
a740g Dec 13, 2023
ef142ec
Update comments
a740g Dec 14, 2023
3dd2495
Add more Linux known directories
a740g Dec 14, 2023
260adbf
Update more macOS known directories
a740g Dec 15, 2023
5c078a1
Implement func__files()
a740g Dec 15, 2023
9760895
Fix func__files() to return empty qbs on error
a740g Dec 15, 2023
5d03777
Add support for _FILES$()
a740g Dec 15, 2023
8c61cac
Merge branch 'filesystem-refactor-and-update' of https://github.com/a…
a740g Dec 27, 2023
28c9964
Add _FILES$ to syntax_highlighter_list.bas
a740g Dec 27, 2023
c558d2a
Update func__files() to return directory names with trailing slash
a740g Dec 27, 2023
a29d2b5
Prefix function names with FS_ to avoid possible collisions
a740g Dec 27, 2023
fcabef6
Implement cross-platform sub_files()
a740g Dec 28, 2023
85afb4b
Make FS_GetFQN() return trailing slash for directories
a740g Dec 28, 2023
35e44a6
Update func__files() to handle fileSpec directory name without traili…
a740g Dec 28, 2023
fa395b7
Implement func__FQN()
a740g Dec 28, 2023
0d71d08
Replace most qbs stuff with std::string
a740g Dec 28, 2023
cd5a605
Remove new_error check in func__FQN()
a740g Dec 28, 2023
84b58c0
Update func__sndopen() to use filepath_fix_directory()
a740g Dec 28, 2023
035a12e
Update func__loadimage() & sub__saveimage() to use filepath_fix_direc…
a740g Dec 28, 2023
d4437d1
Update func__loadfont() to use filepath_fix_directory()
a740g Dec 28, 2023
77122d4
Update func__dir() to support "PROGRAMFILES(X86)"
a740g Dec 28, 2023
d8cb77e
Change FS_GetKnownDirectory() to return "/Applications" on macOS
a740g Dec 28, 2023
c2bdb61
Fix comment typos
a740g Dec 29, 2023
ced74fb
Add QB64 error constants
a740g Dec 29, 2023
d518c9d
Merge branch 'QB64-Phoenix-Edition:main' into filesystem-refactor-and…
a740g Dec 30, 2023
b32dedf
Change _FQN$ to _FULLPATH$
a740g Dec 30, 2023
103e0f0
Cleanup FS_GetKnownDirectory() and make `libqb/` compile using -O2
a740g Jan 2, 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
105 changes: 102 additions & 3 deletions internal/c/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
# endif

// common includes
# include <stdio.h>
# include <cmath>
# include <stdint.h>
# include <errno.h>
# include <fcntl.h>
# include <fstream>
# include <iostream>
# include <limits.h>
# include <stdint.h>
# include <stdio.h>
# include <string.h>
# include <time.h>

Expand All @@ -77,13 +77,13 @@

# else

# include <dlfcn.h>
# include <pthread.h>
# include <stdlib.h>
# include <sys/stat.h>
# include <sys/types.h>
# include <sys/wait.h>
# include <unistd.h>
# include <dlfcn.h>

# endif

Expand All @@ -93,6 +93,105 @@
# endif
# endif

# define QB_FALSE 0
# define QB_TRUE -1

# define QB_ERROR_NEXT_WITHOUT_FOR 1
# define QB_ERROR_SYNTAX_ERROR 2
# define QB_ERROR_RETURN_WITHOUT_GOSUB 3
# define QB_ERROR_OUT_OF_DATA 4
# define QB_ERROR_ILLEGAL_FUNCTION_CALL 5
# define QB_ERROR_OVERFLOW 6
# define QB_ERROR_OUT_OF_MEMORY 7
# define QB_ERROR_LABEL_NOT_DEFINED 8
# define QB_ERROR_SUBSCRIPT_OUT_OF_RANGE 9
# define QB_ERROR_DUPLICATE_DEFINITION 10
# define QB_ERROR_DIVISION_BY_ZERO 11
# define QB_ERROR_ILLEGAL_IN_DIRECT_MODE 12
# define QB_ERROR_TYPE_MISMATCH 13
# define QB_ERROR_OUT_OF_STRING_SPACE 14
# define QB_ERROR_STRING_FORMULA_TOO_COMPLEX 16
# define QB_ERROR_CANNOT_CONTINUE 17
# define QB_ERROR_FUNCTION_NOT_DEFINED 18
# define QB_ERROR_NO_RESUME 19
# define QB_ERROR_RESUME_WITHOUT_ERROR 20
# define QB_ERROR_DEVICE_TIMEOUT 24
# define QB_ERROR_DEVICE_FAULT 25
# define QB_ERROR_FOR_WITHOUT_NEXT 26
# define QB_ERROR_OUT_OF_PAPER 27
# define QB_ERROR_WHILE_WITHOUT_WEND 29
# define QB_ERROR_WEND_WITHOUT_WHILE 30
# define QB_ERROR_DUPLICATE_LABEL 33
# define QB_ERROR_SUBPROGRAM_NOT_DEFINED 35
# define QB_ERROR_ARGUMENT_COUNT_MISMATCH 37
# define QB_ERROR_ARRAY_NOT_DEFINED 38
# define QB_ERROR_VARIABLE_REQUIRED 40
# define QB_ERROR_FIELD_OVERFLOW 50
# define QB_ERROR_INTERNAL_ERROR 51
# define QB_ERROR_BAD_FILE_NAME_OR_NUMBER 52
# define QB_ERROR_FILE_NOT_FOUND 53
# define QB_ERROR_BAD_FILE_MODE 54
# define QB_ERROR_FILE_ALREADY_OPEN 55
# define QB_ERROR_FIELD_STATEMENT_ACTIVE 56
# define QB_ERROR_DEVICE_IO_ERROR 57
# define QB_ERROR_FILE_ALREADY_EXISTS 58
# define QB_ERROR_BAD_RECORD_LENGTH 59
# define QB_ERROR_DISK_FULL 61
# define QB_ERROR_INPUT_PAST_END_OF_FILE 62
# define QB_ERROR_BAD_RECORD_NUMBER 63
# define QB_ERROR_BAD_FILE_NAME 64
# define QB_ERROR_TOO_MANY_FILES 67
# define QB_ERROR_DEVICE_UNAVAILABLE 68
# define QB_ERROR_COMMUNICATION_BUFFER_OVERFLOW 69
# define QB_ERROR_PERMISSION_DENIED 70
# define QB_ERROR_DISK_NOT_READY 71
# define QB_ERROR_DISK_MEDIA_ERROR 72
# define QB_ERROR_FEATURE_UNAVAILABLE 73
# define QB_ERROR_RENAME_ACROSS_DISKS 74
# define QB_ERROR_PATH_FILE_ACCESS_ERROR 75
# define QB_ERROR_PATH_NOT_FOUND 76
# define QB_ERROR_OUT_OF_STACK_SPACE 256
# define QB_ERROR_OUT_OF_MEMORY_FATAL 257
# define QB_ERROR_INVALID_HANDLE 258
# define QB_ERROR_CANNOT_FIND_DYNAMIC_LIBRARY_FILE 259
# define QB_ERROR_FUNCTION_NOT_FOUND_IN_DYNAMIC_LIBRARY 260
# define QB_ERROR_FUNCTION_NOT_FOUND_IN_DYNAMIC_LIBRARY_261 261
# define QB_ERROR_GL_COMMAND_OUTSIDE_SUB_GL_SCOPE 270
# define QB_ERROR_END_SYSTEM_IN_SUB_GL_SCOPE 271
# define QB_ERROR_MEMORY_REGION_OUT_OF_RANGE 300
# define QB_ERROR_INVALID_SIZE 301
# define QB_ERROR_SOURCE_MEMORY_REGION_OUT_OF_RANGE 302
# define QB_ERROR_DESTINATION_MEMORY_REGION_OUT_OF_RANGE 303
# define QB_ERROR_BOTH_MEMORY_REGIONS_OUT_OF_RANGE 304
# define QB_ERROR_SOURCE_MEMORY_FREED 305
# define QB_ERROR_DESTINATION_MEMORY_FREED 306
# define QB_ERROR_MEMORY_ALREADY_FREED 307
# define QB_ERROR_MEMORY_HAS_BEEN_FREED 308
# define QB_ERROR_MEMORY_NOT_INITIALIZED 309
# define QB_ERROR_SOURCE_MEMORY_NOT_INITIALIZED 310
# define QB_ERROR_DESTINATION_MEMORY_NOT_INITIALIZED 311
# define QB_ERROR_BOTH_MEMORY_NOT_INITIALIZED 312
# define QB_ERROR_BOTH_MEMORY_FREED 313
# define QB_ERROR_ASSERT_FAILED 314
# define QB_ERROR_ASSERT_FAILED_WITH_DESCRIPTION 315
# define QB_ERROR_OUT_OF_MEMORY_FATAL_502 502
# define QB_ERROR_OUT_OF_MEMORY_FATAL_503 503
# define QB_ERROR_OUT_OF_MEMORY_FATAL_504 504
# define QB_ERROR_OUT_OF_MEMORY_FATAL_505 505
# define QB_ERROR_OUT_OF_MEMORY_FATAL_506 506
# define QB_ERROR_OUT_OF_MEMORY_FATAL_507 507
# define QB_ERROR_OUT_OF_MEMORY_FATAL_508 508
# define QB_ERROR_OUT_OF_MEMORY_FATAL_509 509
# define QB_ERROR_OUT_OF_MEMORY_FATAL_510 510
# define QB_ERROR_OUT_OF_MEMORY_FATAL_511 511
# define QB_ERROR_OUT_OF_MEMORY_FATAL_512 512
# define QB_ERROR_OUT_OF_MEMORY_FATAL_513 513
# define QB_ERROR_OUT_OF_MEMORY_FATAL_514 514
# define QB_ERROR_OUT_OF_MEMORY_FATAL_515 515
# define QB_ERROR_OUT_OF_MEMORY_FATAL_516 516
# define QB_ERROR_OUT_OF_MEMORY_FATAL_517 517
# define QB_ERROR_OUT_OF_MEMORY_FATAL_518 518

// QB64 string descriptor structure
struct qbs_field {
int32 fileno;
Expand Down
Loading