sort into folders

This commit is contained in:
anon
2024-03-10 16:02:52 +01:00
parent b0f6752c44
commit fa1d1f5cfd
123 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,15 @@
// @COMPILECMD g++ $@ -lboost_date_time
#include <iostream>
#include <boost/date_time/gregorian/gregorian.hpp>
int main() {
int year = 2023;
int month = 7;
boost::gregorian::date firstDay(year, month, 1);
boost::gregorian::date::day_of_week_type weekday = firstDay.day_of_week();
std::cout << "The first day of " << month << "/" << year << " is a " << weekday << std::endl;
return 0;
}

13
C&C++/JJbY.cpp Normal file
View File

@ -0,0 +1,13 @@
// @BAKE g++ $@ $(pkg-config --cflags --libs menu ncurses); ./a.out
#include <stdio.h>
#include "menu.h"
int main() {
printf("E_NOT_CONNECTED: %d\n", E_NOT_CONNECTED);
printf("E_SYSTEM_ERROR: %d\n", E_SYSTEM_ERROR);
printf("E_OK: %d\n", E_OK);
printf("E_BAD_ARGUMENT: %d\n", E_BAD_ARGUMENT);
printf("E_POSTED: %d\n", E_POSTED);
return 0;
}

28
C&C++/Tp6G.cpp Normal file
View File

@ -0,0 +1,28 @@
// @BAKE g++ $@ -o ncurses_pufka_example.out $(pkg-config --cflags --libs ncurses)
#include <ncurses.h>
int scr_h, scr_w;
char greeting[] = "Hello Ncurses!";
signed main(){
initscr();
start_color();
noecho();
curs_set(0);
getmaxyx(stdscr, scr_h, scr_w);
WINDOW* myWindow = newwin(3, ( sizeof(greeting)-1 ) + 4,
( scr_h / 2 ) - 1, (scr_w - ( sizeof(greeting)-1) ) / 2);
init_pair(1, COLOR_RED, COLOR_BLUE);
wbkgd(myWindow, COLOR_PAIR(1));
refresh();
box(myWindow, 0, 0);
mvwaddstr(myWindow, 1, 2, greeting);
wrefresh(myWindow);
while(1){}
endwin();
return 0;
}

View File

@ -0,0 +1 @@
int a<:4:>;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
# This file was generated by Autom4te 2.71.
# It contains the lists of macros which have been traced.
# It can be safely removed.
@request = (
bless( [
'0',
1,
[
'/usr/share/autoconf-2.71'
],
[
'/usr/share/autoconf-2.71/autoconf/autoconf.m4f',
'/usr/share/autoconf-2.71/autoconf/trailer.m4',
'configure.scan'
],
{
'm4_pattern_allow' => 1,
'AM_SILENT_RULES' => 1,
'AC_CANONICAL_TARGET' => 1,
'm4_sinclude' => 1,
'AM_PROG_MOC' => 1,
'm4_include' => 1,
'IT_PROG_INTLTOOL' => 1,
'AC_FC_PP_SRCEXT' => 1,
'AM_PROG_FC_C_O' => 1,
'AC_SUBST_TRACE' => 1,
'AM_GNU_GETTEXT' => 1,
'AM_PROG_MKDIR_P' => 1,
'include' => 1,
'AM_POT_TOOLS' => 1,
'AM_PROG_LIBTOOL' => 1,
'AM_INIT_AUTOMAKE' => 1,
'AM_MAINTAINER_MODE' => 1,
'_LT_AC_TAGCONFIG' => 1,
'sinclude' => 1,
'AC_LIBSOURCE' => 1,
'_AM_COND_IF' => 1,
'AM_XGETTEXT_OPTION' => 1,
'_AM_COND_ELSE' => 1,
'AM_PROG_CXX_C_O' => 1,
'AM_PROG_AR' => 1,
'AC_CONFIG_HEADERS' => 1,
'_AM_COND_ENDIF' => 1,
'AC_REQUIRE_AUX_FILE' => 1,
'AM_AUTOMAKE_VERSION' => 1,
'AM_ENABLE_MULTILIB' => 1,
'_m4_warn' => 1,
'AC_DEFINE_TRACE_LITERAL' => 1,
'AM_GNU_GETTEXT_INTL_SUBDIR' => 1,
'AC_CONFIG_MACRO_DIR_TRACE' => 1,
'AM_PATH_GUILE' => 1,
'LT_INIT' => 1,
'AC_INIT' => 1,
'AM_PROG_CC_C_O' => 1,
'AM_PROG_F77_C_O' => 1,
'GTK_DOC_CHECK' => 1,
'AC_CANONICAL_SYSTEM' => 1,
'AC_CANONICAL_HOST' => 1,
'AM_NLS' => 1,
'AC_CONFIG_SUBDIRS' => 1,
'AC_FC_PP_DEFINE' => 1,
'AC_FC_FREEFORM' => 1,
'AC_CONFIG_LIBOBJ_DIR' => 1,
'AM_MAKEFILE_INCLUDE' => 1,
'AC_CANONICAL_BUILD' => 1,
'LT_SUPPORTED_TAG' => 1,
'AC_CONFIG_FILES' => 1,
'm4_pattern_forbid' => 1,
'AM_CONDITIONAL' => 1,
'AC_FC_SRCEXT' => 1,
'AC_CONFIG_AUX_DIR' => 1,
'AH_OUTPUT' => 1,
'_AM_SUBST_NOTMAKE' => 1,
'AC_SUBST' => 1,
'AM_EXTRA_RECURSIVE_TARGETS' => 1,
'AC_PROG_LIBTOOL' => 1,
'_AM_MAKEFILE_INCLUDE' => 1,
'LT_CONFIG_LTDL_DIR' => 1,
'AC_CONFIG_LINKS' => 1
}
], 'Autom4te::Request' )
);

View File

@ -0,0 +1,185 @@
m4trace:configure.scan:5: -1- AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
m4trace:configure.scan:5: -1- m4_pattern_forbid([^_?A[CHUM]_])
m4trace:configure.scan:5: -1- m4_pattern_forbid([_AC_])
m4trace:configure.scan:5: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
m4trace:configure.scan:5: -1- m4_pattern_allow([^AS_FLAGS$])
m4trace:configure.scan:5: -1- m4_pattern_forbid([^_?m4_])
m4trace:configure.scan:5: -1- m4_pattern_forbid([^dnl$])
m4trace:configure.scan:5: -1- m4_pattern_forbid([^_?AS_])
m4trace:configure.scan:5: -1- AC_SUBST([SHELL])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([SHELL])
m4trace:configure.scan:5: -1- m4_pattern_allow([^SHELL$])
m4trace:configure.scan:5: -1- AC_SUBST([PATH_SEPARATOR])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([PATH_SEPARATOR])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PATH_SEPARATOR$])
m4trace:configure.scan:5: -1- AC_SUBST([PACKAGE_NAME], [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([PACKAGE_NAME])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.scan:5: -1- AC_SUBST([PACKAGE_TARNAME], [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([PACKAGE_TARNAME])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.scan:5: -1- AC_SUBST([PACKAGE_VERSION], [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([PACKAGE_VERSION])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.scan:5: -1- AC_SUBST([PACKAGE_STRING], [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([PACKAGE_STRING])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.scan:5: -1- AC_SUBST([PACKAGE_BUGREPORT], [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([PACKAGE_BUGREPORT])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.scan:5: -1- AC_SUBST([PACKAGE_URL], [m4_ifdef([AC_PACKAGE_URL], ['AC_PACKAGE_URL'])])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([PACKAGE_URL])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_URL$])
m4trace:configure.scan:5: -1- AC_SUBST([exec_prefix], [NONE])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([exec_prefix])
m4trace:configure.scan:5: -1- m4_pattern_allow([^exec_prefix$])
m4trace:configure.scan:5: -1- AC_SUBST([prefix], [NONE])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([prefix])
m4trace:configure.scan:5: -1- m4_pattern_allow([^prefix$])
m4trace:configure.scan:5: -1- AC_SUBST([program_transform_name], [s,x,x,])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([program_transform_name])
m4trace:configure.scan:5: -1- m4_pattern_allow([^program_transform_name$])
m4trace:configure.scan:5: -1- AC_SUBST([bindir], ['${exec_prefix}/bin'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([bindir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^bindir$])
m4trace:configure.scan:5: -1- AC_SUBST([sbindir], ['${exec_prefix}/sbin'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([sbindir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^sbindir$])
m4trace:configure.scan:5: -1- AC_SUBST([libexecdir], ['${exec_prefix}/libexec'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([libexecdir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^libexecdir$])
m4trace:configure.scan:5: -1- AC_SUBST([datarootdir], ['${prefix}/share'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([datarootdir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^datarootdir$])
m4trace:configure.scan:5: -1- AC_SUBST([datadir], ['${datarootdir}'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([datadir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^datadir$])
m4trace:configure.scan:5: -1- AC_SUBST([sysconfdir], ['${prefix}/etc'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([sysconfdir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^sysconfdir$])
m4trace:configure.scan:5: -1- AC_SUBST([sharedstatedir], ['${prefix}/com'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([sharedstatedir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^sharedstatedir$])
m4trace:configure.scan:5: -1- AC_SUBST([localstatedir], ['${prefix}/var'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([localstatedir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^localstatedir$])
m4trace:configure.scan:5: -1- AC_SUBST([runstatedir], ['${localstatedir}/run'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([runstatedir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^runstatedir$])
m4trace:configure.scan:5: -1- AC_SUBST([includedir], ['${prefix}/include'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([includedir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^includedir$])
m4trace:configure.scan:5: -1- AC_SUBST([oldincludedir], ['/usr/include'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([oldincludedir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^oldincludedir$])
m4trace:configure.scan:5: -1- AC_SUBST([docdir], [m4_ifset([AC_PACKAGE_TARNAME],
['${datarootdir}/doc/${PACKAGE_TARNAME}'],
['${datarootdir}/doc/${PACKAGE}'])])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([docdir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^docdir$])
m4trace:configure.scan:5: -1- AC_SUBST([infodir], ['${datarootdir}/info'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([infodir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^infodir$])
m4trace:configure.scan:5: -1- AC_SUBST([htmldir], ['${docdir}'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([htmldir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^htmldir$])
m4trace:configure.scan:5: -1- AC_SUBST([dvidir], ['${docdir}'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([dvidir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^dvidir$])
m4trace:configure.scan:5: -1- AC_SUBST([pdfdir], ['${docdir}'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([pdfdir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^pdfdir$])
m4trace:configure.scan:5: -1- AC_SUBST([psdir], ['${docdir}'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([psdir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^psdir$])
m4trace:configure.scan:5: -1- AC_SUBST([libdir], ['${exec_prefix}/lib'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([libdir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^libdir$])
m4trace:configure.scan:5: -1- AC_SUBST([localedir], ['${datarootdir}/locale'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([localedir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^localedir$])
m4trace:configure.scan:5: -1- AC_SUBST([mandir], ['${datarootdir}/man'])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([mandir])
m4trace:configure.scan:5: -1- m4_pattern_allow([^mandir$])
m4trace:configure.scan:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_NAME])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_NAME$])
m4trace:configure.scan:5: -1- AH_OUTPUT([PACKAGE_NAME], [/* Define to the full name of this package. */
@%:@undef PACKAGE_NAME])
m4trace:configure.scan:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_TARNAME])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_TARNAME$])
m4trace:configure.scan:5: -1- AH_OUTPUT([PACKAGE_TARNAME], [/* Define to the one symbol short name of this package. */
@%:@undef PACKAGE_TARNAME])
m4trace:configure.scan:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_VERSION])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_VERSION$])
m4trace:configure.scan:5: -1- AH_OUTPUT([PACKAGE_VERSION], [/* Define to the version of this package. */
@%:@undef PACKAGE_VERSION])
m4trace:configure.scan:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_STRING])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_STRING$])
m4trace:configure.scan:5: -1- AH_OUTPUT([PACKAGE_STRING], [/* Define to the full name and version of this package. */
@%:@undef PACKAGE_STRING])
m4trace:configure.scan:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_BUGREPORT])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_BUGREPORT$])
m4trace:configure.scan:5: -1- AH_OUTPUT([PACKAGE_BUGREPORT], [/* Define to the address where bug reports for this package should be sent. */
@%:@undef PACKAGE_BUGREPORT])
m4trace:configure.scan:5: -1- AC_DEFINE_TRACE_LITERAL([PACKAGE_URL])
m4trace:configure.scan:5: -1- m4_pattern_allow([^PACKAGE_URL$])
m4trace:configure.scan:5: -1- AH_OUTPUT([PACKAGE_URL], [/* Define to the home page for this package. */
@%:@undef PACKAGE_URL])
m4trace:configure.scan:5: -1- AC_SUBST([DEFS])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([DEFS])
m4trace:configure.scan:5: -1- m4_pattern_allow([^DEFS$])
m4trace:configure.scan:5: -1- AC_SUBST([ECHO_C])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([ECHO_C])
m4trace:configure.scan:5: -1- m4_pattern_allow([^ECHO_C$])
m4trace:configure.scan:5: -1- AC_SUBST([ECHO_N])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([ECHO_N])
m4trace:configure.scan:5: -1- m4_pattern_allow([^ECHO_N$])
m4trace:configure.scan:5: -1- AC_SUBST([ECHO_T])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([ECHO_T])
m4trace:configure.scan:5: -1- m4_pattern_allow([^ECHO_T$])
m4trace:configure.scan:5: -1- AC_SUBST([LIBS])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([LIBS])
m4trace:configure.scan:5: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.scan:5: -1- AC_SUBST([build_alias])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([build_alias])
m4trace:configure.scan:5: -1- m4_pattern_allow([^build_alias$])
m4trace:configure.scan:5: -1- AC_SUBST([host_alias])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([host_alias])
m4trace:configure.scan:5: -1- m4_pattern_allow([^host_alias$])
m4trace:configure.scan:5: -1- AC_SUBST([target_alias])
m4trace:configure.scan:5: -1- AC_SUBST_TRACE([target_alias])
m4trace:configure.scan:5: -1- m4_pattern_allow([^target_alias$])
m4trace:configure.scan:7: -1- AC_CONFIG_HEADERS([config.h])
m4trace:configure.scan:10: -1- AC_SUBST([CXX])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([CXX])
m4trace:configure.scan:10: -1- m4_pattern_allow([^CXX$])
m4trace:configure.scan:10: -1- AC_SUBST([CXXFLAGS])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([CXXFLAGS])
m4trace:configure.scan:10: -1- m4_pattern_allow([^CXXFLAGS$])
m4trace:configure.scan:10: -1- AC_SUBST([LDFLAGS])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([LDFLAGS])
m4trace:configure.scan:10: -1- m4_pattern_allow([^LDFLAGS$])
m4trace:configure.scan:10: -1- AC_SUBST([LIBS])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([LIBS])
m4trace:configure.scan:10: -1- m4_pattern_allow([^LIBS$])
m4trace:configure.scan:10: -1- AC_SUBST([CPPFLAGS])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([CPPFLAGS])
m4trace:configure.scan:10: -1- m4_pattern_allow([^CPPFLAGS$])
m4trace:configure.scan:10: -1- AC_SUBST([CXX])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([CXX])
m4trace:configure.scan:10: -1- m4_pattern_allow([^CXX$])
m4trace:configure.scan:10: -1- AC_SUBST([ac_ct_CXX])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([ac_ct_CXX])
m4trace:configure.scan:10: -1- m4_pattern_allow([^ac_ct_CXX$])
m4trace:configure.scan:10: -1- AC_SUBST([EXEEXT], [$ac_cv_exeext])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([EXEEXT])
m4trace:configure.scan:10: -1- m4_pattern_allow([^EXEEXT$])
m4trace:configure.scan:10: -1- AC_SUBST([OBJEXT], [$ac_cv_objext])
m4trace:configure.scan:10: -1- AC_SUBST_TRACE([OBJEXT])
m4trace:configure.scan:10: -1- m4_pattern_allow([^OBJEXT$])
m4trace:configure.scan:20: -1- AC_SUBST([LIB@&t@OBJS], [$ac_libobjs])
m4trace:configure.scan:20: -1- AC_SUBST_TRACE([LIB@&t@OBJS])
m4trace:configure.scan:20: -1- m4_pattern_allow([^LIB@&t@OBJS$])
m4trace:configure.scan:20: -1- AC_SUBST([LTLIBOBJS], [$ac_ltlibobjs])
m4trace:configure.scan:20: -1- AC_SUBST_TRACE([LTLIBOBJS])
m4trace:configure.scan:20: -1- m4_pattern_allow([^LTLIBOBJS$])

View File

235
C&C++/autoconfig/config.log Normal file
View File

@ -0,0 +1,235 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by FULL-PACKAGE-NAME configure VERSION, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
hostname = anon872387634598
uname -m = x86_64
uname -r = 6.0.2-gentoo
uname -s = Linux
uname -v = #1 SMP Fri Oct 21 13:55:34 CEST 2022
/usr/bin/uname -p = Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/sbin/
PATH: /usr/local/bin/
PATH: /usr/sbin/
PATH: /usr/bin/
PATH: /sbin/
PATH: /bin/
PATH: /opt/bin/
PATH: /usr/lib/llvm/16/bin/
PATH: /usr/lib/llvm/15/bin/
PATH: /usr/lib/llvm/14/bin/
PATH: /etc/eselect/wine/bin/
PATH: ./
PATH: /home/anon/Master/bin/
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2077: checking for g++
configure:2098: found /usr/bin/g++
configure:2109: result: g++
configure:2136: checking for C++ compiler version
configure:2145: g++ --version >&5
g++ (Gentoo Hardened 12.2.1_p20230304 p13) 12.2.1 20230304
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:2156: $? = 0
configure:2145: g++ -v >&5
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/12/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-12.2.1_p20230304/work/gcc-12-20230304/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/12 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/12/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/12/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/12/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened 12.2.1_p20230304 p13' --with-gcc-major-version-only --enable-esp --enable-libstdcxx-time --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --with-multilib-list=m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --enable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --without-zstd --enable-lto --without-isl --enable-default-pie --enable-default-ssp --with-build-config=bootstrap-cet
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.1 20230304 (Gentoo Hardened 12.2.1_p20230304 p13)
configure:2156: $? = 0
configure:2145: g++ -V >&5
g++: error: unrecognized command-line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:2156: $? = 1
configure:2145: g++ -qversion >&5
g++: error: unrecognized command-line option '-qversion'; did you mean '--version'?
g++: fatal error: no input files
compilation terminated.
configure:2156: $? = 1
configure:2176: checking whether the C++ compiler works
configure:2198: g++ conftest.cpp >&5
configure:2202: $? = 0
configure:2252: result: yes
configure:2255: checking for C++ compiler default output file name
configure:2257: result: a.out
configure:2263: checking for suffix of executables
configure:2270: g++ -o conftest conftest.cpp >&5
configure:2274: $? = 0
configure:2297: result:
configure:2319: checking whether we are cross compiling
configure:2327: g++ -o conftest conftest.cpp >&5
configure:2331: $? = 0
configure:2338: ./conftest
configure:2342: $? = 0
configure:2357: result: no
configure:2362: checking for suffix of object files
configure:2385: g++ -c conftest.cpp >&5
configure:2389: $? = 0
configure:2411: result: o
configure:2415: checking whether the compiler supports GNU C++
configure:2435: g++ -c conftest.cpp >&5
configure:2435: $? = 0
configure:2445: result: yes
configure:2456: checking whether g++ accepts -g
configure:2477: g++ -c -g conftest.cpp >&5
configure:2477: $? = 0
configure:2521: result: yes
configure:2541: checking for g++ option to enable C++11 features
configure:2556: g++ -c -g -O2 conftest.cpp >&5
conftest.cpp: In function 'int main(int, char**)':
conftest.cpp:175:25: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
175 | cxx11test::delegate d2();
| ^~
conftest.cpp:175:25: note: remove parentheses to default-initialize a variable
175 | cxx11test::delegate d2();
| ^~
| --
conftest.cpp:175:25: note: or replace parentheses with braces to value-initialize a variable
configure:2556: $? = 0
configure:2574: result: none needed
configure:2753: creating ./config.status
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by FULL-PACKAGE-NAME config.status VERSION, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status
on anon872387634598
config.status:643: error: cannot find input file: `config.h.in'
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_cxx_compiler_gnu=yes
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_objext=o
ac_cv_prog_ac_ct_CXX=g++
ac_cv_prog_cxx_11=no
ac_cv_prog_cxx_cxx11=
ac_cv_prog_cxx_g=yes
ac_cv_prog_cxx_stdcxx=
## ----------------- ##
## Output variables. ##
## ----------------- ##
CPPFLAGS=''
CXX='g++'
CXXFLAGS='-g -O2'
DEFS='-DHAVE_CONFIG_H'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
OBJEXT='o'
PACKAGE_BUGREPORT='BUG-REPORT-ADDRESS'
PACKAGE_NAME='FULL-PACKAGE-NAME'
PACKAGE_STRING='FULL-PACKAGE-NAME VERSION'
PACKAGE_TARNAME='full-package-name'
PACKAGE_URL=''
PACKAGE_VERSION='VERSION'
PATH_SEPARATOR=':'
SHELL='/bin/sh'
ac_ct_CXX='g++'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='${prefix}'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/usr/local'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "FULL-PACKAGE-NAME"
#define PACKAGE_TARNAME "full-package-name"
#define PACKAGE_VERSION "VERSION"
#define PACKAGE_STRING "FULL-PACKAGE-NAME VERSION"
#define PACKAGE_BUGREPORT "BUG-REPORT-ADDRESS"
#define PACKAGE_URL ""
configure: exit 1

767
C&C++/autoconfig/config.status Executable file
View File

@ -0,0 +1,767 @@
#! /bin/sh
# Generated by configure.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.
debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
as_nop=:
if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
then :
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else $as_nop
case `(set -o) 2>/dev/null` in #(
*posix*) :
set -o posix ;; #(
*) :
;;
esac
fi
# Reset variables that may have inherited troublesome values from
# the environment.
# IFS needs to be set, to space, tab, and newline, in precisely that order.
# (If _AS_PATH_WALK were called with IFS unset, it would have the
# side effect of setting IFS to empty, thus disabling word splitting.)
# Quoting is to prevent editors from complaining about space-tab.
as_nl='
'
export as_nl
IFS=" "" $as_nl"
PS1='$ '
PS2='> '
PS4='+ '
# Ensure predictable behavior from utilities with locale-dependent output.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE
# We cannot yet rely on "unset" to work, but we need these variables
# to be unset--not just set to an empty or harmless value--now, to
# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
# also avoids known problems related to "unset" and subshell syntax
# in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
do eval test \${$as_var+y} \
&& ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
# Ensure that fds 0, 1, and 2 are open.
if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
# The user is always right.
if ${PATH_SEPARATOR+false} :; then
PATH_SEPARATOR=:
(PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
PATH_SEPARATOR=';'
}
fi
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
test -r "$as_dir$0" && as_myself=$as_dir$0 && break
done
IFS=$as_save_IFS
;;
esac
# We did not find ourselves, most probably we were run as `sh COMMAND'
# in which case we are not to be found in the path.
if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
exit 1
fi
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
as_status=$1; test $as_status -eq 0 && as_status=1
if test "$4"; then
as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
printf "%s\n" "$as_me: error: $2" >&2
as_fn_exit $as_status
} # as_fn_error
# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
return $1
} # as_fn_set_status
# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
set +e
as_fn_set_status $1
exit $1
} # as_fn_exit
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
{ eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
then :
eval 'as_fn_append ()
{
eval $1+=\$2
}'
else $as_nop
as_fn_append ()
{
eval $1=\$$1\$2
}
fi # as_fn_append
# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
then :
eval 'as_fn_arith ()
{
as_val=$(( $* ))
}'
else $as_nop
as_fn_arith ()
{
as_val=`expr "$@" || test $? -eq 1`
}
fi # as_fn_arith
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
else
as_expr=false
fi
if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
fi
if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
as_dirname=dirname
else
as_dirname=false
fi
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
/^X\/\(\/\/\)$/{
s//\1/
q
}
/^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits
# Determine whether it's possible to make 'echo' print without a newline.
# These variables are no longer used directly by Autoconf, but are AC_SUBSTed
# for compatibility with existing Makefiles.
ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
xy) ECHO_C='\c';;
*) echo `echo ksh88 bug on AIX 6.1` > /dev/null
ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
# For backward compatibility with old third-party macros, we provide
# the shell variables $as_echo and $as_echo_n. New code should use
# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
as_echo='printf %s\n'
as_echo_n='printf %s'
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
if ln -s conf$$.file conf$$ 2>/dev/null; then
as_ln_s='ln -s'
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
# In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -pR'
fi
else
as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{
case $as_dir in #(
-*) as_dir=./$as_dir;;
esac
test -d "$as_dir" || eval $as_mkdir_p || {
as_dirs=
while :; do
case $as_dir in #(
*\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
*) as_qdir=$as_dir;;
esac
as_dirs="'$as_qdir' $as_dirs"
as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$as_dir" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
test -d "$as_dir" && break
done
test -z "$as_dirs" || eval "mkdir $as_dirs"
} || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by FULL-PACKAGE-NAME $as_me VERSION, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
CONFIG_LINKS = $CONFIG_LINKS
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
on `(hostname || uname -n) 2>/dev/null | sed 1q`
"
# Files that config.status was made for.
config_headers=" config.h"
ac_cs_usage="\
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration. Unless the files
and actions are specified as TAGs, all are instantiated by default.
Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
--config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--header=FILE[:TEMPLATE]
instantiate the configuration header FILE
Configuration headers:
$config_headers
Report bugs to <BUG-REPORT-ADDRESS>."
ac_cs_config=''
ac_cs_version="\
FULL-PACKAGE-NAME config.status VERSION
configured by ./configure, generated by GNU Autoconf 2.71,
with options \"$ac_cs_config\"
Copyright (C) 2021 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='/home/anon/Swap/tests/autoconfig'
srcdir='.'
test -n "$AWK" || AWK=awk
# The default lists apply if the user does not specify any file.
ac_need_defaults=:
while test $# != 0
do
case $1 in
--*=?*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
--*=)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=
ac_shift=:
;;
*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
esac
case $ac_option in
# Handling of the options.
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
printf "%s\n" "$ac_cs_version"; exit ;;
--config | --confi | --conf | --con | --co | --c )
printf "%s\n" "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--header | --heade | --head | --hea )
$ac_shift
case $ac_optarg in
*\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
--help | --hel | -h )
printf "%s\n" "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
-*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;
*) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
shift
done
ac_configure_extra_args=
if $ac_cs_silent; then
exec 6>/dev/null
ac_configure_extra_args="$ac_configure_extra_args --silent"
fi
if $ac_cs_recheck; then
set X /bin/sh './configure' $ac_configure_extra_args --no-create --no-recursion
shift
\printf "%s\n" "running CONFIG_SHELL=/bin/sh $*" >&6
CONFIG_SHELL='/bin/sh'
export CONFIG_SHELL
exec "$@"
fi
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
printf "%s\n" "$ac_log"
} >&5
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
done
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers
fi
# Have a temporary directory for convenience. Make it in the build tree
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
tmp= ac_tmp=
trap 'exit_status=$?
: "${ac_tmp:=$tmp}"
{ test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp
# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
D["PACKAGE_NAME"]=" \"FULL-PACKAGE-NAME\""
D["PACKAGE_TARNAME"]=" \"full-package-name\""
D["PACKAGE_VERSION"]=" \"VERSION\""
D["PACKAGE_STRING"]=" \"FULL-PACKAGE-NAME VERSION\""
D["PACKAGE_BUGREPORT"]=" \"BUG-REPORT-ADDRESS\""
D["PACKAGE_URL"]=" \"\""
for (key in D) D_is_set[key] = 1
FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*([\t (]|$)/ {
line = $ 0
split(line, arg, " ")
if (arg[1] == "#") {
defundef = arg[2]
mac1 = arg[3]
} else {
defundef = substr(arg[1], 2)
mac1 = arg[2]
}
split(mac1, mac2, "(") #)
macro = mac2[1]
prefix = substr(line, 1, index(line, defundef) - 1)
if (D_is_set[macro]) {
# Preserve the white space surrounding the "#".
print prefix "define", macro P[macro] D[macro]
next
} else {
# Replace #undef with comments. This is necessary, for example,
# in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
if (defundef == "undef") {
print "/*", prefix defundef, macro, "*/"
next
}
}
}
{ print }
_ACAWK
as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"
eval set X " :H $CONFIG_HEADERS "
shift
for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
:L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
ac_save_IFS=$IFS
IFS=:
set x $ac_tag
IFS=$ac_save_IFS
shift
ac_file=$1
shift
case $ac_mode in
:L) ac_source=$1;;
:[FH])
ac_file_inputs=
for ac_f
do
case $ac_f in
-) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
test -f "$ac_f" ||
case $ac_f in
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
esac
case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
as_fn_append ac_file_inputs " '$ac_f'"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
configure_input='Generated from '`
printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
`' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
printf "%s\n" "$as_me: creating $ac_file" >&6;}
fi
# Neutralize special characters interpreted by sed in replacement strings.
case $configure_input in #(
*\&* | *\|* | *\\* )
ac_sed_conf_input=`printf "%s\n" "$configure_input" |
sed 's/[\\\\&|]/\\\\&/g'`;; #(
*) ac_sed_conf_input=$configure_input;;
esac
case $ac_tag in
*:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
printf "%s\n" X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
.) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;
[\\/]* | ?:[\\/]* ) # Absolute name.
ac_srcdir=$srcdir$ac_dir_suffix;
ac_top_srcdir=$srcdir
ac_abs_top_srcdir=$srcdir ;;
*) # Relative name.
ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_build_prefix$srcdir
ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
case $ac_mode in
:H)
#
# CONFIG_HEADER
#
if test x"$ac_file" != x-; then
{
printf "%s\n" "/* $configure_input */" >&1 \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
} >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
printf "%s\n" "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
printf "%s\n" "/* $configure_input */" >&1 \
&& eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
esac
done # for ac_tag
as_fn_exit 0

3659
C&C++/autoconfig/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.71])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([main.cpp])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT

View File

@ -0,0 +1,7 @@
#include <stdio.h>
signed main(){
puts("hw");
return 0;
}

11
C&C++/c.php Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
signed main(){
int a = 10;
/*
<?php
echo "\thorror\n";
?>
*/
return a;
}

View File

@ -0,0 +1,10 @@
//gcc c_old_argument_notation.c -o c_old_argument_notation.out -O0 -ggdb
void f(c)
char *c;
{
void* b = (void*)c;
}
signed main(){
f("aaa");
}

126
C&C++/cnn.c Normal file
View File

@ -0,0 +1,126 @@
/* @BAKE gcc $@ -o n.out -lm && ./n.out
*/
/*
# CNN
> Simple Neural Network from scratch in C, emulating logic gates.
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
typedef struct {
double input[3];
double output;
} sample_t;
sample_t OR[] = {
{{0.0, 0.0, 1.0}, 0.0},
{{1.0, 0.0, 1.0}, 1.0},
{{0.0, 1.0, 1.0}, 1.0},
{{1.0, 1.0, 1.0}, 1.0},
};
sample_t AND[] = {
{{0.0, 0.0, 1.0}, 0.0},
{{1.0, 0.0, 1.0}, 0.0},
{{0.0, 1.0, 1.0}, 0.0},
{{1.0, 1.0, 1.0}, 1.0},
};
sample_t XOR[] = {
{{0.0, 0.0, 1.0}, 0.0},
{{1.0, 0.0, 1.0}, 1.0},
{{0.0, 1.0, 1.0}, 1.0},
{{1.0, 1.0, 1.0}, 0.0},
};
typedef struct {
size_t n_layers;
double * layer_width;
double * * weights;
} network_t;
double activation(double x) {
return 1.0/(1.0 + exp(-x));
}
double deactivation(double y) {
return y * (1.0 - y);
}
void new_network(network_t * n) {
n->n_layers = 5;
n->layer_width = (double*)malloc(n->n_layers*sizeof(double));
n->layer_width[0] = 3;
n->layer_width[1] = 3;
n->layer_width[2] = 3;
n->layer_width[3] = 3;
n->layer_width[4] = 1;
n->weights = (double**)malloc((n->n_layers-1)*sizeof(double));
for (int i = 0; i < n->n_layers-1; i++) {
size_t synapse_count = n->layer_width[i] * n->layer_width[i+1];
n->weights[i] = (double*)malloc(synapse_count*sizeof(double));
for (int h = 0; h < synapse_count; h++) {
n->weights[i][h] = (double)rand() / (double)RAND_MAX;
}
}
}
double oracle(network_t * n, double * input) {
double r;
int sum = 0;
for (int i = 0; i < n->n_layers-1; i++) {
size_t synapse_count = n->layer_width[i] * n->layer_width[i+1];
for (int h = 0; h < synapse_count; h++) {
sum += (input[h] * n->weights[i][h]);
}
}
r = activation(sum);
//printf("The network oracles %d!\n", (int)round(r));
return r;
}
double adjust(network_t * n, double response, sample_t s) {
double error = s.output - response;
double delta = error * deactivation(response);
for (int i = 0; i < n->n_layers-1; i++) {
size_t synapse_count = n->layer_width[i] * n->layer_width[i+1];
for (int h = 0; h < synapse_count; h++) {
n->weights[i][h] += 0.8 * delta * s.input[h];
}
}
return error;
}
void train(network_t * n, sample_t * s, size_t c) {
for (int i = 0; i < c; i++) {
double sumerr = 0;
for (int h = 0; h < 4; h++) {
double network_response = oracle(n, s[h].input);
double error = adjust(n, network_response, s[h]);
sumerr += pow(error, 2);
}
printf("%d: %lf\n", i, sumerr);
}
}
void print_sample(sample_t * s) {
printf("{%d, %d, %d} -> %d\n",
(int)s->input[0], (int)s->input[1], (int)s->input[2], (int)s->output
);
}
void test(network_t * n, sample_t * s) {
for (int i = 0; i < 4; i++) {
fputs("\033[1mfor: ", stdout);
print_sample(s + i);
printf("\033[0;33mThe Network oracles: %d\033[0m\n", (int)round(oracle(n, s[i].input)));
}
}
signed main() {
network_t n;
new_network(&n);
train(&n, AND, 100);
test(&n, AND);
}

3
C&C++/comp.c Normal file
View File

@ -0,0 +1,3 @@
range_t * {
i = "asd",
};

View File

@ -0,0 +1 @@
main(){ const int i = (1 ? 3 : 6); }

8
C&C++/const.c Normal file
View File

@ -0,0 +1,8 @@
// @COMPILECMD gcc $@ -o $*.out
signed main(){
char a = 'a';
char b = 'b';
const char * const p = &a;
//*p = 'c';
//p = &b;
}

18
C&C++/cpp_regex_error.cpp Normal file
View File

@ -0,0 +1,18 @@
// @COMPILECMD g++ $@ -o regex_error -std=c++20
#include <iostream>
#include <regex>
int main() {
std::string input = "Hello world, this is a sample text with hello world.";
std::regex pattern("+hello\\s+world", std::regex_constants::icase); // Case-insensitive regex pattern
std::smatch matches;
if (std::regex_search(input, matches, pattern)) {
std::cout << "Found 'hello world' at position " << matches.position() << std::endl;
} else {
std::cout << "Pattern not found." << std::endl;
}
return 0;
}

20
C&C++/current_year.cpp Normal file
View File

@ -0,0 +1,20 @@
// @COMPILECMD g++ $@
#include <iostream>
#include <chrono>
#include <ctime>
int main() {
// Get the current system time
std::time_t currentTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
// Convert the time to a local time
std::tm* localTime = std::localtime(&currentTime);
// Extract the year from the local time
int currentYear = localTime->tm_year + 1900;
// Display the current year
std::cout << "Current year: " << currentYear << std::endl;
return 0;
}

44
C&C++/dda2.cpp Normal file
View File

@ -0,0 +1,44 @@
// @COMPILECMD g++ $@ -o $*.out -ggdb $(pkg-config --cflags --libs ncurses)
#include <sys/param.h> // MAX()
#include <math.h>
#include <ncurses.h>
typedef struct {
int y;
int x;
} spatial;
void dda(const char c, const spatial from, const spatial to) {
const int steps = MAX(abs(to.y - from.y), abs(to.x - from.x));
struct {
double y;
double x;
} d = {
.y = (double)from.y,
.x = (double)from.x,
};
for (int i = 0; i < steps+1; i++) {
mvaddch(round(d.y), round(d.x), c);
d.y += (double)(to.y - from.y) / (double)steps;
d.x += (double)(to.x - from.x) / (double)steps;
}
return;
}
signed main() {
initscr();
noecho();
curs_set(0);
spatial from = {6, 20};
spatial to = {3, 0};
dda('-', from, to);
refresh();
while(1){}
endwin();
return 0;
}

BIN
C&C++/dog.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
C&C++/dog2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

8
C&C++/else_while.c Normal file
View File

@ -0,0 +1,8 @@
main(){
int i = 0;
if(i) {
puts("hurr");
} else while(1) {
puts("durr");
}
}

24
C&C++/flex/aaaaaaaa.y Normal file
View File

@ -0,0 +1,24 @@
/* @BAKE
bison --header=a.tab.h -o a.tab.c $@
g++ a.tab.c -o a
./a
@STOP
*/
%code requires {
#include <iostream>
void yyerror(...) { ; }
}
%union {
std::string * strval;
}
%{
int yylex() {
yylval.strval = new std::string("There are only two hard problems in CS: cache invalidation, nameing things, and off-by-one errors.");
return STRING;
}
%}
%token STRING
%%
string: STRING { std::cout << *(yylval.strval) << std::endl; }
%%
signed main() { yyparse(); }

View File

@ -0,0 +1,10 @@
@BAKE
flex -o pattern.yy.c pattern.l
flex -o state.yy.c state.l
gcc -o pattern.out pattern.yy.c -lfl -g
gcc -o state.out state.yy.c -lfl -g
python -c '''print("/*", "".join([ "a" for i in range(0,1000000)]), "*/")''' | valgrind --tool=massif --massif-out-file=massif.out.pattern ./pattern.out
python -c '''print("/*", "".join([ "a" for i in range(0,1000000)]), "*/")''' | valgrind --tool=massif --massif-out-file=massif.out.state ./state.out
ms_print massif.out.pattern
ms_print massif.out.state
@STOP

View File

@ -0,0 +1,135 @@
desc: --massif-out-file=massif.out.pattern
cmd: ./pattern.out
time_unit: i
#-----------
snapshot=0
#-----------
time=0
mem_heap_B=0
mem_heap_extra_B=0
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=1
#-----------
time=178535
mem_heap_B=8
mem_heap_extra_B=16
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=2
#-----------
time=178627
mem_heap_B=72
mem_heap_extra_B=24
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=3
#-----------
time=178684
mem_heap_B=16458
mem_heap_extra_B=46
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=4
#-----------
time=179417
mem_heap_B=20554
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=5
#-----------
time=2450242
mem_heap_B=36938
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=6
#-----------
time=7769087
mem_heap_B=69706
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=7
#-----------
time=27548940
mem_heap_B=135242
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=8
#-----------
time=103677625
mem_heap_B=266314
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=9
#-----------
time=402211238
mem_heap_B=528458
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=detailed
n2: 528458 (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
n1: 524290 0x10B046: yyrealloc (pattern.yy.c:1745)
n1: 524290 0x109AAE: yy_get_next_buffer (pattern.yy.c:960)
n1: 524290 0x10977F: yylex (pattern.yy.c:822)
n0: 524290 0x109234: main (in /home/anon/Swap/tests/flex_patter_vs_state/pattern.out)
n0: 4168 in 2 places, all below massif's threshold (1.00%)
#-----------
snapshot=10
#-----------
time=1584383763
mem_heap_B=1052746
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=11
#-----------
time=5796516138
mem_heap_B=1053770
mem_heap_extra_B=62
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=12
#-----------
time=5796520196
mem_heap_B=1053770
mem_heap_extra_B=62
mem_stacks_B=0
heap_tree=peak
n2: 1053770 (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
n1: 1048578 0x10B046: yyrealloc (pattern.yy.c:1745)
n1: 1048578 0x109AAE: yy_get_next_buffer (pattern.yy.c:960)
n1: 1048578 0x10977F: yylex (pattern.yy.c:822)
n0: 1048578 0x109234: main (in /home/anon/Swap/tests/flex_patter_vs_state/pattern.out)
n0: 5192 in 2 places, all below massif's threshold (1.00%)
#-----------
snapshot=13
#-----------
time=5796520196
mem_heap_B=1049674
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=14
#-----------
time=5796520230
mem_heap_B=1048650
mem_heap_extra_B=46
mem_stacks_B=0
heap_tree=empty

View File

@ -0,0 +1,95 @@
desc: --massif-out-file=massif.out.state
cmd: ./state.out
time_unit: i
#-----------
snapshot=0
#-----------
time=0
mem_heap_B=0
mem_heap_extra_B=0
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=1
#-----------
time=178536
mem_heap_B=8
mem_heap_extra_B=16
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=2
#-----------
time=178628
mem_heap_B=72
mem_heap_extra_B=24
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=3
#-----------
time=178685
mem_heap_B=16458
mem_heap_extra_B=46
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=4
#-----------
time=179418
mem_heap_B=20554
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=5
#-----------
time=94248676
mem_heap_B=21578
mem_heap_extra_B=62
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=6
#-----------
time=94252737
mem_heap_B=21578
mem_heap_extra_B=62
mem_stacks_B=0
heap_tree=peak
n2: 21578 (heap allocation functions) malloc/new/new[], --alloc-fns, etc.
n2: 16458 0x10B03B: yyalloc (state.yy.c:1747)
n1: 16386 0x10A699: yy_create_buffer (state.yy.c:1294)
n1: 16386 0x1093ED: yylex (state.yy.c:676)
n0: 16386 0x109234: main (in /home/anon/Swap/tests/flex_patter_vs_state/state.out)
n0: 72 in 2 places, all below massif's threshold (1.00%)
n1: 5120 0x48DB95C: _IO_file_doallocate (filedoalloc.c:101)
n1: 5120 0x48EA958: _IO_doallocbuf (genops.c:347)
n2: 5120 0x48EA958: _IO_doallocbuf (genops.c:342)
n1: 4096 0x48E98BB: _IO_file_xsgetn (fileops.c:1288)
n1: 4096 0x48DCA4E: fread (iofread.c:38)
n1: 4096 0x109CDB: yy_get_next_buffer (state.yy.c:997)
n1: 4096 0x10979D: yylex (state.yy.c:837)
n0: 4096 0x109234: main (in /home/anon/Swap/tests/flex_patter_vs_state/state.out)
n1: 1024 0x48E8A77: _IO_file_overflow@@GLIBC_2.2.5 (fileops.c:745)
n1: 1024 0x48E95C6: _IO_new_file_xsputn (fileops.c:1244)
n1: 1024 0x48E95C6: _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1197)
n1: 1024 0x48DCF71: fwrite (iofwrite.c:39)
n1: 1024 0x10963E: yylex (state.l:9)
n0: 1024 0x109234: main (in /home/anon/Swap/tests/flex_patter_vs_state/state.out)
#-----------
snapshot=7
#-----------
time=94252737
mem_heap_B=17482
mem_heap_extra_B=54
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=8
#-----------
time=94252771
mem_heap_B=16458
mem_heap_extra_B=46
mem_stacks_B=0
heap_tree=empty

View File

@ -0,0 +1,4 @@
%option noyywrap
%%
<INITIAL>\/\*([^*]|\*+[^/*])*\*+\/ { ; }
%%

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
%option noyywrap
%x COMMENT
%%
<INITIAL>\/\* { BEGIN COMMENT; }
<COMMENT>{
. { ; }
\*\/ { BEGIN INITIAL; }
}
%%

File diff suppressed because it is too large Load Diff

11
C&C++/flex/hack.l Normal file
View File

@ -0,0 +1,11 @@
/* @BAKE
flex -o edge.yy.c $@
gcc edge.yy.c -o edge.out -lfl
./edge.out
@STOP
*/
%x HILL
%%
{ puts("Let me help you, Sisyphus!"); goto top; }
<HILL>. { top: puts("There you go!"); exit(0); }
%%

15
C&C++/flex/hw.l Normal file
View File

@ -0,0 +1,15 @@
%{
#include <stdio.h>
%}
%%
hello printf("World!\n");
%{
int i;
%}
%%
int main() {
yylex();
return 0;
}

3
C&C++/flex/sections.l Normal file
View File

@ -0,0 +1,3 @@
%%
<.>
%%

3
C&C++/for_ctags.cpp Normal file
View File

@ -0,0 +1,3 @@
f(int i) { ; }
f(char * s) { ; }

5
C&C++/free_null.c Normal file
View File

@ -0,0 +1,5 @@
#include <stdlib.h>
signed main(){
//free(NULL);
free(1);
}

6
C&C++/gcc_include_next.c Normal file
View File

@ -0,0 +1,6 @@
#include_next "stdio.h"
signed main() {
puts("seriously?");
return 0;
}

7
C&C++/gdb_graph.c Normal file
View File

@ -0,0 +1,7 @@
// @COMPILECMD gcc $@ -o graph.out -ggdb -O0 -fno-unroll-loops
#include "header.h"
signed main(){
int r = fun();
return r;
}

16
C&C++/getopt_test.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
int opt;
while ((opt = getopt(argc, argv, ";-a:")) != -1) {
switch (opt) {
default:
printf("%c", opt);
break;
}
}
return 0;
}

16
C&C++/gnu_decimals.c Normal file
View File

@ -0,0 +1,16 @@
// @COMPILECMD gcc $@ -o $*.out
#define _OPEN_SYS_ITOA_EXT
#include <stdio.h>
#include <stdlib.h>
signed main() {
_Decimal32 d = 1;
for (int i = 0; i < sizeof(_Decimal32); i++) {
char c = *( ((char *)(&d)) + i );
for(int h = 0; h < 8; h++){
fputs(((c & 0b10000000) ? "1" : "0"), stdout);
c <<= 1;
}
fputs(".", stdout);
}
puts("");
}

23
C&C++/gnu_history.c Normal file
View File

@ -0,0 +1,23 @@
// @COMPILECMD gcc $@ -lreadline -lhistory
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
int main() {
using_history(); // Initialize history
char *input;
while ((input = readline("Enter your command: ")) != NULL) {
if (input[0] != '\0') {
add_history(input); // Add to history
// Process and handle input here
printf("You entered: %s\n", input);
}
free(input); // Free allocated memory
}
// Save history to a file (optional)
write_history("history.txt");
return 0;
}

21
C&C++/gnu_regex.c Normal file
View File

@ -0,0 +1,21 @@
#include <stdio.h>
#include <regex.h>
int main() {
regex_t regex;
regcomp(&regex, "pattern", 0);
char test_str[] = "This is a pattern example.";
regmatch_t pmatch[1];
if (regexec(&regex, test_str, 1, pmatch, 0) == 0) {
printf("Pattern found at position %d.\n", pmatch[0].rm_so);
} else {
printf("Pattern not found.\n");
}
regfree(&regex);
return 0;
}

23
C&C++/gnu_regex2.c Normal file
View File

@ -0,0 +1,23 @@
#include <stdio.h>
#include <regex.h>
int main() {
regex_t regex;
regcomp(&regex, "(pattern) (example)", REG_EXTENDED);
char test_str[] = "This is a pattern example.";
regmatch_t pmatch[3]; // One for the whole match, and one for each group
if (regexec(&regex, test_str, 3, pmatch, 0) == 0) {
printf("Whole match: %.*s\n", pmatch[0].rm_eo - pmatch[0].rm_so, test_str + pmatch[0].rm_so);
printf("Group 1: %.*s\n", pmatch[1].rm_eo - pmatch[1].rm_so, test_str + pmatch[1].rm_so);
printf("Group 2: %.*s\n", pmatch[2].rm_eo - pmatch[2].rm_so, test_str + pmatch[2].rm_so);
} else {
printf("Pattern not found.\n");
}
regfree(&regex);
return 0;
}

10
C&C++/header.h Normal file
View File

@ -0,0 +1,10 @@
#define FUNSIZE 32
int fun(){
int a[FUNSIZE];
int r = 0;
for(int i = 0; i < FUNSIZE;){
r += a[i];
i++;
}
return r;
}

View File

@ -0,0 +1,3 @@
void main(){
int a[] = { [3] 1, [10] 5 };
}

1
C&C++/knr.c Normal file
View File

@ -0,0 +1 @@
main(i) int i; {}

View File

@ -0,0 +1,74 @@
// @BAKE g++ $@
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
// https://github.com/Meteorix/pylcs
vector<string> utf8_split(const string &str){
vector<string> split;
int len = str.length();
int left = 0;
int right = 1;
for (int i = 0; i < len; i++){
if (right >= len || ((str[right] & 0xc0) != 0x80)){
string s = str.substr(left, right - left);
split.push_back(s);
// printf("%s %d %d\n", s.c_str(), left, right);
left = right;
}
right ++;
}
return split;
}
// https://github.com/schiffma/distlib
int mini(int a, int b, int c){
return(min(a, min(b,c)));
}
int levenshtein_dist(const string &word1, const string &word2){
///
/// Please use lower-case strings
/// word1 : first word
/// word2 : second word
///
//int size1 = word1.size(), size2 = word2.size();
vector<string> word1_ = utf8_split(word1);
vector<string> word2_ = utf8_split(word2);
int size1 = word1_.size();
int size2 = word2_.size();
int suppr_dist, insert_dist, subs_dist;
int* dist = new int[(size1+1)*(size2+1)];
for(int i=0; i<size1+1; ++i)
dist[(size2+1)*i] = i;
for(int j=0; j<size2+1; ++j)
dist[j] = j;
for(int i=1; i<size1+1; ++i){
for(int j=1; j<size2+1; ++j){
suppr_dist = dist[(size2+1)*(i-1)+j] + 1;
insert_dist = dist[(size2+1)*i+j-1] + 1;
subs_dist = dist[(size2+1)*(i-1)+j-1];
if(word1_[i-1]!=word2_[j-1]){ // word indexes are implemented differently.
subs_dist += 1;
}
dist[(size2+1)*i+j] = mini(suppr_dist, insert_dist, subs_dist);
}
}
// --------------------------------------------------------
int res = dist[(size1+1)*(size2+1) - 1];
delete dist;
return(res);
}
signed main() {
return levenshtein_dist("ginger", "pilger");
}

1
C&C++/linking/h.c Normal file
View File

@ -0,0 +1 @@
int h = 10;

1
C&C++/linking/i.c Normal file
View File

@ -0,0 +1 @@
int i = 10;

7
C&C++/linking/main.c Normal file
View File

@ -0,0 +1,7 @@
// @COMPILECMD gcc -shared i.c -o i.so; gcc -shared h.c -o h.so; gcc $@ i.so h.so
extern int i;
extern int h;
signed main(){
return h;
}

View File

@ -0,0 +1,17 @@
// @BAKE g++ $@ -o $*; ./$*
#include <map>
#include <stdio.h>
using namespace std;
signed main() {
//std::map<char, std::map<char, int>> charMapOfMaps = {
// {'a', {{'x', 1}, {'y', 2}, {'z', 3}}},
// {'b', {{'x', 4}, {'y', 5}, {'z', 6}}},
// {'c', {{'x', 7}, {'y', 8}, {'z', 9}}}
//};
map<char, map<char, int>> m = {
{ 'o', { {'k', 1}, {'o', 3} }},
{ 'p', {{'l', 2} }},
};
}

41
C&C++/ncurses_labels.c Normal file
View File

@ -0,0 +1,41 @@
// @BAKE gcc $@ -o $*.out $(pkg-config --cflags --libs ncurses)
#include <ncurses.h>
char * own_source(void) {
FILE* f = fopen("ncurses_labels.c", "r");
fseek(f, 0, SEEK_END);
int flen = ftell(f);
rewind(f);
char * buffer = calloc(flen+1, sizeof(char));
fread(buffer, flen, sizeof(char), f);
fclose(f);
return buffer;
}
signed main() {
slk_init(3);
initscr();
noecho();
cbreak();
WINDOW * win = newwin(0, 0, 0, 0);
nodelay(win, TRUE);
keypad(win, TRUE);
refresh();
slk_set(1, "exit", 0);
slk_refresh();
waddstr(win, own_source());
wrefresh(win);
int do_run = TRUE;
while (do_run) {
if (wgetch(win) == KEY_F(1)) {
do_run = FALSE;
}
}
endwin();
return 0;
}

68
C&C++/ncurses_mv_win.cpp Normal file
View File

@ -0,0 +1,68 @@
// @COMPILECMD g++ ncurses_mv_win.cpp $(pkg-config --libs ncurses)
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <ncurses.h>
int scr_h, scr_w;
WINDOW* myWindow;
WINDOW* mysubWindow;
signed main(){
int r = 0;
initscr();
noecho();
curs_set(0);
getmaxyx(stdscr, scr_h, scr_w);
const int myWinWidth = 100;
myWindow = newwin(0, myWinWidth,
0, 0);
if(!myWindow){
r = 1;
goto exit;
}
box(myWindow, 0, 0);
refresh();
mysubWindow = subwin(myWindow, 0, scr_w, 0, 0);
if(!mysubWindow){
r = 1;
goto exit;
}
touchwin(myWindow);
refresh();
wrefresh(myWindow);
wrefresh(mysubWindow);
refresh();
while(1){
int y, x;
getyx(mysubWindow, y, x);
char* s;
asprintf(&s, "%dx%d", y, x);
mvwaddstr(mysubWindow, 1, 1, s);
free(s);
wrefresh(mysubWindow);
switch(getch()){
case 'h':
//if(x > 0){
mvderwin(mysubWindow, 0, 8);
//}
break;
case 'l':
//if(x < myWinWidth){
mvderwin(mysubWindow, 0, 8);
//}
break;
}
}
exit:
endwin();
return r;
}

View File

@ -0,0 +1,70 @@
// @COMPILECMD g++ $@ $(pkg-config --libs ncurses readline)
#include <ncurses.h>
#include <readline/readline.h>
#define WINDOW_WIDTH 32
#define WINDOW_HEIGHT 3
int scr_h, scr_w;
WINDOW* myWindow;
int input_available = false; // C style bool to track when to stop reading
char input; // our input; since we read char-by-char this is all the buffering we need
inline void init(){
// Ncurses (nothing special)
initscr();
noecho();
curs_set(0);
getmaxyx(stdscr, scr_h, scr_w);
myWindow = newwin(WINDOW_HEIGHT, WINDOW_WIDTH,
( scr_h / 2 ) - 1, ( scr_w - WINDOW_WIDTH) / 2);
refresh();
box(myWindow, 0, 0);
// Readline
// make readline shut up
rl_bind_key('\t', rl_insert); // make tab insert itself
rl_catch_signals = 0; // do not install signal handlers
rl_catch_sigwinch = 0; // do not care about window change signals
rl_prep_term_function = NULL; // do not initialize the ternimal
rl_deprep_term_function = NULL; // do not clean up
rl_change_environment = 0; // ?!
// bind callbacks, for seemless integration
rl_getc_function = +[](FILE* ignore){ // define how Readline is handed chars
input_available = false; // since we read 1 char at the time we know that there will be no more available
return (int)input;
};
rl_input_available_hook = +[]{ // let Readline know that it shall call it rl_getc_function
return input_available;
};
rl_redisplay_function = +[]{ // instruct Readline what to do after rl_line_buffer has changed
// echo rl_line_buffer (without using the terminals built in echo)
wmove(myWindow, 1, 1);
wclrtoeol(myWindow);
box(myWindow, 0, 0); // wclrtoeol(), screws with the box
waddstr(myWindow, rl_line_buffer);
wrefresh(myWindow);
return;
};
rl_callback_handler_install("", +[](char *line){ // instruct Readline what to do once rl_line_buffer is submitted (enter hit)
// print the submitted line to the top of the screen
wmove(stdscr, 0, 0);
wclrtoeol(stdscr);
waddstr(stdscr, line);
wrefresh(stdscr);
return;
});
}
signed main(){
init();
wrefresh(myWindow);
while(1){
input = wgetch(myWindow);
input_available = true;
rl_callback_read_char();
}
}

44
C&C++/ncurses_resize2.cpp Normal file
View File

@ -0,0 +1,44 @@
// @COMPILECMD g++ $@ -o ncurses_resize_pufka_example.out $(pkg-config --libs ncurses)
#include <signal.h>
#include <ncurses.h>
int scr_h, scr_w;
WINDOW* myWindow = NULL;
char greeting[] = "Hello Ncurses!";
void display(){
if(myWindow){
delwin(myWindow);
endwin();
erase();
refresh();
clear();
}
getmaxyx(stdscr, scr_h, scr_w);
myWindow = newwin(3, ( sizeof(greeting)-1 ) + 4,
( scr_h / 2 ) - 1, (scr_w - ( sizeof(greeting)-1) ) / 2);
refresh();
box(myWindow, 0, 0);
mvwaddstr(myWindow, 1, 2, greeting);
wrefresh(myWindow);
}
signed main(){
initscr();
noecho();
curs_set(0);
display();
while(1){
if(wgetch(stdscr) == KEY_RESIZE){
display();
flushinp();
}
}
endwin();
return 0;
}

View File

@ -0,0 +1,38 @@
// @COMPILECMD g++ $@ $(pkg-config --libs ncurses)
#include <signal.h>
#include <ncurses.h>
int scr_h, scr_w;
WINDOW* myWindow;
char greeting[] = "Hello Ncurses!";
void display(int sig = 0){
if(sig != 0){
delwin(myWindow);
endwin();
refresh();
clear();
}
getmaxyx(curscr, scr_h, scr_w);
myWindow = newwin(3, ( sizeof(greeting)-1 ) + 4,
( scr_h / 2 ) - 1, (scr_w - ( sizeof(greeting)-1) ) / 2);
refresh();
box(myWindow, 0, 0);
mvwaddstr(myWindow, 1, 2, greeting);
wrefresh(myWindow);
}
signed main(){
initscr();
noecho();
curs_set(0);
signal(SIGWINCH, display);
display();
while(1){}
endwin();
return 0;
}

114
C&C++/ncurses_resize_test.c Normal file
View File

@ -0,0 +1,114 @@
#include <signal.h>
#include <ncurses.h>
void handle_winch(int sig)
{
endwin();
refresh();
clear();
}
int main() {
initscr();
cbreak();
noecho();
curs_set(0);
signal(SIGWINCH, handle_winch);
while(true){
mvprintw(LINES-2, 0, "Hello, world! %d:%d\n", LINES, COLS);
refresh();
}
endwin();
return 0;
}
//#include <signal.h>
//#include <ncurses.h>
//
//void sigwinch_handler(int sig) {
// // Tell ncurses to update its internal screen size data
// endwin();
// refresh();
//}
//
//int main() {
// // Initialize ncurses
// initscr();
// cbreak();
// noecho();
// curs_set(0);
//
// // Register the SIGWINCH signal handler
// signal(SIGWINCH, sigwinch_handler);
//
// // Set the initial screen color and print a message
// start_color();
// init_pair(1, COLOR_BLUE, COLOR_TRANSPARENT);
// bkgd(COLOR_PAIR(1));
// printw("Hello, world!\n");
//
// // Wait for user input
// refresh();
// getch();
//
// // Resize the screen
// endwin();
// refresh();
// int new_rows, new_cols;
// getmaxyx(stdscr, new_rows, new_cols);
// resizeterm(new_rows, new_cols);
//
// // Update the screen color and print another message
// init_pair(2, COLOR_RED, COLOR_TRANSPARENT);
// bkgd(COLOR_PAIR(2));
// printw("Goodbye!\n");
//
// // Wait for user input
// refresh();
// getch();
//
// // Clean up and exit
// endwin();
// return 0;
//}
//#include <signal.h>
//#include <ncurses.h>
//
//void sigwinch_handler(int sig) {
// // Resize the terminal to the new size
// endwin();
// refresh();
// resize_term(LINES, COLS);
//}
//
//int main() {
// // Initialize ncurses
// initscr();
// cbreak();
// noecho();
//
// // Register the SIGWINCH signal handler
// signal(SIGWINCH, sigwinch_handler);
//
// // Print the initial size of the screen
// printw("Initial screen size: %d rows, %d columns\n", LINES, COLS);
//
// // Wait for user input
// refresh();
// getch();
//
// // Resize the screen
// resize_term(40, 80);
//
// // Print the new size of the screen
// printw("New screen size: %d rows, %d columns\n", LINES, COLS);
//
// // Wait for user input
// refresh();
// getch();
//
// // Clean up and exit
// endwin();
// return 0;
//}

34
C&C++/ncurses_scroll.c Normal file
View File

@ -0,0 +1,34 @@
// @COMPILECMD gcc $@ -o $*.out $(pkg-config --cflags --libs ncurses)
#include <ncurses.h>
void main(){
initscr();
noecho();
cbreak();
scrollok(stdscr, TRUE);
char buf[12];
for(int i = 0; i < 1000; i++){
sprintf(buf, "%d", i);
for(int h = 0; h < 4; h++){
addstr(buf);
addch(' ');
}
addch('\n');
}
refresh();
while(true){
int i = getch();
switch(i){
case 'j': {
scrl(1);
} break;
case 'k': {
scrl(-1);
} break;
}
refresh();
}
}

28
C&C++/nf.c Normal file
View File

@ -0,0 +1,28 @@
#include <ncurses.h>
#include <pthread.h>
#include <unistd.h>
void* fool(void* args){
sleep(2);
ungetch('x');
ungetch('c');
printw(" OK");
refresh();
}
int main() {
initscr();
cbreak(); // Set cbreak mode on
printw("Press any key to continue...");
refresh();
pthread_t th;
pthread_create(&th, NULL, fool, NULL);
getch();
pthread_join(th, NULL);
endwin();
return 0;
}

9
C&C++/null_printf.c Normal file
View File

@ -0,0 +1,9 @@
#include <stdio.h>
int main() {
const char* myString = NULL;
printf("%s\n", myString);
return 0;
}

9
C&C++/null_printf.cpp Normal file
View File

@ -0,0 +1,9 @@
#include <cstdio>
int main() {
const char* myString = NULL;
printf("%s\n", myString);
return 0;
}

View File

@ -0,0 +1,13 @@
#include "portable_namespace.h"
#ifdef __cplusplus
signed main() {
nm::fun();
return 0;
}
#else
signed main() {
NM_fun();
return 0;
}
#endif

View File

@ -0,0 +1,9 @@
#ifdef __cplusplus
namespace nm {
#else
# define fun NM_fun
#endif
void fun() { int a = 12; }
#ifdef __cplusplus
}
#endif

8
C&C++/pta.c Normal file
View File

@ -0,0 +1,8 @@
// @COMPILECMD gcc $@ -o $*.out
signed main(){
long a[] = {10, 11, 12};
long * b = a;
++b;
return *b;
}

20
C&C++/scoping_showcase.c Normal file
View File

@ -0,0 +1,20 @@
// @COMPILECMD gcc $@ -ggdb -O0
int * ii(){
int i = 4;
return &i;
}
int * hh(){
int h = 8;
const int * my_i = ii();
return my_i;
}
void beast(){
char b[] = "akjshaskldahdjsajssssssssssssssjjjjjjjjjjjjjaaaaaaaaaaaaaaaaassssssssssss";
}
signed main(){
const int * k = hh();
beast();
}

View File

@ -0,0 +1,24 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
signed main(){
/* struct winsize{
unsigned short int ws_row;
unsigned short int ws_col;
unsigned short int ws_xpixel;
unsigned short int ws_ypixel;
}; */
struct winsize ws;
int fd = open("/dev/tty", O_WRONLY);
ioctl(fd, TIOCGWINSZ, &ws);
close(fd);
printf("%dx%d", ws.ws_col, ws.ws_row);
return 0;
}

View File

@ -0,0 +1,56 @@
// @COMPILECMD g++ $@ $(pkg-config --libs SDL2_image SDL2_ttf) -ggdb
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <iostream>
// Window dimensions
const int WINDOW_WIDTH = 800;
const int WINDOW_HEIGHT = 600;
int main() {
SDL_Init(SDL_INIT_VIDEO);
IMG_Init(IMG_INIT_JPG);
SDL_Window* window = SDL_CreateWindow("Texture Example", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN);
SDL_Renderer* windowRenderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
SDL_Texture* texture1 = IMG_LoadTexture(windowRenderer, "dog.jpg");
SDL_Texture* texture2 = IMG_LoadTexture(windowRenderer, "dog2.jpg");
SDL_Texture* texture3 = SDL_CreateTexture(windowRenderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET,
WINDOW_WIDTH, WINDOW_HEIGHT);
SDL_SetRenderTarget(windowRenderer, texture3);
SDL_SetRenderDrawColor(windowRenderer, 0, 0, 0, 255);
SDL_RenderClear(windowRenderer);
//
SDL_Rect r = {0, 0, 300, 300};
SDL_RenderCopy(windowRenderer, texture1, nullptr, &r);
r.x = 300;
SDL_RenderCopy(windowRenderer, texture2, nullptr, &r);
SDL_SetRenderTarget(windowRenderer, nullptr);
SDL_SetRenderDrawColor(windowRenderer, 255, 255, 255, 255);
SDL_RenderClear(windowRenderer);
SDL_RenderCopy(windowRenderer, texture3, nullptr, nullptr);
SDL_RenderPresent(windowRenderer);
// Wait for user exit
bool quit = false;
SDL_Event event;
while (!quit) {
while (SDL_PollEvent(&event)) {
if (event.type == SDL_QUIT) {
quit = true;
}
}
}
IMG_Quit();
SDL_Quit();
return 0;
}

8
C&C++/sentinel_pack.c Normal file
View File

@ -0,0 +1,8 @@
struct MyTightlyPackedStruct {
const char i[] = "abcdefg";
char sentinel
} __attribute__((packed));
signed main(){
}

26
C&C++/setjmp_test.cpp Normal file
View File

@ -0,0 +1,26 @@
#include <stdio.h>
#include <setjmp.h>
void f(int* a, int* b){
*a += 3;
*b += 5;
}
signed main(){
int* heap_var = new int(1);
int stack_var = 2;
jmp_buf buf;
int j = setjmp(buf);
printf("heap: %d\nstack: %d\n---\n", *heap_var, stack_var);
if(j){
return 0;
}
f(heap_var, &stack_var);
longjmp(buf, 1);
}

6
C&C++/strdup.c Normal file
View File

@ -0,0 +1,6 @@
// @BAKE gcc $@ -Wall -Wextra -Wpedantic -o $*
#include <string.h>
main() {
char * i = strdup("test");
}

10
C&C++/tcc_int.c Normal file
View File

@ -0,0 +1,10 @@
#include <stdio.h>
signed main(){
puts("test");
fflush(stdout);
link_err();
return 0;
}

9
C&C++/test.c Normal file
View File

@ -0,0 +1,9 @@
main(){
int i = 10;
int h;
do{
h = i - 1;
}while(i = h);
void * v = malloc(100);
free(v);
}

5
C&C++/typedef.c Normal file
View File

@ -0,0 +1,5 @@
typedef int a[3][3];
signed main(){
a i;
}

7
C&C++/unctrl.c Normal file
View File

@ -0,0 +1,7 @@
// @COMPILECMD gcc $@ -o $* $(pkg-config --cflags --libs ncurses)
#include <stdio.h>
#include <ncurses.h>
void main() {
puts(unctrl("test"));
}

View File

@ -0,0 +1,6 @@
void fun(){}
signed main(){
fun_not_defined();
fun();
}

55
C&C++/usb.c Normal file
View File

@ -0,0 +1,55 @@
// @COMPILECMD gcc $@ -lusb-1.0
#include <stdio.h>
#include <libusb-1.0/libusb.h>
#define VENDOR_ID 0x0b95
#define PRODUCT_ID 0x1790
const int WRITE_CONSTS[] = {
0x0002,
0x0004
};
// <?!> 1 <?!> 00000000000000001 <?!>
const char* intToBinary64(int value) {
static char binary[67]; // Buffer to hold the binary representation (64 bits + '0b' prefix + null-terminator)
binary[0] = '0';
binary[1] = 'b';
for (int i = 63; i >= 0; i--) {
binary[2 + 63 - i] = ((value >> i) & 1) ? '1' : '0';
}
binary[66] = '\0';
return binary;
}
int main() {
libusb_device_handle* handle;
libusb_init(NULL);
handle = libusb_open_device_with_vid_pid(NULL, VENDOR_ID, PRODUCT_ID);
if (handle == NULL) {
fprintf(stderr, "Could not find/open the USB device.\n");
return 1;
}
unsigned char data[64]; // Replace with your data or remove this line for other operations
int result, i;
const int start = WRITE_CONSTS[(sizeof(WRITE_CONSTS)/sizeof(int))-1];
for(i = 0; i < 64; i++){
result = libusb_control_transfer(
handle,
LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_ENDPOINT_OUT,
0x0001 << i,
0, // wValue
0, // wIndex
data, // Data buffer containing dummy data
sizeof(data), // wLength
1000 // Timeout in milliseconds
);
if (result > 0) {
printf("%s, %d\n", intToBinary64(i), i);
}
}
libusb_close(handle);
libusb_exit(NULL);
return 0;
}

27
C&C++/vasprintf.c Normal file
View File

@ -0,0 +1,27 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
void test(const char *fmt, ...)
{
char* dyn_buf;
printf("Demo asprintf:\n");
const int written_1 = asprintf(&dyn_buf, "%s", fmt);
printf("dyn_buf: \"%s\"; %i chars were written\n", dyn_buf, written_1);
free(dyn_buf);
printf("Demo vasprintf:\n");
va_list args;
va_start(args, fmt);
const int written_2 = vasprintf(&dyn_buf, fmt, args);
va_end(args);
printf("dyn_buf: \"%s\"; %i chars were written\n", dyn_buf, written_2);
free(dyn_buf);
}
int main(void)
{
test("Testing... %d, %d, %d", 1, 2, 3);
}

3
C&C++/void_main.c Normal file
View File

@ -0,0 +1,3 @@
void main(){
}

50
C&C++/x.cpp Normal file
View File

@ -0,0 +1,50 @@
// @COMPILECMD g++ $@ -o test.out -lX11 -lXtst -ggdb
#include <X11/Xlib.h>
#include <X11/Xutil.h>
int main()
{
Display* display = XOpenDisplay(NULL);
XVisualInfo vinfo;
XMatchVisualInfo(display, DefaultScreen(display), 32, TrueColor, &vinfo);
XSetWindowAttributes attr;
attr.colormap = XCreateColormap(display, DefaultRootWindow(display), vinfo.visual, AllocNone);
attr.border_pixel = 0;
attr.background_pixel = 0;
Window win = XCreateWindow(display,
DefaultRootWindow(display),
0, 0,
300, 200,
0, vinfo.depth,
InputOutput, vinfo.visual,
CWColormap | CWBorderPixel | CWBackPixel, &attr
);
Atom wm_delete_window = XInternAtom(display, "WM_DELETE_WINDOW", 0);
XSetWMProtocols(display, win, &wm_delete_window, 1);
XMapWindow(display, win);
int keep_running = 1;
while (keep_running) {
XEvent event;
XNextEvent(display, &event);
switch(event.type) {
case ClientMessage: {
if (event.xclient.message_type == XInternAtom(display, "WM_PROTOCOLS", 1)
&& (Atom)event.xclient.data.l[0] == XInternAtom(display, "WM_DELETE_WINDOW", 1)) {
keep_running = 0;
}
} break;
}
}
XDestroyWindow(display, win);
XCloseDisplay(display);
return 0;
}

121
C&C++/xtermio.c Normal file
View File

@ -0,0 +1,121 @@
#include <stdio.h>
#include <termio.h>
#include <string.h>
#include <unistd.h>
/*
@COMPILECMD clang -g -ansi -Weverything -o gaem $@
valgrind --show-leak-kinds=all --leak-check=full ./gaem
*/
#define WIDTH (80)
#define HEIGHT (24)
enum {
EFFECT_NORMAL,
EFFECT_BOLD,
EFFECT_DARK,
EFFECT_ITALIC,
EFFECT_UNDERLINE,
EFFECT_BLINK,
EFFECT_UNDEFINED,
EFFECT_REVERSE
};
enum {
COLOUR_GREY,
COLOUR_RED,
COLOUR_GREEN,
COLOUR_YELLOW,
COLOUR_BLUE,
COLOUR_PINK,
COLOUR_CYAN,
COLOUR_WHITE
};
static char screen [12 * WIDTH * HEIGHT + (HEIGHT - 1) * 2 + 4] = "\033[H";
static int player [2] = { 0, 0 };
static struct termios old_terminal;
static struct termios new_terminal;
static void render_character (
char character,
int x,
int y,
int effect,
int colour
) {
char format [13] = "\033[ ;3 m \033[0m";
format [2] = (char) effect + '0';
format [5] = (char) colour + '0';
format [7] = character;
memcpy (& screen [12 * (WIDTH * y + x) + y * 2 + 3], & format [0], sizeof (format) - 1);
}
static void player_move (int direction, int step) {
player [(int) (direction != 0)] += step;
if (player [0] > WIDTH - 1) { player [0] = WIDTH - 1; }
if (player [0] < 0) { player [0] = 0; }
if (player [1] > HEIGHT - 1) { player [1] = HEIGHT - 1; }
if (player [1] < 0) { player [1] = 0; }
}
int main (
int argc,
char * * argv
) {
char signal = '\0';
int offset = 0;
(void) argc;
(void) argv;
tcgetattr (STDIN_FILENO, & old_terminal);
new_terminal = old_terminal;
new_terminal.c_cc [VMIN] = (unsigned char) 0;
new_terminal.c_cc [VTIME] = (unsigned char) 1;
new_terminal.c_iflag &= (unsigned int) ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
new_terminal.c_oflag &= (unsigned int) ~(OPOST);
new_terminal.c_cflag |= (unsigned int) (CS8);
new_terminal.c_lflag &= (unsigned int) ~(ECHO | ICANON | IEXTEN | ISIG);
tcsetattr (STDIN_FILENO, TCSAFLUSH, & new_terminal);
for (offset = 0; offset != HEIGHT - 1; ++offset) {
memcpy (& screen [12 * WIDTH * (offset + 1) + offset * 2 + 3], "\r\n", sizeof ("\r\n") - 1);
}
do {
signal = '\0';
for (offset = 0; offset != WIDTH * HEIGHT; ++offset) {
render_character ('.', offset % WIDTH, offset / WIDTH, EFFECT_BOLD, COLOUR_GREY);
}
render_character ('@', player [0], player [1], EFFECT_BOLD, COLOUR_RED);
(void) write (STDOUT_FILENO, screen, sizeof (screen));
(void) read (STDIN_FILENO, & signal, sizeof (signal));
if (signal == 'w') { player_move (1, -1); }
if (signal == 'a') { player_move (0, -1); }
if (signal == 's') { player_move (1, 1); }
if (signal == 'd') { player_move (0, 1); }
} while (signal != 'Q');
tcsetattr (STDIN_FILENO, TCSAFLUSH, & old_terminal);
(void) write (STDOUT_FILENO, "\033[2J\033[H", sizeof ("\033[2J\033[H"));
return (0);
}

63
C&C++/xtp.cpp Normal file
View File

@ -0,0 +1,63 @@
// @COMPILECMD g++ $@ -o $* -lX11 -lXtst -ggdb
#include <X11/Xlib.h>
#include <stdio.h>
int main() {
// Open the display
Display *display = XOpenDisplay(NULL);
if (!display) {
fprintf(stderr, "Unable to open display\n");
return 1;
}
// Get the root window
Window root = DefaultRootWindow(display);
// Create a window
Window window = XCreateSimpleWindow(
display, root, 100, 100, 400, 300, 2, BlackPixel(display, DefaultScreen(display)), WhitePixel(display, DefaultScreen(display))
);
// Set the window title
XStoreName(display, window, "Xlib Window Example");
// Select events to listen for
XSelectInput(display, window, ExposureMask | StructureNotifyMask);
// Map the window to the screen
XMapWindow(display, window);
XEvent event;
while (1) {
XNextEvent(display, &event);
switch (event.type) {
case Expose:
// Handle expose events
printf("Expose event received\n");
break;
case ConfigureNotify:
// Handle window resize or other configuration changes
printf("Window resized or reconfigured\n");
// Get the absolute window position
Window root_return, child_return;
int root_x, root_y, win_x, win_y;
unsigned int mask_return;
if (XTranslateCoordinates(display, window, root, 0, 0, &root_x, &root_y, &child_return)) {
printf("Window position: (%d, %d)\n", root_x, root_y);
} else {
fprintf(stderr, "Failed to translate coordinates\n");
}
break;
default:
break;
}
}
// Close the display
XCloseDisplay(display);
return 0;
}