A python script for compiling and executing .cc files

Overview

Debug And Run

A python script for compiling and executing .cc files

Example
dbrun <fname>.cc
[DEBUG MODE] Compiling <fname>.cc with C++17
--------------------

<sample program output>

The script can also be used by providing an input and output file for the program

Example
dbrun <fname>.cc / <sample input file>.txt / <sample output file>.txt
[DEBUG MODE] Compiling <fname>.cc with C++17
[INPUT FILE] Selected Input File is <sample input file>.txt
[OUTPUT FILE] Selected Output File is <sample output file>.txt
--------------------
[SUCCESS] Write lines to file C_output.txt successful

A output file is not always required as the script will print the program output if no output file is provided

For this version a input file is needed to make an output file

Define DBG_MODE

This script will also open the .cc file that you intend to run and will replace

//dbg

With

#define DBG_MODE

This is mostly used for competitive programming as you only want your debug functions to run

If you are testing the program localy this prevents the program validater from failing your program due to debug function calls that you forgot to remove

Example
#include <iostream>
using namespace std;

//dbg
void DBG_OUT() { cerr << endl; }
template<typename Front, typename... Back> void DBG_OUT(Front K, Back... T) { cerr << ' ' << K; DBG_OUT(T...); }
#ifdef DBG_MODE
#define testArgs(...) cerr << '(' << #__VA_ARGS__ << "):", DBG_OUT(__VA_ARGS__)
#else
#define testArgs(...)
#endif


int main() {
    int A, B;
    cin >> A >> B;

    testArgs(A - B, A * B);

    cout << A + B << '\n';
    cout << flush;
}
Input
5 2
Output

Without defining DBG_MODE

7

With defining DBG_MODE

(A - B, A * B): 3 10
7

If you want to look more at my debug template for competitive programming that can be found Here

At the moment this does mean that the script checks every line to see if it needs to define the dbg macro but a feature to disable this with sys.args is to be added in newer versions

You might also like...
Script to produce `.tex` files of example GAP sessions

Introduction The main file GapToTex.py in this directory is used to produce .tex files of example GAP sessions. Instructions Run python GapToTex.py [G

Uproot - A script to bring deeply nested files or directories to the surface
Uproot - A script to bring deeply nested files or directories to the surface

UPROOT Bring deeply nested files or folders to the surface Uproot helps convert

Python script to commit to your github for a perfect commit streak. This is purely for education purposes, please don't use this script to do bad stuff.

Daily-Git-Commit Commit to repo every day for the perfect commit streak Requirments pip install -r requirements.txt Setup Download this repository. Cr

A script where you execute a script that generates a base project for your gdextension

GDExtension Project Creator this is a script (currently only for linux) where you execute a script that generates a base project for your gdextension,

A simple script written using symbolic python that takes as input a desired metric and automatically calculates and outputs the Christoffel Pseudo-Tensor, Riemann Curvature Tensor, Ricci Tensor, Scalar Curvature and the Kretschmann Scalar

A simple script written using symbolic python that takes as input a desired metric and automatically calculates and outputs the Christoffel Pseudo-Tensor, Riemann Curvature Tensor, Ricci Tensor, Scalar Curvature and the Kretschmann Scalar

These are After Effects and Python files that were made in the process of creating the video for the contest.

spirograph These are After Effects and Python files that were made in the process of creating the video for the contest. In the python file you can qu

python scripts and other files to generate induction encoder PCBs in Kicad
python scripts and other files to generate induction encoder PCBs in Kicad

induction_encoder python scripts and other files to generate induction encoder PCBs in Kicad Targeting the Renesas IPS2200 encoder chips.

Python library for creating and parsing HSReplay XML files

python-hsreplay A python module for HSReplay support. https://hearthsim.info/hsreplay/ Installation The library is available on PyPI. pip install hsre

Python package for handling and analyzing PSRFITS files

PyPulse A pure-Python package for handling and analyzing PSRFITS files. Read the documentation here. This is an alternate code base from PSRCHIVE. Req

Comments
  • Define + license

    Define + license

    The functions to find the target line and edit it are not needed at all. Using the compile command 'g++ -g -std=c++17 -Wall -DDEBUG_MODE`

    Will have the same effect without the need for editing the file. Keep the error for no dbg functions but the source file does not need to be edited.

    Also added mit license.

    opened by BrandonPacewic 1
  • gcc error program still runs

    gcc error program still runs

    In the latest release there is a problem where even if a gcc compiler error is raised when attempting the compile the latest a.out file will still be run giving the impression that the program still run successfully when in reality it never successfully compiled in the first place.

    bug 
    opened by BrandonPacewic 0
Releases(v1.2)
Owner
null
Interpreting-compiling programming language.

HoneyASM The programming language written on Python, which can be as interpreted as compiled. HoneyASM is easy for use very optimized PL, which can so

TalismanChet 1 Dec 25, 2021
nbsafety adds a layer of protection to computational notebooks by solving the stale dependency problem when executing cells out-of-order

nbsafety adds a layer of protection to computational notebooks by solving the stale dependency problem when executing cells out-of-order

null 150 Jan 7, 2023
Blender addon for executing the operator in response to the received OSC message.

I/F Joiner 受信したOSCメッセージに応じてオペレータ(bpy.ops)を実行するアドオンです. OSC通信に対応したコントローラやアプリをインストールしたスマートフォンを使用してBlenderを操作することが可能になります. 同時開発しているAndroidコントローラ化アプリMocopa

simasimataiyo 6 Oct 2, 2022
Standalone PyQGIS application for executing custom scripts without a QGIS GUI.

PyQGIS Standalone Script Executer Standalone PyQGIS application that is able to run a custom script, in this case Proximity.py without the need of a G

null 6 Sep 23, 2022
Islam - This is a simple python script.In this script I have written all the suras of Al Quran. As a result, by using this script, you can know the number of any sura at the moment.

Introduction: If you want to know sura number of al quran by just typing the name of sura than you can use this script. Usage in termux: $ pkg install

Fazle Rabbi 1 Jan 2, 2022
List of short Codeforces problems with a statement of 1000 characters or less. Python script and data files included.

Shortest problems on Codeforces List of Codeforces problems with a short problem statement of 1000 characters or less. Sorted for each rating level. B

null 32 Dec 24, 2022
This Python script can enumerate all URLs present in robots.txt files, and test whether they can be accessed or not.

Robots.txt tester With this script, you can enumerate all URLs present in robots.txt files, and test whether you can access them or not. Setup Clone t

Podalirius 32 Oct 10, 2022
A python script to decrypt media files encrypted using the Android application 'Secret Calculator Photo Vault'. Supports brute force of PIN also.

A python script to decrypt media files encrypted using the Android application 'Secret Calculator Photo Vault'. Supports brute force of PIN also.

null 3 May 1, 2022
A script to download all the challenges and files from the CTFd instance.

Python CTFd Downloader A script to download all the challenges and files from the CTFd instance. Installation Clone this repo: git clone https://githu

Jacob Elliott 19 Dec 16, 2022
An OBS script to fuze files together

OBS TEXT FUZE Fuze text files and inject the output into a text source. The Index file directory should be a list of file directorys for the text file

SuperZooper3 1 Dec 27, 2021