File: xpm_to_ml

package info (click to toggle)
ocamlsdl 0.9.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,608 kB
  • sloc: ansic: 3,311; sh: 3,103; ml: 2,111; makefile: 180; awk: 13
file content (21 lines) | stat: -rwxr-xr-x 334 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/awk -f

# This small program reads an XPM file and converts it in a .ml file
# that can be used with Sdlloader.read_XPM_from_array

/^static/ { 
  match ($0, /(\w+)\[\]/, arr); 
  print "let " arr[1] " = [|"
}

/ *};/ { FINISH=1 }

/^ *\"/ {
  sub (/(,|\};) *$/, " ;");
  print "  " $0
}

FINISH {
  print "|]" ;
  FINISH=0
}