1
2#------------------------------------------------------------------------------
3# $File: mathematica,v 1.7 2009/09/19 16:28:10 christos Exp $
4# mathematica:  file(1) magic for mathematica files
5# "H. Nanosecond" <aldomel@ix.netcom.com>
6# Mathematica a multi-purpose math program
7# versions 2.2 and 3.0
8
9#mathematica .mb
100	string	\064\024\012\000\035\000\000\000	Mathematica version 2 notebook
110	string	\064\024\011\000\035\000\000\000	Mathematica version 2 notebook
12
13# .ma
14# multiple possibilites:
15
160	string	(*^\n\n::[\011frontEndVersion\ =\ 	Mathematica notebook
17#>41	string	>\0	%s
18
19#0	string	(*^\n\n::[\011palette	Mathematica notebook version 2.x
20
21#0	string	(*^\n\n::[\011Information	Mathematica notebook version 2.x
22#>675	string	>\0	%s #doesn't work well
23
24# there may be 'cr' instread of 'nl' in some does this matter?
25
26# generic:
270	string	(*^\r\r::[\011	Mathematica notebook version 2.x
280	string	(*^\r\n\r\n::[\011	Mathematica notebook version 2.x
290	string	(*^\015			Mathematica notebook version 2.x
300	string	(*^\n\r\n\r::[\011	Mathematica notebook version 2.x
310	string	(*^\r::[\011	Mathematica notebook version 2.x
320	string	(*^\r\n::[\011	Mathematica notebook version 2.x
330	string	(*^\n\n::[\011	Mathematica notebook version 2.x
340	string	(*^\n::[\011	Mathematica notebook version 2.x
35
36
37# Mathematica .mx files
38
39#0	string	(*This\ is\ a\ Mathematica\ binary\ dump\ file.\ It\ can\ be\ loaded\ with\ Get.*)	Mathematica binary file
400	string	(*This\ is\ a\ Mathematica\ binary\ 	Mathematica binary file
41#>71	string \000\010\010\010\010\000\000\000\000\000\000\010\100\010\000\000\000
42# >71... is optional
43>88	string	>\0	from %s
44
45
46# Mathematica files PBF:
47# 115 115 101 120 102 106 000 001 000 000 000 203 000 001 000
480	string	MMAPBF\000\001\000\000\000\203\000\001\000	Mathematica PBF (fonts I think)
49
50# .ml files  These are menu resources I think
51# these start with "[0-9][0-9][0-9]\ A~[0-9][0-9][0-9]\
52# how to put that into a magic rule?
534	string	\ A~	MAthematica .ml file
54
55# .nb files
56#too long 0	string	(***********************************************************************\n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Mathematica-Compatible Notebook	Mathematica 3.0 notebook
570	string	(***********************	Mathematica 3.0 notebook
58
59# other (* matches it is a comment start in these langs
60# GRR: Too weak; also matches other languages e.g. ML
61#0	string	(*	Mathematica, or Pascal, Modula-2 or 3 code text
62
63#########################
64# MatLab v5
650       string  MATLAB  Matlab v5 mat-file
66>126    short   0x494d  (big endian)
67>>124   beshort x       version 0x%04x
68>126    short   0x4d49  (little endian)
69>>124   leshort x       version 0x%04x
70
71