Giter Site home page Giter Site logo

water-melon / melon Goto Github PK

View Code? Open in Web Editor NEW
1.3K 1.3K 174.0 3.16 MB

A generic cross-platform C library that includes many commonly used components and frameworks, and a new scripting language interpreter. It currently supports C99 and Aspect-Oriented Programming (AOP).

Home Page: http://doc.melonc.io

License: BSD 3-Clause "New" or "Revised" License

C 99.87% Objective-C 0.02% Dockerfile 0.04% CMake 0.07%
algorithms aop base64 c c99 cipher-algorithms data-structures framework http interpreter json md5 memory-pool multiprocessing multithreading reedsolomon regular-expression sha1 sha256 thread-pool

melon's People

Contributors

jer6y avatar water-melon avatar zengwei2000 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

melon's Issues

Compiling failed on MSYS2 gcc-11.2

When compiling on mingw64, got error: cast to pointer from integer of different size

$ make
test -d objs || mkdir objs
test -d lib || mkdir lib
gcc -Iinclude -Imelang -c -Wall -ggdb -Werror -O3 -fPIC -o objs/mln_lang_file.o ./melang/file/mln_lang_file.c
./melang/file/mln_lang_file.c: In function 'mln_lang_open_process':
./melang/file/mln_lang_file.c:345:41: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
345 | if ((rn = mln_rbtree_node_new(tree, (void *)fd)) == NULL) {
| ^
./melang/file/mln_lang_file.c: In function 'mln_lang_close_process':
./melang/file/mln_lang_file.c:939:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
939 | rn = mln_rbtree_search(tree, tree->root, (void *)fd);
| ^
cc1.exe: all warnings being treated as errors
make: *** [Makefile:90: objs/mln_lang_file.o] Error 1

GCC version

$ gcc -v
Using built-in specs.
COLLECT_GCC=H:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=H:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-11.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev8, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --with-boot-ldflags='-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc' 'LDFLAGS_FOR_TARGET=-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high' --enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ -static-libgcc\ -pipe\ -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high\ -Wl,--stack,12582912'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Rev8, Built by MSYS2 project)

And turn to mingw32, got another error error: conflicting types for 'inet_ntop'

$ make
test -d objs || mkdir objs
test -d lib || mkdir lib
gcc -Iinclude -Imelang -c -Wall -ggdb -Werror -O3 -fPIC -o objs/mln_lang_network.o ./melang/network/mln_lang_network.c
./melang/network/mln_lang_network.c:180:7: error: conflicting types for 'inet_ntop'; have 'char *(int, const void *, char *, socklen_t)' {aka 'char *(int, const void *, char *, int)'}
180 | char *inet_ntop(int af, const void src, char dst, socklen_t size){
| ^~~~~~~~~
In file included from ./melang/network/mln_lang_network.c:6:
H:/msys64/mingw32/include/ws2tcpip.h:401:35: note: previous declaration of 'inet_ntop' with type 'const CHAR *(INT, const void *, CHAR *, size_t)' {aka 'const char *(int, const void *, char *, unsigned int)'}
401 | WINSOCK_API_LINKAGE LPCSTR WSAAPI InetNtopA(INT Family, LPCVOID pAddr, LPSTR pStringBuf, size_t StringBufSize);
| ^~~~~~~~~
make: *** [Makefile:102: objs/mln_lang_network.o] Error 1

With GCC version

$ gcc -v
Using built-in specs.
COLLECT_GCC=H:\msys64\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=H:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.2.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-11.2.0/configure --prefix=/mingw32 --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 --with-native-system-header-dir=/mingw32/include --libexecdir=/mingw32/lib --enable-bootstrap --enable-checking=release --with-arch=i686 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev10, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --with-boot-ldflags='-pipe -Wl,--no-seh -Wl,--large-address-aware -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc' 'LDFLAGS_FOR_TARGET=-pipe -Wl,--no-seh -Wl,--large-address-aware' --enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ -static-libgcc\ -pipe\ -Wl,--no-seh\ -Wl,--large-address-aware\ -Wl,--stack,12582912' --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Rev10, Built by MSYS2 project)

MSYS version

$ uname -a
MSYS_NT-10.0-19043 XXX 3.3.3-341.x86_64 2022-01-18 13:00 UTC x86_64 Msys

melon git branch/commit 3d6329a60941ab198ab9b952ebd2bbdea0c8de49

fheap算法有误

让我们构造一个序列 期望的输出应该是0 288 289 289
而在我本地c++14 msvc的编译之下 输出序列为0 288 289 539
mln_fheap_consolidate中 while (array[d] != NULL) {

            y = array[d];
     
            if (!fh->cmp(x->key, y->key)) {

的交换策略
与mln_fheap_insert中
if (!fh->cmp(fn->key, fh->min->key))的交换策略完全相反
`//
// Created by Yuan on 2022/4/17.
//
#include <stdio.h>
#include <stdlib.h>
#include "mln_fheap.h"
#include
using namespace std;
static int cmp_handler(const void *key1, const void *key2)
{
return *(int *)key1 < *(int *)key2? 0: 1;
}

static void copy_handler(void *old_key, void *new_key)
{
*(int *)old_key = *(int *)new_key;
}

int main(int argc, char *argv[])
{
int i = 10, min = 0;
mln_fheap_t *fh;
mln_fheap_node_t *fn;
struct mln_fheap_attr fattr;

fattr.cmp = cmp_handler;
fattr.copy = copy_handler;
fattr.key_free = NULL;
fattr.min_val = &min;
fattr.min_val_size = sizeof(min);
fh = mln_fheap_init(&fattr);

int i1=0;
int i21=289;
int i22=288;
int i23=289;
int i31=539;
int i32=538;
int i33=537;
int i34=538;
int i35=539;

//int i3=500;
//int i3=500;
fn = mln_fheap_node_init(fh, &i1);
mln_fheap_insert(fh, fn);

mln_fheap_extract_min(fh);
cout<<"出队"<<*((int*)fn->key)<<endl;

fn = mln_fheap_node_init(fh, &i21);
mln_fheap_insert(fh, fn);
fn = mln_fheap_node_init(fh, &i22);
mln_fheap_insert(fh, fn);
fn = mln_fheap_node_init(fh, &i23);
mln_fheap_insert(fh, fn);


fn = mln_fheap_extract_min(fh);
cout<<"出队"<<*((int*)fn->key)<<endl;
fn = mln_fheap_node_init(fh, &i31);
mln_fheap_insert(fh, fn);
fn = mln_fheap_node_init(fh, &i32);
mln_fheap_insert(fh, fn);
fn = mln_fheap_node_init(fh, &i33);
mln_fheap_insert(fh, fn);
fn = mln_fheap_node_init(fh, &i34);
mln_fheap_insert(fh, fn);
fn = mln_fheap_node_init(fh, &i35);
mln_fheap_insert(fh, fn);


fn = mln_fheap_extract_min(fh);
cout<<"出队"<<*((int*)fn->key)<<endl;
fn = mln_fheap_extract_min(fh);
cout<<"出队"<<*((int*)fn->key)<<endl;
fn = mln_fheap_extract_min(fh);
cout<<"出队"<<*((int*)fn->key)<<endl;
fn = mln_fheap_extract_min(fh);
cout<<"出队"<<*((int*)fn->key)<<endl;
fn = mln_fheap_extract_min(fh);
cout<<"出队"<<*((int*)fn->key)<<endl;
fn = mln_fheap_extract_min(fh);
cout<<"出队"<<*((int*)fn->key)<<endl;
mln_fheap_destroy(fh);

return 0;

}`

melon.conf文件无效

项目目录:

  • inc
    • melon
      • *.h
  • lib
    • melon
      • libmelon.so
  • conf
    • melon.conf
  • src
    • *.c
  • logs

发现不管如何编译,最后默认的log文件保存的地方都是"{{ROOT}}/logs/melon.log"

找不到"mln_path.h" 头文件

我将include、src目录单独拷贝出来,结合一个main.c组合成一个cmake工程,编译发现找不到"mln_path.h"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.