Is it possible to use the #remark Special Command inside a #retval block without leaving the #retval paragraph?
Example:
...
* #retval res #li Some text
* #li Some text
* #remark Try often if res = false
* <!-----------------------------------------------------------------------------> */
Related
Add info to question:
I'm very new writting this kind of descriptions for my functions.
I can't see any difference between declare function variables description in the library (anylib.h) like
#ifndef MYLIB_H
# define MYLIB_H
/**
* My function description.
*
* #param[in] x Mtrx size x.
* #param[in] y Mtrx size y.
*
* #return Result.
*/
int *my_function(int x, int y);
#endif
(Sorry if image is an url instead image, is because low reputation)
VSCode showing function description in file.c using #param[in]
or declare like
#ifndef MYLIB_H
# define MYLIB_H
/**
* My function description.
*
* #param x Mtrx size x.
* #param y Mtrx size y.
*
* #return Result.
*/
int *my_function(int x, int y);
#endif
VSCode showing function description in file.c using #param
The library is included with -I ( i ) flag
INC = -I include -I ./mylibdir/ -I ./inc/anotherdir/
...
$(OBJDIR)%.o:$(SRCDIR)%.c
#$(CC) $(CFLAGS) $(INC) -o $# -c $<
...
Here I call the function. The path to my lib is no necessary, only the name
#include "mylib.h"
int main(int argc, char *argv[])
{
int a = 3;
int b = 2;
printf("my function result: %i", my_function(a, b));
}
Exist a difference between this?
pd: I dont know the version of Dox. Im in my college mac computer, and i know i have some depracated software versions, idk if its the case
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I am trying to make something and I am trying to use an equation in Swift. This is the equation:
((((((((((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) * ((((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) /1005.967 * (3.14159 * ((d / 100)/2) * ((d / 100)/2)))) - (((calculation.mempty/1000) + ((calculation.vol * 0.972)/1000))/2) * calculation.g) / (((calculation.mempty/1000) + ((calculation.vol * 0.972)/1000))/2)) * ((1005.967 * (calculation.vol / 1000000) / (((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) * 6894.76))))) * 2) sin 2(calculation.theta) / calculation.g) * (1 - calculation.dc))
This might seem complicated but if you understand it, it isn't (for a computer). All the variables have been defined and the error message says:
Missing argument for parameter 'verbatim' in call and another error that says: Unterminated string literal
I am unsure why and whenever I google it up, an actual result never comes up and when one does, it's always about Playgrounds, not the actual Swift that is used to make apps and stuff.
EDIT:
Here is the reproducible example:
'''
//
// ContentView.swift
// MRE File
//
// Created by Go Peter on 2021/06/18.
//
import SwiftUI
struct Calculation {
var vbottle:Int = 2
var g:Int = Int(9.807)
var vol:Int = 250
var d:Int = 2
var theta:Int = 90
var psi:Int = 40
var mempty:Int = 70
}
struct ContentView: View {
var body: some View {
Text("\(((((((((((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) * ((((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) /1005.967 * (3.14159 * ((d / 100)/2) * ((d / 100)/2)))) - (((calculation.mempty/1000) + ((calculation.vol * 0.972)/1000))/2) * calculation.g) / (((calculation.mempty/1000) + ((calculation.vol * 0.972)/1000))/2)) * ((1005.967 * (calculation.vol / 1000000) / (((calculation.d/100)/2) * Int(0.98) * (sqrt(calculation.vbottle * 1005.967 * (calculation.psi + (calculation.psi * (calculation.vbottle - (calculation.vol/1000))/2)/2) * 6894.76))))) * 2) sin 2(calculation.theta) / calculation.g) * (1 - calculation.dc)))m")
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
'''
There are a few errors I see:
You need a space in /1005.967 after the / operator -- there are likely other spots like this as well.
Near the end of the expression, you have a floating sin that doesn't have an operator before it and isn't followed with parenthesis at all
There are many spots where you refer to just d, but probably mean calculation.d
You have a mismatched number of open and closed parenthesis.
You don't actually have a Calculation property defined on your view, so there's nothing to do the calculations on yet.
Because I don't know the intent of some of this stuff, I can't actually fix it for you. But, I'd recommend trying to clean up the code a little -- at the least, it'll make it easier to debug.
To start, move this out of the interpolated String and into a computed property:
var calc : Int { //Int? -- see comment about this
//your calculation here
}
var body: some View {
Text("\(calc)m")
}
Then, I'd break the calculation up into much smaller expressions that are more readable and would let you find your errors more easily than trying to sift through so many parenthesis, etc. Even a computer can theoretically handle a long, tough-to-read expression, it makes it a challenging debugging issue for us humans.
I'd also be really surprised if you truly want Int for these properties. You have a bunch of spots where you're doing things like Int(0.98), which doesn't make sense, because it'll get rounded to 1. Perhaps you instead want to use Double or Float for everything? You'll see as you start breaking the instructions up and the compiler starts to find more errors once it can parse everything correctly that you're going to end up with type mismatches between things like Int and Double in the existing expressions.
I'm trying to send an email with SendGrid using a transaction template, and see a problem with substitution limited.
Substitutions are limited to 10000 bytes per personalization block.
SendGrid Docs
I will resolved this problem by get the template from SendGrid and replace all placeholders inside it. But I need to check when I can do it, I think will check limited of substitutions and I don't know How SendGrid calculate it? maybe length of all string in substitutions?
Any help?
Thanks!
I resolved my problem and share the solution for the people who care ;)
Solution:
You need to optimize Substitutions by using it together with Sections
/**
* When you have the $variables too big, SendGrid will reject the message because
* SendGrid's Substitution is limited(10000 bytes)
*
* Before that, the format of substitution as below:
*
* {
* "to": [
* "example#example.com"
* ],
* "sub": {
* "%FirstName%": "This string maybe too long",
* "%LastName%": "This string maybe too long",
* ....
* ....
* more and limited
* }
* }
*
* To resolved this problem we will use the Section with Substitution as below:
*
* {
* "to": [
* "example#example.com"
* ],
* "sub": {
* "%FirstName%": "%FirstName%",
* "%LastName%": "%LastName%",
* ....
* ....
* more and more
* },
* "section": {
* "%FirstName%": "This string maybe too long",
* "%LastName%": "This string maybe too long",
* ....
* ....
* }
* }
*
* We will optimize the strings in Substitutions and let Section in SendGrid to contain that strings.
*/
As per sendgrid documentation they are going to remove support for Section. As they says Substitution is alternative for Section. Do you have any other alternative for large content (> 10000 bytes).
This may be a simple question.But I couldn't find a way to go around this.I am using an s function block to input a wave signal to my algorithm.wave signal is being read from file of about 2000 points
First i started with simulation time equal to 50.Then it read only 50 points.I checked the 'tout' variable. It was 0,1,2,....50
Then i increased simulation time to 100.still result is same.only 50 points read.But tout is 0,2,4,6..50
I tried up to 10000.Whatever i do it reads 50 values only with wide time step like 0,200,400,600 etc.
Is it a problem with my s-function or simulink settings?
Here is the c s-function file
/* Give S-function a name */
#define S_FUNCTION_NAME Readip
#define S_FUNCTION_LEVEL 2
/* Include SimStruct definition and file I/O functions */
#include "simstruc.h"
#include <stdio.h>
#include <stdlib.h>
static FILE* file2;
/* Called at the beginning of the simulation */
static void mdlInitializeSizes(SimStruct *S)
{
ssSetNumSFcnParams(S, 0);
if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) {
return;
}
if (!ssSetNumOutputPorts(S, 3)) return;
ssSetNumContStates(S, 0);
ssSetNumDiscStates(S, 0);
ssSetOutputPortWidth(S, 0, 1);
ssSetOutputPortDataType(S,0,DYNAMICALLY_SIZED);
ssSetOutputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
ssSetOutputPortWidth(S, 1, 1);
ssSetOutputPortDataType(S,1,DYNAMICALLY_SIZED);
ssSetOutputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
ssSetOutputPortWidth(S, 2, 1);
ssSetOutputPortDataType(S,2,DYNAMICALLY_SIZED);
ssSetOutputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
ssSetNumPWork(S,1);
ssSetNumSampleTimes(S, 1);
}
/* Set sample times for the block */
static void mdlInitializeSampleTimes(SimStruct *S)
{
ssSetSampleTime(S, 0, CONTINUOUS_SAMPLE_TIME);
ssSetOffsetTime(S, 0, 0.0);
}
#define MDL_START /* Change to #undef to remove function */
#if defined(MDL_START)
/* Function: mdlStart ========
===============================================
* Abstract:
* This function is called once at start of model execution. If you
* have states that shou
ld be initialized once, this is the place
* to do it.
*/
static void mdlStart(SimStruct *S)
{
/*at start of model execution, open the file and store the pointer
*in the pwork vector */
void** pwork = ssGetPWork(S);
FILE *datafile;
datafile = fopen("table.data","r");
pwork[0] = datafile;
}
#endif /* MDL_START */
/* Function: mdlOutputs =======================================================
* Abstract:
* In this function, you compute the outputs of your S-function
* block. Generally outputs are placed in the output vector, ssGetY(S).
*/
static void mdlOutputs(SimStruct *S, int_T tid)
{
//get pointer to the block's output signal
real_T *y1 = ssGetOutputPortSignal(S,0);
real_T *y2 = ssGetOutputPortSignal(S,1);
real_T *y3 = ssGetOutputPortSignal(S,2);
char a[10];
char b[10];
char c[10];
/*get pointer to array of pointers, where the first element is the address
*of the open file */
void** pwork = ssGetPWork(S);
/*read a floating point number and then the comma delimiter
*store the result in y*/
fscanf(pwork[0],"%s %s %s",&a,&b,&c);
*y1=atof(a);
*y2=atof(b);
*y3=atof(c);
}
/* Function: mdlTerminate =====================================================
* Abstract:
* In this function, you should perform any actions that are necessary
* at the termination of a simulation. For example, if memory was
* allocated in mdlStart, this is the place to free it.
*/
static void mdlTerminate(SimStruct *S)
{
//close the file
void** pwork = ssGetPWork(S);
FILE *datafile;
datafile = pwork[0];
fclose(datafile);
}
/*=============================*
* Required S-function trailer *
*=============================*/
#ifdef MATLAB_MEX_FILE /* Is this file being compiled as a MEX-file? */
#include "simulink.c" /* MEX-file interface mechanism */
#else
#include "cg_sfun.h" /* Code generation registration function */
#endif
This appears to just be a settings issue. If you do not specify a step-size for your solver and your blocks do not indicate sample time, Simulink will choose a default of Simulation Time / 50. Simply open the Model Configuration Parameters dialog and click on solvers in the left-hand pane. If you are using a fixed-step solver, you can explicitly set the step size. If you are using a variable-step solver, you can specify the max/min step sizes.
Additionally, if you are looking to specify a discrete sample period specifically for your S-function, then you may want to look in to this link to be sure that you are implementing mdlInitializeSampleTimes as desired.
You need to use the fixed step discrete solver.
Set Periodic sample time constraint to 'Unconstrined'
Enter the Fixed-step size and Simulation Stop time so that you get 2000 steps.
For example 1s/step and 2000s stop time, or 0.1s/step and 200s stop time.
Need a command line argument to login the volume with persistent login i tried with follwing command. but not working.
iscsicli persistentlogintarget iqn.2003-10.com.lefthandnetworks:mg-test:51:volume " T * * * * * * * * * * * * * * * 0"
Please help
Regards
NewDev
cmd>iscsicli persistentlogintarget
TargetName T * * * * * * * * * * * * * * * 0
The output was:
Microsoft iSCSI Initiator Version 6.0 Build 6000
The operation completed successfully.
To confirm that the operation was successful, I entered:
cmd>iscsicli listpersistenttargets
Id it doesnt list the targets then there is some problem.Try qlogintarget to check if it is succesfull.