One of the most remarkable and beautiful theorems in coding theory is Gleason's 1970 theorem about the weight enumerators of self-dual codes and their connections with invariant theory which has inspired hundreds of papers about generalizations and applications of this theorem to different types of codes. This self-contained book develops a new theory which is powerful enough to include all the earlier generalizations. It is also in part...