Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Zeug
Friday, September 28th, 2007 at 8:06:18pm UTC 

  1. #!/bin/sh
  2. #
  3. #             __________               __   ___.
  4. #   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  5. #   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  6. #   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  7. #   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  8. #                     \/            \/     \/    \/            \/
  9. #
  10. #
  11. # Copyright (c) 2007 Alexander Levin
  12. #
  13. #
  14. # This script produces the file "menu_call_stats_list.c" containing
  15. # pointers to the call statistics for all menu items in the core RockBox.
  16. # Files with menu items that should get into this list must be compiled
  17. # so that all the temporary files are kept (in particular, the result of
  18. # the preprocessing). Usually this is done by including '-save-temps' into
  19. # the list of the compiler options. In that case, the preprocessed files
  20. # have the extension '.i' and are stored in the same directory as the
  21. # original '.c' files.
  22.  
  23. BASE_NAME = $(OBJDIR)/menu_call_stats_list
  24. TMP_NAME = $(BASE_NAME).tmp
  25. OUT_NAME = $(BASE_NAME).c
  26. STRUCT = "struct s_call_stats"
  27.  
  28. # Process all *.i files (results of the preprocessing), find strings where
  29. # stat structs are defined, isolate the definitions, and put them all to a
  30. # temporary file.
  31. find . -name "$(APPSDIR)/*.i" -exec grep "$(STRUCT) item_call" {} \; | sed -e "s/.*\($(STRUCT) item[^ ]*\) .*/\1/" | sort > $(TMP_NAME)
  32.  
  33. #
  34. # Now produce the .c file with the array containing addresses of all the structs.
  35. #
  36. echo "/* This file was generated automatically. Please do not edit. */" > $(OUT_NAME)
  37. echo "#include \"menu.h\"" >> $(OUT_NAME)
  38. echo "" >> $(OUT_NAME)
  39. cat $(TMP_NAME) | sed -e "s/\(.*\)/extern \1;/" >> $(OUT_NAME)
  40. echo "" >> $(OUT_NAME)
  41. echo "$(STRUCT)" *menu_call_stats_list[] = {" >> $(OUT_NAME)
  42. cat $(TMP_NAME) | sed -e "s/.* \(.*\)/    \&\1,/" >> $(OUT_NAME)
  43. echo "};" >> $(OUT_NAME)
  44.  
  45. # Delete the temporary file
  46. rm $(TMP_NAME)

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus