Your SlideShare is downloading. ×
There is more to C
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

There is more to C

1,712

Published on

Slides form talk at FI MUNI about development in C (2012). Covers topic about C libraries including libuv library from Node.js and its relation to Google V8 JavaScript Engine.

Slides form talk at FI MUNI about development in C (2012). Covers topic about C libraries including libuv library from Node.js and its relation to Google V8 JavaScript Engine.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,712
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. There is more to C 26.11. 2012 FI MUNI Juraj Michálekhttp://georgik.sinusgear.com http://twitter.com/sinusgear
  • 2. Something about me ;-)
  • 3. ContentWhy C rocks? libuv
  • 4. #1 language 2012http://www.tiobe.com
  • 5. Trends
  • 6. Interactive C - Robot● Handyboard● Motorola 68AX11● derrived from C● http://www.kipr.org● http://www.boatball.org
  • 7. PortabilityLinux – Windows – Mac – BSD http://suacommunity.com/
  • 8. Clone examples Available at GitHub: https://github.com/georgik/fimuni-c-cpp-examplesgit clone git://github.com/georgik/fimuni-c-cpp-examples.git
  • 9. AllegroAllegro Low Level Game Routines
  • 10. Allegro - featureskeyboard, mouse, touch screen audio, video, graphics timers, events data files
  • 11. Allegro 5.1 Win, Lin, Mac iOS, Androidhttp://alleg.sourceforge.net/a5docs/refman/
  • 12. Initialization al_init();
  • 13. Graphic environmental_create_display(int w, int h)
  • 14. ALLEGRO_BITMAP Structure for bitmapsALLEGRO_BITMAP *bmp = create_bitmap(x,y);
  • 15. Graphics al_putpixel(x, y, color) al_load_bitmap(filename);al_draw_bitmap(bmp, 10, 10, 0);
  • 16. Release memoryal_destroy_bitmap(bmp);
  • 17. Keyboard al_install_keyboard()al_uninstall_keyboard()event.keyboard.keycode
  • 18. Mouse al_install_mouse() al_uninstall_mouse()al_get_mouse_state(&msestate);
  • 19. Additional Allegro libraries Allegttf - True Type fonts supportAllegGL – HW accelerated graphics DUMB - audio (Vorbis/Ogg)
  • 20. 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
  • 21. CMake – Cross Platform Make http://www.cmake.org
  • 22. Allegro – CMake – MSVC 2012Requires: 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/
  • 23. Allegro – CMake - KDevelop4
  • 24. SourcesLibrary: http://alleg.sourceforge.net Wiki: http://wiki.allegro.cc/
  • 25. Game development community network http://www.allegro.cc
  • 26. Simple Direct Media Layer
  • 27. Init/quitSDL_init(flags) SDL_quit()
  • 28. GraphicsSDL_SetVideoMode(width, height, video_bpp, videoflags) Store in memory: SDL_SWSURFACEStore on graphics card: SDL_HWSURFACE
  • 29. Visual data SDL_Surface SDL_CreateRGBSurface(SDL_SWSURFACE,width, height, 32, rmask, gmask, bmask, amask);
  • 30. Visual dataSDL_Surface *SDL_LoadBMP(const char *file) Copy from one memory to another: SDL_BlitSurface(src, srcrect, dst, dstrect);
  • 31. KeyboardSDL_PollEvent(SDL_Event *event) event.key.keysym.sym
  • 32. Timer static int counter;SDL_SetTimer(interval, tick_callback);
  • 33. MouseSDL_GetMouseState(*x, *y);
  • 34. TextNot implemented
  • 35. Extensions support for GL extension for many languagesAda, Eiffel, Java, Lua, Perl, PHP, Pike, Python, Ruby 176 additional libraries
  • 36. SDL based Libraries SDL_mixer – audio mixerSDL_image – image formatsSDL_net – network support
  • 37. Sourcehttp://www.libsdl.org
  • 38. Compilation sdl-config Linux, Windows, BeOS, Mac OSgcc foo.cc -o foo `sdl-config --libs`
  • 39. PyGamePower of C and Power of Python http://www.pygame.org
  • 40. http://nodejs.org/
  • 41. Architecture of Node.js
  • 42. libuvHigh performance evented I/O library which offers the same API on Windows and Unix
  • 43. libuv https://github.com/joyent/libuvhttp://nikhilm.github.com/uvbook/index.html
  • 44. libuv – event loopCall callbacks Sleep
  • 45. libuv - example
  • 46. FeaturesFilesystemNetworking ThreadsProcesses Utilities
  • 47. TCP server example
  • 48. http://www.gtk.org
  • 49. GTK GIMP ToolKitC++, Guile, Perl, Python, TOM, Ada95, Objective C, Free Pascal, Eiffel...
  • 50. Glade 3http://glade.gnome.org
  • 51. Valgrind debugging a profiling memcheckhelgrind - race condition, thread profiling
  • 52. Modes debugger Local application Attach to local processAttach to remote process Post-mortem
  • 53. Application crashed Post-mortem analysisImage from memory: coredump
  • 54. Quick analysis of coredump
  • 55. Strace
  • 56. 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
  • 57. http://www.se-radio.net
  • 58. EOF 26.11. 2012 FI MUNI Juraj Michálekhttp://georgik.sinusgear.com http://twitter.com/sinusgear

×