From 5952e3b3d7f505a7e6d71ecd0793911224f5bac3 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 18 Jun 2020 16:39:06 -0400 Subject: Prelude is associated with SourceLanguage (#1398) * Associate a downstream compiler for prelude lookup even if output is source. * Remove LanguageStyle and just use SourceLanguage instread. * Added set/getPrelude. Made prelude work on source language. * Fix typo in method name replacement. get/SetPrelude get/setLanguagePrelude * Fix issue because of method name change. * Remove getPreludeDownstreamCompilerForTarget --- slang.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'slang.h') diff --git a/slang.h b/slang.h index 9720b04cb..fd6655fea 100644 --- a/slang.h +++ b/slang.h @@ -2862,7 +2862,9 @@ namespace slang SlangPassThrough passThrough, char const* path) = 0; - /** Set the 'prelude' for generated code for a 'downstream compiler'. + /** DEPRECIATED: Use setLanguagePrelude + + Set the 'prelude' for generated code for a 'downstream compiler'. @param passThrough The downstream compiler for generated code that will have the prelude applied to it. @param preludeText The text added pre-pended verbatim before the generated source @@ -2872,7 +2874,9 @@ namespace slang SlangPassThrough passThrough, const char* preludeText) = 0; - /** Get the 'prelude' for generated code for a 'downstream compiler'. + /** DEPRECIATED: Use getLanguagePrelude + + Get the 'prelude' for generated code for a 'downstream compiler'. @param passThrough The downstream compiler for generated code that will have the prelude applied to it. @param outPrelude On exit holds a blob that holds the string of the prelude. */ @@ -2909,6 +2913,25 @@ namespace slang @return The downstream compiler for that source language */ virtual SlangPassThrough SLANG_MCALL getDefaultDownstreamCompiler( SlangSourceLanguage sourceLanguage) = 0; + + /* Set the 'prelude' placed before generated code for a specific language type. + + @param sourceLanguage The language the prelude should be inserted on. + @param preludeText The text added pre-pended verbatim before the generated source + + Note! That for pass-through usage, prelude is not pre-pended, preludes are for code generation only. + */ + virtual SLANG_NO_THROW void SLANG_MCALL setLanguagePrelude( + SlangSourceLanguage sourceLanguage, + const char* preludeText) = 0; + + /** Get the 'prelude' associated with a specific source language. + @param sourceLanguage The language the prelude should be inserted on. + @param outPrelude On exit holds a blob that holds the string of the prelude. + */ + virtual SLANG_NO_THROW void SLANG_MCALL getLanguagePrelude( + SlangSourceLanguage sourceLanguage, + ISlangBlob** outPrelude) = 0; }; #define SLANG_UUID_IGlobalSession { 0xc140b5fd, 0xc78, 0x452e, { 0xba, 0x7c, 0x1a, 0x1e, 0x70, 0xc7, 0xf7, 0x1c } }; -- cgit v1.2.3