Introduce plugin_crt0.c that every plugin links.
commit9923136e36642c111d40290c1a5bc587de880505
authorkugel <kugel@a1c6a512-1295-4272-9138-f99709370657>
Mon, 23 Aug 2010 16:56:49 +0000 (23 16:56 +0000)
committerkugel <kugel@a1c6a512-1295-4272-9138-f99709370657>
Mon, 23 Aug 2010 16:56:49 +0000 (23 16:56 +0000)
tree3eb3ca86063d0fff58ca8ed2c49dbb0af0792570
parent1679022ed70dab2ab88fe60405372354a04d7842
Introduce plugin_crt0.c that every plugin links.

It handles exit() properly, calling the handler also when the plugin returns
normally (also it makes exit() more standard compliant while at it).
It also holds PLUGIN_HEADER, so that it doesn't need to be in each plugin anymore.

To work better together with callbacks passed to rb->default_event_handler_ex introduce exit_on_usb() which will call the exit handler before showing the usb screen and exit() after it.
In most cases it was passed a callback which was manually called at all other return points. This can now be done via atexit().

In future plugin_crt0.c could also handle clearing bss, initializing iram and more.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27862 a1c6a512-1295-4272-9138-f99709370657
141 files changed:
apps/plugin.h
apps/plugins/alarmclock.c
apps/plugins/alpine_cdc.c
apps/plugins/battery_bench.c
apps/plugins/beatbox/beatbox.c
apps/plugins/bench_mem_jpeg.c
apps/plugins/bench_scaler.c
apps/plugins/blackjack.c
apps/plugins/bounce.c
apps/plugins/brickmania.c
apps/plugins/bubbles.c
apps/plugins/calculator.c
apps/plugins/calendar.c
apps/plugins/chessbox.c
apps/plugins/chessbox/chessbox.c
apps/plugins/chessclock.c
apps/plugins/chip8.c
apps/plugins/chopper.c
apps/plugins/clix.c
apps/plugins/clock/clock.c
apps/plugins/codebuster.c
apps/plugins/credits.c
apps/plugins/crypt_firmware.c
apps/plugins/cube.c
apps/plugins/demystify.c
apps/plugins/dice.c
apps/plugins/dict.c
apps/plugins/disktidy.c
apps/plugins/doom/rockdoom.c
apps/plugins/euroconverter.c
apps/plugins/fft/fft.c
apps/plugins/fire.c
apps/plugins/fireworks.c
apps/plugins/firmware_flash.c
apps/plugins/flipit.c
apps/plugins/fractals/fractal.c
apps/plugins/frotz/frotz.c
apps/plugins/goban.c
apps/plugins/goban/goban.c
apps/plugins/greyscale.c
apps/plugins/helloworld.c
apps/plugins/imageviewer/imageviewer.c
apps/plugins/invadrox.c
apps/plugins/iriver_flash.c
apps/plugins/iriverify.c
apps/plugins/jackpot.c
apps/plugins/jewels.c
apps/plugins/keybox.c
apps/plugins/lamp.c
apps/plugins/lib/SOURCES
apps/plugins/lib/pluginlib_exit.h [moved from apps/plugins/lib/pluginlib_exit.c with 51% similarity]
apps/plugins/logo.c
apps/plugins/lrcplayer.c
apps/plugins/lua/rocklua.c
apps/plugins/matrix.c
apps/plugins/maze.c
apps/plugins/mazezam.c
apps/plugins/md5sum.c
apps/plugins/metronome.c
apps/plugins/midi/midiplay.c
apps/plugins/minesweeper.c
apps/plugins/mosaique.c
apps/plugins/mp3_encoder.c
apps/plugins/mpegplayer/mpegplayer.c
apps/plugins/nim.c
apps/plugins/oscilloscope.c
apps/plugins/pacbox/pacbox.c
apps/plugins/pdbox/pdbox.c
apps/plugins/pegbox.c
apps/plugins/pictureflow.c
apps/plugins/pictureflow/pictureflow.c
apps/plugins/pitch_detector.c
apps/plugins/plasma.c
apps/plugins/plugin_crt0.c [new file with mode: 0755]
apps/plugins/plugins.make
apps/plugins/pong.c
apps/plugins/ppmviewer.c
apps/plugins/properties.c
apps/plugins/random_folder_advance_config.c
apps/plugins/remote_control.c
apps/plugins/reversi/reversi-gui.c
apps/plugins/robotfindskitten.c
apps/plugins/rockblox.c
apps/plugins/rockblox1d.c
apps/plugins/rockbox_flash.c
apps/plugins/rockboy.c
apps/plugins/rockboy/rockboy.c
apps/plugins/rocklife.c
apps/plugins/rockpaint.c
apps/plugins/search.c
apps/plugins/searchengine/searchengine.c
apps/plugins/settings_dumper.c
apps/plugins/shopper.c
apps/plugins/shortcuts/shortcuts_append.c
apps/plugins/shortcuts/shortcuts_view.c
apps/plugins/sliding_puzzle.c
apps/plugins/snake.c
apps/plugins/snake2.c
apps/plugins/snow.c
apps/plugins/sokoban.c
apps/plugins/solitaire.c
apps/plugins/sort.c
apps/plugins/spacerocks.c
apps/plugins/splitedit.c
apps/plugins/star.c
apps/plugins/starfield.c
apps/plugins/stats.c
apps/plugins/stopwatch.c
apps/plugins/sudoku/sudoku.c
apps/plugins/superdom.c
apps/plugins/test_boost.c
apps/plugins/test_codec.c
apps/plugins/test_core_jpeg.c
apps/plugins/test_disk.c
apps/plugins/test_fps.c
apps/plugins/test_gfx.c
apps/plugins/test_grey.c
apps/plugins/test_greylib_bitmap_scale.c
apps/plugins/test_mem.c
apps/plugins/test_mem_jpeg.c
apps/plugins/test_resize.c
apps/plugins/test_sampr.c
apps/plugins/test_scanrate.c
apps/plugins/test_touchscreen.c
apps/plugins/test_viewports.c
apps/plugins/text_editor.c
apps/plugins/text_viewer/text_viewer.c
apps/plugins/text_viewer/tv_action.c
apps/plugins/text_viewer/tv_action.h
apps/plugins/theme_remove.c
apps/plugins/vbrfix.c
apps/plugins/video.c
apps/plugins/vu_meter.c
apps/plugins/wav2wv.c
apps/plugins/wavplay.c
apps/plugins/wavrecord.c
apps/plugins/wavview.c
apps/plugins/wormlet.c
apps/plugins/xobox.c
apps/plugins/zxbox.c
apps/plugins/zxbox/zxbox.c