SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Downloaden Sie, um offline zu lesen
There is more to C

        26.11. 2012
         FI MUNI

         Juraj Michálek
http://georgik.sinusgear.com
 http://twitter.com/sinusgear
Something about me ;-)
Content

Why C rocks?




               libuv
#1 language 2012




http://www.tiobe.com
Trends
Interactive C - Robot




●   Handyboard
●   Motorola 68AX11
●   derrived from C
●   http://www.kipr.org
●   http://www.boatball.org
Portability


Linux – Windows – Mac – BSD




  http://suacommunity.com/
Clone examples


                 Available at GitHub:
  https://github.com/georgik/fimuni-c-cpp-examples



git clone git://github.com/georgik/fimuni-c-cpp-examples.git
Allegro




Allegro Low Level Game Routines
Allegro - features



keyboard, mouse, touch screen
    audio, video, graphics
        timers, events
           data files
Allegro 5.1

              Win, Lin, Mac

               iOS, Android

http://alleg.sourceforge.net/a5docs/refman/
Initialization




 al_init();
Graphic environment




al_create_display(int w, int h)
ALLEGRO_BITMAP



            Structure for bitmaps

ALLEGRO_BITMAP *bmp = create_bitmap(x,y);
Graphics



   al_putpixel(x, y, color)

   al_load_bitmap(filename);

al_draw_bitmap(bmp, 10, 10, 0);
Release memory




al_destroy_bitmap(bmp);
Keyboard



 al_install_keyboard()
al_uninstall_keyboard()


event.keyboard.keycode
Mouse



      al_install_mouse()
     al_uninstall_mouse()

al_get_mouse_state(&msestate);
Additional Allegro libraries



 Allegttf - True Type fonts support

AllegGL – HW accelerated graphics

   DUMB - audio (Vorbis/Ogg)
Compilation
             Configuration script:
              allegro-config

             Linux, Unix, MacOS:
  gcc foo.cc -o foo `allegro-config --libs`

gcc foo.cc -o foo `pkg-config --libs --cflags
                 allegro-5.0`

           iPhone – requires Xcode

       Android – requires Android SDK
CMake – Cross Platform Make




       http://www.cmake.org
Allegro – CMake – MSVC 2012




Requires: DirectX SDK (e.g. Windows SDK for Windows 8)
Small tweak to run examples: http://georgik.sinusgear.com/2012/11/18/allegro5-1-and-visual-studio-2012-unable-to-start-examples-missing-dll-files/
Allegro – CMake - KDevelop4
Sources



Library: http://alleg.sourceforge.net

    Wiki: http://wiki.allegro.cc/
Game development community network
        http://www.allegro.cc
Simple Direct Media Layer
Init/quit



SDL_init(flags)

  SDL_quit()
Graphics



SDL_SetVideoMode(width, height,
     video_bpp, videoflags)

   Store in memory: SDL_SWSURFACE
Store on graphics card: SDL_HWSURFACE
Visual data


              SDL_Surface

  SDL_CreateRGBSurface(SDL_SWSURFACE,
width, height, 32, rmask, gmask, bmask,
                amask);
Visual data



SDL_Surface *SDL_LoadBMP(const char *file)

      Copy from one memory to another:
   SDL_BlitSurface(src, srcrect, dst,
                 dstrect);
Keyboard


SDL_PollEvent(SDL_Event *event)


     event.key.keysym.sym
Timer



         static int counter;

SDL_SetTimer(interval, tick_callback);
Mouse




SDL_GetMouseState(*x, *y);
Text

Not implemented
Extensions

                support for GL

         extension for many languages
Ada, Eiffel, Java, Lua, Perl, PHP, Pike, Python,
                      Ruby

            176 additional libraries
SDL based Libraries



 SDL_mixer – audio mixer

SDL_image – image formats

SDL_net – network support
Source




http://www.libsdl.org
Compilation



             sdl-config

      Linux, Windows, BeOS, Mac OS
gcc foo.cc -o foo `sdl-config --libs`
PyGame



Power of C and Power of Python
   http://www.pygame.org
http://nodejs.org/
Architecture of Node.js
libuv


High performance evented I/O library

     which offers the same API

       on Windows and Unix
libuv


      https://github.com/joyent/libuv



http://nikhilm.github.com/uvbook/index.html
libuv – event loop




Call callbacks   Sleep
libuv - example
Features

Filesystem

Networking

 Threads

Processes

 Utilities
TCP server example
http://www.gtk.org
GTK


                 GIMP ToolKit


C++, Guile, Perl, Python, TOM, Ada95, Objective
             C, Free Pascal, Eiffel...
Glade 3




http://glade.gnome.org
Valgrind


          debugging a profiling

               memcheck

helgrind - race condition, thread profiling
Modes debugger


   Local application

 Attach to local process

Attach to remote process

     Post-mortem
Application crashed




    Post-mortem analysis

Image from memory: coredump
Quick analysis of coredump
Strace
Mutextrace

●   mutextrace ./mutex-tester-app param1 param2
    –   lock #1, free -> thread 1
    –   init #2
    –   lock #2, free -> thread 1
    –   unlock #1
    –   lock #1, free -> thread 1
    –   init #3
    –   lock #3, free -> thread 1
    –   unlock #1
http://www.se-radio.net
EOF

        26.11. 2012
         FI MUNI

         Juraj Michálek
http://georgik.sinusgear.com
 http://twitter.com/sinusgear

Weitere ähnliche Inhalte

Was ist angesagt?

Angelo Compagnucci - Upgrading buildroot based devices with swupdate
Angelo Compagnucci - Upgrading buildroot based devices with swupdateAngelo Compagnucci - Upgrading buildroot based devices with swupdate
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
linuxlab_conf
 

Was ist angesagt? (20)

Kernel Recipes 2013 - Crosstool-NG, a cross-toolchain generator
Kernel Recipes 2013 - Crosstool-NG, a cross-toolchain generatorKernel Recipes 2013 - Crosstool-NG, a cross-toolchain generator
Kernel Recipes 2013 - Crosstool-NG, a cross-toolchain generator
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
Andrea Righi - Spying on the Linux kernel for fun and profit
Andrea Righi - Spying on the Linux kernel for fun and profitAndrea Righi - Spying on the Linux kernel for fun and profit
Andrea Righi - Spying on the Linux kernel for fun and profit
 
Kernel Recipes 2013 - Conditional boot
Kernel Recipes 2013 - Conditional bootKernel Recipes 2013 - Conditional boot
Kernel Recipes 2013 - Conditional boot
 
Cross-compilation native sous android
Cross-compilation native sous androidCross-compilation native sous android
Cross-compilation native sous android
 
Build Your Own Android Tablet
Build Your Own Android TabletBuild Your Own Android Tablet
Build Your Own Android Tablet
 
syzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzersyzkaller: the next gen kernel fuzzer
syzkaller: the next gen kernel fuzzer
 
syzbot and the tale of million kernel bugs
syzbot and the tale of million kernel bugssyzbot and the tale of million kernel bugs
syzbot and the tale of million kernel bugs
 
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
Angelo Compagnucci - Upgrading buildroot based devices with swupdateAngelo Compagnucci - Upgrading buildroot based devices with swupdate
Angelo Compagnucci - Upgrading buildroot based devices with swupdate
 
LAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
 
Intel Nervana Graph とは?
Intel Nervana Graph とは?Intel Nervana Graph とは?
Intel Nervana Graph とは?
 
Beagleboard xm-setup
Beagleboard xm-setupBeagleboard xm-setup
Beagleboard xm-setup
 
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
 
Jollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-level
 
Talk 160920 @ Cat System Workshop
Talk 160920 @ Cat System WorkshopTalk 160920 @ Cat System Workshop
Talk 160920 @ Cat System Workshop
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
 
Openwrt startup
Openwrt startupOpenwrt startup
Openwrt startup
 
The Simple Scheduler in Embedded System @ OSDC.TW 2014
The Simple Scheduler in Embedded System @ OSDC.TW 2014The Simple Scheduler in Embedded System @ OSDC.TW 2014
The Simple Scheduler in Embedded System @ OSDC.TW 2014
 
pkgsrc 2013 - the record of the past year
pkgsrc 2013 - the record of the past yearpkgsrc 2013 - the record of the past year
pkgsrc 2013 - the record of the past year
 
Linux as a gaming platform, ideology aside
Linux as a gaming platform, ideology asideLinux as a gaming platform, ideology aside
Linux as a gaming platform, ideology aside
 

Ähnlich wie There is more to C

Porting C++ apps to FLASCC
Porting C++ apps to FLASCCPorting C++ apps to FLASCC
Porting C++ apps to FLASCC
Pavel Nakaznenko
 
Varnish http accelerator
Varnish http acceleratorVarnish http accelerator
Varnish http accelerator
no no
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
sean chen
 
LCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platformLCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platform
Linaro
 

Ähnlich wie There is more to C (20)

C language in our world 2017
C language in our world 2017C language in our world 2017
C language in our world 2017
 
Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
 
Android OS Porting: Introduction
Android OS Porting: IntroductionAndroid OS Porting: Introduction
Android OS Porting: Introduction
 
Porting C++ apps to FLASCC
Porting C++ apps to FLASCCPorting C++ apps to FLASCC
Porting C++ apps to FLASCC
 
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
DEF CON 27 - HUBER AND ROSKOSCH - im on your phone listening attacking voip c...
 
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
 
Varnish http accelerator
Varnish http acceleratorVarnish http accelerator
Varnish http accelerator
 
Virtual platform
Virtual platformVirtual platform
Virtual platform
 
Video Drivers
Video DriversVideo Drivers
Video Drivers
 
Genode Compositions
Genode CompositionsGenode Compositions
Genode Compositions
 
Porting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindPorting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mind
 
Memory Management in TIZEN - Samsung SW Platform Team
Memory Management in TIZEN - Samsung SW Platform TeamMemory Management in TIZEN - Samsung SW Platform Team
Memory Management in TIZEN - Samsung SW Platform Team
 
Open-source Android 10 on Orange Pi: myth or reality?
Open-source Android 10 on Orange Pi: myth or reality?Open-source Android 10 on Orange Pi: myth or reality?
Open-source Android 10 on Orange Pi: myth or reality?
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
Beagle board101 esc-boston-2009b
Beagle board101 esc-boston-2009bBeagle board101 esc-boston-2009b
Beagle board101 esc-boston-2009b
 
LCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platformLCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platform
 
App container rkt
App container rktApp container rkt
App container rkt
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
JavaScript all the things! - FullStack 2017
JavaScript all the things! - FullStack 2017JavaScript all the things! - FullStack 2017
JavaScript all the things! - FullStack 2017
 
Начало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev KitНачало работы с Intel IoT Dev Kit
Начало работы с Intel IoT Dev Kit
 

Mehr von Juraj Michálek

Mehr von Juraj Michálek (20)

Rust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with EmbassyRust Embedded Development on ESP32 and basics of Async with Embassy
Rust Embedded Development on ESP32 and basics of Async with Embassy
 
Embedded Development on ESP32 - FEKT VUT - UREL
Embedded Development on ESP32 - FEKT VUT - URELEmbedded Development on ESP32 - FEKT VUT - UREL
Embedded Development on ESP32 - FEKT VUT - UREL
 
Embedded Rust on ESP2 - Rust Linz
Embedded Rust on ESP2 - Rust LinzEmbedded Rust on ESP2 - Rust Linz
Embedded Rust on ESP2 - Rust Linz
 
How Open Source Community and Espressif made it possible to use Rust language...
How Open Source Community and Espressif made it possible to use Rust language...How Open Source Community and Espressif made it possible to use Rust language...
How Open Source Community and Espressif made it possible to use Rust language...
 
C language in our world 2019
C language in our world 2019C language in our world 2019
C language in our world 2019
 
Continuous Delivery - FIT VUT
Continuous Delivery - FIT VUTContinuous Delivery - FIT VUT
Continuous Delivery - FIT VUT
 
C language in our world 2016
C language in our world 2016C language in our world 2016
C language in our world 2016
 
Story behind PF 2016
Story behind PF 2016Story behind PF 2016
Story behind PF 2016
 
C++ and Software Engineering 2015
C++ and Software Engineering 2015C++ and Software Engineering 2015
C++ and Software Engineering 2015
 
C language in our world 2015
C language in our world 2015C language in our world 2015
C language in our world 2015
 
C++ in our world
C++ in our worldC++ in our world
C++ in our world
 
Bigger & Better RnD - GeeCON.cz 2014
Bigger & Better RnD - GeeCON.cz 2014Bigger & Better RnD - GeeCON.cz 2014
Bigger & Better RnD - GeeCON.cz 2014
 
Gradle and build systems for C language
Gradle and build systems for C languageGradle and build systems for C language
Gradle and build systems for C language
 
The story behind PF2014 - Cordova
The story behind PF2014 - CordovaThe story behind PF2014 - Cordova
The story behind PF2014 - Cordova
 
There is more to C 2013
There is more to C 2013There is more to C 2013
There is more to C 2013
 
PowerShell UIAtomation
PowerShell UIAtomationPowerShell UIAtomation
PowerShell UIAtomation
 
PowerShell from *nix user perspective
PowerShell from *nix user perspectivePowerShell from *nix user perspective
PowerShell from *nix user perspective
 
Ať se z kódu nepráší! 2013
Ať se z kódu nepráší! 2013Ať se z kódu nepráší! 2013
Ať se z kódu nepráší! 2013
 
Libraries and tools for C++
Libraries and tools for C++Libraries and tools for C++
Libraries and tools for C++
 
Git, Jenkins & Chuck
Git, Jenkins & ChuckGit, Jenkins & Chuck
Git, Jenkins & Chuck
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 

There is more to C