5 Revize

9 změnil soubory, kde provedl 64 přidání a 22 odebrání
Rozdělené zobrazení
  1. +2
    -1
      .github/workflows/parse.yml
  2. +1
    -1
      src/raylib.h
  3. +40
    -13
      src/rcore.c
  4. +1
    -1
      tools/parser/Makefile
  5. +1
    -1
      tools/parser/output/raylib_api.json
  6. +1
    -1
      tools/parser/output/raylib_api.lua
  7. +1
    -1
      tools/parser/output/raylib_api.txt
  8. +1
    -1
      tools/parser/output/raylib_api.xml
  9. +16
    -2
      tools/rexm/rexm.c

+ 2
- 1
.github/workflows/parse.yml Zobrazit soubor

@ -32,6 +32,7 @@ jobs:
set -x
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add parser
git add tools/parser
git commit -m "Update raylib_api.* by CI"
git push

+ 1
- 1
src/raylib.h Zobrazit soubor

@ -1129,7 +1129,7 @@ RLAPI bool SaveFileText(const char *fileName, const char *text); // Save text d
// File system functions
RLAPI bool FileExists(const char *fileName); // Check if file exists
RLAPI bool DirectoryExists(const char *dirPath); // Check if a directory path exists
RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (including point: .png, .wav)
RLAPI bool IsFileExtension(const char *fileName, const char *ext); // Check file extension (recommended include point: .png, .wav)
RLAPI int GetFileLength(const char *fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
RLAPI const char *GetFileExtension(const char *fileName); // Get pointer to extension for a filename string (includes dot: '.png')
RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string

+ 40
- 13
src/rcore.c Zobrazit soubor

@ -113,7 +113,7 @@
#include <stdlib.h> // Required for: srand(), rand(), atexit()
#include <stdio.h> // Required for: sprintf() [Used in OpenURL()]
#include <string.h> // Required for: strrchr(), strcmp(), strlen(), memset()
#include <string.h> // Required for: strlen(), strcpy(), strcmp(), strrchr(), memset()
#include <time.h> // Required for: time() [Used in InitTimer()]
#include <math.h> // Required for: tan() [Used in BeginMode3D()], atan2f() [Used in LoadVrStereoConfig()]
@ -1940,34 +1940,61 @@ bool FileExists(const char *fileName)
}
// Check file extension
// TODO: Avoid [rtext] module dependency
bool IsFileExtension(const char *fileName, const char *ext)
{
#define MAX_FILE_EXTENSION_LENGTH 16
#define MAX_FILE_EXTENSIONS 32
bool result = false;
const char *fileExt = GetFileExtension(fileName);
if (fileExt != NULL)
{
#if defined(SUPPORT_MODULE_RTEXT) && defined(SUPPORT_TEXT_MANIPULATION)
int extCount = 0;
char **checkExts = TextSplit(ext, ';', &extCount); // WARNING: Module required: rtext
char fileExtLower[MAX_FILE_EXTENSION_LENGTH + 1] = { 0 };
strncpy(fileExtLower, TextToLower(fileExt), MAX_FILE_EXTENSION_LENGTH); // WARNING: Module required: rtext
int fileExtLen = strlen(fileExt);
char fileExtLower[8] = { 0 };
char *fileExtLowerPtr = fileExtLower;
for (int i = 0; i < fileExtLen; i++)
{
// Copy and convert to lower-case
if ((fileExt[i] >= 'A') && (fileExt[i] <= 'Z')) fileExtLower[i] = fileExt[i] + 32;
else fileExtLower[i] = fileExt[i];
}
int extCount = 1;
int extLen = strlen(ext);
char *extList = (char *)RL_CALLOC(extLen + 1, 1);
char *extListPtrs[MAX_FILE_EXTENSIONS] = { 0 };
strcpy(extList, ext);
extListPtrs[0] = extList;
for (int i = 0; i < extLen; i++)
{
// Convert to lower-case if extension is upper-case
if ((extList[i] >= 'A') && (extList[i] <= 'Z')) extList[i] += 32;
// Get pointer to next extension and add null-terminator
if ((extList[i] == ';') && (extCount < (MAX_FILE_EXTENSIONS - 1)))
{
extList[i] = '\0';
extListPtrs[extCount] = extList + i + 1;
extCount++;
}
}
for (int i = 0; i < extCount; i++)
{
if (strcmp(fileExtLower, TextToLower(checkExts[i])) == 0)
// Consider the case where extension provided
// does not start with the '.'
fileExtLowerPtr = fileExtLower;
if (extListPtrs[i][0] != '.') fileExtLowerPtr++;
if (strcmp(fileExtLowerPtr, extListPtrs[i]) == 0)
{
result = true;
break;
}
}
#else
if (strcmp(fileExt, ext) == 0) result = true;
#endif
RL_FREE(extList);
}
return result;

+ 1
- 1
tools/parser/Makefile Zobrazit soubor

@ -6,7 +6,7 @@ FORMAT?=DEFAULT
raylib_parser: raylib_parser.c
cc raylib_parser.c -o raylib_parser
raylib_api: ../src/raylib.h raylib_parser
raylib_api: ../../src/raylib.h raylib_parser
FORMAT=DEFAULT EXTENSION=txt $(MAKE) raylib_api.txt
FORMAT=JSON EXTENSION=json $(MAKE) raylib_api.json
FORMAT=XML EXTENSION=xml $(MAKE) raylib_api.xml

+ 1
- 1
tools/parser/output/raylib_api.json Zobrazit soubor

@ -4438,7 +4438,7 @@
},
{
"name": "IsFileExtension",
"description": "Check file extension (including point: .png, .wav)",
"description": "Check file extension (recommended include point: .png, .wav)",
"returnType": "bool",
"params": [
{

+ 1
- 1
tools/parser/output/raylib_api.lua Zobrazit soubor

@ -4027,7 +4027,7 @@ return {
},
{
name = "IsFileExtension",
description = "Check file extension (including point: .png, .wav)",
description = "Check file extension (recommended include point: .png, .wav)",
returnType = "bool",
params = {
{type = "const char *", name = "fileName"},

+ 1
- 1
tools/parser/output/raylib_api.txt Zobrazit soubor

@ -1670,7 +1670,7 @@ Function 125: DirectoryExists() (1 input parameters)
Function 126: IsFileExtension() (2 input parameters)
Name: IsFileExtension
Return type: bool
Description: Check file extension (including point: .png, .wav)
Description: Check file extension (recommended include point: .png, .wav)
Param[1]: fileName (type: const char *)
Param[2]: ext (type: const char *)
Function 127: GetFileLength() (1 input parameters)

+ 1
- 1
tools/parser/output/raylib_api.xml Zobrazit soubor

@ -1054,7 +1054,7 @@
<Function name="DirectoryExists" retType="bool" paramCount="1" desc="Check if a directory path exists">
<Param type="const char *" name="dirPath" desc="" />
</Function>
<Function name="IsFileExtension" retType="bool" paramCount="2" desc="Check file extension (including point: .png, .wav)">
<Function name="IsFileExtension" retType="bool" paramCount="2" desc="Check file extension (recommended include point: .png, .wav)">
<Param type="const char *" name="fileName" desc="" />
<Param type="const char *" name="ext" desc="" />
</Function>

+ 16
- 2
tools/rexm/rexm.c Zobrazit soubor

@ -740,6 +740,8 @@ int main(int argc, char *argv[])
VALID_INVALID_CATEGORY
*/
// TODO: Log more details about the validation process
// Check all examples in collection [examples_list.txt] -> Source of truth!
int exCollectionCount = 0;
rlExampleInfo *exCollection = LoadExamplesData(exCollectionFilePath, "ALL", false, &exCollectionCount);
@ -971,8 +973,20 @@ int main(int argc, char *argv[])
// Review: Add/Remove: raylib.com/examples/<category>/<category>_example_name.wasm
// Review: Add/Remove: raylib.com/examples/<category>/<category>_example_name.js
// Solves: VALID_MISSING_WEB_OUTPUT
//if (exInfo->status & VALID_MISSING_WEB_OUTPUT)
// system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exInfo->category, exInfo->name));
if (exInfo->status & VALID_MISSING_WEB_OUTPUT)
{
system(TextFormat("%s/build_example_web.bat %s/%s", exBasePath, exInfo->category, exInfo->name));
// Copy results to web side
FileCopy(TextFormat("%s/%s/%s.html", exBasePath, exInfo->category, exInfo->name),
TextFormat("%s/%s/%s.html", exWebPath, exInfo->category, exInfo->name));
FileCopy(TextFormat("%s/%s/%s.data", exBasePath, exInfo->category, exInfo->name),
TextFormat("%s/%s/%s.data", exWebPath, exInfo->category, exInfo->name));
FileCopy(TextFormat("%s/%s/%s.wasm", exBasePath, exInfo->category, exInfo->name),
TextFormat("%s/%s/%s.wasm", exWebPath, exInfo->category, exInfo->name));
FileCopy(TextFormat("%s/%s/%s.js", exBasePath, exInfo->category, exInfo->name),
TextFormat("%s/%s/%s.js", exWebPath, exInfo->category, exInfo->name));
}
}
}

Načítá se…
Zrušit
Uložit