void MeshSaverImplv1_0::WriteVertexData(MeshBuffer* buffer, ChunkOutputStream& outStream) { OutputSerializer& ser = outStream.BeginChunk(MCID_VERTEX_DATA); uint32 numVertexBuffer = buffer->GetVertexBufferCount(); uint32 vertexCount = buffer->GetVertexCount(); ser << numVertexBuffer << vertexCount; WriteElementData(buffer, outStream); WriteVertexBufferData(buffer, numVertexBuffer, outStream); outStream.EndChunk(); }
/* --------------------------------------------------------------------------- * writes just the elements in the buffer to file */ static int WriteBuffer (FILE * FP) { Cardinal i; WriteViaData (FP, PASTEBUFFER->Data); WriteElementData (FP, PASTEBUFFER->Data); for (i = 0; i < max_copper_layer + 2; i++) WriteLayerData (FP, i, &(PASTEBUFFER->Data->Layer[i])); return (STATUS_OK); }
/* --------------------------------------------------------------------------- * writes PCB to file */ static int WritePCB (FILE * FP) { Cardinal i; WritePCBInfoHeader (FP); WritePCBDataHeader (FP); WritePCBFontData (FP); WriteAttributeList (FP, &PCB->Attributes, ""); WriteViaData (FP, PCB->Data); WriteElementData (FP, PCB->Data); WritePCBRatData (FP); for (i = 0; i < max_copper_layer + 2; i++) WriteLayerData (FP, i, &(PCB->Data->Layer[i])); WritePCBNetlistData (FP); return (STATUS_OK); }
/* --------------------------------------------------------------------------- * writes PCB to file */ static int WritePCB (FILE * FP) { Cardinal i; if (Settings.SaveMetricOnly) set_allow_readable (ALLOW_MM); else set_allow_readable (ALLOW_READABLE); WritePCBInfoHeader (FP); WritePCBDataHeader (FP); WritePCBFontData (FP); WriteAttributeList (FP, &PCB->Attributes, ""); WriteViaData (FP, PCB->Data); WriteElementData (FP, PCB->Data); WritePCBRatData (FP); for (i = 0; i < max_copper_layer + 2; i++) WriteLayerData (FP, i, &(PCB->Data->Layer[i])); WritePCBNetlistData (FP); return (STATUS_OK); }
/* --------------------------------------------------------------------------- * writes to pipe using the command defined by Settings.SaveCommand * %f are replaced by the passed filename */ static int WritePipe (char *Filename, bool thePcb) { FILE *fp; int result; char *p; static DynamicStringType command; int used_popen = 0; if (EMPTY_STRING_P (Settings.SaveCommand)) { fp = fopen (Filename, "w"); if (fp == 0) { Message ("Unable to write to file %s\n", Filename); return STATUS_ERROR; } } else { used_popen = 1; /* setup commandline */ DSClearString (&command); for (p = Settings.SaveCommand; *p; p++) { /* copy character if not special or add string to command */ if (!(*p == '%' && *(p + 1) == 'f')) DSAddCharacter (&command, *p); else { DSAddString (&command, Filename); /* skip the character */ p++; } } DSAddCharacter (&command, '\0'); printf ("write to pipe \"%s\"\n", command.Data); if ((fp = popen (command.Data, "w")) == NULL) { PopenErrorMessage (command.Data); return (STATUS_ERROR); } } if (thePcb) { if (PCB->is_footprint) { WriteElementData (fp, PCB->Data); result = 0; } else result = WritePCB (fp); } else result = WriteBuffer (fp); if (used_popen) return (pclose (fp) ? STATUS_ERROR : result); return (fclose (fp) ? STATUS_ERROR : result); }