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