mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
Move some utility functions to slang_utility.c.
This commit is contained in:
parent
3ed1f07686
commit
b10d080b1e
4 changed files with 123 additions and 42 deletions
|
|
@ -29,8 +29,9 @@
|
|||
*/
|
||||
|
||||
#include "imports.h"
|
||||
#include "slang_compile.h"
|
||||
#include "grammar_mesa.h"
|
||||
#include "slang_utility.h"
|
||||
#include "slang_compile.h"
|
||||
#include "slang_preprocess.h"
|
||||
|
||||
/*
|
||||
|
|
@ -40,46 +41,6 @@
|
|||
may be accepted resulting in undefined behaviour.
|
||||
*/
|
||||
|
||||
void slang_alloc_free (void *ptr)
|
||||
{
|
||||
_mesa_free (ptr);
|
||||
}
|
||||
|
||||
void *slang_alloc_malloc (unsigned int size)
|
||||
{
|
||||
return _mesa_malloc (size);
|
||||
}
|
||||
|
||||
void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
|
||||
{
|
||||
return _mesa_realloc (ptr, old_size, size);
|
||||
}
|
||||
|
||||
int slang_string_compare (const char *str1, const char *str2)
|
||||
{
|
||||
return _mesa_strcmp (str1, str2);
|
||||
}
|
||||
|
||||
char *slang_string_copy (char *dst, const char *src)
|
||||
{
|
||||
return _mesa_strcpy (dst, src);
|
||||
}
|
||||
|
||||
char *slang_string_concat (char *dst, const char *src)
|
||||
{
|
||||
return _mesa_strcpy (dst + _mesa_strlen (dst), src);
|
||||
}
|
||||
|
||||
char *slang_string_duplicate (const char *src)
|
||||
{
|
||||
return _mesa_strdup (src);
|
||||
}
|
||||
|
||||
unsigned int slang_string_length (const char *str)
|
||||
{
|
||||
return _mesa_strlen (str);
|
||||
}
|
||||
|
||||
static void slang_variable_construct (slang_variable *);
|
||||
static int slang_variable_copy (slang_variable *, const slang_variable *);
|
||||
static void slang_struct_construct (slang_struct *);
|
||||
|
|
|
|||
73
src/mesa/shader/slang/slang_utility.c
Normal file
73
src/mesa/shader/slang/slang_utility.c
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file slang_utility.c
|
||||
* slang utilities
|
||||
* \author Michal Krol
|
||||
*/
|
||||
|
||||
#include "imports.h"
|
||||
#include "slang_utility.h"
|
||||
|
||||
void slang_alloc_free (void *ptr)
|
||||
{
|
||||
_mesa_free (ptr);
|
||||
}
|
||||
|
||||
void *slang_alloc_malloc (unsigned int size)
|
||||
{
|
||||
return _mesa_malloc (size);
|
||||
}
|
||||
|
||||
void *slang_alloc_realloc (void *ptr, unsigned int old_size, unsigned int size)
|
||||
{
|
||||
return _mesa_realloc (ptr, old_size, size);
|
||||
}
|
||||
|
||||
int slang_string_compare (const char *str1, const char *str2)
|
||||
{
|
||||
return _mesa_strcmp (str1, str2);
|
||||
}
|
||||
|
||||
char *slang_string_copy (char *dst, const char *src)
|
||||
{
|
||||
return _mesa_strcpy (dst, src);
|
||||
}
|
||||
|
||||
char *slang_string_concat (char *dst, const char *src)
|
||||
{
|
||||
return _mesa_strcpy (dst + _mesa_strlen (dst), src);
|
||||
}
|
||||
|
||||
char *slang_string_duplicate (const char *src)
|
||||
{
|
||||
return _mesa_strdup (src);
|
||||
}
|
||||
|
||||
unsigned int slang_string_length (const char *str)
|
||||
{
|
||||
return _mesa_strlen (str);
|
||||
}
|
||||
|
||||
46
src/mesa/shader/slang/slang_utility.h
Normal file
46
src/mesa/shader/slang/slang_utility.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 2005 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if !defined SLANG_UTILITY_H
|
||||
#define SLANG_UTILITY_H
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void slang_alloc_free (void *);
|
||||
void *slang_alloc_malloc (unsigned int);
|
||||
void *slang_alloc_realloc (void *, unsigned int, unsigned int);
|
||||
int slang_string_compare (const char *, const char *);
|
||||
char *slang_string_copy (char *, const char *);
|
||||
char *slang_string_concat (char *, const char *);
|
||||
char *slang_string_duplicate (const char *);
|
||||
unsigned int slang_string_length (const char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -182,7 +182,8 @@ SLANG_CPP_SOURCES = \
|
|||
|
||||
SLANG_SOURCES = \
|
||||
shader/slang/slang_compile.c \
|
||||
shader/slang/slang_preprocess.c
|
||||
shader/slang/slang_preprocess.c \
|
||||
shader/slang/slang_utility.c
|
||||
|
||||
ASM_C_SOURCES = \
|
||||
x86/common_x86.c \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue