继续把 interp_execute.cc、interp_queue.cc、interp_find.cc 等 LinuxCNC 源文件纳入直接编译/链接路径,逐步删除临时 convert_g() wrapper 行为

结论:已将核心 LinuxCNC interpreter 源接入 standalone native 编译链接路径,移除 minimal runtime 中的手写 convert_g 行为,并通过 native probe 验证。
This commit is contained in:
2026-06-06 23:49:01 +08:00
commit 5025b0c1a1
95 changed files with 35453 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2013 Jeff Epler <jepler@unpythonic.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __LINUXCNC_RTAPI_BYTEORDER_H
#define __LINUXCNC_RTAPI_BYTEORDER_H
#ifdef __KERNEL__
#include <asm/byteorder.h>
#ifdef __BIG_ENDIAN
#define RTAPI_BIG_ENDIAN 1
#define RTAPI_LITTLE_ENDIAN 0
#define RTAPI_FLOAT_BIG_ENDIAN 1
#else
#define RTAPI_LITTLE_ENDIAN 1
#define RTAPI_BIG_ENDIAN 0
#define RTAPI_FLOAT_BIG_ENDIAN 0
#endif
#else
#ifdef __FreeBSD__
#include <sys/endian.h>
#define RTAPI_BIG_ENDIAN (_BYTE_ORDER == _BIG_ENDIAN)
#define RTAPI_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN)
#define RTAPI_FLOAT_BIG_ENDIAN (_FLOAT_WORD_ORDER == _BIG_ENDIAN)
#else
#include <endian.h>
#define RTAPI_BIG_ENDIAN (__BYTE_ORDER == __BIG_ENDIAN)
#define RTAPI_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN)
#define RTAPI_FLOAT_BIG_ENDIAN (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
#endif /* !__FreeBSD__ */
#endif
#endif

View File

@@ -0,0 +1,52 @@
// Copyright 2014 Jeff Epler
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#ifndef __LINUXCNC_RTAPI_GFP_H
#define __LINUXCNC_RTAPI_GFP_H
#ifdef __KERNEL__
#include <linux/gfp.h>
// types
#define rtapi_gpf_e gpf_e
#define rtapi_gpf_t gpf_t
// enumerated values
#define RTAPI_GFP_BUFFER GFP_BUFFER
#define RTAPI_GFP_ATOMIC GFP_ATOMIC
#define RTAPI_GFP_KERNEL GFP_KERNEL
#define RTAPI_GFP_USER GFP_USER
#define RTAPI_GFP_NOBUFFER GFP_NOBUFFER
#define RTAPI_GFP_NFS GFP_NFS
#define RTAPI_GFP_DMA GFP_DMA
#else
enum rtapi_gfp_e {
RTAPI_GFP_BUFFER,
RTAPI_GFP_ATOMIC,
RTAPI_GFP_KERNEL,
RTAPI_GFP_USER,
RTAPI_GFP_NOBUFFER,
RTAPI_GFP_NFS,
RTAPI_GFP_DMA
};
typedef unsigned long rtapi_gfp_t;
#endif
#endif

View File

@@ -0,0 +1,132 @@
// Copyright 2006-2010 Various Authors
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#ifndef __LINUXCNC_RTAPI_MATH_H
#define __LINUXCNC_RTAPI_MATH_H
#include "rtapi.h" /* Because of all the rtapi refs */
#include <float.h> /* DBL_MAX and other FP goodies */
#ifndef M_PIl
#define M_PIl 3.1415926535897932384626433832795029L /* pi */
#endif
#ifndef M_PI_2l
#define M_PI_2l 1.570796326794896619231321691639751442L /* pi/2 */
#endif
#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795029 /* pi */
#endif
#if defined(__KERNEL__)
extern double sin(double);
extern double cos(double);
extern double tan(double);
extern double sqrt(double);
extern double fabs(double);
extern double atan(double);
extern double atan2(double, double);
extern double asin(double);
extern double acos(double);
extern double exp(double);
extern double pow(double, double);
extern double fmin(double, double);
extern double fmax(double, double);
extern double fmod(double, double);
extern double round(double);
extern double ceil(double);
extern double floor(double);
#define frexp(p,q) __builtin_frexp((p),(q))
#define isnan(x) __builtin_isnan((x))
#define signbit(x) __builtin_signbit((x))
#define nan(x) __builtin_nan((x))
#define isinf(x) __builtin_isinf((x))
#define isfinite(x) __builtin_isfinite((x))
#ifdef __i386__
#include "rtapi_math_i386.h"
#endif
#else
#include <math.h>
#endif
#include "rtapi_byteorder.h"
// adapted from ieee754.h
union ieee754_double
{
double d;
/* This is the IEEE 754 double-precision format. */
struct
{
#if RTAPI_BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:11;
/* Together these comprise the mantissa. */
unsigned int mantissa0:20;
unsigned int mantissa1:32;
#endif /* Big endian. */
#if RTAPI_LITTLE_ENDIAN
# if RTAPI_FLOAT_BIG_ENDIAN
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
unsigned int mantissa1:32;
# else
/* Together these comprise the mantissa. */
unsigned int mantissa1:32;
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
# endif
#endif /* Little endian. */
} ieee;
/* This format makes it easier to see if a NaN is a signalling NaN. */
struct
{
#if RTAPI_BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:11;
unsigned int quiet_nan:1;
/* Together these comprise the mantissa. */
unsigned int mantissa0:19;
unsigned int mantissa1:32;
#else
# if RTAPI_FLOAT_BIG_ENDIAN
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
unsigned int negative:1;
unsigned int mantissa1:32;
# else
/* Together these comprise the mantissa. */
unsigned int mantissa1:32;
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
unsigned int negative:1;
# endif
#endif
} ieee_nan;
};
#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
#endif

View File

@@ -0,0 +1,78 @@
// Copyright 2014 Jeff Epler
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#ifndef __LINUXCNC_RTAPI_STDINT_H
#define __LINUXCNC_RTAPI_STDINT_H
#ifdef __KERNEL__
#include <asm/types.h>
typedef s8 rtapi_s8;
typedef s16 rtapi_s16;
typedef s32 rtapi_s32;
typedef s64 rtapi_s64;
typedef long rtapi_intptr_t;
typedef u8 rtapi_u8;
typedef u16 rtapi_u16;
typedef u32 rtapi_u32;
typedef u64 rtapi_u64;
typedef unsigned long rtapi_uintptr_t;
#define RTAPI_INT8_MAX (127)
#define RTAPI_INT8_MIN (-128)
#define RTAPI_UINT8_MAX (255)
#define RTAPI_INT16_MAX (32767)
#define RTAPI_INT16_MIN (-32768)
#define RTAPI_UINT16_MAX (65535)
#define RTAPI_INT32_MAX (2147483647)
#define RTAPI_INT32_MIN (-2147483647-1)
#define RTAPI_UINT32_MAX (4294967295ul)
#define RTAPI_INT64_MAX (9223372036854775807)
#define RTAPI_INT64_MIN (-9223372036854775807-1)
#define RTAPI_UINT64_MAX (18446744073709551615ull)
#else
#include <inttypes.h>
typedef int8_t rtapi_s8;
typedef int16_t rtapi_s16;
typedef int32_t rtapi_s32;
typedef int64_t rtapi_s64;
typedef intptr_t rtapi_intptr_t;
typedef uint8_t rtapi_u8;
typedef uint16_t rtapi_u16;
typedef uint32_t rtapi_u32;
typedef uint64_t rtapi_u64;
typedef uintptr_t rtapi_uintptr_t;
#define RTAPI_INT8_MAX INT8_MAX
#define RTAPI_INT8_MIN INT8_MIN
#define RTAPI_UINT8_MAX UINT8_MAX
#define RTAPI_INT16_MAX INT16_MAX
#define RTAPI_INT16_MIN INT16_MIN
#define RTAPI_UINT16_MAX UINT16_MAX
#define RTAPI_INT32_MAX INT32_MAX
#define RTAPI_INT32_MIN INT32_MIN
#define RTAPI_UINT32_MAX UINT32_MAX
#define RTAPI_INT64_MAX INT64_MAX
#define RTAPI_INT64_MIN INT64_MIN
#define RTAPI_UINT64_MAX UINT64_MAX
#endif
#endif

View File

@@ -0,0 +1,69 @@
// Copyright 2006-2009, Jeff Epler
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#ifndef __LINUXCNC_RTAPI_STRING_H
#define __LINUXCNC_RTAPI_STRING_H
#include "rtapi.h"
#ifdef __cplusplus
#include <assert.h>
#include <type_traits>
#define rtapi_static_assert(a,b) static_assert(a,b)
#define rtapi_is_array(x) (std::is_array<decltype(x)>::value)
#else
#define rtapi_static_assert(a,b) _Static_assert(a,b)
#define rtapi_is_array(x) (!__builtin_types_compatible_p(__typeof__((x)), __typeof__(&(x)[0])))
#endif
#ifdef MODULE
/* Suspect only very early kernels are missing the basic string functions.
To be sure, see what has been implemented by looking in linux/string.h
and {linux_src_dir}/lib/string.c */
#include <linux/string.h>
#include <linux/version.h>
#define rtapi_argv_split argv_split
#define rtapi_argv_free argv_free
#define rtapi_kstrdup(a,b) kstrdup(a,b)
#else
#include <string.h>
#include "rtapi_gfp.h"
RTAPI_BEGIN_DECLS
extern char **rtapi_argv_split(rtapi_gfp_t, const char *argstr, int *argc);
extern void rtapi_argv_free(char **argv);
#define rtapi_kstrdup(a,b) strdup(a)
RTAPI_END_DECLS
#endif
RTAPI_BEGIN_DECLS
static inline size_t rtapi_strlcpy(char *dst, const char *src, size_t size) {
return rtapi_snprintf(dst, size, "%s", src);
}
#define rtapi_strxcpy(dst, src) ({ \
rtapi_static_assert(rtapi_is_array(dst), "dst must be non-const array"); \
rtapi_strlcpy(dst, src, sizeof(dst)); \
})
static inline size_t rtapi_strlcat(char *dst, const char *src, size_t size) {
size_t l = strlen(dst);
return rtapi_snprintf(dst+l, size-l, "%s", src);
}
#define rtapi_strxcat(dst, src) ({ \
rtapi_static_assert(rtapi_is_array(dst), "dst must be non-const array"); \
rtapi_strlcat(dst, src, sizeof(dst)); \
})
RTAPI_END_DECLS
#endif