Code Monkey home page Code Monkey logo

reports-parser's Introduction

Camera Reports Parser

Donate to this project to keep it alive.

Donate using Liberapay

Build Status

Public Roadmap https://trello.com/b/DEhIf5Hp/careports-roadmap

This project defines a simple markup language for camera assistants that can be parsed into a PDF report. This application defines the grammar and includes the code to generate the PDF report. An example of the markup language can be found in the sample.txt file in the repo.

Currently in active development, not all features are active.

Install Via homebrew

brew tap ditServices/homebrew-careports
brew install careports

Build instructions

Ensure that you have Haru PDF (https://github.com/libharu/libharu) installed to /usr/local/lib/

You will also need Flex and Bison 3.6.

If building on MacOS you will need to install Bison via homebrew. Once this is installed you will need to modify the Makefile with the path of your installation. This is because MacOS ships with a outdated version of Bison nativley.

For example:

ca_mu.tab.c: ca_mu.y
	bison -d ca_mu.y

Will become:

ca_mu.tab.c: ca_mu.y
	/path/to/bison -d ca_mu.y

Then run:

make

Documentation and additional information: https://digitalimagingtech.co.uk/posts/digital-camera-reports/

reports-parser's People

Contributors

ditservices avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar

reports-parser's Issues

Memory Error

memory error at some point whilst saving report. It appears that a value is being freed that has not been allocated.

Causes UB on MacOS

==11323== Invalid free() / delete / delete[] / realloc()
==11323==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11323==    by 0x116330: ca_free (ca_reports.c:448)
==11323==    by 0x1111F6: yyparse (ca_mu.y:46)
==11323==    by 0x11186C: main (ca_mu.y:92)
==11323==  Address 0x55ce6b0 is 0 bytes inside a block of size 96 free'd
==11323==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11323==    by 0x12C33A: InternalFreeMem (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x12C301: HPDF_FreeMem (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x1458E6: HPDF_Dict_Free (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x148A72: HPDF_Obj_ForceFree (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x140110: HPDF_Xref_Free (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x116C4D: HPDF_FreeDoc (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x116DF8: HPDF_FreeDocAll (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x11684D: HPDF_Free (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x116132: ca_save_report (ca_reports.c:427)
==11323==    by 0x1111E7: yyparse (ca_mu.y:45)
==11323==    by 0x11186C: main (ca_mu.y:92)
==11323==  Block was alloc'd at
==11323==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11323==    by 0x12C320: InternalGetMem (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x12C2A2: HPDF_GetMem (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x145647: HPDF_Dict_New (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x136071: HPDF_Page_New (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x117D6D: HPDF_AddPage (in /home/howard/Documents/Code/careports-0.1/careports)
==11323==    by 0x1143D4: new_report (ca_reports.c:114)
==11323==    by 0x111860: main (ca_mu.y:91)
==11323== 
==11323== 
==11323== HEAP SUMMARY:
==11323==     in use at exit: 16,466 bytes in 4 blocks
==11323==   total heap usage: 310 allocs, 307 frees, 77,035 bytes allocated
==11323== 
==11323== 8 bytes in 1 blocks are still reachable in loss record 1 of 4
==11323==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11323==    by 0x113BE8: yyalloc (lex.yy.c:2116)
==11323==    by 0x1136EB: yyensure_buffer_stack (lex.yy.c:1811)
==11323==    by 0x111CA7: yylex (lex.yy.c:844)
==11323==    by 0x110D46: yyparse (ca_mu.tab.c:1249)
==11323==    by 0x11186C: main (ca_mu.y:92)
==11323== 
==11323== 8 bytes in 1 blocks are definitely lost in loss record 2 of 4
==11323==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11323==    by 0x1143B1: new_report (ca_reports.c:113)
==11323==    by 0x111860: main (ca_mu.y:91)
==11323== 
==11323== 64 bytes in 1 blocks are still reachable in loss record 3 of 4
==11323==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11323==    by 0x113BE8: yyalloc (lex.yy.c:2116)
==11323==    by 0x113272: yy_create_buffer (lex.yy.c:1651)
==11323==    by 0x111CD1: yylex (lex.yy.c:846)
==11323==    by 0x110D46: yyparse (ca_mu.tab.c:1249)
==11323==    by 0x11186C: main (ca_mu.y:92)
==11323== 
==11323== 16,386 bytes in 1 blocks are still reachable in loss record 4 of 4
==11323==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11323==    by 0x113BE8: yyalloc (lex.yy.c:2116)
==11323==    by 0x1132A7: yy_create_buffer (lex.yy.c:1660)
==11323==    by 0x111CD1: yylex (lex.yy.c:846)
==11323==    by 0x110D46: yyparse (ca_mu.tab.c:1249)
==11323==    by 0x11186C: main (ca_mu.y:92)
==11323== 
==11323== LEAK SUMMARY:
==11323==    definitely lost: 8 bytes in 1 blocks
==11323==    indirectly lost: 0 bytes in 0 blocks
==11323==      possibly lost: 0 bytes in 0 blocks
==11323==    still reachable: 16,458 bytes in 3 blocks
==11323==         suppressed: 0 bytes in 0 blocks
==11323== 
==11323== For counts of detected and suppressed errors, rerun with: -v
==11323== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)


Fix memory leak when ending the program early

When calling "exit" whilst running in an interpretive mode, the program does not correctly free memory.

Output from Valgrind

==29133== Memcheck, a memory error detector
==29133== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29133== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==29133== Command: ./build/camu
==29133== 
exit
Exiting
==29133== 
==29133== HEAP SUMMARY:
==29133==     in use at exit: 44,211 bytes in 116 blocks
==29133==   total heap usage: 120 allocs, 4 frees, 46,347 bytes allocated
==29133== 
==29133== 27,753 (40 direct, 27,713 indirect) bytes in 1 blocks are definitely lost in loss record 116 of 116
==29133==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==29133==    by 0x12C330: InternalGetMem (in /home/howard/Documents/Code/reports-parser/build/camu)
==29133==    by 0x12BFFD: HPDF_MMgr_New (in /home/howard/Documents/Code/reports-parser/build/camu)
==29133==    by 0x116705: HPDF_NewEx (in /home/howard/Documents/Code/reports-parser/build/camu)
==29133==    by 0x1166AF: HPDF_New (in /home/howard/Documents/Code/reports-parser/build/camu)
==29133==    by 0x114369: new_report (ca_reports.c:122)
==29133==    by 0x111885: main (ca_mu.y:112)
==29133== 
==29133== LEAK SUMMARY:
==29133==    definitely lost: 40 bytes in 1 blocks
==29133==    indirectly lost: 27,713 bytes in 112 blocks
==29133==      possibly lost: 0 bytes in 0 blocks
==29133==    still reachable: 16,458 bytes in 3 blocks
==29133==         suppressed: 0 bytes in 0 blocks
==29133== Reachable blocks (those to which a pointer was found) are not shown.
==29133== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==29133== 
==29133== For counts of detected and suppressed errors, rerun with: -v
==29133== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

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.